Import
createSolanaBuilder
Factory function to create a Solana instruction builder.Signature
Parameters
Returns
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
The validated transfer from
bridge.validateTransfer(). Must have sourceChain set to ChainKind.Sol.The public key of the account that owns the tokens and authorizes the transfer (signs the token transfer/burn).
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
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
The transfer message payload containing destination nonce, transfer ID, token address, amount, and recipient.
The MPC signature authorizing the finalization. Must implement
toBytes() method returning a Uint8Array.The public key of the account paying for the transaction.
Returns
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
The public key of the SPL token mint to register.
The public key of the account paying for the transaction.
Returns
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
The MPC signature authorizing the token deployment.
The public key of the account paying for the transaction.
Returns
Array of Solana transaction instructions that create a new wrapped token mint PDA and set up its metadata.
Example
PDA Derivation Methods
deriveConfig
Derives the bridge configuration PDA.Signature
Returns
The config PDA used as the Wormhole message emitter.
Example
deriveAuthority
Derives the program authority PDA.Signature
Returns
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
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
The public key of the SPL token mint.
Returns
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
The original token address on the source chain. For tokens longer than 32 bytes, the address is hashed with SHA-256.
Returns
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.The nonce assigned to this transfer on the destination chain.
The OmniAddress of the token on Solana (e.g.,
"sol:EPjFWdd5...").The amount to transfer in the smallest unit.
The OmniAddress of the recipient on Solana (e.g.,
"sol:RecipientPubkey...").Optional OmniAddress of the fee recipient (typically the relayer).
SolanaMPCSignature
Interface for MPC signatures used in finalization and token deployment.Returns the signature as a byte array. The signature is typically 64 bytes (Ed25519).
SolanaTokenMetadata
Token metadata for deploying wrapped tokens.The original token address on the source chain (e.g.,
"near:wrap.near").The name for the wrapped token.
The symbol for the wrapped token.
The number of decimals for the wrapped token.
SolanaTransferId
Transfer ID for cross-chain transfers (Solana-specific).The chain where the transfer originated.
The nonce of the transfer on the origin chain.
SolanaDepositPayload
Internal payload used for finalize transfer operations.The destination nonce as a BN (bn.js) instance.
The transfer amount as a BN instance.
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
Related
- Core Package - Validation, types, and API client
- EVM Package - EVM transaction builder
- NEAR Package - NEAR transaction builder
- Bitcoin Package - Bitcoin/Zcash UTXO builder