Use network specific ens suffix

This commit is contained in:
Martin Boehm 2025-01-12 18:18:38 +01:00
parent b40948a781
commit 70f34cedeb
2 changed files with 11 additions and 6 deletions

View File

@ -38,6 +38,7 @@ func NewBNBSmartChainRPC(config json.RawMessage, pushHandler func(bchain.Notific
s := &BNBSmartChainRPC{
EthereumRPC: c.(*eth.EthereumRPC),
}
s.Parser.EnsSuffix = ".bnb"
return s, nil
}

View File

@ -25,15 +25,19 @@ const EtherAmountDecimalPoint = 18
// EthereumParser handle
type EthereumParser struct {
*bchain.BaseParser
EnsSuffix string
}
// NewEthereumParser returns new EthereumParser instance
func NewEthereumParser(b int, addressAliases bool) *EthereumParser {
return &EthereumParser{&bchain.BaseParser{
BlockAddressesToKeep: b,
AmountDecimalPoint: EtherAmountDecimalPoint,
AddressAliases: addressAliases,
}}
return &EthereumParser{
BaseParser: &bchain.BaseParser{
BlockAddressesToKeep: b,
AmountDecimalPoint: EtherAmountDecimalPoint,
AddressAliases: addressAliases,
},
EnsSuffix: ".eth",
}
}
type rpcHeader struct {
@ -489,7 +493,7 @@ func (p *EthereumParser) EthereumTypeGetTokenTransfersFromTx(tx *bchain.Tx) (bch
// FormatAddressAlias adds .eth to a name alias
func (p *EthereumParser) FormatAddressAlias(address string, name string) string {
return name + ".eth"
return name + p.EnsSuffix
}
// TxStatus is status of transaction