Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace solana

Index

Type aliases

SignTransaction

SignTransaction: (transaction: Transaction) => Promise<Transaction>

Type declaration

    • (transaction: Transaction): Promise<Transaction>
    • Resembles WalletContextState and Anchor's NodeWallet's signTransaction function signature

      Parameters

      • transaction: Transaction

      Returns Promise<Transaction>

Variables

Const ETHEREUM_KEY_LENGTH

ETHEREUM_KEY_LENGTH: 20 = 20

Const SIGNATURE_LENGTH

SIGNATURE_LENGTH: 65 = 65

Const TOKEN_METADATA_PROGRAM_ID

TOKEN_METADATA_PROGRAM_ID: PublicKey = ...

Functions

createBridgeFeeTransferInstruction

  • createBridgeFeeTransferInstruction(connection: Connection, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, commitment?: Commitment): Promise<TransactionInstruction>

createPostVaaInstructionSolana

  • createPostVaaInstructionSolana(wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, vaa: SignedVaa | ParsedVaa, signatureSet: PublicKeyInitData): TransactionInstruction

createReadOnlyProvider

  • createReadOnlyProvider(connection?: Connection): Provider | undefined

createSecp256k1Instruction

  • createSecp256k1Instruction(signatures: Buffer[], keys: Buffer[], message: Buffer): TransactionInstruction
  • Create {@link TransactionInstruction} for {@link Secp256k1Program}.

    Parameters

    • signatures: Buffer[]

      65-byte signatures (64 bytes + 1 byte recovery id)

    • keys: Buffer[]

      20-byte ethereum public keys

    • message: Buffer

      32-byte hash

    Returns TransactionInstruction

    Solana instruction for Secp256k1 program

createVerifySignaturesInstructionsSolana

  • createVerifySignaturesInstructionsSolana(connection: Connection, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, vaa: SignedVaa | ParsedVaa, signatureSet: PublicKeyInitData, commitment?: Commitment): Promise<TransactionInstruction[]>
  • This is used in {@link createPostSignedVaaTransactions}'s initial transactions.

    Signatures are batched in groups of 7 due to instruction data limits. These signatures are passed through to the Secp256k1 program to verify that the guardian public keys can be recovered. This instruction is paired with verify_signatures to validate the pubkey recovery.

    There are at most three pairs of instructions created.

    https://github.com/certusone/wormhole/blob/main/solana/bridge/program/src/api/verify_signature.rs

    Parameters

    • connection: Connection

      Solana web3 connection

    • wormholeProgramId: PublicKeyInitData

      wormhole program address

    • payer: PublicKeyInitData

      transaction signer address

    • vaa: SignedVaa | ParsedVaa

      either signed VAA bytes or parsed VAA (use parseVaa on signed VAA)

    • signatureSet: PublicKeyInitData

      address to account of verified signatures

    • Optional commitment: Commitment

    Returns Promise<TransactionInstruction[]>

deriveAddress

  • deriveAddress(seeds: (Buffer | Uint8Array)[], programId: PublicKeyInitData): PublicKey
  • Find valid program address. See {@link PublicKey.findProgramAddressSync} for details.

    Parameters

    • seeds: (Buffer | Uint8Array)[]

      seeds for PDA

    • programId: PublicKeyInitData

      program address

    Returns PublicKey

    PDA

deriveTokenMetadataKey

  • deriveTokenMetadataKey(mint: PublicKeyInitData): PublicKey

deriveUpgradeableProgramKey

  • deriveUpgradeableProgramKey(programId: PublicKeyInitData): PublicKey

getAccountData

  • getAccountData(info: AccountInfo<Buffer> | null): Buffer
  • Get serialized data from account

    Parameters

    • info: AccountInfo<Buffer> | null

      Solana AccountInfo

    Returns Buffer

    serialized data as Buffer

getCompleteTransferNativeWithPayloadCpiAccounts

  • Generate accounts needed to perform complete_native_with_payload instruction as cross-program invocation.

    Note: toFeesTokenAccount is the same as toTokenAccount. For your program, you only need to pass your toTokenAccount into the complete transfer instruction for the toFeesTokenAccount.

    Parameters

    • tokenBridgeProgramId: PublicKeyInitData
    • wormholeProgramId: PublicKeyInitData
    • payer: PublicKeyInitData
    • vaa: SignedVaa | ParsedTokenTransferVaa
    • toTokenAccount: PublicKeyInitData

    Returns CompleteTransferNativeWithPayloadCpiAccounts

getCompleteTransferWrappedWithPayloadCpiAccounts

  • Generate accounts needed to perform complete_wrapped_with_payload instruction as cross-program invocation.

    Note: toFeesTokenAccount is the same as toTokenAccount. For your program, you only need to pass your toTokenAccount into the complete transfer instruction for the toFeesTokenAccount.

    Parameters

    • tokenBridgeProgramId: PublicKeyInitData
    • wormholeProgramId: PublicKeyInitData
    • payer: PublicKeyInitData
    • vaa: SignedVaa | ParsedTokenTransferVaa
    • toTokenAccount: PublicKeyInitData

    Returns CompleteTransferWrappedWithPayloadCpiAccounts

getPostMessageCpiAccounts

  • getPostMessageCpiAccounts(cpiProgramId: PublicKeyInitData, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, message: PublicKeyInitData): PostMessageCpiAccounts
  • Generate accounts needed to perform post_message instruction as cross-program invocation.

    Parameters

    • cpiProgramId: PublicKeyInitData
    • wormholeProgramId: PublicKeyInitData
    • payer: PublicKeyInitData
    • message: PublicKeyInitData

    Returns PostMessageCpiAccounts

