From 4c4e5eb281f42bb4f81549991d24b96f9fae37f7 Mon Sep 17 00:00:00 2001 From: Kevin Peters Date: Fri, 8 Sep 2023 14:50:47 -0500 Subject: [PATCH] Added contract audit changes, code review changes --- sdk/src/config/TESTNET.ts | 2 +- sdk/src/contexts/solana/relayer.ts | 107 +- .../accounts/foreignContract.ts | 12 +- .../tokenBridgeRelayer/accounts/index.ts | 1 - .../accounts/redeemerConfig.ts | 1 - .../accounts/registeredToken.ts | 1 - .../tokenBridgeRelayer/accounts/relayerFee.ts | 18 - .../accounts/senderConfig.ts | 6 +- .../accounts/signerSequence.ts | 17 + .../accounts/tokenTransferMessage.ts | 11 +- .../transferNativeTokensWithRelay.ts | 24 +- .../transferWrappedTokensWithRelay.ts | 25 +- .../utils/tokenBridgeRelayer/program.ts | 7 +- .../solana/utils/types/tokenBridgeRelayer.ts | 6846 ++++++++--------- wormhole-connect/public/index.html | 4 +- wormhole-connect/src/utils/routes/bridge.ts | 9 - 16 files changed, 3376 insertions(+), 3715 deletions(-) delete mode 100644 sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/relayerFee.ts create mode 100644 sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/signerSequence.ts diff --git a/sdk/src/config/TESTNET.ts b/sdk/src/config/TESTNET.ts index 60c217dac..d284f34b0 100644 --- a/sdk/src/config/TESTNET.ts +++ b/sdk/src/config/TESTNET.ts @@ -61,7 +61,7 @@ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = { context: Context.SOLANA, contracts: { ...CONTRACTS.TESTNET.solana, - relayer: '7PJ8fNkkUQo32SzPNoaw57prhGmRVRvRJhu8Gkvx71wo', + relayer: '3bPRWXqtSfUaCw3S4wdgvypQtsSzcmvDeaqSqPDkncrg', }, finalityThreshold: 32, nativeTokenDecimals: 9, diff --git a/sdk/src/contexts/solana/relayer.ts b/sdk/src/contexts/solana/relayer.ts index 17272d022..0c61e28b7 100644 --- a/sdk/src/contexts/solana/relayer.ts +++ b/sdk/src/contexts/solana/relayer.ts @@ -5,16 +5,17 @@ import { BN, Program } from '@project-serum/anchor'; import { ChainId } from 'types'; import { NATIVE_MINT } from '@solana/spl-token'; import { - RelayerFee, - deriveRelayerFeeAddress, RegisteredToken, deriveRegisteredTokenAddress, RedeemerConfig, deriveRedeemerConfigAddress, + ForeignContract, + deriveForeignContractAddress, } from './utils/tokenBridgeRelayer/accounts'; const SOL_DECIMALS = 9; const TEN = new BN(10); +const SWAP_RATE_PRECISION = new BN(100_000_000); export interface SwapEvent { recipient: string; @@ -36,12 +37,10 @@ export class SolanaRelayer { async isAcceptedToken(mint: string): Promise { try { - const { isRegistered } = await this.getRegisteredToken( - new PublicKey(mint), - ); - return isRegistered; - } catch (e) { - if (e instanceof Error && e.message?.includes('Account does not exist')) { + await this.getRegisteredToken(new PublicKey(mint)); + return true; + } catch (e: any) { + if (e.message?.includes('Account does not exist')) { // the token is not registered return false; } @@ -54,15 +53,14 @@ export class SolanaRelayer { mint: PublicKey, decimals: number, ): Promise { - const [{ fee }, { swapRate }, { relayerFeePrecision, swapRatePrecision }] = - await Promise.all([ - this.getRelayerFee(targetChain), - this.getRegisteredToken(mint), - this.getRedeemerConfig(), - ]); + const [{ fee }, { swapRate }, { relayerFeePrecision }] = await Promise.all([ + this.getForeignContract(targetChain), + this.getRegisteredToken(mint), + this.getRedeemerConfig(), + ]); const relayerFee = TEN.pow(new BN(decimals)) .mul(fee) - .mul(new BN(swapRatePrecision)) + .mul(SWAP_RATE_PRECISION) .div(new BN(relayerFeePrecision).mul(swapRate)); return BigInt(relayerFee.toString()); @@ -72,32 +70,16 @@ export class SolanaRelayer { mint: PublicKey, decimals: number, ): Promise { - const [ - { swapRate, maxNativeSwapAmount }, - { swapRate: solSwapRate }, - { swapRatePrecision }, - ] = await Promise.all([ - this.getRegisteredToken(mint), - this.getRegisteredToken(NATIVE_MINT), - this.getRedeemerConfig(), - ]); - const swapRatePrecisionBN = new BN(swapRatePrecision); - const nativeSwapRate = this.calculateNativeSwapRate( - swapRatePrecisionBN, - solSwapRate, - swapRate, - ); - const maxSwapAmountIn = - decimals > SOL_DECIMALS - ? maxNativeSwapAmount - .mul(nativeSwapRate) - .mul(TEN.pow(new BN(decimals - SOL_DECIMALS))) - .div(swapRatePrecisionBN) - : maxNativeSwapAmount - .mul(nativeSwapRate) - .div( - TEN.pow(new BN(SOL_DECIMALS - decimals)).mul(swapRatePrecisionBN), - ); + const [{ swapRate, maxNativeSwapAmount }, { swapRate: solSwapRate }] = + await Promise.all([ + this.getRegisteredToken(mint), + this.getRegisteredToken(NATIVE_MINT), + ]); + const nativeSwapRate = this.calculateNativeSwapRate(solSwapRate, swapRate); + const maxSwapAmountIn = maxNativeSwapAmount + .mul(nativeSwapRate) + .mul(TEN.pow(new BN(decimals - SOL_DECIMALS))) + .div(SWAP_RATE_PRECISION); return BigInt(maxSwapAmountIn.toString()); } @@ -110,27 +92,14 @@ export class SolanaRelayer { if (toNativeAmount === 0n) { return 0n; } - const [{ swapRate }, { swapRate: solSwapRate }, { swapRatePrecision }] = - await Promise.all([ - this.getRegisteredToken(mint), - this.getRegisteredToken(NATIVE_MINT), - this.getRedeemerConfig(), - ]); - const swapRatePrecisionBN = new BN(swapRatePrecision); - const nativeSwapRate = this.calculateNativeSwapRate( - swapRatePrecisionBN, - solSwapRate, - swapRate, - ); - const swapAmountOut = - decimals > SOL_DECIMALS - ? swapRatePrecisionBN - .mul(new BN(toNativeAmount.toString())) - .div(nativeSwapRate.mul(TEN.pow(new BN(decimals - SOL_DECIMALS)))) - : swapRatePrecisionBN - .mul(new BN(toNativeAmount.toString())) - .mul(TEN.pow(new BN(SOL_DECIMALS - decimals))) - .div(nativeSwapRate); + const [{ swapRate }, { swapRate: solSwapRate }] = await Promise.all([ + this.getRegisteredToken(mint), + this.getRegisteredToken(NATIVE_MINT), + ]); + const nativeSwapRate = this.calculateNativeSwapRate(solSwapRate, swapRate); + const swapAmountOut = SWAP_RATE_PRECISION.mul( + new BN(toNativeAmount.toString()), + ).div(nativeSwapRate.mul(TEN.pow(new BN(decimals - SOL_DECIMALS)))); return BigInt(swapAmountOut.toString()); } @@ -158,17 +127,13 @@ export class SolanaRelayer { return null; } - private calculateNativeSwapRate( - swapRatePrecision: BN, - solSwapRate: BN, - swapRate: BN, - ): BN { - return swapRatePrecision.mul(solSwapRate).div(swapRate); + private calculateNativeSwapRate(solSwapRate: BN, swapRate: BN): BN { + return SWAP_RATE_PRECISION.mul(solSwapRate).div(swapRate); } - private async getRelayerFee(chain: ChainId): Promise { - return await this.program.account.relayerFee.fetch( - deriveRelayerFeeAddress(this.program.programId, chain), + private async getForeignContract(chain: ChainId): Promise { + return await this.program.account.foreignContract.fetch( + deriveForeignContractAddress(this.program.programId, chain), ); } diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/foreignContract.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/foreignContract.ts index 8bfd51828..34486f2dd 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/foreignContract.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/foreignContract.ts @@ -1,16 +1,18 @@ import { ChainId } from 'types'; import { deriveAddress } from '../../utils'; -import { PublicKeyInitData } from '@solana/web3.js'; +import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; +import { BN } from '@project-serum/anchor'; -export interface ForeignEmitter { - chain: ChainId; - address: Buffer; +export interface ForeignContract { + chain: number; + address: number[]; + fee: BN; } export function deriveForeignContractAddress( programId: PublicKeyInitData, chainId: ChainId, -) { +): PublicKey { const chainIdBuf = Buffer.alloc(2); chainIdBuf.writeUInt16LE(chainId); return deriveAddress( diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/index.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/index.ts index 46adadf7d..cf9cf0c68 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/index.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/index.ts @@ -1,7 +1,6 @@ export * from './foreignContract'; export * from './redeemerConfig'; export * from './registeredToken'; -export * from './relayerFee'; export * from './senderConfig'; export * from './tmpTokenAccount'; export * from './tokenTransferMessage'; diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/redeemerConfig.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/redeemerConfig.ts index 2374a9efd..3a99fcf6d 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/redeemerConfig.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/redeemerConfig.ts @@ -5,7 +5,6 @@ export interface RedeemerConfig { owner: PublicKey; bump: number; relayerFeePrecision: number; - swapRatePrecision: number; feeRecipient: PublicKey; } diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/registeredToken.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/registeredToken.ts index 523518c2f..848e6c9e9 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/registeredToken.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/registeredToken.ts @@ -5,7 +5,6 @@ import { deriveAddress } from '../../utils'; export interface RegisteredToken { swapRate: BN; maxNativeSwapAmount: BN; - isRegistered: boolean; } export function deriveRegisteredTokenAddress( diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/relayerFee.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/relayerFee.ts deleted file mode 100644 index 1b54cc6aa..000000000 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/relayerFee.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ChainId } from 'types'; -import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; -import { BN } from '@project-serum/anchor'; -import { deriveAddress } from '../../utils'; - -export interface RelayerFee { - chain: number; - fee: BN; -} - -export function deriveRelayerFeeAddress( - programId: PublicKeyInitData, - chainId: ChainId, -): PublicKey { - const chainIdBuf = Buffer.alloc(2); - chainIdBuf.writeUInt16LE(chainId); - return deriveAddress([Buffer.from('relayer_fee'), chainIdBuf], programId); -} diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/senderConfig.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/senderConfig.ts index 37109d951..4df63673c 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/senderConfig.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/senderConfig.ts @@ -5,12 +5,12 @@ export interface SenderConfig { owner: PublicKey; bump: number; tokenBridge: any; - finality: number; relayerFeePrecision: number; - swapRatePrecision: number; paused: boolean; } -export function deriveSenderConfigAddress(programId: PublicKeyInitData): PublicKey { +export function deriveSenderConfigAddress( + programId: PublicKeyInitData, +): PublicKey { return deriveAddress([Buffer.from('sender')], programId); } diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/signerSequence.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/signerSequence.ts new file mode 100644 index 000000000..1a091a78c --- /dev/null +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/signerSequence.ts @@ -0,0 +1,17 @@ +import { deriveAddress } from '../../utils'; +import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; +import { BN } from '@project-serum/anchor'; + +export interface SignerSequence { + value: BN; +} + +export function deriveSignerSequenceAddress( + programId: PublicKeyInitData, + payerKey: PublicKeyInitData, +): PublicKey { + return deriveAddress( + [Buffer.from('seq'), new PublicKey(payerKey).toBuffer()], + programId, + ); +} diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/tokenTransferMessage.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/tokenTransferMessage.ts index 35e8ed08a..00ac40c01 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/tokenTransferMessage.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/accounts/tokenTransferMessage.ts @@ -1,11 +1,16 @@ import { deriveAddress } from '../../utils'; import { PublicKey, PublicKeyInitData } from '@solana/web3.js'; +import { BN } from '@project-serum/anchor'; export function deriveTokenTransferMessageAddress( programId: PublicKeyInitData, - sequence: bigint, + payer: PublicKeyInitData, + sequence: BN, ): PublicKey { const sequenceBuf = Buffer.alloc(8); - sequenceBuf.writeBigUInt64LE(sequence); - return deriveAddress([Buffer.from('bridged'), sequenceBuf], programId); + sequenceBuf.writeBigUInt64LE(BigInt(sequence.toString())); + return deriveAddress( + [Buffer.from('bridged'), new PublicKey(payer).toBuffer(), sequenceBuf], + programId, + ); } diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferNativeTokensWithRelay.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferNativeTokensWithRelay.ts index a41fe08f9..90d60c813 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferNativeTokensWithRelay.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferNativeTokensWithRelay.ts @@ -11,13 +11,12 @@ import { deriveSenderConfigAddress, deriveTokenTransferMessageAddress, deriveRegisteredTokenAddress, - deriveRelayerFeeAddress, deriveTmpTokenAccountAddress, } from '../accounts'; -import { getProgramSequenceTracker } from '../../wormhole'; import { getAssociatedTokenAddressSync } from '@solana/spl-token'; import { BN } from '@project-serum/anchor'; import { ChainId } from 'types'; +import { deriveSignerSequenceAddress } from '../accounts/signerSequence'; export async function createTransferNativeTokensWithRelayInstruction( connection: Connection, @@ -35,13 +34,20 @@ export async function createTransferNativeTokensWithRelayInstruction( ): Promise { const { methods: { transferNativeTokensWithRelay }, + account: { signerSequence }, } = createTokenBridgeRelayerProgramInterface(programId, connection); - const { sequence } = await getProgramSequenceTracker( - connection, - tokenBridgeProgramId, - wormholeProgramId, - ); - const message = deriveTokenTransferMessageAddress(programId, sequence); + const signerSequenceAddress = deriveSignerSequenceAddress(programId, payer); + const sequence = await signerSequence + .fetch(signerSequenceAddress) + .then(({ value }) => value) + .catch((e) => { + if (e.message?.includes('Account does not exist')) { + // first time transferring + return new BN(0); + } + throw e; + }); + const message = deriveTokenTransferMessageAddress(programId, payer, sequence); const fromTokenAccount = getAssociatedTokenAddressSync( new PublicKey(mint), new PublicKey(payer), @@ -66,9 +72,9 @@ export async function createTransferNativeTokensWithRelayInstruction( ) .accounts({ config: deriveSenderConfigAddress(programId), + payerSequence: signerSequenceAddress, foreignContract: deriveForeignContractAddress(programId, recipientChain), registeredToken: deriveRegisteredTokenAddress(programId, mint), - relayerFee: deriveRelayerFeeAddress(programId, recipientChain), tmpTokenAccount, tokenBridgeProgram: new PublicKey(tokenBridgeProgramId), ...tokenBridgeAccounts, diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferWrappedTokensWithRelay.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferWrappedTokensWithRelay.ts index eef894648..dfa23109c 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferWrappedTokensWithRelay.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/instructions/transferWrappedTokensWithRelay.ts @@ -12,13 +12,12 @@ import { deriveTokenTransferMessageAddress, deriveTmpTokenAccountAddress, deriveRegisteredTokenAddress, - deriveRelayerFeeAddress, } from '../accounts'; -import { getProgramSequenceTracker } from '../../wormhole'; import { getAssociatedTokenAddressSync } from '@solana/spl-token'; import { getWrappedMeta } from '../../tokenBridge'; import { BN } from '@project-serum/anchor'; import { ChainId } from 'types'; +import { deriveSignerSequenceAddress } from '../accounts/signerSequence'; export async function createTransferWrappedTokensWithRelayInstruction( connection: Connection, @@ -35,13 +34,21 @@ export async function createTransferWrappedTokensWithRelayInstruction( ): Promise { const { methods: { transferWrappedTokensWithRelay }, + account: { signerSequence }, } = createTokenBridgeRelayerProgramInterface(programId, connection); - const { sequence } = await getProgramSequenceTracker( - connection, - tokenBridgeProgramId, - wormholeProgramId, - ); - const message = deriveTokenTransferMessageAddress(programId, sequence); + const signerSequenceAddress = deriveSignerSequenceAddress(programId, payer); + const sequence = await signerSequence + .fetch(signerSequenceAddress) + .then(({ value }) => value) + .catch((e) => { + if (e.message?.includes('Account does not exist')) { + // first time transferring + return new BN(0); + } + throw e; + }); + + const message = deriveTokenTransferMessageAddress(programId, payer, sequence); const fromTokenAccount = getAssociatedTokenAddressSync( new PublicKey(mint), new PublicKey(payer), @@ -72,12 +79,12 @@ export async function createTransferWrappedTokensWithRelayInstruction( ) .accounts({ config: deriveSenderConfigAddress(programId), + payerSequence: signerSequenceAddress, foreignContract: deriveForeignContractAddress(programId, recipientChain), registeredToken: deriveRegisteredTokenAddress( programId, new PublicKey(mint), ), - relayerFee: deriveRelayerFeeAddress(programId, recipientChain), tmpTokenAccount, tokenBridgeProgram: new PublicKey(tokenBridgeProgramId), ...tokenBridgeAccounts, diff --git a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/program.ts b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/program.ts index c14a471ab..bbc946024 100644 --- a/sdk/src/contexts/solana/utils/tokenBridgeRelayer/program.ts +++ b/sdk/src/contexts/solana/utils/tokenBridgeRelayer/program.ts @@ -6,10 +6,5 @@ export function createTokenBridgeRelayerProgramInterface( programId: PublicKeyInitData, connection: Connection, ): Program { - return new Program( - IDL, - new PublicKey(programId), - { connection }, - // TODO: pass coder? - ); + return new Program(IDL, new PublicKey(programId), { connection }); } diff --git a/sdk/src/contexts/solana/utils/types/tokenBridgeRelayer.ts b/sdk/src/contexts/solana/utils/types/tokenBridgeRelayer.ts index b8c2ad27a..8d6493e78 100644 --- a/sdk/src/contexts/solana/utils/types/tokenBridgeRelayer.ts +++ b/sdk/src/contexts/solana/utils/types/tokenBridgeRelayer.ts @@ -1,4271 +1,3965 @@ export type TokenBridgeRelayer = { - "version": "0.1.0", - "name": "token_bridge_relayer", - "constants": [ + version: '0.1.0'; + name: 'token_bridge_relayer'; + constants: [ { - "name": "SEED_PREFIX_BRIDGED", - "type": "bytes", - "value": "[98, 114, 105, 100, 103, 101, 100]" + name: 'SEED_PREFIX_BRIDGED'; + type: 'bytes'; + value: '[98, 114, 105, 100, 103, 101, 100]'; }, { - "name": "SEED_PREFIX_TMP", - "type": "bytes", - "value": "[116, 109, 112]" - } - ], - "instructions": [ + name: 'SEED_PREFIX_TMP'; + type: 'bytes'; + value: '[116, 109, 112]'; + }, + { + name: 'SWAP_RATE_PRECISION'; + type: 'u32'; + value: '100_000_000'; + }, + ]; + instructions: [ { - "name": "initialize", - "docs": [ + name: 'initialize'; + docs: [ "This instruction is be used to generate your program's config.", - "And for convenience, we will store Wormhole-related PDAs in the", - "config so we can verify these accounts with a simple == constraint.", - "# Arguments", - "", - "* `ctx` - `Initialize` context", - "* `fee_recipient` - Recipient of all relayer fees and swap proceeds", - "* `assistant` - Priviledged key to manage certain accounts" - ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Whoever initializes the config will be the owner of the program. Signer", - "for creating the [`SenderConfig`], [`RedeemerConfig`] and [`OwnerConfig`]", - "accounts." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account, which saves program data useful for other", - "instructions, specifically for outbound transfers. Also saves the payer", + 'And for convenience, we will store Wormhole-related PDAs in the', + 'config so we can verify these accounts with a simple == constraint.', + '# Arguments', + '', + '* `ctx` - `Initialize` context', + '* `fee_recipient` - Recipient of all relayer fees and swap proceeds', + '* `assistant` - Privileged key to manage certain accounts', + ]; + accounts: [ + { + name: 'owner'; + isMut: true; + isSigner: true; + docs: ['Deployer of the program.']; + }, + { + name: 'senderConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Sender Config account, which saves program data useful for other', + 'instructions, specifically for outbound transfers. Also saves the payer', "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] + 'owner.', + ]; }, { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account, which saves program data useful for other", - "instructions, specifically for inbound transfers. Also saves the payer", + name: 'redeemerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Redeemer Config account, which saves program data useful for other', + 'instructions, specifically for inbound transfers. Also saves the payer', "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] + 'owner.', + ]; }, { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner config account, which saves the owner, assistant and", - "pending owner keys. This account is used to manage the ownership of the", - "program." - ] + name: 'ownerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Owner config account, which saves the owner, assistant and', + 'pending owner keys. This account is used to manage the ownership of the', + 'program.', + ]; }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false, - "docs": [ - "that holds data; it is purely just a signer for posting Wormhole", - "messages on behalf of the Token Bridge program." - ] + name: 'tokenBridgeEmitter'; + isMut: false; + isSigner: false; + docs: [ + 'that holds data; it is purely just a signer for posting Wormhole', + 'messages on behalf of the Token Bridge program.', + ]; }, { - "name": "tokenBridgeSequence", - "isMut": false, - "isSigner": false, - "docs": [ + name: 'tokenBridgeSequence'; + isMut: false; + isSigner: false; + docs: [ "Token Bridge emitter's sequence account. Like with all Wormhole", - "emitters, this account keeps track of the sequence number of the last", - "posted message." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - }, - { - "name": "programData", - "isMut": true, - "isSigner": false, - "docs": [ - "upgrade authority. We check this PDA address just in case there is another program that this", - "deployer has deployed.", - "", - "NOTE: Set upgrade authority is scary because any public key can be used to set as the", - "authority." - ] - }, - { - "name": "bpfLoaderUpgradeableProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "feeRecipient", - "type": "publicKey" - }, - { - "name": "assistant", - "type": "publicKey" - } - ] - }, - { - "name": "registerForeignContract", - "docs": [ - "This instruction registers a new foreign contract (from another", - "network) and saves the emitter information in a ForeignEmitter account.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can add and update foreign", - "contracts.", - "", - "# Arguments", - "", - "* `ctx` - `RegisterForeignContract` context", - "* `chain` - Wormhole Chain ID", - "* `address` - Wormhole Emitter Address" - ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "foreignContract", - "isMut": true, - "isSigner": false, - "docs": [ - "Foreign Contract account. Create this account if an emitter has not been", - "registered yet for this Wormhole chain ID. If there already is a", - "contract address saved in this account, overwrite it." - ] - }, - { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "Token Bridge foreign endpoint. This account should really be one", + 'emitters, this account keeps track of the sequence number of the last', + 'posted message.', + ]; + }, + { + name: 'systemProgram'; + isMut: false; + isSigner: false; + docs: ['System program.']; + }, + { + name: 'programData'; + isMut: true; + isSigner: false; + docs: [ + 'upgrade authority. We check this PDA address just in case there is another program that this', + 'deployer has deployed.', + '', + 'NOTE: Set upgrade authority is scary because any public key can be used to set as the', + 'authority.', + ]; + }, + { + name: 'bpfLoaderUpgradeableProgram'; + isMut: false; + isSigner: false; + }, + ]; + args: [ + { + name: 'feeRecipient'; + type: 'publicKey'; + }, + { + name: 'assistant'; + type: 'publicKey'; + }, + ]; + }, + { + name: 'registerForeignContract'; + docs: [ + 'This instruction registers a new foreign contract (from another', + 'network) and saves the emitter information in a ForeignEmitter account.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can add and update foreign', + 'contracts.', + '', + '# Arguments', + '', + '* `ctx` - `RegisterForeignContract` context', + '* `chain` - Wormhole Chain ID', + '* `address` - Wormhole Emitter Address', + '* `relayer_fee` - Relayer fee scaled by the `relayer_fee_precision`', + ]; + accounts: [ + { + name: 'owner'; + isMut: true; + isSigner: true; + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ]; + }, + { + name: 'foreignContract'; + isMut: true; + isSigner: false; + docs: [ + 'Foreign Contract account. Create this account if an emitter has not been', + 'registered yet for this Wormhole chain ID. If there already is a', + 'contract address saved in this account, overwrite it.', + ]; + }, + { + name: 'tokenBridgeForeignEndpoint'; + isMut: false; + isSigner: false; + docs: [ + 'Token Bridge foreign endpoint. This account should really be one', "endpoint per chain, but Token Bridge's PDA allows for multiple", - "endpoints for each chain. We store the proper endpoint for the", - "emitter chain." - ] - }, - { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "Token Bridge program." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } - ], - "args": [ - { - "name": "chain", - "type": "u16" - }, - { - "name": "address", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - }, - { - "name": "registerToken", - "docs": [ - "This instruction registers a new token and saves the initial `swap_rate`", - "and `max_native_token_amount` in a RegisteredToken account.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `RegisterToken` context", - "* `swap_rate`:", - "- USD converion rate scaled by the `swap_rate_precision`. For example,", - "- if the conversion rate is $15 and the `swap_rate_precision` is", - "- 1000000, the `swap_rate` should be set to 15000000.", - "* `max_native_swap_amount`:", - "- Maximum amount of native tokens that can be swapped for this token", - "- on this chain." - ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. Create this", - "account if the mint has not been registered yet. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } - ], - "args": [ + 'endpoints for each chain. We store the proper endpoint for the', + 'emitter chain.', + ]; + }, { - "name": "swapRate", - "type": "u64" + name: 'tokenBridgeProgram'; + isMut: false; + isSigner: false; + docs: ['Token Bridge program.']; }, { - "name": "maxNativeSwapAmount", - "type": "u64" - } - ] - }, - { - "name": "deregisterToken", - "docs": [ - "This instruction deregisters a token by setting the `is_registered`", - "field in the `RegisteredToken` account to `false`. It also sets the", - "`swap_rate` and `max_native_swap_amount` to zero. This instruction", - "is owner-only, meaning that only the owner of the program (defined", - "in the [Config] account) can register a token." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. This account", - "also determines if a mint is registered or not." - ] - } - ], - "args": [] - }, - { - "name": "updateRelayerFee", - "docs": [ - "This instruction updates the `relayer_fee` in the `RelayerFee` account.", - "The `relayer_fee` is scaled by the `relayer_fee_precision`. For example,", - "if the `relayer_fee` is $15 and the `relayer_fee_precision` is 1000000,", - "the `relayer_fee` should be set to 15000000. This instruction can", - "only be called by the owner or assistant, which are defined in the", - "[OwnerConfig] account.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateRelayerFee` context", - "* `chain` - Wormhole Chain ID", - "* `fee` - Relayer fee scaled by the `relayer_fee_precision`" - ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Signer of the transaction. Must be the owner or assistant." - ] - }, - { - "name": "ownerConfig", - "isMut": false, - "isSigner": false, - "docs": [ - "The owner_config is used when updating the swap rate", - "so that the assistant key can be used in addition to the", - "owner key." - ] - }, - { - "name": "relayerFee", - "isMut": true, - "isSigner": false, - "docs": [ - "Relayer Fee account. This account holds the USD denominated relayer fee", - "for the specified `chain`. This account is used to determine the cost of", - "relaying a transfer to a target chain. If there already is a relayer", - "fee saved in this account, overwrite it." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Pass this account to verify that the specified Chain ID has a", - "corresponding registered foreign contract." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } - ], - "args": [ - { - "name": "chain", - "type": "u16" - }, - { - "name": "fee", - "type": "u64" - } - ] - }, - { - "name": "updateRelayerFeePrecision", - "docs": [ - "This instruction updates the `relayer_fee_precision` in the", - "`SenderConfig` and `RedeemerConfig` accounts. The `relayer_fee_precision`", - "is used to scale the `relayer_fee`. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdatePrecision` context", - "* `relayer_fee_precision` - Precision used to scale the relayer fee." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable. The `owner` check is redundant here, but we keep it as an", - "extra protection for future changes to the context. Mutable." - ] - } - ], - "args": [ - { - "name": "relayerFeePrecision", - "type": "u32" - } - ] - }, - { - "name": "updateSwapRate", - "docs": [ - "This instruction updates the `swap_rate` in the `RegisteredToken`", - "account. This instruction can only be called by the owner or", - "assistant, which are defined in the [OwnerConfig] account.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateSwapRate` context", - "* `swap_rate` - USD conversion rate for the specified token." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "The signer of the transaction. Must be the owner or assistant." - ] - }, - { - "name": "ownerConfig", - "isMut": false, - "isSigner": false, - "docs": [ - "The owner_config is used when updating the swap rate so that the", - "assistant key can be used in additional to the owner key." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. The program", - "will modify this account to update the swap rate. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - } - ], - "args": [ - { - "name": "swapRate", - "type": "u64" - } - ] - }, - { - "name": "updateSwapRatePrecision", - "docs": [ - "This instruction updates the `swap_rate_precision` in the", - "`SenderConfig` and `RedeemerConfig` accounts. The `swap_rate_precision`", - "is used to scale the `swap_rate`. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdatePrecision` context", - "* `swap_rate_precision` - Precision used to scale the `swap_rate`." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable. The `owner` check is redundant here, but we keep it as an", - "extra protection for future changes to the context. Mutable." - ] - } - ], - "args": [ - { - "name": "swapRatePrecision", - "type": "u32" - } - ] - }, - { - "name": "updateMaxNativeSwapAmount", - "docs": [ - "This instruction updates the `max_native_swap_amount` in the", - "`RegisteredToken` account. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateMaxNativeSwapAmount` context", - "* `max_native_swap_amount`:", - "- Maximum amount of native tokens that can be swapped for this token", - "- on this chain." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. The program", - "will modify this account when the swap rate or max native swap amount", - "changes. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - } - ], - "args": [ - { - "name": "maxNativeSwapAmount", - "type": "u64" - } - ] - }, - { - "name": "setPauseForTransfers", - "docs": [ - "This instruction updates the `paused` boolean in the `SenderConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can pause outbound", - "transfers.", - "", - "# Arguments", - "", - "* `ctx` - `PauseOutboundTransfers` context", - "* `paused` - Boolean indicating whether outbound transfers are paused." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account." - ] - }, - { - "name": "config", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } - ], - "args": [ - { - "name": "paused", - "type": "bool" - } - ] - }, - { - "name": "submitOwnershipTransferRequest", - "docs": [ - "This instruction sets the `pending_owner` field in the `OwnerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can submit an", - "ownership transfer request.", - "", - "# Arguments", - "", - "* `ctx` - `ManageOwnership` context", - "* `new_owner` - Pubkey of the pending owner." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } - ], - "args": [ + name: 'systemProgram'; + isMut: false; + isSigner: false; + docs: ['System program.']; + }, + ]; + args: [ { - "name": "newOwner", - "type": "publicKey" - } - ] - }, - { - "name": "confirmOwnershipTransferRequest", - "docs": [ - "This instruction confirms that the `pending_owner` is the signer of", - "the transaction and updates the `owner` field in the `SenderConfig`,", - "`RedeemerConfig`, and `OwnerConfig` accounts." - ], - "accounts": [ - { - "name": "pendingOwner", - "isMut": false, - "isSigner": true, - "docs": [ - "Must be the pending owner of the program set in the [`OwnerConfig`]", - "account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `pending_owner`", - "specified in the context equals the pubkey specified in this account." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This instruction will update the `owner`", - "specified in this account to the `pending_owner` specified in the", - "[`OwnerConfig`] account. Mutable." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This instruction will update the `owner`", - "specified in this account to the `pending_owner` specified in the", - "[`OwnerConfig`] account. Mutable." - ] - } - ], - "args": [] + name: 'chain'; + type: 'u16'; + }, + { + name: 'address'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'relayerFee'; + type: 'u64'; + }, + ]; }, { - "name": "cancelOwnershipTransferRequest", - "docs": [ - "This instruction cancels the ownership transfer request by setting", - "the `pending_owner` field in the `OwnerConfig` account to `None`.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can cancel an ownership", - "transfer request." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } - ], - "args": [] - }, - { - "name": "updateAssistant", - "docs": [ - "This instruction updates the `assistant` field in the `OwnerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can update the", - "assistant.", - "", - "# Arguments", - "", - "* `ctx` - `ManageOwnership` context", - "* `new_assistant` - Pubkey of the new assistant." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } - ], - "args": [ - { - "name": "newAssistant", - "type": "publicKey" - } - ] - }, - { - "name": "updateFeeRecipient", - "docs": [ - "This instruction updates the `fee_recipient` field in the `RedeemerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can update the", - "fee recipient.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateFeeRecipient` context", - "* `new_fee_recipient` - Pubkey of the new fee recipient." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account, which saves program data useful for other", - "instructions, specifically for inbound transfers. Also saves the payer", - "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] - } - ], - "args": [ - { - "name": "newFeeRecipient", - "type": "publicKey" - } - ] - }, - { - "name": "transferNativeTokensWithRelay", - "docs": [ - "This instruction is used to transfer native tokens from Solana to a", - "foreign blockchain. The user can optionally specify a", - "`to_native_token_amount` to swap some of the tokens for the native", - "asset on the target chain. For a fee, an off-chain relayer will redeem", - "the transfer on the target chain. If the user is transferring native", - "SOL, the contract will autormatically wrap the lamports into a WSOL.", - "", - "# Arguments", - "", - "* `ctx` - `TransferNativeWithRelay` context", - "* `amount` - Amount of tokens to send", - "* `to_native_token_amount`:", - "- Amount of tokens to swap for native assets on the target chain", - "* `recipient_chain` - Chain ID of the target chain", - "* `recipient_address` - Address of the target wallet on the target chain", - "* `batch_id` - Nonce of Wormhole message", - "* `wrap_native` - Whether to wrap native SOL" - ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. Acts as the signer for the Token Bridge token", - "transfer. Read-only." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. Send tokens to the contract specified in this", - "account. Funnily enough, the Token Bridge program does not have any", - "requirements for outbound transfers for the recipient chain to be", - "registered. This account provides extra protection against sending", - "tokens to an unregistered Wormhole chain ID. Read-only." - ] - }, - { - "name": "mint", - "isMut": true, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract. Mutable." - ] - }, - { - "name": "fromTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Payer's associated token account. We may want to make this a generic", - "token account in the future." - ] + name: 'registerToken'; + docs: [ + 'This instruction registers a new token and saves the initial `swap_rate`', + 'and `max_native_token_amount` in a RegisteredToken account.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `RegisterToken` context', + '* `swap_rate`:', + '- USD conversion rate scaled by the `swap_rate_precision`. For example,', + '- if the conversion rate is $15 and the `swap_rate_precision` is', + '- 1000000, the `swap_rate` should be set to 15000000.', + '* `max_native_swap_amount`:', + '- Maximum amount of native tokens that can be swapped for this token', + '- on this chain.', + ]; + accounts: [ + { + name: 'owner'; + isMut: true; + isSigner: true; + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ]; }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ]; + }, + { + name: 'registeredToken'; + isMut: true; + isSigner: false; + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. Create this', + 'account if the mint has not been registered yet. Mutable.', + ]; + }, + { + name: 'mint'; + isMut: false; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ]; + }, + { + name: 'tokenProgram'; + isMut: false; + isSigner: false; + }, + { + name: 'systemProgram'; + isMut: false; + isSigner: false; + docs: ['System program.']; + }, + ]; + args: [ + { + name: 'swapRate'; + type: 'u64'; + }, + { + name: 'maxNativeSwapAmount'; + type: 'u64'; + }, + ]; + }, + { + name: 'deregisterToken'; + docs: [ + 'This instruction deregisters a token by closing the existing', + '`RegisteredToken` account for a particular mint. This instruction is', + 'owner-only, meaning that only the owner of the program (defined in the', + '[Config] account) can deregister a token.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'closing [`RegisteredToken`] account.', + ]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ]; + }, + { + name: 'mint'; + isMut: false; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ]; + }, + { + name: 'registeredToken'; + isMut: true; + isSigner: false; + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. This account', + 'also determines if a mint is registered or not.', + ]; + }, + ]; + args: []; + }, + { + name: 'updateRelayerFee'; + docs: [ + 'This instruction updates the `relayer_fee` in the `ForeignContract` account.', + 'The `relayer_fee` is scaled by the `relayer_fee_precision`. For example,', + 'if the `relayer_fee` is $15 and the `relayer_fee_precision` is 1000000,', + 'the `relayer_fee` should be set to 15000000. This instruction can', + 'only be called by the owner or assistant, which are defined in the', + '[OwnerConfig] account.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateRelayerFee` context', + '* `chain` - Wormhole Chain ID', + '* `fee` - Relayer fee scaled by the `relayer_fee_precision`', + ]; + accounts: [ + { + name: 'payer'; + isMut: true; + isSigner: true; + docs: ['Signer of the transaction. Must be the owner or assistant.']; + }, + { + name: 'ownerConfig'; + isMut: false; + isSigner: false; + docs: [ + 'The owner_config is used when updating the swap rate', + 'so that the assistant key can be used in addition to the', + 'owner key.', + ]; + }, + { + name: 'foreignContract'; + isMut: true; + isSigner: false; + docs: [ + 'This account holds the USD denominated relayer fee for the specified', + '`chain`. This account is used to determine the cost of relaying', + 'a transfer to a target chain. If there already is a relayer fee', + 'saved in this account, overwrite it.', + ]; + }, + { + name: 'systemProgram'; + isMut: false; + isSigner: false; + docs: ['System program.']; + }, + ]; + args: [ + { + name: 'chain'; + type: 'u16'; + }, + { + name: 'fee'; + type: 'u64'; + }, + ]; + }, + { + name: 'updateRelayerFeePrecision'; + docs: [ + 'This instruction updates the `relayer_fee_precision` in the', + '`SenderConfig` and `RedeemerConfig` accounts. The `relayer_fee_precision`', + 'is used to scale the `relayer_fee`. This instruction is owner-only,', + 'meaning that only the owner of the program (defined in the [Config]', + 'account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `UpdatePrecision` context', + '* `relayer_fee_precision` - Precision used to scale the relayer fee.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: [ + 'Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account.', + ]; + }, + { + name: 'redeemerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Redeemer Config account. This program requires that the `owner`', + 'specified in the context equals the pubkey specified in this account.', + 'Mutable.', + ]; + }, + { + name: 'senderConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner`', + 'specified in the context equals the pubkey specified in this account.', + 'Mutable. The `owner` check is redundant here, but we keep it as an', + 'extra protection for future changes to the context. Mutable.', + ]; + }, + ]; + args: [ + { + name: 'relayerFeePrecision'; + type: 'u32'; + }, + ]; + }, + { + name: 'updateSwapRate'; + docs: [ + 'This instruction updates the `swap_rate` in the `RegisteredToken`', + 'account. This instruction can only be called by the owner or', + 'assistant, which are defined in the [OwnerConfig] account.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateSwapRate` context', + '* `swap_rate` - USD conversion rate for the specified token.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: [ + 'The signer of the transaction. Must be the owner or assistant.', + ]; + }, + { + name: 'ownerConfig'; + isMut: false; + isSigner: false; + docs: [ + 'The owner_config is used when updating the swap rate so that the', + 'assistant key can be used in additional to the owner key.', + ]; + }, + { + name: 'registeredToken'; + isMut: true; + isSigner: false; + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. The program', + 'will modify this account to update the swap rate. Mutable.', + ]; + }, + { + name: 'mint'; + isMut: false; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ]; + }, + ]; + args: [ + { + name: 'swapRate'; + type: 'u64'; + }, + ]; + }, + { + name: 'updateMaxNativeSwapAmount'; + docs: [ + 'This instruction updates the `max_native_swap_amount` in the', + '`RegisteredToken` account. This instruction is owner-only,', + 'meaning that only the owner of the program (defined in the [Config]', + 'account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateMaxNativeSwapAmount` context', + '* `max_native_swap_amount`:', + '- Maximum amount of native tokens that can be swapped for this token', + '- on this chain.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ]; + }, + { + name: 'registeredToken'; + isMut: true; + isSigner: false; + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. The program', + 'will modify this account when the swap rate or max native swap amount', + 'changes. Mutable.', + ]; + }, + { + name: 'mint'; + isMut: false; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ]; + }, + ]; + args: [ + { + name: 'maxNativeSwapAmount'; + type: 'u64'; + }, + ]; + }, + { + name: 'setPauseForTransfers'; + docs: [ + 'This instruction updates the `paused` boolean in the `SenderConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can pause outbound', + 'transfers.', + '', + '# Arguments', + '', + '* `ctx` - `PauseOutboundTransfers` context', + '* `paused` - Boolean indicating whether outbound transfers are paused.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: ['Owner of the program set in the [`SenderConfig`] account.']; + }, + { + name: 'config'; + isMut: true; + isSigner: false; + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ]; + }, + ]; + args: [ + { + name: 'paused'; + type: 'bool'; + }, + ]; + }, + { + name: 'submitOwnershipTransferRequest'; + docs: [ + 'This instruction sets the `pending_owner` field in the `OwnerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can submit an', + 'ownership transfer request.', + '', + '# Arguments', + '', + '* `ctx` - `ManageOwnership` context', + '* `new_owner` - Pubkey of the pending owner.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: ['Owner of the program set in the [`OwnerConfig`] account.']; + }, + { + name: 'ownerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ]; + }, + ]; + args: [ + { + name: 'newOwner'; + type: 'publicKey'; + }, + ]; + }, + { + name: 'confirmOwnershipTransferRequest'; + docs: [ + 'This instruction confirms that the `pending_owner` is the signer of', + 'the transaction and updates the `owner` field in the `SenderConfig`,', + '`RedeemerConfig`, and `OwnerConfig` accounts.', + ]; + accounts: [ + { + name: 'pendingOwner'; + isMut: false; + isSigner: true; + docs: [ + 'Must be the pending owner of the program set in the [`OwnerConfig`]', + 'account.', + ]; + }, + { + name: 'ownerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Owner Config account. This program requires that the `pending_owner`', + 'specified in the context equals the pubkey specified in this account.', + ]; + }, + { + name: 'senderConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Sender Config account. This instruction will update the `owner`', + 'specified in this account to the `pending_owner` specified in the', + '[`OwnerConfig`] account. Mutable.', + ]; + }, + { + name: 'redeemerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Redeemer Config account. This instruction will update the `owner`', + 'specified in this account to the `pending_owner` specified in the', + '[`OwnerConfig`] account. Mutable.', + ]; + }, + ]; + args: []; + }, + { + name: 'cancelOwnershipTransferRequest'; + docs: [ + 'This instruction cancels the ownership transfer request by setting', + 'the `pending_owner` field in the `OwnerConfig` account to `None`.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can cancel an ownership', + 'transfer request.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: ['Owner of the program set in the [`OwnerConfig`] account.']; + }, + { + name: 'ownerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ]; + }, + ]; + args: []; + }, + { + name: 'updateAssistant'; + docs: [ + 'This instruction updates the `assistant` field in the `OwnerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can update the', + 'assistant.', + '', + '# Arguments', + '', + '* `ctx` - `ManageOwnership` context', + '* `new_assistant` - Pubkey of the new assistant.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: ['Owner of the program set in the [`OwnerConfig`] account.']; + }, + { + name: 'ownerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ]; + }, + ]; + args: [ + { + name: 'newAssistant'; + type: 'publicKey'; + }, + ]; + }, + { + name: 'updateFeeRecipient'; + docs: [ + 'This instruction updates the `fee_recipient` field in the `RedeemerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can update the', + 'fee recipient.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateFeeRecipient` context', + '* `new_fee_recipient` - Pubkey of the new fee recipient.', + ]; + accounts: [ + { + name: 'owner'; + isMut: false; + isSigner: true; + docs: ['Owner of the program set in the [`RedeemerConfig`] account.']; + }, + { + name: 'redeemerConfig'; + isMut: true; + isSigner: false; + docs: [ + 'Redeemer Config account, which saves program data useful for other', + 'instructions, specifically for inbound transfers. Also saves the payer', + "of the [`initialize`](crate::initialize) instruction as the program's", + 'owner.', + ]; + }, + ]; + args: [ + { + name: 'newFeeRecipient'; + type: 'publicKey'; + }, + ]; + }, + { + name: 'transferNativeTokensWithRelay'; + docs: [ + 'This instruction is used to transfer native tokens from Solana to a', + 'foreign blockchain. The user can optionally specify a', + '`to_native_token_amount` to swap some of the tokens for the native', + 'asset on the target chain. For a fee, an off-chain relayer will redeem', + 'the transfer on the target chain. If the user is transferring native', + 'SOL, the contract will automatically wrap the lamports into a WSOL.', + '', + '# Arguments', + '', + '* `ctx` - `TransferNativeWithRelay` context', + '* `amount` - Amount of tokens to send', + '* `to_native_token_amount`:', + '- Amount of tokens to swap for native assets on the target chain', + '* `recipient_chain` - Chain ID of the target chain', + '* `recipient_address` - Address of the target wallet on the target chain', + '* `batch_id` - Nonce of Wormhole message', + '* `wrap_native` - Whether to wrap native SOL', + ]; + accounts: [ + { + name: 'payer'; + isMut: true; + isSigner: true; + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ]; + }, + { + name: 'payerSequence'; + isMut: true; + isSigner: false; + docs: ["Used to keep track of payer's Wormhole sequence number."]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. Acts as the signer for the Token Bridge token', + 'transfer. Read-only.', + ]; + }, + { + name: 'foreignContract'; + isMut: false; + isSigner: false; + docs: [ + 'Foreign Contract account. Send tokens to the contract specified in this', + 'account. Funnily enough, the Token Bridge program does not have any', + 'requirements for outbound transfers for the recipient chain to be', + 'registered. This account provides extra protection against sending', + 'tokens to an unregistered Wormhole chain ID. Read-only.', + ]; + }, + { + name: 'mint'; + isMut: true; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract. Mutable.', + ]; + }, + { + name: 'fromTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + "Payer's associated token account. We may want to make this a generic", + 'token account in the future.', + ]; }, { - "name": "relayerFee", - "isMut": false, - "isSigner": false + name: 'registeredToken'; + isMut: false; + isSigner: false; }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount'; + isMut: true; + isSigner: false; + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged out, the token account", - "will have zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged out, the token account', + 'will have zero balance and can be closed.', + ]; }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeCustody", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tokenBridgeCustody'; + isMut: true; + isSigner: false; + docs: [ "account that holds this mint's balance. This account needs to be", - "unchecked because a token account may not have been created for this", - "mint yet. Mutable." - ] + 'unchecked because a token account may not have been created for this', + 'mint yet. Mutable.', + ]; }, { - "name": "tokenBridgeAuthoritySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeAuthoritySigner'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeCustodySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeCustodySigner'; + isMut: false; + isSigner: false; }, { - "name": "wormholeBridge", - "isMut": true, - "isSigner": false + name: 'wormholeBridge'; + isMut: true; + isSigner: false; }, { - "name": "wormholeMessage", - "isMut": true, - "isSigner": false, - "docs": [ - "tokens transferred in this account for our program. Mutable." - ] + name: 'wormholeMessage'; + isMut: true; + isSigner: false; + docs: [ + 'tokens transferred in this account for our program. Mutable.', + ]; }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false + name: 'tokenBridgeEmitter'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeSequence", - "isMut": true, - "isSigner": false + name: 'tokenBridgeSequence'; + isMut: true; + isSigner: false; }, { - "name": "wormholeFeeCollector", - "isMut": true, - "isSigner": false + name: 'wormholeFeeCollector'; + isMut: true; + isSigner: false; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram'; + isMut: false; + isSigner: false; }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram'; + isMut: false; + isSigner: false; }, { - "name": "clock", - "isMut": false, - "isSigner": false + name: 'clock'; + isMut: false; + isSigner: false; }, { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ + name: 'rent'; + isMut: false; + isSigner: false; + }, + ]; + args: [ { - "name": "amount", - "type": "u64" + name: 'amount'; + type: 'u64'; }, { - "name": "toNativeTokenAmount", - "type": "u64" + name: 'toNativeTokenAmount'; + type: 'u64'; }, { - "name": "recipientChain", - "type": "u16" + name: 'recipientChain'; + type: 'u16'; }, { - "name": "recipientAddress", - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'recipientAddress'; + type: { + array: ['u8', 32]; + }; }, { - "name": "batchId", - "type": "u32" + name: 'batchId'; + type: 'u32'; }, { - "name": "wrapNative", - "type": "bool" - } - ] + name: 'wrapNative'; + type: 'bool'; + }, + ]; }, { - "name": "transferWrappedTokensWithRelay", - "docs": [ - "This instruction is used to transfer wrapped tokens from Solana to a", - "foreign blockchain. The user can optionally specify a", - "`to_native_token_amount` to swap some of the tokens for the native", - "assets on the target chain. For a fee, an off-chain relayer will redeem", - "the transfer on the target chain. This instruction should only be called", - "when the user is transferring a wrapped token.", - "", - "# Arguments", - "", - "* `ctx` - `TransferWrappedWithRelay` context", - "* `amount` - Amount of tokens to send", - "* `to_native_token_amount`:", - "- Amount of tokens to swap for native assets on the target chain", - "* `recipient_chain` - Chain ID of the target chain", - "* `recipient_address` - Address of the target wallet on the target chain", - "* `batch_id` - Nonce of Wormhole message" - ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. Acts as the Token Bridge sender PDA. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. Send tokens to the contract specified in this", - "account. Funnily enough, the Token Bridge program does not have any", - "requirements for outbound transfers for the recipient chain to be", - "registered. This account provides extra protection against sending", - "tokens to an unregistered Wormhole chain ID. Read-only." - ] - }, - { - "name": "tokenBridgeWrappedMint", - "isMut": true, - "isSigner": false, - "docs": [ - "Token Bridge wrapped mint info. This is the SPL token that will be", - "bridged to the foreign contract. The wrapped mint PDA must agree", - "with the native token's metadata. Mutable." - ] - }, - { - "name": "fromTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Payer's associated token account. We may want to make this a generic", - "token account in the future." - ] + name: 'transferWrappedTokensWithRelay'; + docs: [ + 'This instruction is used to transfer wrapped tokens from Solana to a', + 'foreign blockchain. The user can optionally specify a', + '`to_native_token_amount` to swap some of the tokens for the native', + 'assets on the target chain. For a fee, an off-chain relayer will redeem', + 'the transfer on the target chain. This instruction should only be called', + 'when the user is transferring a wrapped token.', + '', + '# Arguments', + '', + '* `ctx` - `TransferWrappedWithRelay` context', + '* `amount` - Amount of tokens to send', + '* `to_native_token_amount`:', + '- Amount of tokens to swap for native assets on the target chain', + '* `recipient_chain` - Chain ID of the target chain', + '* `recipient_address` - Address of the target wallet on the target chain', + '* `batch_id` - Nonce of Wormhole message', + ]; + accounts: [ + { + name: 'payer'; + isMut: true; + isSigner: true; + docs: ['Payer will pay Wormhole fee to transfer tokens.']; + }, + { + name: 'payerSequence'; + isMut: true; + isSigner: false; + docs: ["Used to keep track of payer's Wormhole sequence number."]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Sender Config account. Acts as the Token Bridge sender PDA. Mutable.', + ]; }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'foreignContract'; + isMut: false; + isSigner: false; + docs: [ + 'Foreign Contract account. Send tokens to the contract specified in this', + 'account. Funnily enough, the Token Bridge program does not have any', + 'requirements for outbound transfers for the recipient chain to be', + 'registered. This account provides extra protection against sending', + 'tokens to an unregistered Wormhole chain ID. Read-only.', + ]; }, { - "name": "relayerFee", - "isMut": false, - "isSigner": false + name: 'tokenBridgeWrappedMint'; + isMut: true; + isSigner: false; + docs: [ + 'Token Bridge wrapped mint info. This is the SPL token that will be', + 'bridged to the foreign contract. The wrapped mint PDA must agree', + "with the native token's metadata. Mutable.", + ]; }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'fromTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + "Payer's associated token account. We may want to make this a generic", + 'token account in the future.', + ]; + }, + { + name: 'registeredToken'; + isMut: false; + isSigner: false; + }, + { + name: 'tmpTokenAccount'; + isMut: true; + isSigner: false; + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged out, the token account", - "will have zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged out, the token account', + 'will have zero balance and can be closed.', + ]; }, { - "name": "tokenBridgeWrappedMeta", - "isMut": false, - "isSigner": false, - "docs": [ - "about the token from its native chain:", - "* Wormhole Chain ID", + name: 'tokenBridgeWrappedMeta'; + isMut: false; + isSigner: false; + docs: [ + 'about the token from its native chain:', + '* Wormhole Chain ID', "* Token's native contract address", - "* Token's native decimals" - ] + "* Token's native decimals", + ]; }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeAuthoritySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeAuthoritySigner'; + isMut: false; + isSigner: false; }, { - "name": "wormholeBridge", - "isMut": true, - "isSigner": false + name: 'wormholeBridge'; + isMut: true; + isSigner: false; }, { - "name": "wormholeMessage", - "isMut": true, - "isSigner": false, - "docs": [ - "tokens transferred in this account." - ] + name: 'wormholeMessage'; + isMut: true; + isSigner: false; + docs: ['tokens transferred in this account.']; }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false + name: 'tokenBridgeEmitter'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeSequence", - "isMut": true, - "isSigner": false + name: 'tokenBridgeSequence'; + isMut: true; + isSigner: false; }, { - "name": "wormholeFeeCollector", - "isMut": true, - "isSigner": false + name: 'wormholeFeeCollector'; + isMut: true; + isSigner: false; }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram'; + isMut: false; + isSigner: false; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram'; + isMut: false; + isSigner: false; }, { - "name": "clock", - "isMut": false, - "isSigner": false + name: 'clock'; + isMut: false; + isSigner: false; }, { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ + name: 'rent'; + isMut: false; + isSigner: false; + }, + ]; + args: [ { - "name": "amount", - "type": "u64" + name: 'amount'; + type: 'u64'; }, { - "name": "toNativeTokenAmount", - "type": "u64" + name: 'toNativeTokenAmount'; + type: 'u64'; }, { - "name": "recipientChain", - "type": "u16" + name: 'recipientChain'; + type: 'u16'; }, { - "name": "recipientAddress", - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'recipientAddress'; + type: { + array: ['u8', 32]; + }; }, { - "name": "batchId", - "type": "u32" - } - ] + name: 'batchId'; + type: 'u32'; + }, + ]; }, { - "name": "completeNativeTransferWithRelay", - "docs": [ - "This instruction is used to redeem token transfers from foreign emitters.", - "It takes custody of the released native tokens and sends the tokens to the", - "encoded `recipient`. It pays the `fee_recipient` in the token", - "denomination. If requested by the user, it will perform a swap with the", - "off-chain relayer to provide the user with lamports. If the token", - "being transferred is WSOL, the contract will unwrap the WSOL and send", - "the lamports to the recipient and pay the relayer in lamports.", - "", - "# Arguments", - "", - "* `ctx` - `CompleteNativeWithRelay` context", - "* `vaa_hash` - Hash of the VAA that triggered the transfer" - ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Redeemer Config account. Acts as the Token Bridge redeemer, which signs", - "for the complete transfer instruction. Read-only." - ] - }, - { - "name": "feeRecipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Fee recipient's token account. Must be an associated token account. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. The registered contract specified in this", + name: 'completeNativeTransferWithRelay'; + docs: [ + 'This instruction is used to redeem token transfers from foreign emitters.', + 'It takes custody of the released native tokens and sends the tokens to the', + 'encoded `recipient`. It pays the `fee_recipient` in the token', + 'denomination. If requested by the user, it will perform a swap with the', + 'off-chain relayer to provide the user with lamports. If the token', + 'being transferred is WSOL, the contract will unwrap the WSOL and send', + 'the lamports to the recipient and pay the relayer in lamports.', + '', + '# Arguments', + '', + '* `ctx` - `CompleteNativeWithRelay` context', + '* `vaa_hash` - Hash of the VAA that triggered the transfer', + ]; + accounts: [ + { + name: 'payer'; + isMut: true; + isSigner: true; + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Redeemer Config account. Acts as the Token Bridge redeemer, which signs', + 'for the complete transfer instruction. Read-only.', + ]; + }, + { + name: 'feeRecipientTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + "Fee recipient's token account. Must be an associated token account. Mutable.", + ]; + }, + { + name: 'foreignContract'; + isMut: false; + isSigner: false; + docs: [ + 'Foreign Contract account. The registered contract specified in this', "account must agree with the target address for the Token Bridge's token", - "transfer. Read-only." - ] + 'transfer. Read-only.', + ]; }, { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over from the", - "foreign contract. This must match the token address specified in the", - "signed Wormhole message. Read-only." - ] + name: 'mint'; + isMut: false; + isSigner: false; + docs: [ + 'Mint info. This is the SPL token that will be bridged over from the', + 'foreign contract. This must match the token address specified in the', + 'signed Wormhole message. Read-only.', + ]; }, { - "name": "recipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Recipient associated token account. The recipient authority check", - "is necessary to ensure that the recipient is the intended recipient", - "of the bridged tokens. Mutable." - ] + name: 'recipientTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + 'Recipient associated token account. The recipient authority check', + 'is necessary to ensure that the recipient is the intended recipient', + 'of the bridged tokens. Mutable.', + ]; }, { - "name": "recipient", - "isMut": true, - "isSigner": false, - "docs": [ - "transaction. This instruction verifies that the recipient key", - "passed in this context matches the intended recipient in the vaa." - ] + name: 'recipient'; + isMut: true; + isSigner: false; + docs: [ + 'transaction. This instruction verifies that the recipient key', + 'passed in this context matches the intended recipient in the vaa.', + ]; }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'registeredToken'; + isMut: false; + isSigner: false; }, { - "name": "nativeRegisteredToken", - "isMut": false, - "isSigner": false + name: 'nativeRegisteredToken'; + isMut: false; + isSigner: false; }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount'; + isMut: true; + isSigner: false; + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged in, the tokens will be", - "transferred to the destination token accounts. This account will have", - "zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged in, the tokens will be', + 'transferred to the destination token accounts. This account will have', + 'zero balance and can be closed.', + ]; }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig'; + isMut: false; + isSigner: false; }, { - "name": "vaa", - "isMut": false, - "isSigner": false, - "docs": [ - "Verified Wormhole message account. The Wormhole program verified", - "signatures and posted the account data here. Read-only." - ] + name: 'vaa'; + isMut: false; + isSigner: false; + docs: [ + 'Verified Wormhole message account. The Wormhole program verified', + 'signatures and posted the account data here. Read-only.', + ]; }, { - "name": "tokenBridgeClaim", - "isMut": true, - "isSigner": false, - "docs": [ - "is true if the bridged assets have been claimed. If the transfer has", - "not been redeemed, this account will not exist yet.", - "", + name: 'tokenBridgeClaim'; + isMut: true; + isSigner: false; + docs: [ + 'is true if the bridged assets have been claimed. If the transfer has', + 'not been redeemed, this account will not exist yet.', + '', "NOTE: The Token Bridge program's claim account is only initialized when", - "a transfer is redeemed (and the boolean value `true` is written as", - "its data).", - "", - "The Token Bridge program will automatically fail if this transfer", - "is redeemed again. But we choose to short-circuit the failure as the", - "first evaluation of this instruction." - ] + 'a transfer is redeemed (and the boolean value `true` is written as', + 'its data).', + '', + 'The Token Bridge program will automatically fail if this transfer', + 'is redeemed again. But we choose to short-circuit the failure as the', + 'first evaluation of this instruction.', + ]; }, { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "endpoint per chain, but the PDA allows for multiple endpoints for each", - "chain! We store the proper endpoint for the emitter chain." - ] + name: 'tokenBridgeForeignEndpoint'; + isMut: false; + isSigner: false; + docs: [ + 'endpoint per chain, but the PDA allows for multiple endpoints for each', + 'chain! We store the proper endpoint for the emitter chain.', + ]; }, { - "name": "tokenBridgeCustody", - "isMut": true, - "isSigner": false, - "docs": [ - "account that holds this mint's balance." - ] + name: 'tokenBridgeCustody'; + isMut: true; + isSigner: false; + docs: ["account that holds this mint's balance."]; }, { - "name": "tokenBridgeCustodySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeCustodySigner'; + isMut: false; + isSigner: false; }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram'; + isMut: false; + isSigner: false; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram'; + isMut: false; + isSigner: false; }, { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "vaaHash", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - }, - { - "name": "completeWrappedTransferWithRelay", - "docs": [ - "This instruction is used to redeem token transfers from foreign emitters.", - "It takes custody of the minted wrapped tokens and sends the tokens to the", - "encoded `recipient`. It pays the `fee_recipient` in the wrapped-token", - "denomination. If requested by the user, it will perform a swap with the", - "off-chain relayer to provide the user with lamports.", - "", - "# Arguments", - "", - "* `ctx` - `CompleteWrappedWithRelay` context", - "* `vaa_hash` - Hash of the VAA that triggered the transfer" - ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Redeemer Config account. Acts as the Token Bridge redeemer, which signs", - "for the complete transfer instruction. Read-only." - ] - }, - { - "name": "feeRecipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Fee recipient's token account. Must be an associated token account. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. The registered contract specified in this", + name: 'rent'; + isMut: false; + isSigner: false; + }, + ]; + args: [ + { + name: 'vaaHash'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }, + { + name: 'completeWrappedTransferWithRelay'; + docs: [ + 'This instruction is used to redeem token transfers from foreign emitters.', + 'It takes custody of the minted wrapped tokens and sends the tokens to the', + 'encoded `recipient`. It pays the `fee_recipient` in the wrapped-token', + 'denomination. If requested by the user, it will perform a swap with the', + 'off-chain relayer to provide the user with lamports.', + '', + '# Arguments', + '', + '* `ctx` - `CompleteWrappedWithRelay` context', + '* `vaa_hash` - Hash of the VAA that triggered the transfer', + ]; + accounts: [ + { + name: 'payer'; + isMut: true; + isSigner: true; + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ]; + }, + { + name: 'config'; + isMut: false; + isSigner: false; + docs: [ + 'Redeemer Config account. Acts as the Token Bridge redeemer, which signs', + 'for the complete transfer instruction. Read-only.', + ]; + }, + { + name: 'feeRecipientTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + "Fee recipient's token account. Must be an associated token account. Mutable.", + ]; + }, + { + name: 'foreignContract'; + isMut: false; + isSigner: false; + docs: [ + 'Foreign Contract account. The registered contract specified in this', "account must agree with the target address for the Token Bridge's token", - "transfer. Read-only." - ] + 'transfer. Read-only.', + ]; }, { - "name": "tokenBridgeWrappedMint", - "isMut": true, - "isSigner": false, - "docs": [ - "Token Bridge wrapped mint info. This is the SPL token that will be", - "bridged from the foreign contract. The wrapped mint PDA must agree", - "with the native token's metadata in the wormhole message. Mutable." - ] + name: 'tokenBridgeWrappedMint'; + isMut: true; + isSigner: false; + docs: [ + 'Token Bridge wrapped mint info. This is the SPL token that will be', + 'bridged from the foreign contract. The wrapped mint PDA must agree', + "with the native token's metadata in the wormhole message. Mutable.", + ]; }, { - "name": "recipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Recipient associated token account. The recipient authority check", - "is necessary to ensure that the recipient is the intended recipient", - "of the bridged tokens. Mutable." - ] + name: 'recipientTokenAccount'; + isMut: true; + isSigner: false; + docs: [ + 'Recipient associated token account. The recipient authority check', + 'is necessary to ensure that the recipient is the intended recipient', + 'of the bridged tokens. Mutable.', + ]; }, { - "name": "recipient", - "isMut": true, - "isSigner": false, - "docs": [ - "transaction. This instruction verifies that the recipient key", - "passed in this context matches the intended recipient in the vaa." - ] + name: 'recipient'; + isMut: true; + isSigner: false; + docs: [ + 'transaction. This instruction verifies that the recipient key', + 'passed in this context matches the intended recipient in the vaa.', + ]; }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'registeredToken'; + isMut: false; + isSigner: false; }, { - "name": "nativeRegisteredToken", - "isMut": false, - "isSigner": false + name: 'nativeRegisteredToken'; + isMut: false; + isSigner: false; }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount'; + isMut: true; + isSigner: false; + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged in, the tokens will be", - "transferred to the destination token accounts. This account will have", - "zero balance and can be closed." - ] - }, - { - "name": "tokenBridgeWrappedMeta", - "isMut": false, - "isSigner": false, - "docs": [ - "about the token from its native chain:", - "* Wormhole Chain ID", + 'tokens. When the tokens are finally bridged in, the tokens will be', + 'transferred to the destination token accounts. This account will have', + 'zero balance and can be closed.', + ]; + }, + { + name: 'tokenBridgeWrappedMeta'; + isMut: false; + isSigner: false; + docs: [ + 'about the token from its native chain:', + '* Wormhole Chain ID', "* Token's native contract address", - "* Token's native decimals" - ] + "* Token's native decimals", + ]; }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig'; + isMut: false; + isSigner: false; }, { - "name": "vaa", - "isMut": false, - "isSigner": false, - "docs": [ - "Verified Wormhole message account. The Wormhole program verified", - "signatures and posted the account data here. Read-only." - ] + name: 'vaa'; + isMut: false; + isSigner: false; + docs: [ + 'Verified Wormhole message account. The Wormhole program verified', + 'signatures and posted the account data here. Read-only.', + ]; }, { - "name": "tokenBridgeClaim", - "isMut": true, - "isSigner": false, - "docs": [ - "is true if the bridged assets have been claimed. If the transfer has", - "not been redeemed, this account will not exist yet.", - "", + name: 'tokenBridgeClaim'; + isMut: true; + isSigner: false; + docs: [ + 'is true if the bridged assets have been claimed. If the transfer has', + 'not been redeemed, this account will not exist yet.', + '', "NOTE: The Token Bridge program's claim account is only initialized when", - "a transfer is redeemed (and the boolean value `true` is written as", - "its data).", - "", - "The Token Bridge program will automatically fail if this transfer", - "is redeemed again. But we choose to short-circuit the failure as the", - "first evaluation of this instruction." - ] + 'a transfer is redeemed (and the boolean value `true` is written as', + 'its data).', + '', + 'The Token Bridge program will automatically fail if this transfer', + 'is redeemed again. But we choose to short-circuit the failure as the', + 'first evaluation of this instruction.', + ]; }, { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "endpoint per chain, but the PDA allows for multiple endpoints for each", - "chain! We store the proper endpoint for the emitter chain." - ] + name: 'tokenBridgeForeignEndpoint'; + isMut: false; + isSigner: false; + docs: [ + 'endpoint per chain, but the PDA allows for multiple endpoints for each', + 'chain! We store the proper endpoint for the emitter chain.', + ]; }, { - "name": "tokenBridgeMintAuthority", - "isMut": false, - "isSigner": false + name: 'tokenBridgeMintAuthority'; + isMut: false; + isSigner: false; }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram'; + isMut: false; + isSigner: false; }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram'; + isMut: false; + isSigner: false; }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram'; + isMut: false; + isSigner: false; }, { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "vaaHash", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - } - ], - "accounts": [ + name: 'rent'; + isMut: false; + isSigner: false; + }, + ]; + args: [ + { + name: 'vaaHash'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }, + ]; + accounts: [ { - "name": "foreignContract", - "docs": [ - "Foreign emitter account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'foreignContract'; + docs: ['Foreign emitter account data.']; + type: { + kind: 'struct'; + fields: [ { - "name": "chain", - "docs": [ - "Emitter chain. Cannot equal `1` (Solana's Chain ID)." - ], - "type": "u16" + name: 'chain'; + docs: ["Emitter chain. Cannot equal `1` (Solana's Chain ID)."]; + type: 'u16'; }, { - "name": "address", - "docs": [ - "Emitter address. Cannot be zero address." - ], - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'address'; + docs: ['Emitter address. Cannot be zero address.']; + type: { + array: ['u8', 32]; + }; }, { - "name": "tokenBridgeForeignEndpoint", - "docs": [ - "Token Bridge program's foreign endpoint account key." - ], - "type": "publicKey" - } - ] - } + name: 'tokenBridgeForeignEndpoint'; + docs: ["Token Bridge program's foreign endpoint account key."]; + type: 'publicKey'; + }, + { + name: 'fee'; + docs: [ + 'The fee that is paid to the `fee_recipient` upon redeeming a transfer.', + 'This value is set in terms of USD and scaled by the `relayer_fee_precision`.', + 'For example, if the `relayer_fee_precision` is `100000000` and the intended', + 'fee is $5, then the `fee` value should be `500000000`.', + ]; + type: 'u64'; + }, + ]; + }; }, { - "name": "ownerConfig", - "docs": [ - "Owner account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'ownerConfig'; + docs: ['Owner account data.']; + type: { + kind: 'struct'; + fields: [ { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + name: 'owner'; + docs: ["Program's owner."]; + type: 'publicKey'; }, { - "name": "assistant", - "docs": [ - "Program's assistant. Can be used to update the relayer fee and swap rate." - ], - "type": "publicKey" + name: 'assistant'; + docs: [ + "Program's assistant. Can be used to update the relayer fee and swap rate.", + ]; + type: 'publicKey'; }, { - "name": "pendingOwner", - "docs": [ - "Intermediate storage for the pending owner. Is used to transfer ownership." - ], - "type": { - "option": "publicKey" - } - } - ] - } - }, - { - "name": "redeemerConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + name: 'pendingOwner'; + docs: [ + 'Intermediate storage for the pending owner. Is used to transfer ownership.', + ]; + type: { + option: 'publicKey'; + }; }, + ]; + }; + }, + { + name: 'redeemerConfig'; + type: { + kind: 'struct'; + fields: [ { - "name": "bump", - "docs": [ - "PDA bump." - ], - "type": "u8" + name: 'owner'; + docs: ["Program's owner."]; + type: 'publicKey'; }, { - "name": "relayerFeePrecision", - "docs": [ - "Relayer fee and swap rate precision." - ], - "type": "u32" + name: 'bump'; + docs: ['PDA bump.']; + type: 'u8'; }, { - "name": "swapRatePrecision", - "type": "u32" + name: 'relayerFeePrecision'; + docs: ['Relayer fee and swap rate precision.']; + type: 'u32'; }, { - "name": "feeRecipient", - "docs": [ - "Recipient of all relayer fees and swap proceeds." - ], - "type": "publicKey" - } - ] - } + name: 'feeRecipient'; + docs: ['Recipient of all relayer fees and swap proceeds.']; + type: 'publicKey'; + }, + ]; + }; }, { - "name": "registeredToken", - "docs": [ - "Registered token account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'registeredToken'; + docs: ['Registered token account data.']; + type: { + kind: 'struct'; + fields: [ { - "name": "swapRate", - "docs": [ - "Token swap rate. The swap rate is the USD conversion rate of the token." - ], - "type": "u64" + name: 'swapRate'; + docs: [ + 'Token swap rate. The swap rate is the USD conversion rate of the token.', + ]; + type: 'u64'; }, { - "name": "maxNativeSwapAmount", - "docs": [ - "Maximum amount of native SOL the contract will swap for each transfer." - ], - "type": "u64" + name: 'maxNativeSwapAmount'; + docs: [ + 'Maximum amount of native SOL the contract will swap for each transfer.', + ]; + type: 'u64'; }, - { - "name": "isRegistered", - "docs": [ - "Whether the token is registered." - ], - "type": "bool" - } - ] - } + ]; + }; }, { - "name": "relayerFee", - "docs": [ - "Outbound relayer fee data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'senderConfig'; + type: { + kind: 'struct'; + fields: [ { - "name": "chain", - "docs": [ - "Emitter chain. Cannot equal `0` or `1` (Solana's Chain ID)." - ], - "type": "u16" + name: 'owner'; + docs: ["Program's owner."]; + type: 'publicKey'; }, { - "name": "fee", - "docs": [ - "Relayer fee in USD terms." - ], - "type": "u64" - } - ] - } - }, - { - "name": "senderConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + name: 'bump'; + docs: ['PDA bump.']; + type: 'u8'; }, { - "name": "bump", - "docs": [ - "PDA bump." - ], - "type": "u8" + name: 'tokenBridge'; + docs: ["Token Bridge program's relevant addresses."]; + type: { + defined: 'OutboundTokenBridgeAddresses'; + }; }, { - "name": "tokenBridge", - "docs": [ - "Token Bridge program's relevant addresses." - ], - "type": { - "defined": "OutboundTokenBridgeAddresses" - } + name: 'relayerFeePrecision'; + docs: ['Relayer fee and swap rate precision.']; + type: 'u32'; }, { - "name": "relayerFeePrecision", - "docs": [ - "Relayer fee and swap rate precision." - ], - "type": "u32" + name: 'paused'; + docs: ['Boolean indicating whether outbound transfers are paused.']; + type: 'bool'; }, + ]; + }; + }, + { + name: 'signerSequence'; + type: { + kind: 'struct'; + fields: [ { - "name": "swapRatePrecision", - "type": "u32" + name: 'value'; + type: 'u64'; }, - { - "name": "paused", - "docs": [ - "Boolean indicating whether outbound transfers are paused." - ], - "type": "bool" - } - ] - } - } - ], - "types": [ + ]; + }; + }, + ]; + types: [ { - "name": "OutboundTokenBridgeAddresses", - "type": { - "kind": "struct", - "fields": [ + name: 'OutboundTokenBridgeAddresses'; + type: { + kind: 'struct'; + fields: [ { - "name": "sequence", - "type": "publicKey" - } - ] - } - }, - { - "name": "TokenBridgeRelayerMessage", - "docs": [ - "Expected message types for this program. Only valid payloads are:", - "* `TransferWithRelay`: Payload ID == 1.", - "", - "Payload IDs are encoded as u8." - ], - "type": { - "kind": "enum", - "variants": [ + name: 'sequence'; + type: 'publicKey'; + }, + ]; + }; + }, + { + name: 'TokenBridgeRelayerMessage'; + docs: [ + 'Expected message types for this program. Only valid payloads are:', + '* `TransferWithRelay`: Payload ID == 1.', + '', + 'Payload IDs are encoded as u8.', + ]; + type: { + kind: 'enum'; + variants: [ { - "name": "TransferWithRelay", - "fields": [ + name: 'TransferWithRelay'; + fields: [ { - "name": "target_relayer_fee", - "type": "u64" + name: 'target_relayer_fee'; + type: 'u64'; }, { - "name": "to_native_token_amount", - "type": "u64" + name: 'to_native_token_amount'; + type: 'u64'; }, { - "name": "recipient", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - } - ] - } - } - ], - "errors": [ + name: 'recipient'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }, + ]; + }; + }, + ]; + errors: [ { - "code": 6000, - "name": "InvalidWormholeBridge", - "msg": "InvalidWormholeBridge" + code: 6000; + name: 'InvalidWormholeBridge'; + msg: 'InvalidWormholeBridge'; }, { - "code": 6001, - "name": "InvalidWormholeFeeCollector", - "msg": "InvalidWormholeFeeCollector" + code: 6001; + name: 'InvalidWormholeFeeCollector'; + msg: 'InvalidWormholeFeeCollector'; }, { - "code": 6002, - "name": "OwnerOnly", - "msg": "OwnerOnly" + code: 6002; + name: 'OwnerOnly'; + msg: 'OwnerOnly'; }, { - "code": 6003, - "name": "OutboundTransfersPaused", - "msg": "OutboundTransfersPaused" + code: 6003; + name: 'OutboundTransfersPaused'; + msg: 'OutboundTransfersPaused'; }, { - "code": 6004, - "name": "OwnerOrAssistantOnly", - "msg": "OwnerOrAssistantOnly" + code: 6004; + name: 'OwnerOrAssistantOnly'; + msg: 'OwnerOrAssistantOnly'; }, { - "code": 6005, - "name": "NotPendingOwner", - "msg": "NotPendingOwner" + code: 6005; + name: 'NotPendingOwner'; + msg: 'NotPendingOwner'; }, { - "code": 6006, - "name": "AlreadyTheOwner", - "msg": "AlreadyTheOwner" + code: 6006; + name: 'AlreadyTheOwner'; + msg: 'AlreadyTheOwner'; }, { - "code": 6007, - "name": "AlreadyTheAssistant", - "msg": "AlreadyTheAssistant" + code: 6007; + name: 'AlreadyTheAssistant'; + msg: 'AlreadyTheAssistant'; }, { - "code": 6008, - "name": "AlreadyTheFeeRecipient", - "msg": "AlreadyTheFeeRecipient" + code: 6008; + name: 'AlreadyTheFeeRecipient'; + msg: 'AlreadyTheFeeRecipient'; }, { - "code": 6009, - "name": "BumpNotFound", - "msg": "BumpNotFound" + code: 6009; + name: 'BumpNotFound'; + msg: 'BumpNotFound'; }, { - "code": 6010, - "name": "FailedToMakeImmutable", - "msg": "FailedToMakeImmutable" + code: 6010; + name: 'FailedToMakeImmutable'; + msg: 'FailedToMakeImmutable'; }, { - "code": 6011, - "name": "InvalidForeignContract", - "msg": "InvalidForeignContract" + code: 6011; + name: 'InvalidForeignContract'; + msg: 'InvalidForeignContract'; }, { - "code": 6012, - "name": "ZeroBridgeAmount", - "msg": "ZeroBridgeAmount" + code: 6012; + name: 'ZeroBridgeAmount'; + msg: 'ZeroBridgeAmount'; }, { - "code": 6013, - "name": "InvalidToNativeAmount", - "msg": "InvalidToNativeAmount" + code: 6013; + name: 'InvalidToNativeAmount'; + msg: 'InvalidToNativeAmount'; }, { - "code": 6014, - "name": "NativeMintRequired", - "msg": "NativeMintRequired" + code: 6014; + name: 'NativeMintRequired'; + msg: 'NativeMintRequired'; }, { - "code": 6015, - "name": "SwapsNotAllowedForNativeMint", - "msg": "SwapsNotAllowedForNativeMint" + code: 6015; + name: 'SwapsNotAllowedForNativeMint'; + msg: 'SwapsNotAllowedForNativeMint'; }, { - "code": 6016, - "name": "InvalidTokenBridgeConfig", - "msg": "InvalidTokenBridgeConfig" + code: 6016; + name: 'InvalidTokenBridgeConfig'; + msg: 'InvalidTokenBridgeConfig'; }, { - "code": 6017, - "name": "InvalidTokenBridgeAuthoritySigner", - "msg": "InvalidTokenBridgeAuthoritySigner" + code: 6017; + name: 'InvalidTokenBridgeAuthoritySigner'; + msg: 'InvalidTokenBridgeAuthoritySigner'; }, { - "code": 6018, - "name": "InvalidTokenBridgeCustodySigner", - "msg": "InvalidTokenBridgeCustodySigner" + code: 6018; + name: 'InvalidTokenBridgeCustodySigner'; + msg: 'InvalidTokenBridgeCustodySigner'; }, { - "code": 6019, - "name": "InvalidTokenBridgeEmitter", - "msg": "InvalidTokenBridgeEmitter" + code: 6019; + name: 'InvalidTokenBridgeEmitter'; + msg: 'InvalidTokenBridgeEmitter'; }, { - "code": 6020, - "name": "InvalidTokenBridgeSequence", - "msg": "InvalidTokenBridgeSequence" + code: 6020; + name: 'InvalidTokenBridgeSequence'; + msg: 'InvalidTokenBridgeSequence'; }, { - "code": 6021, - "name": "InvalidRecipient", - "msg": "InvalidRecipient" + code: 6021; + name: 'InvalidRecipient'; + msg: 'InvalidRecipient'; }, { - "code": 6022, - "name": "InvalidTransferToChain", - "msg": "InvalidTransferToChain" + code: 6022; + name: 'InvalidTransferToChain'; + msg: 'InvalidTransferToChain'; }, { - "code": 6023, - "name": "InvalidTransferTokenChain", - "msg": "InvalidTransferTokenChain" + code: 6023; + name: 'InvalidTransferTokenChain'; + msg: 'InvalidTransferTokenChain'; }, { - "code": 6024, - "name": "InvalidPrecision", - "msg": "InvalidPrecision" + code: 6024; + name: 'InvalidPrecision'; + msg: 'InvalidPrecision'; }, { - "code": 6025, - "name": "InvalidTransferToAddress", - "msg": "InvalidTransferToAddress" + code: 6025; + name: 'InvalidTransferToAddress'; + msg: 'InvalidTransferToAddress'; }, { - "code": 6026, - "name": "AlreadyRedeemed", - "msg": "AlreadyRedeemed" + code: 6026; + name: 'AlreadyRedeemed'; + msg: 'AlreadyRedeemed'; }, { - "code": 6027, - "name": "InvalidTokenBridgeForeignEndpoint", - "msg": "InvalidTokenBridgeForeignEndpoint" + code: 6027; + name: 'InvalidTokenBridgeForeignEndpoint'; + msg: 'InvalidTokenBridgeForeignEndpoint'; }, { - "code": 6028, - "name": "InvalidTokenBridgeMintAuthority", - "msg": "InvalidTokenBridgeMintAuthority" + code: 6028; + name: 'InvalidTokenBridgeMintAuthority'; + msg: 'InvalidTokenBridgeMintAuthority'; }, { - "code": 6029, - "name": "InvalidPublicKey", - "msg": "InvalidPublicKey" + code: 6029; + name: 'InvalidPublicKey'; + msg: 'InvalidPublicKey'; }, { - "code": 6030, - "name": "ZeroSwapRate", - "msg": "ZeroSwapRate" + code: 6030; + name: 'ZeroSwapRate'; + msg: 'ZeroSwapRate'; }, { - "code": 6031, - "name": "TokenNotRegistered", - "msg": "TokenNotRegistered" + code: 6031; + name: 'TokenNotRegistered'; + msg: 'TokenNotRegistered'; }, { - "code": 6032, - "name": "ChainNotRegistered", - "msg": "ChainNotRegistered" + code: 6032; + name: 'ChainNotRegistered'; + msg: 'ChainNotRegistered'; }, { - "code": 6033, - "name": "TokenAlreadyRegistered", - "msg": "TokenAlreadyRegistered" + code: 6033; + name: 'TokenAlreadyRegistered'; + msg: 'TokenAlreadyRegistered'; }, { - "code": 6034, - "name": "FeeCalculationError", - "msg": "TokenFeeCalculationError" + code: 6034; + name: 'FeeCalculationError'; + msg: 'TokenFeeCalculationError'; }, { - "code": 6035, - "name": "InvalidSwapCalculation", - "msg": "InvalidSwapCalculation" + code: 6035; + name: 'InvalidSwapCalculation'; + msg: 'InvalidSwapCalculation'; }, { - "code": 6036, - "name": "InsufficientFunds", - "msg": "InsufficientFunds" - } - ] + code: 6036; + name: 'InsufficientFunds'; + msg: 'InsufficientFunds'; + }, + ]; }; export const IDL: TokenBridgeRelayer = { - "version": "0.1.0", - "name": "token_bridge_relayer", - "constants": [ + version: '0.1.0', + name: 'token_bridge_relayer', + constants: [ + { + name: 'SEED_PREFIX_BRIDGED', + type: 'bytes', + value: '[98, 114, 105, 100, 103, 101, 100]', + }, { - "name": "SEED_PREFIX_BRIDGED", - "type": "bytes", - "value": "[98, 114, 105, 100, 103, 101, 100]" + name: 'SEED_PREFIX_TMP', + type: 'bytes', + value: '[116, 109, 112]', }, { - "name": "SEED_PREFIX_TMP", - "type": "bytes", - "value": "[116, 109, 112]" - } + name: 'SWAP_RATE_PRECISION', + type: 'u32', + value: '100_000_000', + }, ], - "instructions": [ + instructions: [ { - "name": "initialize", - "docs": [ + name: 'initialize', + docs: [ "This instruction is be used to generate your program's config.", - "And for convenience, we will store Wormhole-related PDAs in the", - "config so we can verify these accounts with a simple == constraint.", - "# Arguments", - "", - "* `ctx` - `Initialize` context", - "* `fee_recipient` - Recipient of all relayer fees and swap proceeds", - "* `assistant` - Priviledged key to manage certain accounts" - ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Whoever initializes the config will be the owner of the program. Signer", - "for creating the [`SenderConfig`], [`RedeemerConfig`] and [`OwnerConfig`]", - "accounts." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account, which saves program data useful for other", - "instructions, specifically for outbound transfers. Also saves the payer", + 'And for convenience, we will store Wormhole-related PDAs in the', + 'config so we can verify these accounts with a simple == constraint.', + '# Arguments', + '', + '* `ctx` - `Initialize` context', + '* `fee_recipient` - Recipient of all relayer fees and swap proceeds', + '* `assistant` - Privileged key to manage certain accounts', + ], + accounts: [ + { + name: 'owner', + isMut: true, + isSigner: true, + docs: ['Deployer of the program.'], + }, + { + name: 'senderConfig', + isMut: true, + isSigner: false, + docs: [ + 'Sender Config account, which saves program data useful for other', + 'instructions, specifically for outbound transfers. Also saves the payer', "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] + 'owner.', + ], }, { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account, which saves program data useful for other", - "instructions, specifically for inbound transfers. Also saves the payer", + name: 'redeemerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Redeemer Config account, which saves program data useful for other', + 'instructions, specifically for inbound transfers. Also saves the payer', "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] + 'owner.', + ], }, { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner config account, which saves the owner, assistant and", - "pending owner keys. This account is used to manage the ownership of the", - "program." - ] + name: 'ownerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Owner config account, which saves the owner, assistant and', + 'pending owner keys. This account is used to manage the ownership of the', + 'program.', + ], }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false, - "docs": [ - "that holds data; it is purely just a signer for posting Wormhole", - "messages on behalf of the Token Bridge program." - ] + name: 'tokenBridgeEmitter', + isMut: false, + isSigner: false, + docs: [ + 'that holds data; it is purely just a signer for posting Wormhole', + 'messages on behalf of the Token Bridge program.', + ], }, { - "name": "tokenBridgeSequence", - "isMut": false, - "isSigner": false, - "docs": [ + name: 'tokenBridgeSequence', + isMut: false, + isSigner: false, + docs: [ "Token Bridge emitter's sequence account. Like with all Wormhole", - "emitters, this account keeps track of the sequence number of the last", - "posted message." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - }, - { - "name": "programData", - "isMut": true, - "isSigner": false, - "docs": [ - "upgrade authority. We check this PDA address just in case there is another program that this", - "deployer has deployed.", - "", - "NOTE: Set upgrade authority is scary because any public key can be used to set as the", - "authority." - ] - }, - { - "name": "bpfLoaderUpgradeableProgram", - "isMut": false, - "isSigner": false - } + 'emitters, this account keeps track of the sequence number of the last', + 'posted message.', + ], + }, + { + name: 'systemProgram', + isMut: false, + isSigner: false, + docs: ['System program.'], + }, + { + name: 'programData', + isMut: true, + isSigner: false, + docs: [ + 'upgrade authority. We check this PDA address just in case there is another program that this', + 'deployer has deployed.', + '', + 'NOTE: Set upgrade authority is scary because any public key can be used to set as the', + 'authority.', + ], + }, + { + name: 'bpfLoaderUpgradeableProgram', + isMut: false, + isSigner: false, + }, + ], + args: [ + { + name: 'feeRecipient', + type: 'publicKey', + }, + { + name: 'assistant', + type: 'publicKey', + }, ], - "args": [ - { - "name": "feeRecipient", - "type": "publicKey" - }, - { - "name": "assistant", - "type": "publicKey" - } - ] - }, - { - "name": "registerForeignContract", - "docs": [ - "This instruction registers a new foreign contract (from another", - "network) and saves the emitter information in a ForeignEmitter account.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can add and update foreign", - "contracts.", - "", - "# Arguments", - "", - "* `ctx` - `RegisterForeignContract` context", - "* `chain` - Wormhole Chain ID", - "* `address` - Wormhole Emitter Address" + }, + { + name: 'registerForeignContract', + docs: [ + 'This instruction registers a new foreign contract (from another', + 'network) and saves the emitter information in a ForeignEmitter account.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can add and update foreign', + 'contracts.', + '', + '# Arguments', + '', + '* `ctx` - `RegisterForeignContract` context', + '* `chain` - Wormhole Chain ID', + '* `address` - Wormhole Emitter Address', + '* `relayer_fee` - Relayer fee scaled by the `relayer_fee_precision`', ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "foreignContract", - "isMut": true, - "isSigner": false, - "docs": [ - "Foreign Contract account. Create this account if an emitter has not been", - "registered yet for this Wormhole chain ID. If there already is a", - "contract address saved in this account, overwrite it." - ] - }, - { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "Token Bridge foreign endpoint. This account should really be one", + accounts: [ + { + name: 'owner', + isMut: true, + isSigner: true, + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ], + }, + { + name: 'foreignContract', + isMut: true, + isSigner: false, + docs: [ + 'Foreign Contract account. Create this account if an emitter has not been', + 'registered yet for this Wormhole chain ID. If there already is a', + 'contract address saved in this account, overwrite it.', + ], + }, + { + name: 'tokenBridgeForeignEndpoint', + isMut: false, + isSigner: false, + docs: [ + 'Token Bridge foreign endpoint. This account should really be one', "endpoint per chain, but Token Bridge's PDA allows for multiple", - "endpoints for each chain. We store the proper endpoint for the", - "emitter chain." - ] - }, - { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "Token Bridge program." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } + 'endpoints for each chain. We store the proper endpoint for the', + 'emitter chain.', + ], + }, + { + name: 'tokenBridgeProgram', + isMut: false, + isSigner: false, + docs: ['Token Bridge program.'], + }, + { + name: 'systemProgram', + isMut: false, + isSigner: false, + docs: ['System program.'], + }, ], - "args": [ - { - "name": "chain", - "type": "u16" - }, - { - "name": "address", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - }, - { - "name": "registerToken", - "docs": [ - "This instruction registers a new token and saves the initial `swap_rate`", - "and `max_native_token_amount` in a RegisteredToken account.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `RegisterToken` context", - "* `swap_rate`:", - "- USD converion rate scaled by the `swap_rate_precision`. For example,", - "- if the conversion rate is $15 and the `swap_rate_precision` is", - "- 1000000, the `swap_rate` should be set to 15000000.", - "* `max_native_swap_amount`:", - "- Maximum amount of native tokens that can be swapped for this token", - "- on this chain." + args: [ + { + name: 'chain', + type: 'u16', + }, + { + name: 'address', + type: { + array: ['u8', 32], + }, + }, + { + name: 'relayerFee', + type: 'u64', + }, ], - "accounts": [ - { - "name": "owner", - "isMut": true, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. Create this", - "account if the mint has not been registered yet. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } + }, + { + name: 'registerToken', + docs: [ + 'This instruction registers a new token and saves the initial `swap_rate`', + 'and `max_native_token_amount` in a RegisteredToken account.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `RegisterToken` context', + '* `swap_rate`:', + '- USD conversion rate scaled by the `swap_rate_precision`. For example,', + '- if the conversion rate is $15 and the `swap_rate_precision` is', + '- 1000000, the `swap_rate` should be set to 15000000.', + '* `max_native_swap_amount`:', + '- Maximum amount of native tokens that can be swapped for this token', + '- on this chain.', ], - "args": [ + accounts: [ + { + name: 'owner', + isMut: true, + isSigner: true, + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ], + }, { - "name": "swapRate", - "type": "u64" + name: 'registeredToken', + isMut: true, + isSigner: false, + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. Create this', + 'account if the mint has not been registered yet. Mutable.', + ], }, { - "name": "maxNativeSwapAmount", - "type": "u64" - } - ] + name: 'mint', + isMut: false, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ], + }, + { + name: 'tokenProgram', + isMut: false, + isSigner: false, + }, + { + name: 'systemProgram', + isMut: false, + isSigner: false, + docs: ['System program.'], + }, + ], + args: [ + { + name: 'swapRate', + type: 'u64', + }, + { + name: 'maxNativeSwapAmount', + type: 'u64', + }, + ], }, { - "name": "deregisterToken", - "docs": [ - "This instruction deregisters a token by setting the `is_registered`", - "field in the `RegisteredToken` account to `false`. It also sets the", - "`swap_rate` and `max_native_swap_amount` to zero. This instruction", - "is owner-only, meaning that only the owner of the program (defined", - "in the [Config] account) can register a token." + name: 'deregisterToken', + docs: [ + 'This instruction deregisters a token by closing the existing', + '`RegisteredToken` account for a particular mint. This instruction is', + 'owner-only, meaning that only the owner of the program (defined in the', + '[Config] account) can deregister a token.', + ], + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'closing [`RegisteredToken`] account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ], + }, + { + name: 'mint', + isMut: false, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ], + }, + { + name: 'registeredToken', + isMut: true, + isSigner: false, + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. This account', + 'also determines if a mint is registered or not.', + ], + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. This account", - "also determines if a mint is registered or not." - ] - } + args: [], + }, + { + name: 'updateRelayerFee', + docs: [ + 'This instruction updates the `relayer_fee` in the `ForeignContract` account.', + 'The `relayer_fee` is scaled by the `relayer_fee_precision`. For example,', + 'if the `relayer_fee` is $15 and the `relayer_fee_precision` is 1000000,', + 'the `relayer_fee` should be set to 15000000. This instruction can', + 'only be called by the owner or assistant, which are defined in the', + '[OwnerConfig] account.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateRelayerFee` context', + '* `chain` - Wormhole Chain ID', + '* `fee` - Relayer fee scaled by the `relayer_fee_precision`', ], - "args": [] - }, - { - "name": "updateRelayerFee", - "docs": [ - "This instruction updates the `relayer_fee` in the `RelayerFee` account.", - "The `relayer_fee` is scaled by the `relayer_fee_precision`. For example,", - "if the `relayer_fee` is $15 and the `relayer_fee_precision` is 1000000,", - "the `relayer_fee` should be set to 15000000. This instruction can", - "only be called by the owner or assistant, which are defined in the", - "[OwnerConfig] account.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateRelayerFee` context", - "* `chain` - Wormhole Chain ID", - "* `fee` - Relayer fee scaled by the `relayer_fee_precision`" + accounts: [ + { + name: 'payer', + isMut: true, + isSigner: true, + docs: ['Signer of the transaction. Must be the owner or assistant.'], + }, + { + name: 'ownerConfig', + isMut: false, + isSigner: false, + docs: [ + 'The owner_config is used when updating the swap rate', + 'so that the assistant key can be used in addition to the', + 'owner key.', + ], + }, + { + name: 'foreignContract', + isMut: true, + isSigner: false, + docs: [ + 'This account holds the USD denominated relayer fee for the specified', + '`chain`. This account is used to determine the cost of relaying', + 'a transfer to a target chain. If there already is a relayer fee', + 'saved in this account, overwrite it.', + ], + }, + { + name: 'systemProgram', + isMut: false, + isSigner: false, + docs: ['System program.'], + }, ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Signer of the transaction. Must be the owner or assistant." - ] - }, - { - "name": "ownerConfig", - "isMut": false, - "isSigner": false, - "docs": [ - "The owner_config is used when updating the swap rate", - "so that the assistant key can be used in addition to the", - "owner key." - ] - }, - { - "name": "relayerFee", - "isMut": true, - "isSigner": false, - "docs": [ - "Relayer Fee account. This account holds the USD denominated relayer fee", - "for the specified `chain`. This account is used to determine the cost of", - "relaying a transfer to a target chain. If there already is a relayer", - "fee saved in this account, overwrite it." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Pass this account to verify that the specified Chain ID has a", - "corresponding registered foreign contract." - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "System program." - ] - } + args: [ + { + name: 'chain', + type: 'u16', + }, + { + name: 'fee', + type: 'u64', + }, + ], + }, + { + name: 'updateRelayerFeePrecision', + docs: [ + 'This instruction updates the `relayer_fee_precision` in the', + '`SenderConfig` and `RedeemerConfig` accounts. The `relayer_fee_precision`', + 'is used to scale the `relayer_fee`. This instruction is owner-only,', + 'meaning that only the owner of the program (defined in the [Config]', + 'account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `UpdatePrecision` context', + '* `relayer_fee_precision` - Precision used to scale the relayer fee.', ], - "args": [ - { - "name": "chain", - "type": "u16" - }, - { - "name": "fee", - "type": "u64" - } - ] - }, - { - "name": "updateRelayerFeePrecision", - "docs": [ - "This instruction updates the `relayer_fee_precision` in the", - "`SenderConfig` and `RedeemerConfig` accounts. The `relayer_fee_precision`", - "is used to scale the `relayer_fee`. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdatePrecision` context", - "* `relayer_fee_precision` - Precision used to scale the relayer fee." + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: [ + 'Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account.', + ], + }, + { + name: 'redeemerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Redeemer Config account. This program requires that the `owner`', + 'specified in the context equals the pubkey specified in this account.', + 'Mutable.', + ], + }, + { + name: 'senderConfig', + isMut: true, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner`', + 'specified in the context equals the pubkey specified in this account.', + 'Mutable. The `owner` check is redundant here, but we keep it as an', + 'extra protection for future changes to the context. Mutable.', + ], + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable. The `owner` check is redundant here, but we keep it as an", - "extra protection for future changes to the context. Mutable." - ] - } + args: [ + { + name: 'relayerFeePrecision', + type: 'u32', + }, ], - "args": [ - { - "name": "relayerFeePrecision", - "type": "u32" - } - ] - }, - { - "name": "updateSwapRate", - "docs": [ - "This instruction updates the `swap_rate` in the `RegisteredToken`", - "account. This instruction can only be called by the owner or", - "assistant, which are defined in the [OwnerConfig] account.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateSwapRate` context", - "* `swap_rate` - USD conversion rate for the specified token." + }, + { + name: 'updateSwapRate', + docs: [ + 'This instruction updates the `swap_rate` in the `RegisteredToken`', + 'account. This instruction can only be called by the owner or', + 'assistant, which are defined in the [OwnerConfig] account.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateSwapRate` context', + '* `swap_rate` - USD conversion rate for the specified token.', ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "The signer of the transaction. Must be the owner or assistant." - ] - }, - { - "name": "ownerConfig", - "isMut": false, - "isSigner": false, - "docs": [ - "The owner_config is used when updating the swap rate so that the", - "assistant key can be used in additional to the owner key." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. The program", - "will modify this account to update the swap rate. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - } + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: [ + 'The signer of the transaction. Must be the owner or assistant.', + ], + }, + { + name: 'ownerConfig', + isMut: false, + isSigner: false, + docs: [ + 'The owner_config is used when updating the swap rate so that the', + 'assistant key can be used in additional to the owner key.', + ], + }, + { + name: 'registeredToken', + isMut: true, + isSigner: false, + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. The program', + 'will modify this account to update the swap rate. Mutable.', + ], + }, + { + name: 'mint', + isMut: false, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ], + }, + ], + args: [ + { + name: 'swapRate', + type: 'u64', + }, ], - "args": [ - { - "name": "swapRate", - "type": "u64" - } - ] - }, - { - "name": "updateSwapRatePrecision", - "docs": [ - "This instruction updates the `swap_rate_precision` in the", - "`SenderConfig` and `RedeemerConfig` accounts. The `swap_rate_precision`", - "is used to scale the `swap_rate`. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdatePrecision` context", - "* `swap_rate_precision` - Precision used to scale the `swap_rate`." + }, + { + name: 'updateMaxNativeSwapAmount', + docs: [ + 'This instruction updates the `max_native_swap_amount` in the', + '`RegisteredToken` account. This instruction is owner-only,', + 'meaning that only the owner of the program (defined in the [Config]', + 'account) can register a token.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateMaxNativeSwapAmount` context', + '* `max_native_swap_amount`:', + '- Maximum amount of native tokens that can be swapped for this token', + '- on this chain.', ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] and [`SenderConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner`", - "specified in the context equals the pubkey specified in this account.", - "Mutable. The `owner` check is redundant here, but we keep it as an", - "extra protection for future changes to the context. Mutable." - ] - } + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: [ + 'Owner of the program set in the [`SenderConfig`] account. Signer for', + 'creating [`ForeignContract`] account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Read-only.', + ], + }, + { + name: 'registeredToken', + isMut: true, + isSigner: false, + docs: [ + 'Registered Token account. This account stores information about the', + 'token, including the swap rate and max native swap amount. The program', + 'will modify this account when the swap rate or max native swap amount', + 'changes. Mutable.', + ], + }, + { + name: 'mint', + isMut: false, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract.', + ], + }, ], - "args": [ - { - "name": "swapRatePrecision", - "type": "u32" - } - ] - }, - { - "name": "updateMaxNativeSwapAmount", - "docs": [ - "This instruction updates the `max_native_swap_amount` in the", - "`RegisteredToken` account. This instruction is owner-only,", - "meaning that only the owner of the program (defined in the [Config]", - "account) can register a token.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateMaxNativeSwapAmount` context", - "* `max_native_swap_amount`:", - "- Maximum amount of native tokens that can be swapped for this token", - "- on this chain." + args: [ + { + name: 'maxNativeSwapAmount', + type: 'u64', + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account. Signer for", - "creating [`ForeignContract`] account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Read-only." - ] - }, - { - "name": "registeredToken", - "isMut": true, - "isSigner": false, - "docs": [ - "Registered Token account. This account stores information about the", - "token, including the swap rate and max native swap amount. The program", - "will modify this account when the swap rate or max native swap amount", - "changes. Mutable." - ] - }, - { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract." - ] - } + }, + { + name: 'setPauseForTransfers', + docs: [ + 'This instruction updates the `paused` boolean in the `SenderConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can pause outbound', + 'transfers.', + '', + '# Arguments', + '', + '* `ctx` - `PauseOutboundTransfers` context', + '* `paused` - Boolean indicating whether outbound transfers are paused.', ], - "args": [ - { - "name": "maxNativeSwapAmount", - "type": "u64" - } - ] - }, - { - "name": "setPauseForTransfers", - "docs": [ - "This instruction updates the `paused` boolean in the `SenderConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can pause outbound", - "transfers.", - "", - "# Arguments", - "", - "* `ctx` - `PauseOutboundTransfers` context", - "* `paused` - Boolean indicating whether outbound transfers are paused." + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: ['Owner of the program set in the [`SenderConfig`] account.'], + }, + { + name: 'config', + isMut: true, + isSigner: false, + docs: [ + 'Sender Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ], + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`SenderConfig`] account." - ] - }, - { - "name": "config", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } + args: [ + { + name: 'paused', + type: 'bool', + }, ], - "args": [ - { - "name": "paused", - "type": "bool" - } - ] - }, - { - "name": "submitOwnershipTransferRequest", - "docs": [ - "This instruction sets the `pending_owner` field in the `OwnerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can submit an", - "ownership transfer request.", - "", - "# Arguments", - "", - "* `ctx` - `ManageOwnership` context", - "* `new_owner` - Pubkey of the pending owner." + }, + { + name: 'submitOwnershipTransferRequest', + docs: [ + 'This instruction sets the `pending_owner` field in the `OwnerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can submit an', + 'ownership transfer request.', + '', + '# Arguments', + '', + '* `ctx` - `ManageOwnership` context', + '* `new_owner` - Pubkey of the pending owner.', ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: ['Owner of the program set in the [`OwnerConfig`] account.'], + }, + { + name: 'ownerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ], + }, ], - "args": [ + args: [ { - "name": "newOwner", - "type": "publicKey" - } - ] + name: 'newOwner', + type: 'publicKey', + }, + ], }, { - "name": "confirmOwnershipTransferRequest", - "docs": [ - "This instruction confirms that the `pending_owner` is the signer of", - "the transaction and updates the `owner` field in the `SenderConfig`,", - "`RedeemerConfig`, and `OwnerConfig` accounts." + name: 'confirmOwnershipTransferRequest', + docs: [ + 'This instruction confirms that the `pending_owner` is the signer of', + 'the transaction and updates the `owner` field in the `SenderConfig`,', + '`RedeemerConfig`, and `OwnerConfig` accounts.', ], - "accounts": [ - { - "name": "pendingOwner", - "isMut": false, - "isSigner": true, - "docs": [ - "Must be the pending owner of the program set in the [`OwnerConfig`]", - "account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `pending_owner`", - "specified in the context equals the pubkey specified in this account." - ] - }, - { - "name": "senderConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Sender Config account. This instruction will update the `owner`", - "specified in this account to the `pending_owner` specified in the", - "[`OwnerConfig`] account. Mutable." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account. This instruction will update the `owner`", - "specified in this account to the `pending_owner` specified in the", - "[`OwnerConfig`] account. Mutable." - ] - } + accounts: [ + { + name: 'pendingOwner', + isMut: false, + isSigner: true, + docs: [ + 'Must be the pending owner of the program set in the [`OwnerConfig`]', + 'account.', + ], + }, + { + name: 'ownerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Owner Config account. This program requires that the `pending_owner`', + 'specified in the context equals the pubkey specified in this account.', + ], + }, + { + name: 'senderConfig', + isMut: true, + isSigner: false, + docs: [ + 'Sender Config account. This instruction will update the `owner`', + 'specified in this account to the `pending_owner` specified in the', + '[`OwnerConfig`] account. Mutable.', + ], + }, + { + name: 'redeemerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Redeemer Config account. This instruction will update the `owner`', + 'specified in this account to the `pending_owner` specified in the', + '[`OwnerConfig`] account. Mutable.', + ], + }, ], - "args": [] + args: [], }, { - "name": "cancelOwnershipTransferRequest", - "docs": [ - "This instruction cancels the ownership transfer request by setting", - "the `pending_owner` field in the `OwnerConfig` account to `None`.", - "This instruction is owner-only, meaning that only the owner of the", - "program (defined in the [Config] account) can cancel an ownership", - "transfer request." - ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } + name: 'cancelOwnershipTransferRequest', + docs: [ + 'This instruction cancels the ownership transfer request by setting', + 'the `pending_owner` field in the `OwnerConfig` account to `None`.', + 'This instruction is owner-only, meaning that only the owner of the', + 'program (defined in the [Config] account) can cancel an ownership', + 'transfer request.', ], - "args": [] - }, - { - "name": "updateAssistant", - "docs": [ - "This instruction updates the `assistant` field in the `OwnerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can update the", - "assistant.", - "", - "# Arguments", - "", - "* `ctx` - `ManageOwnership` context", - "* `new_assistant` - Pubkey of the new assistant." + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: ['Owner of the program set in the [`OwnerConfig`] account.'], + }, + { + name: 'ownerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ], + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`OwnerConfig`] account." - ] - }, - { - "name": "ownerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Owner Config account. This program requires that the `owner` specified", - "in the context equals the pubkey specified in this account. Mutable." - ] - } + args: [], + }, + { + name: 'updateAssistant', + docs: [ + 'This instruction updates the `assistant` field in the `OwnerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can update the', + 'assistant.', + '', + '# Arguments', + '', + '* `ctx` - `ManageOwnership` context', + '* `new_assistant` - Pubkey of the new assistant.', ], - "args": [ - { - "name": "newAssistant", - "type": "publicKey" - } - ] - }, - { - "name": "updateFeeRecipient", - "docs": [ - "This instruction updates the `fee_recipient` field in the `RedeemerConfig`", - "account. This instruction is owner-only, meaning that only the owner", - "of the program (defined in the [Config] account) can update the", - "fee recipient.", - "", - "# Arguments", - "", - "* `ctx` - `UpdateFeeRecipient` context", - "* `new_fee_recipient` - Pubkey of the new fee recipient." + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: ['Owner of the program set in the [`OwnerConfig`] account.'], + }, + { + name: 'ownerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Owner Config account. This program requires that the `owner` specified', + 'in the context equals the pubkey specified in this account. Mutable.', + ], + }, ], - "accounts": [ - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "Owner of the program set in the [`RedeemerConfig`] account." - ] - }, - { - "name": "redeemerConfig", - "isMut": true, - "isSigner": false, - "docs": [ - "Redeemer Config account, which saves program data useful for other", - "instructions, specifically for inbound transfers. Also saves the payer", - "of the [`initialize`](crate::initialize) instruction as the program's", - "owner." - ] - } + args: [ + { + name: 'newAssistant', + type: 'publicKey', + }, ], - "args": [ - { - "name": "newFeeRecipient", - "type": "publicKey" - } - ] - }, - { - "name": "transferNativeTokensWithRelay", - "docs": [ - "This instruction is used to transfer native tokens from Solana to a", - "foreign blockchain. The user can optionally specify a", - "`to_native_token_amount` to swap some of the tokens for the native", - "asset on the target chain. For a fee, an off-chain relayer will redeem", - "the transfer on the target chain. If the user is transferring native", - "SOL, the contract will autormatically wrap the lamports into a WSOL.", - "", - "# Arguments", - "", - "* `ctx` - `TransferNativeWithRelay` context", - "* `amount` - Amount of tokens to send", - "* `to_native_token_amount`:", - "- Amount of tokens to swap for native assets on the target chain", - "* `recipient_chain` - Chain ID of the target chain", - "* `recipient_address` - Address of the target wallet on the target chain", - "* `batch_id` - Nonce of Wormhole message", - "* `wrap_native` - Whether to wrap native SOL" + }, + { + name: 'updateFeeRecipient', + docs: [ + 'This instruction updates the `fee_recipient` field in the `RedeemerConfig`', + 'account. This instruction is owner-only, meaning that only the owner', + 'of the program (defined in the [Config] account) can update the', + 'fee recipient.', + '', + '# Arguments', + '', + '* `ctx` - `UpdateFeeRecipient` context', + '* `new_fee_recipient` - Pubkey of the new fee recipient.', ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. Acts as the signer for the Token Bridge token", - "transfer. Read-only." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. Send tokens to the contract specified in this", - "account. Funnily enough, the Token Bridge program does not have any", - "requirements for outbound transfers for the recipient chain to be", - "registered. This account provides extra protection against sending", - "tokens to an unregistered Wormhole chain ID. Read-only." - ] - }, - { - "name": "mint", - "isMut": true, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over to the", - "foreign contract. Mutable." - ] - }, - { - "name": "fromTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Payer's associated token account. We may want to make this a generic", - "token account in the future." - ] + accounts: [ + { + name: 'owner', + isMut: false, + isSigner: true, + docs: ['Owner of the program set in the [`RedeemerConfig`] account.'], }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'redeemerConfig', + isMut: true, + isSigner: false, + docs: [ + 'Redeemer Config account, which saves program data useful for other', + 'instructions, specifically for inbound transfers. Also saves the payer', + "of the [`initialize`](crate::initialize) instruction as the program's", + 'owner.', + ], + }, + ], + args: [ + { + name: 'newFeeRecipient', + type: 'publicKey', + }, + ], + }, + { + name: 'transferNativeTokensWithRelay', + docs: [ + 'This instruction is used to transfer native tokens from Solana to a', + 'foreign blockchain. The user can optionally specify a', + '`to_native_token_amount` to swap some of the tokens for the native', + 'asset on the target chain. For a fee, an off-chain relayer will redeem', + 'the transfer on the target chain. If the user is transferring native', + 'SOL, the contract will automatically wrap the lamports into a WSOL.', + '', + '# Arguments', + '', + '* `ctx` - `TransferNativeWithRelay` context', + '* `amount` - Amount of tokens to send', + '* `to_native_token_amount`:', + '- Amount of tokens to swap for native assets on the target chain', + '* `recipient_chain` - Chain ID of the target chain', + '* `recipient_address` - Address of the target wallet on the target chain', + '* `batch_id` - Nonce of Wormhole message', + '* `wrap_native` - Whether to wrap native SOL', + ], + accounts: [ + { + name: 'payer', + isMut: true, + isSigner: true, + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ], + }, + { + name: 'payerSequence', + isMut: true, + isSigner: false, + docs: ["Used to keep track of payer's Wormhole sequence number."], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. Acts as the signer for the Token Bridge token', + 'transfer. Read-only.', + ], + }, + { + name: 'foreignContract', + isMut: false, + isSigner: false, + docs: [ + 'Foreign Contract account. Send tokens to the contract specified in this', + 'account. Funnily enough, the Token Bridge program does not have any', + 'requirements for outbound transfers for the recipient chain to be', + 'registered. This account provides extra protection against sending', + 'tokens to an unregistered Wormhole chain ID. Read-only.', + ], + }, + { + name: 'mint', + isMut: true, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over to the', + 'foreign contract. Mutable.', + ], + }, + { + name: 'fromTokenAccount', + isMut: true, + isSigner: false, + docs: [ + "Payer's associated token account. We may want to make this a generic", + 'token account in the future.', + ], }, { - "name": "relayerFee", - "isMut": false, - "isSigner": false + name: 'registeredToken', + isMut: false, + isSigner: false, }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount', + isMut: true, + isSigner: false, + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged out, the token account", - "will have zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged out, the token account', + 'will have zero balance and can be closed.', + ], }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeCustody", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tokenBridgeCustody', + isMut: true, + isSigner: false, + docs: [ "account that holds this mint's balance. This account needs to be", - "unchecked because a token account may not have been created for this", - "mint yet. Mutable." - ] + 'unchecked because a token account may not have been created for this', + 'mint yet. Mutable.', + ], }, { - "name": "tokenBridgeAuthoritySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeAuthoritySigner', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeCustodySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeCustodySigner', + isMut: false, + isSigner: false, }, { - "name": "wormholeBridge", - "isMut": true, - "isSigner": false + name: 'wormholeBridge', + isMut: true, + isSigner: false, }, { - "name": "wormholeMessage", - "isMut": true, - "isSigner": false, - "docs": [ - "tokens transferred in this account for our program. Mutable." - ] + name: 'wormholeMessage', + isMut: true, + isSigner: false, + docs: [ + 'tokens transferred in this account for our program. Mutable.', + ], }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false + name: 'tokenBridgeEmitter', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeSequence", - "isMut": true, - "isSigner": false + name: 'tokenBridgeSequence', + isMut: true, + isSigner: false, }, { - "name": "wormholeFeeCollector", - "isMut": true, - "isSigner": false + name: 'wormholeFeeCollector', + isMut: true, + isSigner: false, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram', + isMut: false, + isSigner: false, }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram', + isMut: false, + isSigner: false, }, { - "name": "clock", - "isMut": false, - "isSigner": false + name: 'clock', + isMut: false, + isSigner: false, }, { - "name": "rent", - "isMut": false, - "isSigner": false - } + name: 'rent', + isMut: false, + isSigner: false, + }, ], - "args": [ + args: [ { - "name": "amount", - "type": "u64" + name: 'amount', + type: 'u64', }, { - "name": "toNativeTokenAmount", - "type": "u64" + name: 'toNativeTokenAmount', + type: 'u64', }, { - "name": "recipientChain", - "type": "u16" + name: 'recipientChain', + type: 'u16', }, { - "name": "recipientAddress", - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'recipientAddress', + type: { + array: ['u8', 32], + }, }, { - "name": "batchId", - "type": "u32" + name: 'batchId', + type: 'u32', }, { - "name": "wrapNative", - "type": "bool" - } - ] + name: 'wrapNative', + type: 'bool', + }, + ], }, { - "name": "transferWrappedTokensWithRelay", - "docs": [ - "This instruction is used to transfer wrapped tokens from Solana to a", - "foreign blockchain. The user can optionally specify a", - "`to_native_token_amount` to swap some of the tokens for the native", - "assets on the target chain. For a fee, an off-chain relayer will redeem", - "the transfer on the target chain. This instruction should only be called", - "when the user is transferring a wrapped token.", - "", - "# Arguments", - "", - "* `ctx` - `TransferWrappedWithRelay` context", - "* `amount` - Amount of tokens to send", - "* `to_native_token_amount`:", - "- Amount of tokens to swap for native assets on the target chain", - "* `recipient_chain` - Chain ID of the target chain", - "* `recipient_address` - Address of the target wallet on the target chain", - "* `batch_id` - Nonce of Wormhole message" + name: 'transferWrappedTokensWithRelay', + docs: [ + 'This instruction is used to transfer wrapped tokens from Solana to a', + 'foreign blockchain. The user can optionally specify a', + '`to_native_token_amount` to swap some of the tokens for the native', + 'assets on the target chain. For a fee, an off-chain relayer will redeem', + 'the transfer on the target chain. This instruction should only be called', + 'when the user is transferring a wrapped token.', + '', + '# Arguments', + '', + '* `ctx` - `TransferWrappedWithRelay` context', + '* `amount` - Amount of tokens to send', + '* `to_native_token_amount`:', + '- Amount of tokens to swap for native assets on the target chain', + '* `recipient_chain` - Chain ID of the target chain', + '* `recipient_address` - Address of the target wallet on the target chain', + '* `batch_id` - Nonce of Wormhole message', ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Sender Config account. Acts as the Token Bridge sender PDA. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. Send tokens to the contract specified in this", - "account. Funnily enough, the Token Bridge program does not have any", - "requirements for outbound transfers for the recipient chain to be", - "registered. This account provides extra protection against sending", - "tokens to an unregistered Wormhole chain ID. Read-only." - ] - }, - { - "name": "tokenBridgeWrappedMint", - "isMut": true, - "isSigner": false, - "docs": [ - "Token Bridge wrapped mint info. This is the SPL token that will be", - "bridged to the foreign contract. The wrapped mint PDA must agree", - "with the native token's metadata. Mutable." - ] - }, - { - "name": "fromTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Payer's associated token account. We may want to make this a generic", - "token account in the future." - ] + accounts: [ + { + name: 'payer', + isMut: true, + isSigner: true, + docs: ['Payer will pay Wormhole fee to transfer tokens.'], }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'payerSequence', + isMut: true, + isSigner: false, + docs: ["Used to keep track of payer's Wormhole sequence number."], }, { - "name": "relayerFee", - "isMut": false, - "isSigner": false + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Sender Config account. Acts as the Token Bridge sender PDA. Mutable.', + ], }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'foreignContract', + isMut: false, + isSigner: false, + docs: [ + 'Foreign Contract account. Send tokens to the contract specified in this', + 'account. Funnily enough, the Token Bridge program does not have any', + 'requirements for outbound transfers for the recipient chain to be', + 'registered. This account provides extra protection against sending', + 'tokens to an unregistered Wormhole chain ID. Read-only.', + ], + }, + { + name: 'tokenBridgeWrappedMint', + isMut: true, + isSigner: false, + docs: [ + 'Token Bridge wrapped mint info. This is the SPL token that will be', + 'bridged to the foreign contract. The wrapped mint PDA must agree', + "with the native token's metadata. Mutable.", + ], + }, + { + name: 'fromTokenAccount', + isMut: true, + isSigner: false, + docs: [ + "Payer's associated token account. We may want to make this a generic", + 'token account in the future.', + ], + }, + { + name: 'registeredToken', + isMut: false, + isSigner: false, + }, + { + name: 'tmpTokenAccount', + isMut: true, + isSigner: false, + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged out, the token account", - "will have zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged out, the token account', + 'will have zero balance and can be closed.', + ], }, { - "name": "tokenBridgeWrappedMeta", - "isMut": false, - "isSigner": false, - "docs": [ - "about the token from its native chain:", - "* Wormhole Chain ID", + name: 'tokenBridgeWrappedMeta', + isMut: false, + isSigner: false, + docs: [ + 'about the token from its native chain:', + '* Wormhole Chain ID', "* Token's native contract address", - "* Token's native decimals" - ] + "* Token's native decimals", + ], }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeAuthoritySigner", - "isMut": false, - "isSigner": false + name: 'tokenBridgeAuthoritySigner', + isMut: false, + isSigner: false, }, { - "name": "wormholeBridge", - "isMut": true, - "isSigner": false + name: 'wormholeBridge', + isMut: true, + isSigner: false, }, { - "name": "wormholeMessage", - "isMut": true, - "isSigner": false, - "docs": [ - "tokens transferred in this account." - ] + name: 'wormholeMessage', + isMut: true, + isSigner: false, + docs: ['tokens transferred in this account.'], }, { - "name": "tokenBridgeEmitter", - "isMut": false, - "isSigner": false + name: 'tokenBridgeEmitter', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeSequence", - "isMut": true, - "isSigner": false + name: 'tokenBridgeSequence', + isMut: true, + isSigner: false, }, { - "name": "wormholeFeeCollector", - "isMut": true, - "isSigner": false + name: 'wormholeFeeCollector', + isMut: true, + isSigner: false, }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram', + isMut: false, + isSigner: false, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram', + isMut: false, + isSigner: false, }, { - "name": "clock", - "isMut": false, - "isSigner": false + name: 'clock', + isMut: false, + isSigner: false, }, { - "name": "rent", - "isMut": false, - "isSigner": false - } + name: 'rent', + isMut: false, + isSigner: false, + }, ], - "args": [ + args: [ { - "name": "amount", - "type": "u64" + name: 'amount', + type: 'u64', }, { - "name": "toNativeTokenAmount", - "type": "u64" + name: 'toNativeTokenAmount', + type: 'u64', }, { - "name": "recipientChain", - "type": "u16" + name: 'recipientChain', + type: 'u16', }, { - "name": "recipientAddress", - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'recipientAddress', + type: { + array: ['u8', 32], + }, }, { - "name": "batchId", - "type": "u32" - } - ] + name: 'batchId', + type: 'u32', + }, + ], }, { - "name": "completeNativeTransferWithRelay", - "docs": [ - "This instruction is used to redeem token transfers from foreign emitters.", - "It takes custody of the released native tokens and sends the tokens to the", - "encoded `recipient`. It pays the `fee_recipient` in the token", - "denomination. If requested by the user, it will perform a swap with the", - "off-chain relayer to provide the user with lamports. If the token", - "being transferred is WSOL, the contract will unwrap the WSOL and send", - "the lamports to the recipient and pay the relayer in lamports.", - "", - "# Arguments", - "", - "* `ctx` - `CompleteNativeWithRelay` context", - "* `vaa_hash` - Hash of the VAA that triggered the transfer" + name: 'completeNativeTransferWithRelay', + docs: [ + 'This instruction is used to redeem token transfers from foreign emitters.', + 'It takes custody of the released native tokens and sends the tokens to the', + 'encoded `recipient`. It pays the `fee_recipient` in the token', + 'denomination. If requested by the user, it will perform a swap with the', + 'off-chain relayer to provide the user with lamports. If the token', + 'being transferred is WSOL, the contract will unwrap the WSOL and send', + 'the lamports to the recipient and pay the relayer in lamports.', + '', + '# Arguments', + '', + '* `ctx` - `CompleteNativeWithRelay` context', + '* `vaa_hash` - Hash of the VAA that triggered the transfer', ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Redeemer Config account. Acts as the Token Bridge redeemer, which signs", - "for the complete transfer instruction. Read-only." - ] - }, - { - "name": "feeRecipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Fee recipient's token account. Must be an associated token account. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. The registered contract specified in this", + accounts: [ + { + name: 'payer', + isMut: true, + isSigner: true, + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Redeemer Config account. Acts as the Token Bridge redeemer, which signs', + 'for the complete transfer instruction. Read-only.', + ], + }, + { + name: 'feeRecipientTokenAccount', + isMut: true, + isSigner: false, + docs: [ + "Fee recipient's token account. Must be an associated token account. Mutable.", + ], + }, + { + name: 'foreignContract', + isMut: false, + isSigner: false, + docs: [ + 'Foreign Contract account. The registered contract specified in this', "account must agree with the target address for the Token Bridge's token", - "transfer. Read-only." - ] + 'transfer. Read-only.', + ], }, { - "name": "mint", - "isMut": false, - "isSigner": false, - "docs": [ - "Mint info. This is the SPL token that will be bridged over from the", - "foreign contract. This must match the token address specified in the", - "signed Wormhole message. Read-only." - ] + name: 'mint', + isMut: false, + isSigner: false, + docs: [ + 'Mint info. This is the SPL token that will be bridged over from the', + 'foreign contract. This must match the token address specified in the', + 'signed Wormhole message. Read-only.', + ], }, { - "name": "recipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Recipient associated token account. The recipient authority check", - "is necessary to ensure that the recipient is the intended recipient", - "of the bridged tokens. Mutable." - ] + name: 'recipientTokenAccount', + isMut: true, + isSigner: false, + docs: [ + 'Recipient associated token account. The recipient authority check', + 'is necessary to ensure that the recipient is the intended recipient', + 'of the bridged tokens. Mutable.', + ], }, { - "name": "recipient", - "isMut": true, - "isSigner": false, - "docs": [ - "transaction. This instruction verifies that the recipient key", - "passed in this context matches the intended recipient in the vaa." - ] + name: 'recipient', + isMut: true, + isSigner: false, + docs: [ + 'transaction. This instruction verifies that the recipient key', + 'passed in this context matches the intended recipient in the vaa.', + ], }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'registeredToken', + isMut: false, + isSigner: false, }, { - "name": "nativeRegisteredToken", - "isMut": false, - "isSigner": false + name: 'nativeRegisteredToken', + isMut: false, + isSigner: false, }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount', + isMut: true, + isSigner: false, + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged in, the tokens will be", - "transferred to the destination token accounts. This account will have", - "zero balance and can be closed." - ] + 'tokens. When the tokens are finally bridged in, the tokens will be', + 'transferred to the destination token accounts. This account will have', + 'zero balance and can be closed.', + ], }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig', + isMut: false, + isSigner: false, }, { - "name": "vaa", - "isMut": false, - "isSigner": false, - "docs": [ - "Verified Wormhole message account. The Wormhole program verified", - "signatures and posted the account data here. Read-only." - ] + name: 'vaa', + isMut: false, + isSigner: false, + docs: [ + 'Verified Wormhole message account. The Wormhole program verified', + 'signatures and posted the account data here. Read-only.', + ], }, { - "name": "tokenBridgeClaim", - "isMut": true, - "isSigner": false, - "docs": [ - "is true if the bridged assets have been claimed. If the transfer has", - "not been redeemed, this account will not exist yet.", - "", + name: 'tokenBridgeClaim', + isMut: true, + isSigner: false, + docs: [ + 'is true if the bridged assets have been claimed. If the transfer has', + 'not been redeemed, this account will not exist yet.', + '', "NOTE: The Token Bridge program's claim account is only initialized when", - "a transfer is redeemed (and the boolean value `true` is written as", - "its data).", - "", - "The Token Bridge program will automatically fail if this transfer", - "is redeemed again. But we choose to short-circuit the failure as the", - "first evaluation of this instruction." - ] + 'a transfer is redeemed (and the boolean value `true` is written as', + 'its data).', + '', + 'The Token Bridge program will automatically fail if this transfer', + 'is redeemed again. But we choose to short-circuit the failure as the', + 'first evaluation of this instruction.', + ], + }, + { + name: 'tokenBridgeForeignEndpoint', + isMut: false, + isSigner: false, + docs: [ + 'endpoint per chain, but the PDA allows for multiple endpoints for each', + 'chain! We store the proper endpoint for the emitter chain.', + ], }, { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "endpoint per chain, but the PDA allows for multiple endpoints for each", - "chain! We store the proper endpoint for the emitter chain." - ] + name: 'tokenBridgeCustody', + isMut: true, + isSigner: false, + docs: ["account that holds this mint's balance."], }, { - "name": "tokenBridgeCustody", - "isMut": true, - "isSigner": false, - "docs": [ - "account that holds this mint's balance." - ] + name: 'tokenBridgeCustodySigner', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeCustodySigner", - "isMut": false, - "isSigner": false + name: 'wormholeProgram', + isMut: false, + isSigner: false, }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram', + isMut: false, + isSigner: false, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'rent', + isMut: false, + isSigner: false, }, + ], + args: [ { - "name": "rent", - "isMut": false, - "isSigner": false - } + name: 'vaaHash', + type: { + array: ['u8', 32], + }, + }, ], - "args": [ - { - "name": "vaaHash", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - }, - { - "name": "completeWrappedTransferWithRelay", - "docs": [ - "This instruction is used to redeem token transfers from foreign emitters.", - "It takes custody of the minted wrapped tokens and sends the tokens to the", - "encoded `recipient`. It pays the `fee_recipient` in the wrapped-token", - "denomination. If requested by the user, it will perform a swap with the", - "off-chain relayer to provide the user with lamports.", - "", - "# Arguments", - "", - "* `ctx` - `CompleteWrappedWithRelay` context", - "* `vaa_hash` - Hash of the VAA that triggered the transfer" + }, + { + name: 'completeWrappedTransferWithRelay', + docs: [ + 'This instruction is used to redeem token transfers from foreign emitters.', + 'It takes custody of the minted wrapped tokens and sends the tokens to the', + 'encoded `recipient`. It pays the `fee_recipient` in the wrapped-token', + 'denomination. If requested by the user, it will perform a swap with the', + 'off-chain relayer to provide the user with lamports.', + '', + '# Arguments', + '', + '* `ctx` - `CompleteWrappedWithRelay` context', + '* `vaa_hash` - Hash of the VAA that triggered the transfer', ], - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "Payer will pay Wormhole fee to transfer tokens and create temporary", - "token account." - ] - }, - { - "name": "config", - "isMut": false, - "isSigner": false, - "docs": [ - "Redeemer Config account. Acts as the Token Bridge redeemer, which signs", - "for the complete transfer instruction. Read-only." - ] - }, - { - "name": "feeRecipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Fee recipient's token account. Must be an associated token account. Mutable." - ] - }, - { - "name": "foreignContract", - "isMut": false, - "isSigner": false, - "docs": [ - "Foreign Contract account. The registered contract specified in this", + accounts: [ + { + name: 'payer', + isMut: true, + isSigner: true, + docs: [ + 'Payer will pay Wormhole fee to transfer tokens and create temporary', + 'token account.', + ], + }, + { + name: 'config', + isMut: false, + isSigner: false, + docs: [ + 'Redeemer Config account. Acts as the Token Bridge redeemer, which signs', + 'for the complete transfer instruction. Read-only.', + ], + }, + { + name: 'feeRecipientTokenAccount', + isMut: true, + isSigner: false, + docs: [ + "Fee recipient's token account. Must be an associated token account. Mutable.", + ], + }, + { + name: 'foreignContract', + isMut: false, + isSigner: false, + docs: [ + 'Foreign Contract account. The registered contract specified in this', "account must agree with the target address for the Token Bridge's token", - "transfer. Read-only." - ] + 'transfer. Read-only.', + ], }, { - "name": "tokenBridgeWrappedMint", - "isMut": true, - "isSigner": false, - "docs": [ - "Token Bridge wrapped mint info. This is the SPL token that will be", - "bridged from the foreign contract. The wrapped mint PDA must agree", - "with the native token's metadata in the wormhole message. Mutable." - ] + name: 'tokenBridgeWrappedMint', + isMut: true, + isSigner: false, + docs: [ + 'Token Bridge wrapped mint info. This is the SPL token that will be', + 'bridged from the foreign contract. The wrapped mint PDA must agree', + "with the native token's metadata in the wormhole message. Mutable.", + ], }, { - "name": "recipientTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ - "Recipient associated token account. The recipient authority check", - "is necessary to ensure that the recipient is the intended recipient", - "of the bridged tokens. Mutable." - ] + name: 'recipientTokenAccount', + isMut: true, + isSigner: false, + docs: [ + 'Recipient associated token account. The recipient authority check', + 'is necessary to ensure that the recipient is the intended recipient', + 'of the bridged tokens. Mutable.', + ], }, { - "name": "recipient", - "isMut": true, - "isSigner": false, - "docs": [ - "transaction. This instruction verifies that the recipient key", - "passed in this context matches the intended recipient in the vaa." - ] + name: 'recipient', + isMut: true, + isSigner: false, + docs: [ + 'transaction. This instruction verifies that the recipient key', + 'passed in this context matches the intended recipient in the vaa.', + ], }, { - "name": "registeredToken", - "isMut": false, - "isSigner": false + name: 'registeredToken', + isMut: false, + isSigner: false, }, { - "name": "nativeRegisteredToken", - "isMut": false, - "isSigner": false + name: 'nativeRegisteredToken', + isMut: false, + isSigner: false, }, { - "name": "tmpTokenAccount", - "isMut": true, - "isSigner": false, - "docs": [ + name: 'tmpTokenAccount', + isMut: true, + isSigner: false, + docs: [ "Program's temporary token account. This account is created before the", "instruction is invoked to temporarily take custody of the payer's", - "tokens. When the tokens are finally bridged in, the tokens will be", - "transferred to the destination token accounts. This account will have", - "zero balance and can be closed." - ] - }, - { - "name": "tokenBridgeWrappedMeta", - "isMut": false, - "isSigner": false, - "docs": [ - "about the token from its native chain:", - "* Wormhole Chain ID", + 'tokens. When the tokens are finally bridged in, the tokens will be', + 'transferred to the destination token accounts. This account will have', + 'zero balance and can be closed.', + ], + }, + { + name: 'tokenBridgeWrappedMeta', + isMut: false, + isSigner: false, + docs: [ + 'about the token from its native chain:', + '* Wormhole Chain ID', "* Token's native contract address", - "* Token's native decimals" - ] + "* Token's native decimals", + ], }, { - "name": "tokenBridgeConfig", - "isMut": false, - "isSigner": false + name: 'tokenBridgeConfig', + isMut: false, + isSigner: false, }, { - "name": "vaa", - "isMut": false, - "isSigner": false, - "docs": [ - "Verified Wormhole message account. The Wormhole program verified", - "signatures and posted the account data here. Read-only." - ] + name: 'vaa', + isMut: false, + isSigner: false, + docs: [ + 'Verified Wormhole message account. The Wormhole program verified', + 'signatures and posted the account data here. Read-only.', + ], }, { - "name": "tokenBridgeClaim", - "isMut": true, - "isSigner": false, - "docs": [ - "is true if the bridged assets have been claimed. If the transfer has", - "not been redeemed, this account will not exist yet.", - "", + name: 'tokenBridgeClaim', + isMut: true, + isSigner: false, + docs: [ + 'is true if the bridged assets have been claimed. If the transfer has', + 'not been redeemed, this account will not exist yet.', + '', "NOTE: The Token Bridge program's claim account is only initialized when", - "a transfer is redeemed (and the boolean value `true` is written as", - "its data).", - "", - "The Token Bridge program will automatically fail if this transfer", - "is redeemed again. But we choose to short-circuit the failure as the", - "first evaluation of this instruction." - ] + 'a transfer is redeemed (and the boolean value `true` is written as', + 'its data).', + '', + 'The Token Bridge program will automatically fail if this transfer', + 'is redeemed again. But we choose to short-circuit the failure as the', + 'first evaluation of this instruction.', + ], }, { - "name": "tokenBridgeForeignEndpoint", - "isMut": false, - "isSigner": false, - "docs": [ - "endpoint per chain, but the PDA allows for multiple endpoints for each", - "chain! We store the proper endpoint for the emitter chain." - ] + name: 'tokenBridgeForeignEndpoint', + isMut: false, + isSigner: false, + docs: [ + 'endpoint per chain, but the PDA allows for multiple endpoints for each', + 'chain! We store the proper endpoint for the emitter chain.', + ], }, { - "name": "tokenBridgeMintAuthority", - "isMut": false, - "isSigner": false + name: 'tokenBridgeMintAuthority', + isMut: false, + isSigner: false, }, { - "name": "wormholeProgram", - "isMut": false, - "isSigner": false + name: 'wormholeProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenBridgeProgram", - "isMut": false, - "isSigner": false + name: 'tokenBridgeProgram', + isMut: false, + isSigner: false, }, { - "name": "systemProgram", - "isMut": false, - "isSigner": false + name: 'systemProgram', + isMut: false, + isSigner: false, }, { - "name": "tokenProgram", - "isMut": false, - "isSigner": false + name: 'tokenProgram', + isMut: false, + isSigner: false, }, { - "name": "rent", - "isMut": false, - "isSigner": false - } + name: 'rent', + isMut: false, + isSigner: false, + }, ], - "args": [ - { - "name": "vaaHash", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - } + args: [ + { + name: 'vaaHash', + type: { + array: ['u8', 32], + }, + }, + ], + }, ], - "accounts": [ + accounts: [ { - "name": "foreignContract", - "docs": [ - "Foreign emitter account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'foreignContract', + docs: ['Foreign emitter account data.'], + type: { + kind: 'struct', + fields: [ { - "name": "chain", - "docs": [ - "Emitter chain. Cannot equal `1` (Solana's Chain ID)." - ], - "type": "u16" + name: 'chain', + docs: ["Emitter chain. Cannot equal `1` (Solana's Chain ID)."], + type: 'u16', }, { - "name": "address", - "docs": [ - "Emitter address. Cannot be zero address." - ], - "type": { - "array": [ - "u8", - 32 - ] - } + name: 'address', + docs: ['Emitter address. Cannot be zero address.'], + type: { + array: ['u8', 32], + }, + }, + { + name: 'tokenBridgeForeignEndpoint', + docs: ["Token Bridge program's foreign endpoint account key."], + type: 'publicKey', }, { - "name": "tokenBridgeForeignEndpoint", - "docs": [ - "Token Bridge program's foreign endpoint account key." + name: 'fee', + docs: [ + 'The fee that is paid to the `fee_recipient` upon redeeming a transfer.', + 'This value is set in terms of USD and scaled by the `relayer_fee_precision`.', + 'For example, if the `relayer_fee_precision` is `100000000` and the intended', + 'fee is $5, then the `fee` value should be `500000000`.', ], - "type": "publicKey" - } - ] - } + type: 'u64', + }, + ], + }, }, { - "name": "ownerConfig", - "docs": [ - "Owner account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'ownerConfig', + docs: ['Owner account data.'], + type: { + kind: 'struct', + fields: [ { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + name: 'owner', + docs: ["Program's owner."], + type: 'publicKey', }, { - "name": "assistant", - "docs": [ - "Program's assistant. Can be used to update the relayer fee and swap rate." + name: 'assistant', + docs: [ + "Program's assistant. Can be used to update the relayer fee and swap rate.", ], - "type": "publicKey" + type: 'publicKey', }, { - "name": "pendingOwner", - "docs": [ - "Intermediate storage for the pending owner. Is used to transfer ownership." + name: 'pendingOwner', + docs: [ + 'Intermediate storage for the pending owner. Is used to transfer ownership.', ], - "type": { - "option": "publicKey" - } - } - ] - } - }, - { - "name": "redeemerConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + type: { + option: 'publicKey', + }, }, + ], + }, + }, + { + name: 'redeemerConfig', + type: { + kind: 'struct', + fields: [ { - "name": "bump", - "docs": [ - "PDA bump." - ], - "type": "u8" + name: 'owner', + docs: ["Program's owner."], + type: 'publicKey', }, { - "name": "relayerFeePrecision", - "docs": [ - "Relayer fee and swap rate precision." - ], - "type": "u32" + name: 'bump', + docs: ['PDA bump.'], + type: 'u8', }, { - "name": "swapRatePrecision", - "type": "u32" + name: 'relayerFeePrecision', + docs: ['Relayer fee and swap rate precision.'], + type: 'u32', }, { - "name": "feeRecipient", - "docs": [ - "Recipient of all relayer fees and swap proceeds." - ], - "type": "publicKey" - } - ] - } + name: 'feeRecipient', + docs: ['Recipient of all relayer fees and swap proceeds.'], + type: 'publicKey', + }, + ], + }, }, { - "name": "registeredToken", - "docs": [ - "Registered token account data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'registeredToken', + docs: ['Registered token account data.'], + type: { + kind: 'struct', + fields: [ { - "name": "swapRate", - "docs": [ - "Token swap rate. The swap rate is the USD conversion rate of the token." + name: 'swapRate', + docs: [ + 'Token swap rate. The swap rate is the USD conversion rate of the token.', ], - "type": "u64" + type: 'u64', }, { - "name": "maxNativeSwapAmount", - "docs": [ - "Maximum amount of native SOL the contract will swap for each transfer." + name: 'maxNativeSwapAmount', + docs: [ + 'Maximum amount of native SOL the contract will swap for each transfer.', ], - "type": "u64" + type: 'u64', }, - { - "name": "isRegistered", - "docs": [ - "Whether the token is registered." - ], - "type": "bool" - } - ] - } + ], + }, }, { - "name": "relayerFee", - "docs": [ - "Outbound relayer fee data." - ], - "type": { - "kind": "struct", - "fields": [ + name: 'senderConfig', + type: { + kind: 'struct', + fields: [ { - "name": "chain", - "docs": [ - "Emitter chain. Cannot equal `0` or `1` (Solana's Chain ID)." - ], - "type": "u16" + name: 'owner', + docs: ["Program's owner."], + type: 'publicKey', }, { - "name": "fee", - "docs": [ - "Relayer fee in USD terms." - ], - "type": "u64" - } - ] - } - }, - { - "name": "senderConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "owner", - "docs": [ - "Program's owner." - ], - "type": "publicKey" + name: 'bump', + docs: ['PDA bump.'], + type: 'u8', }, { - "name": "bump", - "docs": [ - "PDA bump." - ], - "type": "u8" + name: 'tokenBridge', + docs: ["Token Bridge program's relevant addresses."], + type: { + defined: 'OutboundTokenBridgeAddresses', + }, }, { - "name": "tokenBridge", - "docs": [ - "Token Bridge program's relevant addresses." - ], - "type": { - "defined": "OutboundTokenBridgeAddresses" - } + name: 'relayerFeePrecision', + docs: ['Relayer fee and swap rate precision.'], + type: 'u32', }, { - "name": "relayerFeePrecision", - "docs": [ - "Relayer fee and swap rate precision." - ], - "type": "u32" + name: 'paused', + docs: ['Boolean indicating whether outbound transfers are paused.'], + type: 'bool', }, + ], + }, + }, + { + name: 'signerSequence', + type: { + kind: 'struct', + fields: [ { - "name": "swapRatePrecision", - "type": "u32" + name: 'value', + type: 'u64', }, - { - "name": "paused", - "docs": [ - "Boolean indicating whether outbound transfers are paused." - ], - "type": "bool" - } - ] - } - } + ], + }, + }, ], - "types": [ + types: [ { - "name": "OutboundTokenBridgeAddresses", - "type": { - "kind": "struct", - "fields": [ + name: 'OutboundTokenBridgeAddresses', + type: { + kind: 'struct', + fields: [ { - "name": "sequence", - "type": "publicKey" - } - ] - } - }, - { - "name": "TokenBridgeRelayerMessage", - "docs": [ - "Expected message types for this program. Only valid payloads are:", - "* `TransferWithRelay`: Payload ID == 1.", - "", - "Payload IDs are encoded as u8." + name: 'sequence', + type: 'publicKey', + }, + ], + }, + }, + { + name: 'TokenBridgeRelayerMessage', + docs: [ + 'Expected message types for this program. Only valid payloads are:', + '* `TransferWithRelay`: Payload ID == 1.', + '', + 'Payload IDs are encoded as u8.', ], - "type": { - "kind": "enum", - "variants": [ + type: { + kind: 'enum', + variants: [ { - "name": "TransferWithRelay", - "fields": [ + name: 'TransferWithRelay', + fields: [ { - "name": "target_relayer_fee", - "type": "u64" + name: 'target_relayer_fee', + type: 'u64', }, { - "name": "to_native_token_amount", - "type": "u64" + name: 'to_native_token_amount', + type: 'u64', }, { - "name": "recipient", - "type": { - "array": [ - "u8", - 32 - ] - } - } - ] - } - ] - } - } + name: 'recipient', + type: { + array: ['u8', 32], + }, + }, + ], + }, + ], + }, + }, ], - "errors": [ + errors: [ { - "code": 6000, - "name": "InvalidWormholeBridge", - "msg": "InvalidWormholeBridge" + code: 6000, + name: 'InvalidWormholeBridge', + msg: 'InvalidWormholeBridge', }, { - "code": 6001, - "name": "InvalidWormholeFeeCollector", - "msg": "InvalidWormholeFeeCollector" + code: 6001, + name: 'InvalidWormholeFeeCollector', + msg: 'InvalidWormholeFeeCollector', }, { - "code": 6002, - "name": "OwnerOnly", - "msg": "OwnerOnly" + code: 6002, + name: 'OwnerOnly', + msg: 'OwnerOnly', }, { - "code": 6003, - "name": "OutboundTransfersPaused", - "msg": "OutboundTransfersPaused" + code: 6003, + name: 'OutboundTransfersPaused', + msg: 'OutboundTransfersPaused', }, { - "code": 6004, - "name": "OwnerOrAssistantOnly", - "msg": "OwnerOrAssistantOnly" + code: 6004, + name: 'OwnerOrAssistantOnly', + msg: 'OwnerOrAssistantOnly', }, { - "code": 6005, - "name": "NotPendingOwner", - "msg": "NotPendingOwner" + code: 6005, + name: 'NotPendingOwner', + msg: 'NotPendingOwner', }, { - "code": 6006, - "name": "AlreadyTheOwner", - "msg": "AlreadyTheOwner" + code: 6006, + name: 'AlreadyTheOwner', + msg: 'AlreadyTheOwner', }, { - "code": 6007, - "name": "AlreadyTheAssistant", - "msg": "AlreadyTheAssistant" + code: 6007, + name: 'AlreadyTheAssistant', + msg: 'AlreadyTheAssistant', }, { - "code": 6008, - "name": "AlreadyTheFeeRecipient", - "msg": "AlreadyTheFeeRecipient" + code: 6008, + name: 'AlreadyTheFeeRecipient', + msg: 'AlreadyTheFeeRecipient', }, { - "code": 6009, - "name": "BumpNotFound", - "msg": "BumpNotFound" + code: 6009, + name: 'BumpNotFound', + msg: 'BumpNotFound', }, { - "code": 6010, - "name": "FailedToMakeImmutable", - "msg": "FailedToMakeImmutable" + code: 6010, + name: 'FailedToMakeImmutable', + msg: 'FailedToMakeImmutable', }, { - "code": 6011, - "name": "InvalidForeignContract", - "msg": "InvalidForeignContract" + code: 6011, + name: 'InvalidForeignContract', + msg: 'InvalidForeignContract', }, { - "code": 6012, - "name": "ZeroBridgeAmount", - "msg": "ZeroBridgeAmount" + code: 6012, + name: 'ZeroBridgeAmount', + msg: 'ZeroBridgeAmount', }, { - "code": 6013, - "name": "InvalidToNativeAmount", - "msg": "InvalidToNativeAmount" + code: 6013, + name: 'InvalidToNativeAmount', + msg: 'InvalidToNativeAmount', }, { - "code": 6014, - "name": "NativeMintRequired", - "msg": "NativeMintRequired" + code: 6014, + name: 'NativeMintRequired', + msg: 'NativeMintRequired', }, { - "code": 6015, - "name": "SwapsNotAllowedForNativeMint", - "msg": "SwapsNotAllowedForNativeMint" + code: 6015, + name: 'SwapsNotAllowedForNativeMint', + msg: 'SwapsNotAllowedForNativeMint', }, { - "code": 6016, - "name": "InvalidTokenBridgeConfig", - "msg": "InvalidTokenBridgeConfig" + code: 6016, + name: 'InvalidTokenBridgeConfig', + msg: 'InvalidTokenBridgeConfig', }, { - "code": 6017, - "name": "InvalidTokenBridgeAuthoritySigner", - "msg": "InvalidTokenBridgeAuthoritySigner" + code: 6017, + name: 'InvalidTokenBridgeAuthoritySigner', + msg: 'InvalidTokenBridgeAuthoritySigner', }, { - "code": 6018, - "name": "InvalidTokenBridgeCustodySigner", - "msg": "InvalidTokenBridgeCustodySigner" + code: 6018, + name: 'InvalidTokenBridgeCustodySigner', + msg: 'InvalidTokenBridgeCustodySigner', }, { - "code": 6019, - "name": "InvalidTokenBridgeEmitter", - "msg": "InvalidTokenBridgeEmitter" + code: 6019, + name: 'InvalidTokenBridgeEmitter', + msg: 'InvalidTokenBridgeEmitter', }, { - "code": 6020, - "name": "InvalidTokenBridgeSequence", - "msg": "InvalidTokenBridgeSequence" + code: 6020, + name: 'InvalidTokenBridgeSequence', + msg: 'InvalidTokenBridgeSequence', }, { - "code": 6021, - "name": "InvalidRecipient", - "msg": "InvalidRecipient" + code: 6021, + name: 'InvalidRecipient', + msg: 'InvalidRecipient', }, { - "code": 6022, - "name": "InvalidTransferToChain", - "msg": "InvalidTransferToChain" + code: 6022, + name: 'InvalidTransferToChain', + msg: 'InvalidTransferToChain', }, { - "code": 6023, - "name": "InvalidTransferTokenChain", - "msg": "InvalidTransferTokenChain" + code: 6023, + name: 'InvalidTransferTokenChain', + msg: 'InvalidTransferTokenChain', }, { - "code": 6024, - "name": "InvalidPrecision", - "msg": "InvalidPrecision" + code: 6024, + name: 'InvalidPrecision', + msg: 'InvalidPrecision', }, { - "code": 6025, - "name": "InvalidTransferToAddress", - "msg": "InvalidTransferToAddress" + code: 6025, + name: 'InvalidTransferToAddress', + msg: 'InvalidTransferToAddress', }, { - "code": 6026, - "name": "AlreadyRedeemed", - "msg": "AlreadyRedeemed" + code: 6026, + name: 'AlreadyRedeemed', + msg: 'AlreadyRedeemed', }, { - "code": 6027, - "name": "InvalidTokenBridgeForeignEndpoint", - "msg": "InvalidTokenBridgeForeignEndpoint" + code: 6027, + name: 'InvalidTokenBridgeForeignEndpoint', + msg: 'InvalidTokenBridgeForeignEndpoint', }, { - "code": 6028, - "name": "InvalidTokenBridgeMintAuthority", - "msg": "InvalidTokenBridgeMintAuthority" + code: 6028, + name: 'InvalidTokenBridgeMintAuthority', + msg: 'InvalidTokenBridgeMintAuthority', }, { - "code": 6029, - "name": "InvalidPublicKey", - "msg": "InvalidPublicKey" + code: 6029, + name: 'InvalidPublicKey', + msg: 'InvalidPublicKey', }, { - "code": 6030, - "name": "ZeroSwapRate", - "msg": "ZeroSwapRate" + code: 6030, + name: 'ZeroSwapRate', + msg: 'ZeroSwapRate', }, { - "code": 6031, - "name": "TokenNotRegistered", - "msg": "TokenNotRegistered" + code: 6031, + name: 'TokenNotRegistered', + msg: 'TokenNotRegistered', }, { - "code": 6032, - "name": "ChainNotRegistered", - "msg": "ChainNotRegistered" + code: 6032, + name: 'ChainNotRegistered', + msg: 'ChainNotRegistered', }, { - "code": 6033, - "name": "TokenAlreadyRegistered", - "msg": "TokenAlreadyRegistered" + code: 6033, + name: 'TokenAlreadyRegistered', + msg: 'TokenAlreadyRegistered', }, { - "code": 6034, - "name": "FeeCalculationError", - "msg": "TokenFeeCalculationError" + code: 6034, + name: 'FeeCalculationError', + msg: 'TokenFeeCalculationError', }, { - "code": 6035, - "name": "InvalidSwapCalculation", - "msg": "InvalidSwapCalculation" + code: 6035, + name: 'InvalidSwapCalculation', + msg: 'InvalidSwapCalculation', }, { - "code": 6036, - "name": "InsufficientFunds", - "msg": "InsufficientFunds" - } - ] + code: 6036, + name: 'InsufficientFunds', + msg: 'InsufficientFunds', + }, + ], }; diff --git a/wormhole-connect/public/index.html b/wormhole-connect/public/index.html index 2d98dcd1b..a5a8c3c34 100644 --- a/wormhole-connect/public/index.html +++ b/wormhole-connect/public/index.html @@ -15,7 +15,7 @@ -
- + +
diff --git a/wormhole-connect/src/utils/routes/bridge.ts b/wormhole-connect/src/utils/routes/bridge.ts index c29829334..710182a62 100644 --- a/wormhole-connect/src/utils/routes/bridge.ts +++ b/wormhole-connect/src/utils/routes/bridge.ts @@ -33,15 +33,6 @@ import { isCosmWasmChain } from '../cosmos'; import { fetchVaa } from '../vaa'; import { hexlify } from 'ethers/lib/utils.js'; -export interface BridgePreviewParams { - destToken: TokenConfig; - sourceGasToken: string; - destinationGasToken: string; - receiveAmount: number; - sendingGasEst: string; - destGasEst: string; -} - export class BridgeRoute extends BaseRoute { readonly NATIVE_GAS_DROPOFF_SUPPORTED: boolean = false; readonly AUTOMATIC_DEPOSIT: boolean = false;