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.
Attest an already created asset If you create a new asset on algorand and want to transfer it elsewhere, you create an attestation for it on algorand... pass that vaa to the target chain.. submit it.. then you can transfer from algorand to that target chain
An Algodv2 client
The ID of the token bridge
The asset index
Transaction ID
Attest given token from Aptos.
Address of token bridge
Origin chain ID
Address of token on origin chain
Transaction payload
Creates attestation message
Address of Inj token bridge contract
Address of wallet in inj format
Name or address of the asset to be attested For native assets the asset string is the denomination. For foreign assets the asset string is the inj address of the foreign asset
Message to be broadcast
Returns module address from given fully qualified type/module address.
FQT or module address
Module address
Constructs payload to create wrapped asset.
Note that this function is typically called in tandem with createWrappedTypeOnAptos
because
we must first create the CoinType that is used by create_wrapped_coin<CoinType>
. Since it's
not possible to create a resource and use it in the same transaction, this is broken into
separate transactions.
Address of token bridge
Bytes of attest VAA
Transaction payload
Constructs payload to create wrapped asset type. The type is of form {{address}}::coin::T
,
where address is sha256_hash(tokenBridgeAddress | chainID | "::" | originAddress | 0xFF)
.
Note that the typical createWrapped call is broken into two parts on Aptos because we must first
create the CoinType that is used by create_wrapped_coin<CoinType>
. Since it's not possible to
create a resource and use it in the same transaction, this is broken into separate transactions.
Address of token bridge
Bytes of attest VAA
Transaction payload
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 qualified type of asset on Aptos given its origin info.
Client used to transfer data to/from Aptos node
Address of token bridge
Chain ID of chain asset is originally from
Asset address on origin chain
Fully qualified type of asset on Aptos
Returns a foreign asset address on Ethereum for a provided native chain and asset address, AddressZero if it does not exist
zero pad to 32 bytes
Returns the address of the foreign asset
Address of token bridge contact
Holds the wallet and signing information
The chainId of the origin of the asset
The address of the origin asset
The foreign asset address or null
Returns a foreign asset address on Solana for a provided native chain and asset address
zero pad to 32 bytes
Returns true if this transfer was completed on Algorand
AlgodV2 client
Most likely the Token bridge ID
VAA to check
true if VAA has been redeemed, false otherwise
Determine whether or not the transfer in the given VAA has completed on Aptos.
Client used to transfer data to/from Aptos node
Address of token bridge
Bytes of transfer VAA
True if transfer is completed
Return if the VAA has been redeemed or not
The Injective token bridge contract address
The signed VAA byte array
Holds the wallet and signing information
true if the VAA has been redeemed.
This function is used to check if a VAA has been redeemed on terra2 by querying the token bridge contract.
The token bridge address (bech32)
The signed VAA byte array
The LCD client. Only used for querying, not transactions will be signed
Returns whethor or not an asset on Algorand is a wormhole wrapped asset
Algodv2 client
token bridge ID
Algorand asset index
true if the asset is wrapped
Determines whether or not given address is wrapped or native to Aptos.
Client used to transfer data to/from Aptos node
Address of token bridge
Fully qualified type of asset
True if asset is wrapped
Returns whether or not an asset address on Ethereum is a wormhole wrapped asset
Checks if the asset is a wrapped asset
The address of the Injective token bridge contract
Connection/wallet information
Address of the asset in Injective format
true if asset is a wormhole wrapped asset
Returns whether or not an asset on Solana is a wormhole wrapped asset
Returns an origin chain and asset address on {originChain} for a provided Wormhole wrapped address
Algodv2 client
Application ID of the token bridge
Algorand asset index
wrapped wormhole information structure
Gets the origin chain ID and address of an asset on Aptos, given its fully qualified type.
Client used to transfer data to/from Aptos node
Address of token bridge
Fully qualified type of asset
Original chain ID and address of asset
Returns a origin chain and asset address on {originChain} for a provided Wormhole wrapped address
Returns information about the asset
Address of the asset in wormhole wrapped format (hex string)
WASM api client
Information about the asset
Returns a origin chain and asset address on {originChain} for a provided Wormhole wrapped address
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.
Given a transaction result, return the first WormholeMessage event sequence
Wormhole Core bridge address
the result of client.waitForTransactionWithResult(txHash)
sequence
This basically just submits the VAA to Algorand
AlgodV2 client
Token bridge ID
Core bridge ID
The VAA to be redeemed
Transaction ID(s)
Register the token specified in the given VAA in the transfer recipient's account if necessary and complete the transfer.
Client used to transfer data to/from Aptos node
Address of token bridge
Bytes of transfer VAA
Transaction payload
Submits the supplied VAA to Injective
Address of Inj token bridge contract
Address of wallet in inj format
VAA with the attestation message
Message to be broadcast
Transfers an asset from Algorand to a receiver on another chain
AlgodV2 client
Application ID of the token bridge
Application ID of the core bridge
Asset index
Quantity to transfer
Receiving account
Reeiving chain
Transfer fee
payload for payload3 transfers
Sequence number of confirmation
Transfer an asset on Aptos to another chain.
Address of token bridge
Full qualified type of asset to transfer
Amount to send to recipient
Target chain
Recipient's address on target chain
Fee to pay relayer
Payload3 data, leave undefined for basic token transfers
Transaction payload
Creates the necessary messages to transfer an asset
Address of the Inj wallet
Address of the token bridge contract
Address of the token being transferred
Amount of token to be transferred
Destination chain
Destination wallet address
Relayer fee
Optional payload
Transfer messages to be sent on chain
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