All the EVM-based chain names that Wormhole supports
All the Solana-based chain names that Wormhole supports
Contracts addresses on testnet and mainnet
Asserts that the given number or string is a valid chain, and throws otherwise. After calling this function, the type of chain will be narrowed to ChainId or ChainName thanks to the type assertion in the return type.
A typical use-case might look like
// c has type 'string'
assertChain(c)
// c now has type 'ChainName'
Asserts that the given chain id or chain name is an EVM chain, and throws otherwise. After calling this function, the type of chain will be narrowed to EVMChainId or EVMChainName thanks to the type assertion in the return type.
Returns module address from given fully qualified type/module address.
FQT or module address
Module address
Get a hash that uniquely identifies a collection on Aptos.
Collection hash
The NFT bridge creates resource accounts, which in turn create a collection and mint a single token for each transferred NFT. This method derives the address of that resource account from the given origin chain and address.
External address of NFT on origin chain
Address of resource account
Get a hash that uniquely identifies a token on Aptos.
Native tokens in Aptos are uniquely identified by a hash of creator address,
collection name, token name, and property version. This hash is converted to
a bigint in the tokenId
field in NFT transfer VAAs.
Token hash identifying the token
Generate, sign, and submit a transaction calling the given entry function with the given arguments. Prevents transaction submission and throws if the transaction fails.
This is separated from generateSignAndSubmitScript
because it makes use of AptosClient
's
generateTransaction
which pulls ABIs from the node and uses them to encode arguments
automatically.
Client used to transfer data to/from Aptos node
Account that will submit transaction
Payload containing unencoded fully qualified entry function, types, and arguments
Override default transaction options
Data from transaction after is has been successfully submitted to mempool
Generate, sign, and submit a transaction containing given bytecode. Prevents transaction submission and throws if the transaction fails.
Unlike generateSignAndSubmitEntryFunction
, this function must construct a RawTransaction
manually because generateTransaction
does not have support for scripts for which there are
no corresponding on-chain ABIs. Type/argument encoding is left to the caller.
Client used to transfer data to/from Aptos node
Account that will submit transaction
Payload containing compiled bytecode and encoded types/arguments
Override default transaction options
Data from transaction after is has been successfully submitted to mempool
Derives the fully qualified type of the asset defined by the given origin chain and address.
Address of token bridge (32 bytes)
Chain ID of chain that original asset is from
Native address of asset; if origin chain ID is 22 (Aptos), this is the asset's fully qualified type
The fully qualified type on Aptos for the given asset
Hashes the given type. Because fully qualified types are a concept unique to Aptos, this output acts as the address on other chains.
Fully qualified type on Aptos
External address corresponding to given type
Derive the module address for an asset defined by the given origin chain and address.
Address of token bridge (32 bytes)
Chain ID of chain that original asset is from
Native address of asset
The module address for the given asset
Get creator address, collection name, token name, and property version from a token hash. Note that this method is meant to be used for native tokens that have already been registered in the NFT bridge.
The token hash is stored in the tokenId
field of NFT transfer VAAs and
is calculated by the operations in deriveTokenHashFromTokenId
.
Token hash
Token ID
Given a hash, returns the fully qualified type by querying the corresponding TypeInfo.
Client used to transfer data to/from Aptos node
Address of token bridge
Hash of fully qualified type
The fully qualified type associated with the given hash
Convert an address in a wormhole's 32-byte hex representation into a chain's native string representation.
Convert an address in a wormhole's 32-byte hex representation into a chain's native string representation.
Returns true when called with a valid chain, and narrows the type in the "true" branch to ChainId or ChainName thanks to the type predicate in the return type.
A typical use-case might look like
foo = isChain(c) ? doSomethingWithChainId(c) : handleInvalidCase()
Returns true when called with an EVMChainId or EVMChainName, and false otherwise. Importantly, after running this check, the chain's type will be narrowed to either the EVM subset, or the non-EVM subset thanks to the type predicate in the return type.
Returns true iff the hex string represents a native Terra denom.
Native assets on terra don't have an associated smart contract address, just like eth isn't an ERC-20 contract on Ethereum.
The difference is that the EVM implementations of Portal don't support eth directly, and instead require swapping to an ERC-20 wrapped eth (WETH) contract first.
The Terra implementation instead supports Terra-native denoms without wrapping to CW-20 token first. As these denoms don't have an address, they are encoded in the Portal payloads by the setting the first byte to 1. This encoding is safe, because the first 12 bytes of the 32-byte wormhole address space are not used on Terra otherwise, as cosmos addresses are 20 bytes wide.
Test if given string is a valid fully qualified type of moduleAddress::moduleName::structName.
String to test
Whether or not given string is a valid type
Convert an address in a chain's native representation into a 32-byte hex string understood by wormhole.
Convert an address in a wormhole's 32-byte hex representation into a chain's native string representation.
Convert an address in a wormhole's 32-byte hex representation into a chain's native string representation.
Convert an address in a chain's native representation into a 32-byte hex string understood by wormhole.
Convert an address in a wormhole's 32-byte array representation into a chain's native string representation.
Convert an address in a chain's native representation into a 32-byte hex string understood by wormhole.
Generated using TypeDoc
All the EVM-based chain ids that Wormhole supports