import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base"; import type { CapabilitiesResponse, ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, QuoteResponse, StatusResponse, TokenAddress, TokenId, TxHash, UniversalAddress, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions"; import type { WormholeConfig, WormholeConfigOverrides } from "./config.js"; import { CircleTransfer } from "./protocols/cctp/cctpTransfer.js"; import { TokenTransfer } from "./protocols/tokenBridge/tokenTransfer.js"; import type { RouteConstructor } from "./routes/index.js"; import { RouteResolver } from "./routes/resolver.js"; import type { TransactionStatus } from "./whscan-api.js"; type PlatformMap = Map>; type ChainMap = Map>; export declare class Wormhole { protected readonly _network: N; protected _platforms: PlatformMap; protected _chains: ChainMap; readonly config: WormholeConfig; constructor(network: N, platforms: PlatformUtils[], config?: WormholeConfigOverrides); get network(): N; /** * Creates a CircleTransfer object to move Native USDC from one chain to another * @param amount the amount to transfer * @param from the address to transfer from * @param to the address to transfer to * @param automatic whether to use automatic delivery * @param payload the payload to send with the transfer * @param nativeGas the amount of native gas to send with the transfer * @returns the CircleTransfer object * @throws Errors if the chain or protocol is not supported */ circleTransfer(amount: bigint, from: ChainAddress, to: ChainAddress, automatic: boolean, payload?: Uint8Array, nativeGas?: bigint): Promise>; /** * Creates a TokenTransfer object to move a token from one chain to another using TokenBridge protocol * @param token the token to transfer * @param amount the amount to transfer * @param from the address to transfer from * @param to the address to transfer to * @param protocol the protocol to use (TokenBridge) * @param payload the payload to send with the transfer * @returns the TokenTransfer object * @throws Errors if the chain or protocol is not supported */ tokenTransfer(token: TokenId, amount: bigint, from: ChainAddress, to: ChainAddress, protocol: "TokenBridge", payload?: Uint8Array): Promise>; /** * Creates a TokenTransfer object to move a token from one chain to another using AutomaticTokenBridge protocol * @param token the token to transfer * @param amount the amount to transfer * @param from the address to transfer from * @param to the address to transfer to * @param nativeGas optional amount of native gas to drop off with the transfer * @param protocol the protocol to use (AutomaticTokenBridge) * @returns the TokenTransfer object * @throws Errors if the chain or protocol is not supported */ tokenTransfer(token: TokenId, amount: bigint, from: ChainAddress, to: ChainAddress, protocol: "AutomaticTokenBridge", nativeGas?: bigint): Promise>; /** * Creates a TokenTransfer object to move a token from one chain to another using ExecutorTokenBridge protocol * @param token the token to transfer * @param amount the amount to transfer * @param from the address to transfer from * @param to the address to transfer to * @param protocol the protocol to use (ExecutorTokenBridge) * @returns the TokenTransfer object * @throws Errors if the chain or protocol is not supported */ tokenTransfer(token: TokenId, amount: bigint, from: ChainAddress, to: ChainAddress, protocol: "ExecutorTokenBridge"): Promise>; /** * Gets a RouteResolver configured with the routes passed * @param routes the list RouteConstructors to use * @returns the RouteResolver */ resolver(routes: RouteConstructor[]): RouteResolver; /** * Gets the contract addresses for a given chain * @param chain the chain name * @returns the contract addresses */ getContracts(chain: Chain): Contracts | undefined; /** * Returns the platform object, i.e. the class with platform-specific logic and methods * @param chain the platform name * @returns the platform context class * @throws Errors if platform is not found */ getPlatform

(platformName: P): PlatformContext; /** * Returns the chain "context", i.e. the class with chain-specific logic and methods * @param chain the chain name * @returns the chain context class * @throws Errors if context is not found */ getChain(chain: C): ChainContext; /** * Gets the TokenId for a token representation on any chain * These are the Wormhole wrapped token addresses, not necessarily * the canonical version of that token * * @param chain The chain name to get the wrapped token address * @param tokenId The Token ID (chain/address) of the original token * @returns 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 */ getWrappedAsset(chain: C, token: TokenId): Promise>; /** * Taking the original TokenId for some wrapped token chain * These are the Wormhole wrapped token addresses, not necessarily * the canonical version of that token * * @param tokenId The Token ID of the token we're looking up the original asset for * @returns The Original TokenId corresponding to the token id passed, * @throws Errors if the chain is not supported or the token does not exist */ getOriginalAsset(token: TokenId): Promise>; /** * Returns the UniversalAddress of the token. This may require fetching on-chain data. * @param chain The chain to get the UniversalAddress for * @param token The address to get the UniversalAddress for * @returns The UniversalAddress of the token */ getTokenUniversalAddress(chain: C, token: NativeAddress): Promise; /** * Returns the native address of the token. This may require fetching on-chain data. * @param chain The chain to get the native address for * @param originChain The chain the token is from / native to * @param token The address to get the native address for * @returns The native address of the token */ getTokenNativeAddress(chain: C, originChain: Chain, token: UniversalAddress): Promise>; /** * Gets the number of decimals for a token on a given chain * * @param chain The chain name or id of the token/representation * @param token The token address * @returns The number of decimals */ getDecimals(chain: C, token: TokenAddress): Promise; /** * Fetches the balance of a given token for a wallet * * @param walletAddress The wallet address * @param tokenId The token ID (its home chain and address on the home chain) * @param chain The chain name or id * @returns The token balance of the wormhole asset as a BigNumber */ getBalance(chain: C, token: TokenAddress, walletAddress: string): Promise; /** * Gets the associated token account for chains that require it (only Solana currently). * * @param token the TokenId of the token to get the token account for * @param recipient the address of the primary account that may require a separate token account * @returns */ getTokenAccount(recipient: ChainAddress, token: TokenId): Promise>; /** * Gets the Raw VAA Bytes from the API or Guardian RPC, finality must be met before the VAA will be available. * * @param wormholeMessageId The WormholeMessageId corresponding to the VAA to be fetched * @param timeout The total amount of time to wait for the VAA to be available * @returns The VAA bytes if available * @throws Errors if the VAA is not available after the retries */ getVaaBytes(wormholeMessageId: WormholeMessageId, timeout?: number): Promise; /** * Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available. * * @param id The WormholeMessageId or Transaction hash corresponding to the VAA to be fetched * @param decodeAs The VAA type to decode the bytes as * @param timeout The total amount of time to wait for the VAA to be available * @returns The VAA if available * @throws Errors if the VAA is not available after the retries */ getVaa(id: WormholeMessageId | TxHash, decodeAs: T, timeout?: number): Promise> | null>; /** * Gets if the token bridge transfer VAA has been enqueued by the Governor. * @param id The WormholeMessageId corresponding to the token bridge transfer VAA to check * @returns True if the transfer has been enqueued, false otherwise */ getIsVaaEnqueued(id: WormholeMessageId): Promise; /** * Gets the CircleAttestation corresponding to the message hash logged in the transfer transaction. * @param msgHash The keccak256 hash of the message emitted by the circle contract * @param timeout The total amount of time to wait for the VAA to be available * @returns The CircleAttestation as a string, if available * @throws Errors if the CircleAttestation is not available after the retries */ getCircleAttestation(msgHash: string, timeout?: number): Promise; /** * Get the status of a transaction, identified by the chain, emitter address, and sequence number * * @param id the message id for the Wormhole Message to get transaction status for or originating Transaction hash * @returns the TransactionStatus */ getTransactionStatus(id: WormholeMessageId | TxHash, timeout?: number): Promise; getExecutorCapabilities(): Promise; getExecutorQuote(srcChain: Chain, dstChain: Chain, relayInstructions: string): Promise; getExecutorTxStatus(txHash: TxHash, chain: Chain): Promise; /** * Get recent transactions for an address * * @param address the string formatted address to get transactions for * @returns the TransactionStatus */ getTransactionsForAddress(address: string, pageSize?: number, page?: number): Promise; /** * Parse an address from its canonical string format to a NativeAddress * * @param chain The chain the address is for * @param address The address in canonical string format * @returns The address in the NativeAddress format */ static parseAddress(chain: C, address: string): NativeAddress; /** * Return a string in the canonical chain format representing the address * of a token or account * * @param chainAddress The ChainAddress or TokenId to get a string address * @returns The string address in canonical format for the chain */ static canonicalAddress(chainAddress: ChainAddress | TokenId): string; /** * Parse an address from its canonical string format to a NativeAddress * * @param chain The chain the address is for * @param address The native address in canonical string format * @returns The ChainAddress */ static chainAddress(chain: C, address: string): ChainAddress; /** * Parse an address from its canonical string format to a NativeAddress * * @param chain The chain the address is for * @param address The native address in canonical string format or the string "native" * @returns The ChainAddress */ static tokenId(chain: C, address: string): TokenId; /** * Parses all relevant information from a transaction given the sending tx hash and sending chain * * @param chain The sending chain name or context * @param tx The sending transaction hash * @returns The parsed WormholeMessageId */ static parseMessageFromTx(chain: ChainContext, txid: TxHash, timeout?: number): Promise; } export {}; //# sourceMappingURL=wormhole.d.ts.map