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{ s := &BNBSmartChainRPC{
EthereumRPC: c.(*eth.EthereumRPC), EthereumRPC: c.(*eth.EthereumRPC),
} }
s.Parser.EnsSuffix = ".bnb"
return s, nil return s, nil
} }

View File

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