Skip to content

Commit

Permalink
Use network specific ens suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed Jan 12, 2025
1 parent b40948a commit 70f34ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions bchain/coins/bsc/bscrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
16 changes: 10 additions & 6 deletions bchain/coins/eth/ethparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 70f34ce

Please sign in to comment.