Documentation
¶
Index ¶
- Constants
- Variables
- func ChainIDInChainList(chainID int64, chainList []*Chain) bool
- func ConvertRecoverToError(r interface{}) error
- func CosmosToEthChainID(chainID string) (int64, error)
- func DecodeAddressFromChainID(chainID int64, addr string) ([]byte, error)
- func FilterExternalChains(c *Chain) bool
- func HashToString(chainID int64, blockHash []byte) (string, error)
- func IsEVMChain(chainID int64) bool
- func IsEthereumChain(chainID int64) bool
- func IsHeaderSupportedEvmChain(chainID int64) bool
- func IsPellChain(chainID int64) bool
- func ParseAddressAndData(message string) (ethcommon.Address, []byte, error)
- func PayToWitnessTaprootScript(rawKey []byte) ([]byte, error)
- func StringToHash(chainID int64, hash string) ([]byte, error)
- type Address
- type AddressSegWit
- type AddressTaproot
- type Chain
- func BscMainnetChain() Chain
- func BscTestnetChain() Chain
- func ChainsList() []Chain
- func CombineFilterChains(chainLists ...[]Chain) []Chain
- func CoreTestNetChain() Chain
- func EthChain() Chain
- func ExternalChainList() []Chain
- func FilterChains(chainList []*Chain, filters ...ChainFilter) []*Chain
- func FindChain(filter func(Chain) bool) (Chain, bool)
- func FindChains(filter func(Chain) bool) []Chain
- func GetChainByChainId(id int64) (Chain, bool)
- func GoerliChain() Chain
- func GoerliLocalnetChain() Chain
- func MumbaiChain() Chain
- func PellChainFromChainID(chainID string) (Chain, error)
- func PellChainMainnet() Chain
- func PellPrivnetChain() Chain
- func PellTestnetChain() Chain
- func PrivnetChainList() []Chain
- func SepoliaChain() Chain
- func (c Chain) ChainName() string
- func (chain Chain) DecodeAddress(addr string) ([]byte, error)
- func (*Chain) Descriptor() ([]byte, []int)
- func (chain Chain) EncodeAddress(b []byte) (string, error)
- func (m *Chain) GetId() int64
- func (m *Chain) GetNetwork() NetWork
- func (m *Chain) GetNetworkType() NetWorkType
- func (m *Chain) GetVmType() VMType
- func (chain Chain) InChainList(chainList []*Chain) bool
- func (chain Chain) IsEmpty() bool
- func (chain Chain) IsEqual(c Chain) bool
- func (chain Chain) IsExternalChain() bool
- func (chain Chain) IsPellChain() 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 (chain Chain) SupportMerkleProof() bool
- func (m *Chain) Unmarshal(dAtA []byte) 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 Chains
- type NetWork
- type NetWorkType
- type ReceiveStatus
- type SigninAlgo
- type VMType
Constants ¶
const ETHAddressLen = 42
Variables ¶
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 (
DeadAddress = eth.HexToAddress("0xdEAD000000000000000042069420694206942069")
)
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: "PELL",
2: "BTC",
3: "POLYGON",
4: "BSC",
5: "GOERLI",
6: "MUMBAI",
7: "GANACHE",
8: "BAOBAB",
9: "SEPOLIA",
10: "AMOY",
11: "OPTIMISM",
12: "BASE",
13: "CORE",
14: "MANTLE",
15: "ARBITRUM",
16: "BITLAYER",
}
var NetWork_value = map[string]int32{
"ETH": 0,
"PELL": 1,
"BTC": 2,
"POLYGON": 3,
"BSC": 4,
"GOERLI": 5,
"MUMBAI": 6,
"GANACHE": 7,
"BAOBAB": 8,
"SEPOLIA": 9,
"AMOY": 10,
"OPTIMISM": 11,
"BASE": 12,
"CORE": 13,
"MANTLE": 14,
"ARBITRUM": 15,
"BITLAYER": 16,
}
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 VMType_name = map[int32]string{
0: "NO_VM",
1: "EVM",
2: "SVM",
}
var VMType_value = map[string]int32{
"NO_VM": 0,
"EVM": 1,
"SVM": 2,
}
Functions ¶
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
func FilterExternalChains ¶
FilterExternalChains filters chains that are external
func HashToString ¶
HashToString convert hash bytes to string
func IsEVMChain ¶
IsEVMChain returns true if the chain is an EVM chain
func IsEthereumChain ¶
// IsEthereumChain returns true if the chain is an Ethereum chain // TODO: put this information directly in chain object
func IsHeaderSupportedEvmChain ¶
IsHeaderSupportedEvmChain returns true if the chain is an EVM chain supporting block header-based verification TODO: put this information directly in chain object
func IsPellChain ¶
func ParseAddressAndData ¶
ParseAddressAndData parses the message string into an address and data message is hex encoded byte array [ contractAddress calldata ] [ 20B, variable]
func PayToWitnessTaprootScript ¶
PayToWitnessTaprootScript creates a new script to pay to a version 1 (taproot) witness program. The passed hash is expected to be valid.
Types ¶
type Address ¶
type Address string
var NoAddress Address
func NewAddress ¶
NewAddress create a new Address. Supports Ethereum, BSC, Polygon
type AddressSegWit ¶
type AddressSegWit struct {
// contains filtered or unexported fields
}
func (AddressSegWit) EncodeAddress ¶
func (a AddressSegWit) EncodeAddress() string
EncodeAddress returns the bech32 (or bech32m for SegWit v1) string encoding of an AddressSegWit.
NOTE: This method is part of the Address interface.
func (*AddressSegWit) IsForNet ¶
func (a *AddressSegWit) IsForNet(net *chaincfg.Params) bool
IsForNet returns whether the AddressSegWit is associated with the passed bitcoin network.
NOTE: This method is part of the Address interface.
func (*AddressSegWit) ScriptAddress ¶
func (a *AddressSegWit) ScriptAddress() []byte
ScriptAddress returns the witness program for this address.
NOTE: This method is part of the Address interface.
func (*AddressSegWit) String ¶
func (a *AddressSegWit) String() string
String returns a human-readable string for the AddressWitnessPubKeyHash. This is equivalent to calling EncodeAddress, but is provided so the type can be used as a fmt.Stringer.
NOTE: This method is part of the Address interface.
type AddressTaproot ¶
type AddressTaproot struct {
AddressSegWit
}
func DecodeTaprootAddress ¶
func DecodeTaprootAddress(addr string) (*AddressTaproot, error)
DecodeTaprootAddress decodes taproot address only and returns error on non-taproot address
func NewAddressTaproot ¶
func NewAddressTaproot(witnessProg []byte, net *chaincfg.Params) (*AddressTaproot, error)
NewAddressTaproot returns a new AddressTaproot.
type Chain ¶
type Chain struct {
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Network NetWork `protobuf:"varint,2,opt,name=network,proto3,enum=pkg.chains.NetWork" json:"network,omitempty"`
NetworkType NetWorkType `protobuf:"varint,3,opt,name=network_type,json=networkType,proto3,enum=pkg.chains.NetWorkType" json:"network_type,omitempty"`
VmType VMType `protobuf:"varint,4,opt,name=vm_type,json=vmType,proto3,enum=pkg.chains.VMType" json:"vm_type,omitempty"`
}
Chain represent a chain
func BscMainnetChain ¶
func BscMainnetChain() Chain
func BscTestnetChain ¶
func BscTestnetChain() Chain
func CombineFilterChains ¶
CombineFilterChains combines multiple lists of chains into a single list
func CoreTestNetChain ¶
func CoreTestNetChain() Chain
func ExternalChainList ¶
func ExternalChainList() []Chain
func FilterChains ¶
func FilterChains(chainList []*Chain, filters ...ChainFilter) []*Chain
FilterChains applies a list of filters to a list of chains
func FindChains ¶
func GetChainByChainId ¶
func GoerliLocalnetChain ¶
func GoerliLocalnetChain() Chain
func MumbaiChain ¶
func MumbaiChain() Chain
func PellChainFromChainID ¶
PellChainFromChainID returns a PellChain chainobject from a Cosmos chain ID
func PellChainMainnet ¶
func PellChainMainnet() Chain
func PellPrivnetChain ¶
func PellPrivnetChain() Chain
func PellTestnetChain ¶
func PellTestnetChain() Chain
func PrivnetChainList ¶
func PrivnetChainList() []Chain
func SepoliaChain ¶
func SepoliaChain() Chain
func (Chain) DecodeAddress ¶
DecodeAddress decode the address string to bytes
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) GetNetwork ¶
func (*Chain) GetNetworkType ¶
func (m *Chain) GetNetworkType() NetWorkType
func (Chain) InChainList ¶
InChainList checks whether the chain is in the chain list
func (Chain) IsExternalChain ¶
func (Chain) IsPellChain ¶
func (*Chain) ProtoMessage ¶
func (*Chain) ProtoMessage()
func (Chain) SupportMerkleProof ¶
SupportMerkleProof returns true if the chain supports block header-based verification
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
type Chains ¶
type Chains []Chain
Chains represent a slice of Chain
type NetWork ¶
type NetWork int32
NetWork represent chain type
const ( // ethereum NetWork_ETH NetWork = 0 // pell NetWork_PELL NetWork = 1 // bitcoin NetWork_BTC NetWork = 2 // polygon NetWork_POLYGON NetWork = 3 // bsc NetWork_BSC NetWork = 4 // goerli NetWork_GOERLI NetWork = 5 // mumbai NetWork_MUMBAI NetWork = 6 // ganache NetWork_GANACHE NetWork = 7 // baobab NetWork_BAOBAB NetWork = 8 // sepolia NetWork_SEPOLIA NetWork = 9 // amoy NetWork_AMOY NetWork = 10 // optimism NetWork_OPTIMISM NetWork = 11 // base NetWork_BASE NetWork = 12 // core NetWork_CORE NetWork = 13 // mantle NetWork_MANTLE NetWork = 14 // arbitrum NetWork_ARBITRUM NetWork = 15 // bitlayer NetWork_BITLAYER NetWork = 16 )
func (NetWork) EnumDescriptor ¶
type NetWorkType ¶
type NetWorkType int32
network represent chain network type
const ( // mainnet NetWorkType_MAINNET NetWorkType = 0 // testnet NetWorkType_TESTNET NetWorkType = 1 // privnet NetWorkType_PRIVNET NetWorkType = 2 // devnet 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 represent the status of a received transaction
const ( // some observer sees inbound tx ReceiveStatus_CREATED ReceiveStatus = 0 // success ReceiveStatus_SUCCESS ReceiveStatus = 1 // failed 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
func (ReceiveStatus) EnumDescriptor ¶
func (ReceiveStatus) EnumDescriptor() ([]byte, []int)
func (ReceiveStatus) String ¶
func (x ReceiveStatus) String() string
type SigninAlgo ¶
type SigninAlgo string