Documentation ¶
Index ¶
- Constants
- Variables
- func BitcoinChainIDFromNetworkName(name string) (int64, error)
- func BitcoinNetParamsFromChainID(chainID int64) (*chaincfg.Params, error)
- func BtcNonceMarkOffset() int64
- func ChainIDInChainList(chainID int64, chainList []Chain) bool
- func ConvertRecoverToError(r interface{}) error
- func CosmosToEthChainID(chainID string) (int64, error)
- func DecodeAddressFromChainID(chainID int64, addr string, additionalChains []Chain) ([]byte, error)
- func DecodeBtcAddress(inputAddress string, chainID int64) (address btcutil.Address, err error)
- func DecodeSolanaWalletAddress(inputAddress string) (pk solana.PublicKey, err error)
- func FilterExternalChains(c Chain) bool
- func GetBTCChainIDFromChainParams(params *chaincfg.Params) (int64, error)
- func GetBTCChainParams(chainID int64) (*chaincfg.Params, error)
- func IsBitcoinChain(chainID int64, additionalChains []Chain) bool
- func IsBitcoinMainnet(chainID int64) bool
- func IsBitcoinRegnet(chainID int64) bool
- func IsBtcAddressSupported(addr btcutil.Address) bool
- func IsEVMChain(chainID int64, additionalChains []Chain) bool
- func IsEthereumChain(chainID int64, additionalChains []Chain) bool
- func IsSolanaChain(chainID int64, additionalChains []Chain) bool
- func IsTONChain(chainID int64, additionalChains []Chain) bool
- func IsZetaChain(chainID int64, additionalChains []Chain) bool
- func NonceMarkAmount(nonce uint64) int64
- func StringToHash(chainID int64, hash string, additionalChains []Chain) ([]byte, error)
- type Address
- type CCTXGateway
- type Chain
- func ChainListByConsensus(consensus Consensus, additionalChains []Chain) []Chain
- func ChainListByGateway(gateway CCTXGateway, additionalChains []Chain) []Chain
- func ChainListByNetwork(network Network, additionalChains []Chain) []Chain
- func ChainListByNetworkType(networkType NetworkType, additionalChains []Chain) []Chain
- func CombineChainList(base []Chain, additional []Chain) []Chain
- func CombineDefaultChainsList(chains []Chain) []Chain
- func CombineFilterChains(chainLists ...[]Chain) []Chain
- func DefaultChainsList() []Chain
- func ExternalChainList(additionalChains []Chain) []Chain
- func FilterChains(chainList []Chain, filters ...ChainFilter) []Chain
- func GetChainFromChainID(chainID int64, additionalChains []Chain) (Chain, bool)
- func ZetaChainFromChainID(chainID int64) (Chain, error)
- func ZetaChainFromCosmosChainID(chainID string) (Chain, error)
- func (*Chain) Descriptor() ([]byte, []int)
- func (chain Chain) EncodeAddress(b []byte) (string, error)
- func (m *Chain) GetCctxGateway() CCTXGateway
- func (m *Chain) GetChainId() int64
- func (m *Chain) GetChainName() ChainNamedeprecated
- func (m *Chain) GetConsensus() Consensus
- func (m *Chain) GetIsExternal() bool
- func (m *Chain) GetName() string
- func (m *Chain) GetNetwork() Network
- func (m *Chain) GetNetworkType() NetworkType
- func (m *Chain) GetVm() Vm
- func (chain Chain) IsBitcoinChain() bool
- func (chain Chain) IsEVMChain() bool
- func (chain Chain) IsEmpty() bool
- func (chain Chain) IsExternalChain() bool
- func (chain Chain) IsSolanaChain() bool
- func (chain Chain) IsTONChain() bool
- func (chain Chain) IsZetaChain() bool
- func (m *Chain) Marshal() (dAtA []byte, err error)
- func (m *Chain) MarshalTo(dAtA []byte) (int, error)
- func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Chain) ProtoMessage()
- func (m *Chain) Reset()
- func (m *Chain) Size() (n int)
- func (m *Chain) String() string
- func (m *Chain) Unmarshal(dAtA []byte) error
- func (chain Chain) Validate() error
- func (m *Chain) XXX_DiscardUnknown()
- func (m *Chain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Chain) XXX_Merge(src proto.Message)
- func (m *Chain) XXX_Size() int
- func (m *Chain) XXX_Unmarshal(b []byte) error
- type ChainFilter
- type ChainName
- type Consensus
- type Network
- type NetworkType
- type ReceiveStatus
- type Vm
Constants ¶
const ETHAddressLen = 42
const (
TestNet4 wire.BitcoinNet = 0x283f161c
)
TestNet4 represents the test network (version 4).
Variables ¶
var ( // ZetaChainMainnet is the mainnet chain for Zeta ZetaChainMainnet = Chain{ ChainName: ChainName_zeta_mainnet, ChainId: 7000, Network: Network_zeta, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, CctxGateway: CCTXGateway_zevm, Name: "zeta_mainnet", } // Ethereum is Ethereum mainnet Ethereum = Chain{ ChainName: ChainName_eth_mainnet, ChainId: 1, Network: Network_eth, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "eth_mainnet", } // BscMainnet is Binance Smart Chain mainnet BscMainnet = Chain{ ChainName: ChainName_bsc_mainnet, ChainId: 56, Network: Network_bsc, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "bsc_mainnet", } // BitcoinMainnet is Bitcoin mainnet BitcoinMainnet = Chain{ ChainName: ChainName_btc_mainnet, ChainId: 8332, Network: Network_btc, NetworkType: NetworkType_mainnet, Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "btc_mainnet", } // Polygon is Polygon mainnet Polygon = Chain{ ChainName: ChainName_polygon_mainnet, ChainId: 137, Network: Network_polygon, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "polygon_mainnet", } // OptimismMainnet is Optimism mainnet OptimismMainnet = Chain{ ChainName: ChainName_optimism_mainnet, ChainId: 10, Network: Network_optimism, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "optimism_mainnet", } // BaseMainnet is Base mainnet BaseMainnet = Chain{ ChainName: ChainName_base_mainnet, ChainId: 8453, Network: Network_base, NetworkType: NetworkType_mainnet, Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "base_mainnet", } // SolanaMainnet is Solana mainnet // TODO: define final chain ID // https://github.com/zeta-chain/node/issues/2421 SolanaMainnet = Chain{ ChainName: ChainName_solana_mainnet, ChainId: 900, Network: Network_solana, NetworkType: NetworkType_mainnet, Vm: Vm_svm, Consensus: Consensus_solana_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "solana_mainnet", } TONMainnet = Chain{ ChainId: 2015140, Network: Network_ton, NetworkType: NetworkType_mainnet, Vm: Vm_tvm, Consensus: Consensus_catchain_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "ton_mainnet", } // ZetaChainTestnet is the testnet chain for Zeta ZetaChainTestnet = Chain{ ChainName: ChainName_zeta_testnet, ChainId: 7001, Network: Network_zeta, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, CctxGateway: CCTXGateway_zevm, Name: "zeta_testnet", } // Sepolia is Ethereum sepolia testnet Sepolia = Chain{ ChainName: ChainName_sepolia_testnet, ChainId: 11155111, Network: Network_eth, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "sepolia_testnet", } // BscTestnet is Binance Smart Chain testnet BscTestnet = Chain{ ChainName: ChainName_bsc_testnet, ChainId: 97, Network: Network_bsc, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "bsc_testnet", } // BitcoinTestnet is Bitcoin testnet3 BitcoinTestnet = Chain{ ChainName: ChainName_btc_testnet, ChainId: 18332, Network: Network_btc, NetworkType: NetworkType_testnet, Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "btc_testnet", } // BitcoinSignetTestnet is Bitcoin Signet testnet BitcoinSignetTestnet = Chain{ ChainId: 18333, Network: Network_btc, NetworkType: NetworkType_testnet, Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "btc_signet_testnet", } // BitcoinTestnet4 is Bitcoin testnet4 BitcoinTestnet4 = Chain{ ChainId: 18334, Network: Network_btc, NetworkType: NetworkType_testnet, Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "btc_testnet4", } // Amoy is Polygon amoy testnet Amoy = Chain{ ChainName: ChainName_amoy_testnet, ChainId: 80002, Network: Network_polygon, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "amoy_testnet", } // OptimismSepolia is Optimism sepolia testnet OptimismSepolia = Chain{ ChainName: ChainName_optimism_sepolia, ChainId: 11155420, Network: Network_optimism, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "optimism_sepolia", } // BaseSepolia is Base sepolia testnet BaseSepolia = Chain{ ChainName: ChainName_base_sepolia, ChainId: 84532, Network: Network_base, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_op_stack, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "base_sepolia", } // SolanaDevnet is Solana devnet // NOTE: Solana devnet refers to Solana testnet in our terminology // Solana uses devnet denomitation for network for development // TODO: define final chain ID // https://github.com/zeta-chain/node/issues/2421 SolanaDevnet = Chain{ ChainName: ChainName_solana_devnet, ChainId: 901, Network: Network_solana, NetworkType: NetworkType_testnet, Vm: Vm_svm, Consensus: Consensus_solana_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "solana_devnet", } TONTestnet = Chain{ ChainId: 2015141, Network: Network_ton, NetworkType: NetworkType_testnet, Vm: Vm_tvm, Consensus: Consensus_catchain_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "ton_testnet", } // ZetaChainDevnet is the devnet chain for Zeta // used as live testing environment ZetaChainDevnet = Chain{ ChainName: ChainName_zeta_mainnet, ChainId: 70000, Network: Network_zeta, NetworkType: NetworkType_devnet, Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, CctxGateway: CCTXGateway_zevm, Name: "zeta_mainnet", } // ZetaChainPrivnet is the privnet chain for Zeta (localnet) ZetaChainPrivnet = Chain{ ChainName: ChainName_zeta_mainnet, ChainId: 101, Network: Network_zeta, NetworkType: NetworkType_privnet, Vm: Vm_evm, Consensus: Consensus_tendermint, IsExternal: false, CctxGateway: CCTXGateway_zevm, Name: "zeta_mainnet", } // BitcoinRegtest is Bitcoin regtest (localnet) BitcoinRegtest = Chain{ ChainName: ChainName_btc_regtest, ChainId: 18444, Network: Network_btc, NetworkType: NetworkType_privnet, Vm: Vm_no_vm, Consensus: Consensus_bitcoin, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "btc_regtest", } // GoerliLocalnet is Ethereum local goerli (localnet) GoerliLocalnet = Chain{ ChainName: ChainName_goerli_localnet, ChainId: 1337, Network: Network_eth, NetworkType: NetworkType_privnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "goerli_localnet", } // SolanaLocalnet is Solana localnet // TODO: define final chain ID // https://github.com/zeta-chain/node/issues/2421 SolanaLocalnet = Chain{ ChainName: ChainName_solana_localnet, ChainId: 902, Network: Network_solana, NetworkType: NetworkType_privnet, Vm: Vm_svm, Consensus: Consensus_solana_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "solana_localnet", } TONLocalnet = Chain{ ChainId: 2015142, Network: Network_ton, NetworkType: NetworkType_privnet, Vm: Vm_tvm, Consensus: Consensus_catchain_consensus, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "ton_localnet", } // Goerli is Ethereum goerli testnet (deprecated for sepolia) Goerli = Chain{ ChainName: ChainName_goerli_testnet, ChainId: 5, Network: Network_eth, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "goerli_testnet", } // Mumbai is Polygon mumbai testnet (deprecated for amoy) Mumbai = Chain{ ChainName: ChainName_mumbai_testnet, ChainId: 80001, Network: Network_polygon, NetworkType: NetworkType_testnet, Vm: Vm_evm, Consensus: Consensus_ethereum, IsExternal: true, CctxGateway: CCTXGateway_observers, Name: "mumbai_testnet", } )
var ( ErrInvalidLengthChains = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowChains = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupChains = fmt.Errorf("proto: unexpected end of group") )
var CCTXGateway_name = map[int32]string{
0: "zevm",
1: "observers",
}
var CCTXGateway_value = map[string]int32{
"zevm": 0,
"observers": 1,
}
var ChainName_name = map[int32]string{
0: "empty",
1: "eth_mainnet",
2: "zeta_mainnet",
3: "btc_mainnet",
4: "polygon_mainnet",
5: "bsc_mainnet",
6: "goerli_testnet",
7: "mumbai_testnet",
10: "bsc_testnet",
11: "zeta_testnet",
12: "btc_testnet",
13: "sepolia_testnet",
14: "goerli_localnet",
15: "btc_regtest",
16: "amoy_testnet",
17: "optimism_mainnet",
18: "optimism_sepolia",
19: "base_mainnet",
20: "base_sepolia",
21: "solana_mainnet",
22: "solana_devnet",
23: "solana_localnet",
}
var ChainName_value = map[string]int32{
"empty": 0,
"eth_mainnet": 1,
"zeta_mainnet": 2,
"btc_mainnet": 3,
"polygon_mainnet": 4,
"bsc_mainnet": 5,
"goerli_testnet": 6,
"mumbai_testnet": 7,
"bsc_testnet": 10,
"zeta_testnet": 11,
"btc_testnet": 12,
"sepolia_testnet": 13,
"goerli_localnet": 14,
"btc_regtest": 15,
"amoy_testnet": 16,
"optimism_mainnet": 17,
"optimism_sepolia": 18,
"base_mainnet": 19,
"base_sepolia": 20,
"solana_mainnet": 21,
"solana_devnet": 22,
"solana_localnet": 23,
}
var Consensus_name = map[int32]string{
0: "ethereum",
1: "tendermint",
2: "bitcoin",
3: "op_stack",
4: "solana_consensus",
5: "catchain_consensus",
}
var Consensus_value = map[string]int32{
"ethereum": 0,
"tendermint": 1,
"bitcoin": 2,
"op_stack": 3,
"solana_consensus": 4,
"catchain_consensus": 5,
}
var (
DeadAddress = eth.HexToAddress("0xdEAD000000000000000042069420694206942069")
)
var ErrNotZetaChain = fmt.Errorf("chain is not a ZetaChain chain")
ErrNotZetaChain is the error for chain not being a ZetaChain chain
var NetworkType_name = map[int32]string{
0: "mainnet",
1: "testnet",
2: "privnet",
3: "devnet",
}
var NetworkType_value = map[string]int32{
"mainnet": 0,
"testnet": 1,
"privnet": 2,
"devnet": 3,
}
var Network_name = map[int32]string{
0: "eth",
1: "zeta",
2: "btc",
3: "polygon",
4: "bsc",
5: "optimism",
6: "base",
7: "solana",
8: "ton",
}
var Network_value = map[string]int32{
"eth": 0,
"zeta": 1,
"btc": 2,
"polygon": 3,
"bsc": 4,
"optimism": 5,
"base": 6,
"solana": 7,
"ton": 8,
}
var ReceiveStatus_name = map[int32]string{
0: "created",
1: "success",
2: "failed",
}
var ReceiveStatus_value = map[string]int32{
"created": 0,
"success": 1,
"failed": 2,
}
var TestNet4Params = chaincfg.Params{ Name: "testnet4", Net: TestNet4, DefaultPort: "48333", DNSSeeds: []chaincfg.DNSSeed{ {"seed.testnet4.bitcoin.sprovoost.nl", true}, {"seed.testnet4.wiz.biz", true}, }, GenesisBlock: &testNet4GenesisBlock, GenesisHash: &testNet4GenesisHash, PowLimit: testNet3PowLimit, PowLimitBits: 0x1d00ffff, CoinbaseMaturity: 100, SubsidyReductionInterval: 210000, TargetTimespan: time.Hour * 24 * 14, TargetTimePerBlock: time.Minute * 10, RetargetAdjustmentFactor: 4, ReduceMinDifficulty: true, MinDiffReductionTime: time.Minute * 20, GenerateSupported: false, Checkpoints: []chaincfg.Checkpoint{}, RuleChangeActivationThreshold: 1512, MinerConfirmationWindow: 2016, Deployments: [chaincfg.DefinedDeployments]chaincfg.ConsensusDeployment{ chaincfg.DeploymentTestDummy: { BitNumber: 28, DeploymentStarter: chaincfg.NewMedianTimeDeploymentStarter( time.Time{}, ), DeploymentEnder: chaincfg.NewMedianTimeDeploymentEnder( time.Time{}, ), }, chaincfg.DeploymentTestDummyMinActivation: { BitNumber: 22, CustomActivationThreshold: 1815, MinActivationHeight: 10_0000, DeploymentStarter: chaincfg.NewMedianTimeDeploymentStarter( time.Time{}, ), DeploymentEnder: chaincfg.NewMedianTimeDeploymentEnder( time.Time{}, ), }, chaincfg.DeploymentCSV: { BitNumber: 0, DeploymentStarter: chaincfg.NewMedianTimeDeploymentStarter( time.Time{}, ), DeploymentEnder: chaincfg.NewMedianTimeDeploymentEnder( time.Time{}, ), }, chaincfg.DeploymentSegwit: { BitNumber: 1, DeploymentStarter: chaincfg.NewMedianTimeDeploymentStarter( time.Time{}, ), DeploymentEnder: chaincfg.NewMedianTimeDeploymentEnder( time.Time{}, ), }, chaincfg.DeploymentTaproot: { BitNumber: 2, DeploymentStarter: chaincfg.NewMedianTimeDeploymentStarter( time.Time{}, ), DeploymentEnder: chaincfg.NewMedianTimeDeploymentEnder( time.Time{}, ), CustomActivationThreshold: 1512, }, }, RelayNonStdTxs: true, Bech32HRPSegwit: "tb", PubKeyHashAddrID: 0x6f, ScriptHashAddrID: 0xc4, WitnessPubKeyHashAddrID: 0x03, WitnessScriptHashAddrID: 0x28, PrivateKeyID: 0xef, HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, HDCoinType: 1, }
TestNet4Params defines the network parameters for the test Bitcoin network (version 4). Not to be confused with the regression test network, this network is sometimes simply called "testnet4".
var Vm_name = map[int32]string{
0: "no_vm",
1: "evm",
2: "svm",
3: "tvm",
}
var Vm_value = map[string]int32{
"no_vm": 0,
"evm": 1,
"svm": 2,
"tvm": 3,
}
Functions ¶
func BitcoinChainIDFromNetworkName ¶
BitcoinChainIDFromNetworkName returns the chain id for the given bitcoin network name
func BitcoinNetParamsFromChainID ¶
BitcoinNetParamsFromChainID returns the bitcoin net params to be used from the chain id
func BtcNonceMarkOffset ¶
func BtcNonceMarkOffset() int64
BtcNonceMarkOffset is the offset satoshi amount to calculate the nonce mark output
func ChainIDInChainList ¶
ChainIDInChainList checks whether the chainID is in the chain list
func ConvertRecoverToError ¶
func ConvertRecoverToError(r interface{}) error
func CosmosToEthChainID ¶
CosmosToEthChainID converts a Cosmos chain ID to an Ethereum chain ID parse value between _ and - e.g. cosmoshub_400-1 -> 400
func DecodeAddressFromChainID ¶
DecodeAddressFromChainID decode the address string to bytes additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func DecodeBtcAddress ¶
DecodeBtcAddress decodes a BTC address from a given string and chainID
func DecodeSolanaWalletAddress ¶
DecodeSolanaWalletAddress decodes a Solana wallet address from a given string.
func FilterExternalChains ¶
FilterExternalChains filters chains that are external
func GetBTCChainIDFromChainParams ¶
GetBTCChainIDFromChainParams returns the bitcoin chain ID from the chain config params
func GetBTCChainParams ¶
GetBTCChainParams returns the bitcoin chain config params from the chain ID
func IsBitcoinChain ¶
IsBitcoinChain returns true if the chain is a Bitcoin-based chain or uses the bitcoin consensus mechanism for block finality additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func IsBitcoinMainnet ¶
IsBitcoinMainnet returns true if the chain id is for the mainnet
func IsBitcoinRegnet ¶
IsBitcoinRegnet returns true if the chain id is for the regnet
func IsBtcAddressSupported ¶
IsBtcAddressSupported returns true if the given BTC address is supported
func IsEVMChain ¶
IsEVMChain returns true if the chain is an EVM chain additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func IsEthereumChain ¶
IsEthereumChain returns true if the chain is an Ethereum chain additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func IsSolanaChain ¶
IsSolanaChain returns true if the chain is a Solana chain
func IsTONChain ¶
IsTONChain returns true is the chain is TON chain
func IsZetaChain ¶
IsZetaChain returns true if the chain is a Zeta chain additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func NonceMarkAmount ¶
NonceMarkAmount uses special value to mark current nonce in UTXO
Types ¶
type Address ¶
type Address string
var NoAddress Address
func NewAddress ¶
NewAddress create a new Address. Supports Ethereum, BSC, Polygon
type CCTXGateway ¶
type CCTXGateway int32
CCTXGateway describes for the chain the gateway used to handle CCTX outbounds
const ( // zevm is the internal CCTX gateway to process outbound on the ZEVM and read // inbound events from the ZEVM only used for ZetaChain chains CCTXGateway_zevm CCTXGateway = 0 // observers is the CCTX gateway for chains relying on the observer set to // observe inbounds and TSS for outbounds CCTXGateway_observers CCTXGateway = 1 )
func (CCTXGateway) EnumDescriptor ¶
func (CCTXGateway) EnumDescriptor() ([]byte, []int)
func (CCTXGateway) String ¶
func (x CCTXGateway) String() string
type Chain ¶
type Chain struct { // ChainId is the unique identifier of the chain ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // ChainName is the name of the chain // Deprecated(v19): replaced with Name ChainName ChainName `` // Deprecated: Do not use. /* 134-byte string literal not displayed */ // Network is the network of the chain Network Network `protobuf:"varint,3,opt,name=network,proto3,enum=zetachain.zetacore.pkg.chains.Network" json:"network,omitempty"` // NetworkType is the network type of the chain: mainnet, testnet, etc.. NetworkType NetworkType `` /* 142-byte string literal not displayed */ // Vm is the virtual machine used in the chain Vm Vm `protobuf:"varint,5,opt,name=vm,proto3,enum=zetachain.zetacore.pkg.chains.Vm" json:"vm,omitempty"` // Consensus is the underlying consensus algorithm used by the chain Consensus Consensus `protobuf:"varint,6,opt,name=consensus,proto3,enum=zetachain.zetacore.pkg.chains.Consensus" json:"consensus,omitempty"` // IsExternal describe if the chain is ZetaChain or external IsExternal bool `protobuf:"varint,7,opt,name=is_external,json=isExternal,proto3" json:"is_external,omitempty"` // CCTXGateway is the gateway used to handle CCTX outbounds CctxGateway CCTXGateway `` /* 142-byte string literal not displayed */ // Name is the name of the chain Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name,omitempty"` }
Chain represents static data about a blockchain network it is identified by a unique chain ID
func ChainListByConsensus ¶
ChainListByConsensus returns a list of chains by consensus
func ChainListByGateway ¶
func ChainListByGateway(gateway CCTXGateway, additionalChains []Chain) []Chain
func ChainListByNetwork ¶
ChainListByNetwork returns a list of chains by network
func ChainListByNetworkType ¶
func ChainListByNetworkType(networkType NetworkType, additionalChains []Chain) []Chain
ChainListByNetworkType returns a list of chains by network type
func CombineChainList ¶
CombineChainList combines a list of chains with a list of chains duplicated chain ID are overwritten by the second list
func CombineDefaultChainsList ¶
CombineDefaultChainsList combines the default chains list with a list of chains duplicated chain ID are overwritten by the second list
func CombineFilterChains ¶
CombineFilterChains combines multiple lists of chains into a single list
func DefaultChainsList ¶
func DefaultChainsList() []Chain
DefaultChainsList returns a list of default chains
func ExternalChainList ¶
ExternalChainList returns a list chains that are not Zeta
func FilterChains ¶
func FilterChains(chainList []Chain, filters ...ChainFilter) []Chain
FilterChains applies a list of filters to a list of chains
func GetChainFromChainID ¶
GetChainFromChainID returns the chain from the chain ID additionalChains is a list of additional chains to search from in practice, it is used in the protocol to dynamically support new chains without doing an upgrade
func ZetaChainFromChainID ¶
ZetaChainFromChainID returns a ZetaChain chain object from a chain ID
func ZetaChainFromCosmosChainID ¶
ZetaChainFromCosmosChainID returns a ZetaChain chain object from a Cosmos chain ID
func (*Chain) Descriptor ¶
func (Chain) EncodeAddress ¶
EncodeAddress bytes representations of address on EVM chain, it is 20Bytes on Bitcoin chain, it is P2WPKH address, []byte(bech32 encoded string)
func (*Chain) GetCctxGateway ¶
func (m *Chain) GetCctxGateway() CCTXGateway
func (*Chain) GetChainId ¶
func (*Chain) GetChainName
deprecated
func (*Chain) GetConsensus ¶
func (*Chain) GetIsExternal ¶
func (*Chain) GetNetwork ¶
func (*Chain) GetNetworkType ¶
func (m *Chain) GetNetworkType() NetworkType
func (Chain) IsBitcoinChain ¶
func (Chain) IsEVMChain ¶
func (Chain) IsExternalChain ¶
IsExternalChain returns true if the chain is an ExternalChain chain, not ZetaChain
func (Chain) IsSolanaChain ¶
func (Chain) IsTONChain ¶
func (Chain) IsZetaChain ¶
IsZetaChain returns true if the chain is a ZetaChain chain
func (*Chain) ProtoMessage ¶
func (*Chain) ProtoMessage()
func (Chain) Validate ¶
Validate checks whether the chain is valid The function check the chain ID is positive and all enum fields have a defined value
func (*Chain) XXX_DiscardUnknown ¶
func (m *Chain) XXX_DiscardUnknown()
func (*Chain) XXX_Marshal ¶
func (*Chain) XXX_Unmarshal ¶
type ChainFilter ¶
ChainFilter is a function that filters chains based on some criteria
func FilterByConsensus ¶
func FilterByConsensus(cs Consensus) ChainFilter
FilterByConsensus filters chains by consensus type
func FilterByGateway ¶
func FilterByGateway(gw CCTXGateway) ChainFilter
FilterByGateway filters chains by gateway
type ChainName ¶
type ChainName int32
ChainName represents the name of the chain Deprecated(v19): replaced with Chain.Name as string
const ( ChainName_empty ChainName = 0 ChainName_eth_mainnet ChainName = 1 ChainName_zeta_mainnet ChainName = 2 ChainName_btc_mainnet ChainName = 3 ChainName_polygon_mainnet ChainName = 4 ChainName_bsc_mainnet ChainName = 5 ChainName_goerli_testnet ChainName = 6 ChainName_mumbai_testnet ChainName = 7 ChainName_bsc_testnet ChainName = 10 ChainName_zeta_testnet ChainName = 11 ChainName_btc_testnet ChainName = 12 ChainName_sepolia_testnet ChainName = 13 ChainName_goerli_localnet ChainName = 14 ChainName_btc_regtest ChainName = 15 ChainName_amoy_testnet ChainName = 16 ChainName_optimism_mainnet ChainName = 17 ChainName_optimism_sepolia ChainName = 18 ChainName_base_mainnet ChainName = 19 ChainName_base_sepolia ChainName = 20 ChainName_solana_mainnet ChainName = 21 ChainName_solana_devnet ChainName = 22 ChainName_solana_localnet ChainName = 23 )
func (ChainName) EnumDescriptor ¶
type Consensus ¶
type Consensus int32
Consensus represents the consensus algorithm used by the chain this can represent the consensus of a L1 this can also represent the solution of a L2
func (Consensus) EnumDescriptor ¶
type Network ¶
type Network int32
Network represents the network of the chain there is a single instance of the network on mainnet then the network can have eventual testnets or devnets
func (Network) EnumDescriptor ¶
type NetworkType ¶
type NetworkType int32
NetworkType represents the network type of the chain Mainnet, Testnet, Privnet, Devnet
const ( NetworkType_mainnet NetworkType = 0 NetworkType_testnet NetworkType = 1 NetworkType_privnet NetworkType = 2 NetworkType_devnet NetworkType = 3 )
func (NetworkType) EnumDescriptor ¶
func (NetworkType) EnumDescriptor() ([]byte, []int)
func (NetworkType) String ¶
func (x NetworkType) String() string
type ReceiveStatus ¶
type ReceiveStatus int32
ReceiveStatus represents the status of an outbound TODO: Rename and move https://github.com/zeta-chain/node/issues/2257
const ( // Created is used for inbounds ReceiveStatus_created ReceiveStatus = 0 ReceiveStatus_success ReceiveStatus = 1 ReceiveStatus_failed ReceiveStatus = 2 )
func ReceiveStatusFromString ¶
func ReceiveStatusFromString(str string) (ReceiveStatus, error)
ReceiveStatusFromString returns a ReceiveStatus from a string using in CLI 0 for success, 1 for failed TODO: remove "receive" naming ans use outbound https://github.com/zeta-chain/node/issues/1797
func (ReceiveStatus) EnumDescriptor ¶
func (ReceiveStatus) EnumDescriptor() ([]byte, []int)
func (ReceiveStatus) String ¶
func (x ReceiveStatus) String() string