getTokenBridgeDerivedAccounts

  • getTokenBridgeDerivedAccounts(cpiProgramId: PublicKeyInitData, tokenBridgeProgramId: PublicKeyInitData, wormholeProgramId: PublicKeyInitData): TokenBridgeDerivedAccounts

getTransferNativeWithPayloadCpiAccounts

  • getTransferNativeWithPayloadCpiAccounts(cpiProgramId: PublicKeyInitData, tokenBridgeProgramId: PublicKeyInitData, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, message: PublicKeyInitData, fromTokenAccount: PublicKeyInitData, mint: PublicKeyInitData): TransferNativeWithPayloadCpiAccounts
  • Generate accounts needed to perform transfer_wrapped_with_payload instruction as cross-program invocation.

    Parameters

    • cpiProgramId: PublicKeyInitData
    • tokenBridgeProgramId: PublicKeyInitData
    • wormholeProgramId: PublicKeyInitData
    • payer: PublicKeyInitData
    • message: PublicKeyInitData
    • fromTokenAccount: PublicKeyInitData
    • mint: PublicKeyInitData

    Returns TransferNativeWithPayloadCpiAccounts

getTransferWrappedWithPayloadCpiAccounts

  • getTransferWrappedWithPayloadCpiAccounts(cpiProgramId: PublicKeyInitData, tokenBridgeProgramId: PublicKeyInitData, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, message: PublicKeyInitData, fromTokenAccount: PublicKeyInitData, tokenChain: number, tokenAddress: Buffer | Uint8Array, fromTokenAccountOwner?: PublicKeyInitData): TransferWrappedWithPayloadCpiAccounts
  • Generate accounts needed to perform transfer_wrapped_with_payload instruction as cross-program invocation.

    Parameters

    • cpiProgramId: PublicKeyInitData
    • tokenBridgeProgramId: PublicKeyInitData
    • wormholeProgramId: PublicKeyInitData
    • payer: PublicKeyInitData
    • message: PublicKeyInitData
    • fromTokenAccount: PublicKeyInitData
    • tokenChain: number
    • tokenAddress: Buffer | Uint8Array
    • Optional fromTokenAccountOwner: PublicKeyInitData

    Returns TransferWrappedWithPayloadCpiAccounts

getWormholeCpiAccounts

  • getWormholeCpiAccounts(wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, emitterProgramId: PublicKeyInitData, message: PublicKeyInitData): PostMessageAccounts

getWormholeDerivedAccounts

  • getWormholeDerivedAccounts(cpiProgramId: PublicKeyInitData, wormholeProgramId: PublicKeyInitData): WormholeDerivedAccounts

modifySignTransaction

newAccountMeta

  • newAccountMeta(pubkey: PublicKeyInitData, isSigner: boolean): AccountMeta
  • Factory to create AccountMeta with isWritable set to true

    Parameters

    • pubkey: PublicKeyInitData

      account address

    • isSigner: boolean

      whether account authorized transaction

    Returns AccountMeta

    metadata for writable account

newReadOnlyAccountMeta

  • newReadOnlyAccountMeta(pubkey: PublicKeyInitData, isSigner: boolean): AccountMeta
  • Factory to create AccountMeta with isWritable set to false

    Parameters

    • pubkey: PublicKeyInitData

      account address

    • isSigner: boolean

      whether account authorized transaction

    Returns AccountMeta

    metadata for read-only account

postVaaSolana

  • postVaaSolana(connection: Connection, signTransaction: SignTransaction, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, vaa: Buffer, options?: ConfirmOptions, asyncVerifySignatures?: boolean): Promise<TransactionSignatureAndResponse[]>

postVaaSolanaWithRetry

  • postVaaSolanaWithRetry(connection: Connection, signTransaction: SignTransaction, wormholeProgramId: PublicKeyInitData, payer: PublicKeyInitData, vaa: Buffer, maxRetries?: number, commitment?: Commitment): Promise<TransactionSignatureAndResponse[]>

sendAndConfirmTransactionsWithRetry

  • sendAndConfirmTransactionsWithRetry(connection: Connection, signTransaction: SignTransaction, payer: string, unsignedTransactions: Transaction[], maxRetries?: number, options?: ConfirmOptions): Promise<TransactionSignatureAndResponse[]>
  • deprecated

    Please use signSendAndConfirmTransaction instead, which allows retries to be configured in {@link ConfirmOptions}.

    The transactions provided to this function should be ready to send. This function will do the following:

    1. Add the {@param payer} as the feePayer and latest blockhash to the {@link Transaction}.
    2. Sign using {@param signTransaction}.
    3. Send raw transaction.
    4. Confirm transaction.

    Parameters

    • connection: Connection
    • signTransaction: SignTransaction
    • payer: string
    • unsignedTransactions: Transaction[]
    • maxRetries: number = 0
    • Optional options: ConfirmOptions

    Returns Promise<TransactionSignatureAndResponse[]>

signSendAndConfirmTransaction

  • The transactions provided to this function should be ready to send. This function will do the following:

    1. Add the {@param payer} as the feePayer and latest blockhash to the {@link Transaction}.
    2. Sign using {@param signTransaction}.
    3. Send raw transaction.
    4. Confirm transaction.

    Parameters

    • connection: Connection
    • payer: PublicKeyInitData
    • signTransaction: SignTransaction
    • unsignedTransaction: Transaction
    • Optional options: ConfirmOptions

    Returns Promise<TransactionSignatureAndResponse>

signTransactionFactory

Generated using TypeDoc