Function Signature
Description
Signs a Solana transaction on behalf of a user who has granted delegation permission. This function supports both legacyTransaction
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.
Parameters
Required Parameters
client
(DelegatedSvmWalletClient
) - The delegated client instance created withcreateDelegatedSvmWalletClient()
walletId
(string
) - The wallet ID from the delegation webhookwalletApiKey
(string
) - The wallet-specific API key from the delegation webhookkeyShare
(ServerKeyShare
) - The server key share from the delegation webhooktransaction
(VersionedTransaction | Transaction
) - The Solana transaction to sign
Returns
Promise<VersionedTransaction | Transaction>
- The signed transaction with the signature added
Example
Basic Transaction Signing
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
Related Functions
createDelegatedSvmWalletClient()
- Create the client for delegated operationsdelegatedSignMessage()
- Sign messages instead of transactions- Delegated Access Guide - Complete guide on using delegated access