github.com/InjectiveLabs/sdk-go@v1.53.0/chain/types/config.go (about)

     1  package types
     2  
     3  import (
     4  	sdk "github.com/cosmos/cosmos-sdk/types"
     5  	ethaccounts "github.com/ethereum/go-ethereum/accounts"
     6  )
     7  
     8  const (
     9  	// InjectiveBech32Prefix defines the Bech32 prefix used for EthAccounts on the Injective Chain
    10  	InjectiveBech32Prefix = "inj"
    11  
    12  	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
    13  	Bech32PrefixAccAddr = InjectiveBech32Prefix
    14  	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
    15  	Bech32PrefixAccPub = InjectiveBech32Prefix + sdk.PrefixPublic
    16  	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
    17  	Bech32PrefixValAddr = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
    18  	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
    19  	Bech32PrefixValPub = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
    20  	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
    21  	Bech32PrefixConsAddr = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
    22  	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
    23  	Bech32PrefixConsPub = InjectiveBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
    24  
    25  	// Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info.
    26  	Bip44CoinType = 60
    27  )
    28  
    29  var (
    30  	// BIP44HDPath is the BIP44 HD path used on Ethereum.
    31  	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
    32  )
    33  
    34  // SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.
    35  func SetBech32Prefixes(config *sdk.Config) {
    36  	config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
    37  	config.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
    38  	config.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
    39  }
    40  
    41  // SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.
    42  func SetBip44CoinType(config *sdk.Config) {
    43  	config.SetCoinType(Bip44CoinType)
    44  	config.SetFullFundraiserPath(BIP44HDPath) // nolint:staticcheck //no idea how to fix it properly
    45  }