Documentation
¶
Index ¶
- Constants
- func ChainIdIsValid(id sdk.ChainID) bool
- func ConsistencyLevelIsImmediately(v *sdk.VAA) bool
- func CreateUniqueVaaID(vaa *sdk.VAA) string
- func CreateUniqueVaaIDByObservation(obs *gossipv1.SignedObservation) string
- func DecodeNativeAddressToHex(chainID sdk.ChainID, address string) (string, error)
- func DenormalizeAddressByChainId(chainID sdk.ChainID, address string) string
- func DenormalizeTxHashByChainId(chainID sdk.ChainID, txHash string) string
- func EncodeTrxHashByChainID(chainID sdk.ChainID, txHash []byte) (string, error)
- func GetDigest(vaa *sdk.VAA) string
- func GetDigestFromRaw(raw []byte) (string, error)
- func GetMainnetGuardianSet() ([]common.GuardianSet, []time.Time)
- func GetSupportedChainIDs() map[sdk.ChainID]string
- func GetTestnetGuardianSet() ([]common.GuardianSet, []time.Time)
- func NormalizeAddressByChainId(chainID sdk.ChainID, address string) string
- func NormalizeTxHashByChainId(chainID sdk.ChainID, txHash string) string
- func TranslateEmitterAddress(chainID sdk.ChainID, address string) (string, error)
- type SourceTxStatus
- type Symbol
- type TokenMetadata
- type TokenProvider
- func (t *TokenProvider) GetAllCoingeckoIDs() []string
- func (t *TokenProvider) GetAllTokens() []TokenMetadata
- func (t *TokenProvider) GetCoingeckoIDBySymbol(symbol string) string
- func (t *TokenProvider) GetP2pNewtork() string
- func (t *TokenProvider) GetTokenByAddress(tokenChain sdk.ChainID, tokenAddress string) (*TokenMetadata, bool)
- func (t *TokenProvider) GetTokenByCoingeckoID(coingeckoID string) (*TokenMetadata, bool)
- func (t *TokenProvider) GetTokensBySymbol(symbol string) ([]*TokenMetadata, bool)
Constants ¶
const ( P2pMainNet = "mainnet" P2pTestNet = "testnet" P2pDevNet = "devnet" )
p2p network constants.
const ( AppIdUnkonwn = "UNKONWN" AppIdPortalTokenBridge = "PORTAL_TOKEN_BRIDGE" )
const ( DstTxStatusFailedToProcess = "failed" DstTxStatusConfirmed = "completed" DstTxStatusUnkonwn = "unknown" )
Variables ¶
This section is empty.
Functions ¶
func ChainIdIsValid ¶
ChainIdIsValid returns true if and only if the given chain ID exists.
func ConsistencyLevelIsImmediately ¶
ConsistencyLevelIsImmediately returns true if the VAA is to be published immediately
func CreateUniqueVaaID ¶
CreateUniqueVaaID creates a unique VAA ID based on the message ID and the signing digest.
func CreateUniqueVaaIDByObservation ¶
func CreateUniqueVaaIDByObservation(obs *gossipv1.SignedObservation) string
CreateUniqueVaaIDByObservation creates a unique VAA ID based on the message ID and the observation hash.
func DecodeNativeAddressToHex ¶
DecodeNativeAddressToHex decodes a native address to hex.
func DenormalizeAddressByChainId ¶
DenormalizeAddressByChainId denormalizes the address stored in the database to the format compatible with the API v1 response to avoid breaking changes.
func DenormalizeTxHashByChainId ¶
DenormalizeTxHashByChainId denormalizes the transaction hash stored in the database to the format compatible with the API v1 response to avoid breaking changes.
func EncodeTrxHashByChainID ¶
EncodeTrxHashByChainID encodes the transaction hash by chain id with different encoding methods.
func GetDigestFromRaw ¶
func GetMainnetGuardianSet ¶
func GetMainnetGuardianSet() ([]common.GuardianSet, []time.Time)
func GetSupportedChainIDs ¶
GetSupportedChainIDs returns a map of all supported chain IDs to their respective names.
func GetTestnetGuardianSet ¶
func GetTestnetGuardianSet() ([]common.GuardianSet, []time.Time)
Types ¶
type SourceTxStatus ¶
type SourceTxStatus string
SourceTxStatus is meant to be a user-facing enum that describes the status of the source transaction.
const ( // SourceTxStatusChainNotSupported indicates that the processing failed due to the chain ID not being supported. // // (i.e.: there is no adapter for that chain yet) SourceTxStatusChainNotSupported SourceTxStatus = "chainNotSupported" // SourceTxStatusInternalError represents an internal, unspecified error. SourceTxStatusInternalError SourceTxStatus = "internalError" // SourceTxStatusConfirmed indicates that the transaciton has been processed successfully. SourceTxStatusConfirmed SourceTxStatus = "confirmed" )
type Symbol ¶
type Symbol string
Symbol identifies a publicly traded token (i.e. "ETH" for Ethereum, "ALGO" for Algorand, etc.)
type TokenMetadata ¶
type TokenMetadata struct { TokenChain sdk.ChainID TokenAddress string // Symbol is the name that crypto exchanges use to list the underlying asset represented by this token. // For example, the underlying symbol of the token "USDCso (USDC minted on Solana)" is "USDC". Symbol Symbol CoingeckoID string Decimals int64 }
TokenMetadata contains information about a token supported by Portal Token Bridge.
func GasTokenList ¶
func GasTokenList() []TokenMetadata
GasTokenList : gas tokens are the ones used to pay gas fees on the respective chains, they don't belong to a contract address.
func GetGasTokenMetadata ¶
func GetGasTokenMetadata(chainID sdk.ChainID) *TokenMetadata
func (*TokenMetadata) GetTokenID ¶
func (t *TokenMetadata) GetTokenID() string
type TokenProvider ¶
type TokenProvider struct {
// contains filtered or unexported fields
}
func NewTokenProvider ¶
func NewTokenProvider(p2pNetwork string) *TokenProvider
func (*TokenProvider) GetAllCoingeckoIDs ¶
func (t *TokenProvider) GetAllCoingeckoIDs() []string
GetAllCoingeckoIDs returns a list of all coingecko IDs that exist in the database.
func (*TokenProvider) GetAllTokens ¶
func (t *TokenProvider) GetAllTokens() []TokenMetadata
GetAllTokens returns a list of all tokens that exist in the database.
The caller must not modify the `[]TokenMetadata` returned.
func (*TokenProvider) GetCoingeckoIDBySymbol ¶
func (t *TokenProvider) GetCoingeckoIDBySymbol(symbol string) string
func (*TokenProvider) GetP2pNewtork ¶
func (t *TokenProvider) GetP2pNewtork() string
func (*TokenProvider) GetTokenByAddress ¶
func (t *TokenProvider) GetTokenByAddress(tokenChain sdk.ChainID, tokenAddress string) (*TokenMetadata, bool)
GetTokenByAddress returns information about a token identified by its original mint address.
The caller must not modify the `*TokenMetadata` returned.
func (*TokenProvider) GetTokenByCoingeckoID ¶
func (t *TokenProvider) GetTokenByCoingeckoID(coingeckoID string) (*TokenMetadata, bool)
GetTokenByCoingeckoID returns information about a token identified by its coingecko ID.
The caller must not modify the `*TokenMetadata` returned.
func (*TokenProvider) GetTokensBySymbol ¶
func (t *TokenProvider) GetTokensBySymbol(symbol string) ([]*TokenMetadata, bool)