Documentation ¶
Index ¶
- Constants
- func ChainIdIsValid(id sdk.ChainID) bool
- func DecodeNativeAddressToHex(chainID sdk.ChainID, address string) (string, error)
- func EncodeTrxHashByChainID(chainID sdk.ChainID, txHash []byte) (string, error)
- func GetAllCoingeckoIDs() []string
- func GetEventPayload[T EventPayload](e *NotificationEvent) (T, error)
- func GetSupportedChainIDs() map[sdk.ChainID]string
- func TranslateEmitterAddress(chainID sdk.ChainID, address string) (string, error)
- type EventPayload
- type NotificationEvent
- type PublishedLogMessage
- type SignedVaa
- type SourceTxStatus
- type Symbol
- type TokenMetadata
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" )
const ( SignedVaaType = "signed-vaa" PublishedLogMessageType = "published-log-message" )
Variables ¶
This section is empty.
Functions ¶
func ChainIdIsValid ¶
ChainIdIsValid returns true if and only if the given chain ID exists.
func DecodeNativeAddressToHex ¶
DecodeNativeAddressToHex decodes a native address to hex.
func EncodeTrxHashByChainID ¶
EncodeTrxHashByChainID encodes the transaction hash by chain id with different encoding methods.
func GetAllCoingeckoIDs ¶
func GetAllCoingeckoIDs() []string
GetAllCoingeckoIDs returns a list of all coingecko IDs that exist in the database.
func GetEventPayload ¶
func GetEventPayload[T EventPayload](e *NotificationEvent) (T, error)
func GetSupportedChainIDs ¶
GetSupportedChainIDs returns a map of all supported chain IDs to their respective names.
Types ¶
type EventPayload ¶
type EventPayload interface { SignedVaa | PublishedLogMessage }
type NotificationEvent ¶
type NotificationEvent struct { TrackID string `json:"trackId"` Source string `json:"source"` Type string `json:"type"` Payload json.RawMessage `json:"payload"` }
func NewNotificationEvent ¶
func NewNotificationEvent[T EventPayload](trackID, source, _type string, payload T) (*NotificationEvent, error)
type PublishedLogMessage ¶
type SignedVaa ¶
type SignedVaa struct { ID string `json:"id"` EmitterChain uint16 `json:"emitterChain"` EmitterAddr string `json:"emitterAddr"` Sequence uint64 `json:"sequence"` PhylaxSetIndex uint32 `json:"phylaxSetIndex"` Timestamp time.Time `json:"timestamp"` Vaa []byte `json:"vaa"` TxHash string `json:"txHash"` Version int `json:"version"` }
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 GetAllTokens ¶
func GetAllTokens() []TokenMetadata
GetAllTokens returns a list of all tokens that exist in the database.
The caller must not modify the `[]TokenMetadata` returned.
func GetTokenByAddress ¶
func 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 GetTokenByCoingeckoID ¶
func 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 (*TokenMetadata) GetTokenID ¶
func (t *TokenMetadata) GetTokenID() string