Skip to main content

Function Signature

Description

Executes an Earn signing payload returned by the client.earn.prepare* methods. Solana payloads carry an ordered transactions sequence, so the method signs and sends each transaction one at a time, because a later transaction can depend on the state an earlier one wrote. Each step’s transaction was built against a fixed blockhash and carries an expiryBlockHeight, so execute promptly after preparing. For a single call that prepares and executes, use depositToEarnVault, withdrawFromEarnVault, or claimEarnRewards.

Parameters

Required Parameters

Optional Parameters

  • password (string): Required if the wallet was created with backUpToDynamic: true. Used for backup decryption when externalServerKeyShares is not provided.
  • externalServerKeyShares (ServerKeyShare[]): Caller-supplied plaintext shares.
  • sponsored (boolean): When true, sponsors every transaction in the sequence through Dynamic gas sponsorship. Vault transactions are built with the owner as fee payer, unlike the browser SDK which sponsors automatically. See SVM Gas Sponsorship.
  • rpcUrl (string): Solana RPC endpoint. Defaults to the public cluster for the payload’s chainId (101 mainnet, 103 devnet).
  • chainId (string): The Solana chain identifier.
  • context (SignMessageContext): Signing context forwarded to the transaction signer.
  • onStepChange ((step: EarnExecutionStep) => void): Reports transaction once per transaction in the sequence.
  • onTransactionStepChange ((step: EarnTransactionStepProgress) => void): Invoked as each transaction is about to be signed, with its ordinal, the total, and an optional label.

Returns

  • Promise<EarnTransactionResult>: An object with transactionHash, the signature of the last transaction in the sequence.

Example

Error Handling

Throws when walletMetadata.chainName is not 'SVM' or when the payload carries no transactions sequence. When a step fails after earlier transactions confirmed, the method throws an EarnSolanaStepError whose ordinal reports which step failed, so the action may be partially applied. Its code is one of yield_step_expired, yield_step_failed, yield_step_send_failed, or yield_step_confirmation_unknown.

See Also

Last modified on October 29, 2026