domain

package
v0.0.0-...-220dd01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 33

Documentation

Index

Constants

View Source
const (
	P2pMainNet = "mainnet"
	P2pTestNet = "testnet"
	P2pDevNet  = "devnet"
)

p2p network constants.

View Source
const (
	AppIdUnkonwn           = "UNKONWN"
	AppIdPortalTokenBridge = "PORTAL_TOKEN_BRIDGE"
)
View Source
const (
	DstTxStatusFailedToProcess = "failed"
	DstTxStatusConfirmed       = "completed"
	DstTxStatusUnkonwn         = "unknown"
)

Variables

This section is empty.

Functions

func ChainIdIsValid

func ChainIdIsValid(id sdk.ChainID) bool

ChainIdIsValid returns true if and only if the given chain ID exists.

func ConsistencyLevelIsImmediately

func ConsistencyLevelIsImmediately(v *sdk.VAA) bool

ConsistencyLevelIsImmediately returns true if the VAA is to be published immediately

func CreateUniqueVaaID

func CreateUniqueVaaID(vaa *sdk.VAA) string

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

func DecodeNativeAddressToHex(chainID sdk.ChainID, address string) (string, error)

DecodeNativeAddressToHex decodes a native address to hex.

func EncodeTrxHashByChainID

func EncodeTrxHashByChainID(chainID sdk.ChainID, txHash []byte) (string, error)

EncodeTrxHashByChainID encodes the transaction hash by chain id with different encoding methods.

func GetSupportedChainIDs

func GetSupportedChainIDs() map[sdk.ChainID]string

GetSupportedChainIDs returns a map of all supported chain IDs to their respective names.

func NormalizeTxHashByChainId

func NormalizeTxHashByChainId(chainID sdk.ChainID, txHash string) string

func TranslateEmitterAddress

func TranslateEmitterAddress(chainID sdk.ChainID, address string) (string, error)

TranslateEmitterAddress converts an emitter address into the corresponding native address for the given chain.

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.)

func (Symbol) String

func (s Symbol) String() string

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 (*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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL