# Class Wormhole<N>

#### Type Parameters

- #### N extends Network

#### Hierarchy

- Wormhole

- Defined in connect/src/wormhole.ts:46

#####
Index

### Constructors

constructor

### Properties

_chains
_network
_platforms
config

### Accessors

network

### Methods

circleTransfer
getBalance
getChain
getCircleAttestation
getContracts
getDecimals
getOriginalAsset
getPlatform
getTokenAccount
getTransactionStatus
getTransactionsForAddress
getVaa
getVaaByTxHash
getVaaBytes
getWrappedAsset
tokenTransfer
chainAddress
parseAddress
parseMessageFromTx

## Constructors

### constructor

- new Wormhole<N>(network, platforms, config?): Wormhole<N>

- #### Type Parameters

  - #### N extends "Mainnet" | "Testnet" | "Devnet"

  #### Parameters

  - ##### network: N

  - ##### platforms: PlatformUtils<N, any>[]

  - ##### `Optional` config: RecursivePartial<WormholeConfig<"Mainnet" | "Testnet" | "Devnet", "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm">>

  #### Returns Wormhole<N>

  - Defined in connect/src/wormhole.ts:53

## Properties

### `Protected` _chains

_chains: ChainMap<N, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky">

- Defined in connect/src/wormhole.ts:49

### `Protected` `Readonly` _network

_network: N

- Defined in connect/src/wormhole.ts:47

### `Protected` _platforms

_platforms: PlatformMap<N, "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm">

- Defined in connect/src/wormhole.ts:48

### `Readonly` config

config: WormholeConfig

- Defined in connect/src/wormhole.ts:51

## Accessors

### network

- get network(): N

- #### Returns N

  - Defined in connect/src/wormhole.ts:64

## Methods

### circleTransfer

- circleTransfer(amount, from, to, automatic, payload?, nativeGas?): Promise<CircleTransfer<N>>

- Creates a CircleTransfer object to move Native USDC from one chain to another

  #### Parameters

  - ##### amount: bigint

    the amount to transfer

  - ##### from: ChainAddress

    the address to transfer from

  - ##### to: ChainAddress

    the address to transfer to

  - ##### automatic: boolean

    whether to use automatic delivery

  - ##### `Optional` payload: Uint8Array

    the payload to send with the transfer

  - ##### `Optional` nativeGas: bigint

    the amount of native gas to send with the transfer

  #### Returns Promise<CircleTransfer<N>>

  the CircleTransfer object

  #### Throws

  Errors if the chain or protocol is not supported

  - Defined in connect/src/wormhole.ts:79

### getBalance

- getBalance<C>(chain, token, walletAddress): Promise<bigint>

- Fetches the balance of a given token for a wallet

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: C

    The chain name or id

  - ##### token: TokenAddress<C>

  - ##### walletAddress: string

    The wallet address

  #### Returns Promise<bigint>

  The token balance of the wormhole asset as a BigNumber

  - Defined in connect/src/wormhole.ts:246

### getChain

- getChain<C, P>(chain): ChainContext<N, P, C>

- Returns the chain "context", i.e. the class with chain-specific logic and methods

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  - #### P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm"

  #### Parameters

  - ##### chain: C

    the chain name

  #### Returns ChainContext<N, P, C>

  the chain context class

  #### Throws

  Errors if context is not found

  - Defined in connect/src/wormhole.ts:188

### getCircleAttestation

- getCircleAttestation(msgHash, timeout?): Promise<string>

- Gets the CircleAttestation corresponding to the message hash logged in the transfer transaction.

  #### Parameters

  - ##### msgHash: string

    The keccak256 hash of the message emitted by the circle contract

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

    The total amount of time to wait for the VAA to be available

  #### Returns Promise<string>

  The CircleAttestation as a string, if available

  #### Throws

  Errors if the CircleAttestation is not available after the retries

  - Defined in connect/src/wormhole.ts:321

### getContracts

- getContracts(chain): Contracts

- Gets the contract addresses for a given chain

  #### Parameters

  - ##### chain: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

    the chain name or chain id

  #### Returns Contracts

  the contract addresses

  - Defined in connect/src/wormhole.ts:166

### getDecimals

- getDecimals<C>(chain, token): Promise<bigint>

- Gets the number of decimals for a token on a given chain

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: C

    The chain name or id of the token/representation

  - ##### token: TokenAddress<C>

    The token address

  #### Returns Promise<bigint>

  The number of decimals

  - Defined in connect/src/wormhole.ts:233

### getOriginalAsset

- getOriginalAsset<C>(token): Promise<TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky">>

- Taking a the original TokenId for some wrapped token chain These are the Wormhole wrapped token addresses, not necessarily the cannonical version of that token

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### token: TokenId<C>

  #### Returns Promise<TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky">>

  The Original TokenId corresponding to the token id passed,

  #### Throws

  Errors if the chain is not supported or the token does not exist

  - Defined in connect/src/wormhole.ts:220

### getPlatform

- getPlatform<P>(platformName): PlatformContext<N, P>

- Returns the platform object, i.e. the class with platform-specific logic and methods

  #### Type Parameters

  - #### P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm"

  #### Parameters

  - ##### platformName: P

  #### Returns PlatformContext<N, P>

  the platform context class

  #### Throws

  Errors if platform is not found

  - Defined in connect/src/wormhole.ts:176

### getTokenAccount

- getTokenAccount<C>(recipient, token): Promise<ChainAddress<C>>

- Gets the associated token account for chains that require it (only Solana currently).

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### recipient: ChainAddress<C>

    the address of the primary account that may require a separate token account

  - ##### token: TokenId<C>

    the TokenId of the token to get the token account for

  #### Returns Promise<ChainAddress<C>>

  - Defined in connect/src/wormhole.ts:261

### getTransactionStatus

- getTransactionStatus(wormholeMessageId, timeout?): Promise<TransactionStatus>

- Get the status of a transaction, identified by the chain, emitter address, and sequence number

  #### Parameters

  - ##### wormholeMessageId: WormholeMessageId

    the message id for the Wormhole Message to get transaction status for

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

  #### Returns Promise<TransactionStatus>

  the TransactionStatus

  - Defined in connect/src/wormhole.ts:334

### getTransactionsForAddress

- getTransactionsForAddress(address, pageSize?, page?): Promise<TransactionStatus[]>

- Get recent transactions for an address

  #### Parameters

  - ##### address: string

    the string formatted address to get transactions for

  - ##### pageSize: number = 50

  - ##### page: number = 0

  #### Returns Promise<TransactionStatus[]>

  the TransactionStatus

  - Defined in connect/src/wormhole.ts:347

### getVaa

- getVaa<T>(wormholeMessageId, decodeAs, timeout?): Promise<DistributiveVAA<ExtractLiteral<T>>>

- Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available.

  #### Type Parameters

  - #### T extends PayloadLiteral | PayloadDiscriminator

  #### Parameters

  - ##### wormholeMessageId: WormholeMessageId

    The WormholeMessageId corresponding to the VAA to be fetched

  - ##### decodeAs: T

    The VAA type to decode the bytes as

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

    The total amount of time to wait for the VAA to be available

  #### Returns Promise<DistributiveVAA<ExtractLiteral<T>>>

  The VAA if available

  #### Throws

  Errors if the VAA is not available after the retries

  - Defined in connect/src/wormhole.ts:290

### getVaaByTxHash

- getVaaByTxHash<T>(txid, decodeAs, timeout?): Promise<DistributiveVAA<ExtractLiteral<T>>>

- Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available.

  #### Type Parameters

  - #### T extends PayloadLiteral | PayloadDiscriminator

  #### Parameters

  - ##### txid: string

    The Transaction Hash corresponding to the transaction that cause the wormhole core contract to emit a vaa

  - ##### decodeAs: T

    The VAA type to decode the bytes as

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

    The total amount of time to wait for the VAA to be available

  #### Returns Promise<DistributiveVAA<ExtractLiteral<T>>>

  The VAA if available

  #### Throws

  Errors if the VAA is not available after the retries

  - Defined in connect/src/wormhole.ts:306

### getVaaBytes

- getVaaBytes(wormholeMessageId, timeout?): Promise<Uint8Array>

- Gets the Raw VAA Bytes from the API or Guardian RPC, finality must be met before the VAA will be available.

  #### Parameters

  - ##### wormholeMessageId: WormholeMessageId

    The WormholeMessageId corresponding to the VAA to be fetched

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

    The total amount of time to wait for the VAA to be available

  #### Returns Promise<Uint8Array>

  The VAA bytes if available

  #### Throws

  Errors if the VAA is not available after the retries

  - Defined in connect/src/wormhole.ts:275

### getWrappedAsset

- getWrappedAsset<C>(chain, token): Promise<TokenId<C>>

- Gets the TokenId for a token representation on any chain These are the Wormhole wrapped token addresses, not necessarily the cannonical version of that token

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: C

    The chain name or id to get the wrapped token address

  - ##### token: TokenId<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky">

  #### Returns Promise<TokenId<C>>

  The TokenId on the given chain, null if it does not exist

  #### Throws

  Errors if the chain is not supported or the token does not exist

  - Defined in connect/src/wormhole.ts:205

### tokenTransfer

- tokenTransfer(token, amount, from, to, automatic, payload?, nativeGas?): Promise<TokenTransfer<N>>

- Creates a TokenTransfer object to move a token from one chain to another

  #### Parameters

  - ##### token: "native" | TokenId

    the token to transfer

  - ##### amount: bigint

    the amount to transfer

  - ##### from: ChainAddress

    the address to transfer from

  - ##### to: ChainAddress

    the address to transfer to

  - ##### automatic: boolean

    whether to use automatic delivery

  - ##### `Optional` payload: Uint8Array

    the payload to send with the transfer

  - ##### `Optional` nativeGas: bigint

    the amount of native gas to send with the transfer

  #### Returns Promise<TokenTransfer<N>>

  the TokenTransfer object

  #### Throws

  Errors if the chain or protocol is not supported

  - Defined in connect/src/wormhole.ts:128

### `Static` chainAddress

- chainAddress<C>(chain, address): ChainAddress<C>

- Parse an address from its canonincal string format to a NativeAddress

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: C

    The chain the address is for

  - ##### address: string

    The native address in canonical string format

  #### Returns ChainAddress<C>

  The ChainAddress

  - Defined in connect/src/wormhole.ts:373

### `Static` parseAddress

- parseAddress<C>(chain, address): NativeAddress<C>

- Parse an address from its canonincal string format to a NativeAddress

  #### Type Parameters

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: C

    The chain the address is for

  - ##### address: string

    The address in canonical string format

  #### Returns NativeAddress<C>

  The address in the NativeAddress format

  - Defined in connect/src/wormhole.ts:362

### `Static` parseMessageFromTx

- parseMessageFromTx<N, P, C>(chain, txid, timeout?): Promise<WormholeMessageId[]>

- Parses all relevant information from a transaction given the sending tx hash and sending chain

  #### Type Parameters

  - #### N extends "Mainnet" | "Testnet" | "Devnet"

  - #### P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm"

  - #### C extends "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky"

  #### Parameters

  - ##### chain: ChainContext<N, P, C>

    The sending chain name or context

  - ##### txid: string

  - ##### timeout: number = DEFAULT_TASK_TIMEOUT

  #### Returns Promise<WormholeMessageId[]>

  The parsed WormholeMessageId

  - Defined in connect/src/wormhole.ts:384

Generated using TypeDoc