Skip to main content

Function Signature

Description

Signs a Solana transaction on behalf of a user who has granted delegation permission. This function supports both legacy Transaction and VersionedTransaction types from @solana/web3.js. The function returns the signed transaction object with the signature added, ready to be sent to the Solana network. For gasless transactions where a separate fee payer covers gas, set transaction.feePayer to the fee payer’s public key and pass signerAddress to identify the actual signer.

Parameters

Required Parameters

  • client (DelegatedSvmWalletClient) - The delegated client instance created with createDelegatedSvmWalletClient()
  • walletId (string) - The wallet ID from the delegation webhook
  • walletApiKey (string) - The wallet-specific API key from the delegation webhook
  • keyShare (ServerKeyShare | ServerKeyShare[]) - The server key share(s) from the delegation webhook
  • transaction (VersionedTransaction | Transaction) - The Solana transaction to sign

Optional Parameters

  • shareSetId (string) - The shareSetId from the wallet.delegation.created webhook payload. If omitted, the server resolves the correct share set by walletId and share-set type.
  • signerAddress (string) - The address that should sign the transaction. If not provided, defaults to the first signer (VersionedTransaction) or fee payer (Transaction). Use this for gasless transactions where a separate fee payer pays the fees.
  • derivationPath (Uint32Array) - Custom derivation path for the signing key.

Returns

Promise<VersionedTransaction | Transaction> - The signed transaction with the signature added

Example

Basic Transaction Signing

Gasless Transaction with Separate Fee Payer

When a separate wallet pays the gas fees, set feePayer to the sponsor and pass signerAddress so the delegated wallet signs only the instruction:

Complete Transaction Flow

Versioned Transaction

Type Definitions

Error Handling

The function throws an error if:
  • Any required parameter is missing or invalid
  • The transaction is malformed
  • The delegation credentials are expired or revoked
  • The MPC signing operation fails
  • Network communication with Dynamic services fails

Security Considerations

  • Transaction Validation: Always validate transaction contents before signing
  • Recipient Verification: Verify recipient addresses to prevent sending to wrong addresses
  • Amount Validation: Implement checks for transaction amounts to prevent accidental large transfers
  • Audit Logging: Log all transaction signing operations for security auditing
  • Credential Storage: Never log or expose wallet API keys or key shares
  • Rate Limiting: Implement rate limiting to prevent abuse

Common Use Cases

Automated Payments

Batch Transactions

Last modified on June 23, 2026