Skip to main content

Import


createSolanaBuilder

Factory function to create a Solana instruction builder.

Signature

Parameters

config
SolanaBuilderConfig
required

Returns

SolanaBuilder
object
A builder instance with methods for creating Solana transaction instructions.

Example


SolanaBuilder Methods

buildTransfer

Builds transfer instructions for bridging tokens from Solana to another chain.

Signature

Parameters

validated
ValidatedTransfer
required
The validated transfer from bridge.validateTransfer(). Must have sourceChain set to ChainKind.Sol.
user
PublicKey
required
The public key of the account that owns the tokens and authorizes the transfer (signs the token transfer/burn).
payer
PublicKey
Optional public key of the account paying for Wormhole fees and rent. Defaults to user if not provided. This allows a gas refiller to pay fees on behalf of the user.

Returns

instructions
TransactionInstruction[]
Array of Solana transaction instructions. Typically contains a single instruction for either initTransfer (SPL tokens) or initTransferSol (native SOL).

Example

Native SOL Transfers

For native SOL transfers, use the zero address as the token:

buildFinalization

Builds finalization instructions for receiving tokens on Solana from another chain.

Signature

Parameters

payload
SolanaTransferMessagePayload
required
The transfer message payload containing destination nonce, transfer ID, token address, amount, and recipient.
signature
SolanaMPCSignature
required
The MPC signature authorizing the finalization. Must implement toBytes() method returning a Uint8Array.
payer
PublicKey
required
The public key of the account paying for the transaction.

Returns

instructions
TransactionInstruction[]
Array of Solana transaction instructions for finalizing the transfer. This will mint tokens (for bridged tokens) or release tokens from the vault (for native Solana tokens).

Example


buildLogMetadata

Builds instructions for logging token metadata to register a Solana token with the bridge.

Signature

Parameters

token
PublicKey
required
The public key of the SPL token mint to register.
payer
PublicKey
required
The public key of the account paying for the transaction.

Returns

instructions
TransactionInstruction[]
Array of Solana transaction instructions that emit the token’s metadata (name, symbol, decimals) via Wormhole for cross-chain registration.

Example

This creates a vault for the token if it doesn’t exist and emits metadata via Wormhole. The metadata can then be used to deploy a wrapped version of this token on other chains.

buildDeployToken

Builds instructions for deploying a wrapped token on Solana for a token from another chain.

Signature

Parameters

signature
SolanaMPCSignature
required
The MPC signature authorizing the token deployment.
metadata
SolanaTokenMetadata
required
payer
PublicKey
required
The public key of the account paying for the transaction.

Returns

instructions
TransactionInstruction[]
Array of Solana transaction instructions that create a new wrapped token mint PDA and set up its metadata.

Example


PDA Derivation Methods

PDA seeds must match the on-chain program exactly. Always use the builder’s derive methods rather than computing PDAs manually.

deriveConfig

Derives the bridge configuration PDA.

Signature

Returns

config
PublicKey
The config PDA used as the Wormhole message emitter.

Example


deriveAuthority

Derives the program authority PDA.

Signature

Returns

authority
PublicKey
The authority PDA that has mint/burn authority over bridged tokens and controls token vaults.

Example


deriveSolVault

Derives the native SOL vault PDA.

Signature

Returns

solVault
PublicKey
The SOL vault PDA that holds native SOL for bridging.

Example


deriveVault

Derives the token vault PDA for a specific SPL token mint.

Signature

Parameters

mint
PublicKey
required
The public key of the SPL token mint.

Returns

vault
PublicKey
The vault PDA that holds tokens of this mint for bridging.

Example


deriveWrappedMint

Derives the wrapped token mint PDA for a token from another chain.

Signature

Parameters

token
string
required
The original token address on the source chain. For tokens longer than 32 bytes, the address is hashed with SHA-256.

Returns

wrappedMint
PublicKey
The wrapped mint PDA for the bridged token.

Example


PDA Seeds Reference

For reference only - always use the derive methods above.

Types

SolanaBuilderConfig

Configuration for creating a Solana builder.

SolanaBuilder

The Solana instruction builder interface.

SolanaTransferMessagePayload

Payload for finalizing a transfer to Solana.
destination_nonce
bigint | number
required
The nonce assigned to this transfer on the destination chain.
transfer_id
object
required
token_address
string
required
The OmniAddress of the token on Solana (e.g., "sol:EPjFWdd5...").
amount
bigint | string
required
The amount to transfer in the smallest unit.
recipient
string
required
The OmniAddress of the recipient on Solana (e.g., "sol:RecipientPubkey...").
fee_recipient
string | null
Optional OmniAddress of the fee recipient (typically the relayer).

SolanaMPCSignature

Interface for MPC signatures used in finalization and token deployment.
toBytes
() => Uint8Array
required
Returns the signature as a byte array. The signature is typically 64 bytes (Ed25519).

SolanaTokenMetadata

Token metadata for deploying wrapped tokens.
token
string
required
The original token address on the source chain (e.g., "near:wrap.near").
name
string
required
The name for the wrapped token.
symbol
string
required
The symbol for the wrapped token.
decimals
number
required
The number of decimals for the wrapped token.

SolanaTransferId

Transfer ID for cross-chain transfers (Solana-specific).
originChain
ChainKind | number
required
The chain where the transfer originated.
originNonce
bigint | BN
required
The nonce of the transfer on the origin chain.

SolanaDepositPayload

Internal payload used for finalize transfer operations.
destinationNonce
BN
required
The destination nonce as a BN (bn.js) instance.
transferId
object
required
amount
BN
required
The transfer amount as a BN instance.
feeRecipient
string
required
The fee recipient address (empty string if none).

BridgeTokenFactory

The Anchor IDL type for the bridge program. This is exported for advanced use cases that need direct program interaction.

Complete Example