Function Signature
Description
Signs an EVM transaction on behalf of a user who has granted delegation permission. This function requires delegation credentials (wallet ID, wallet API key, and key share) that are provided to your webhook endpoint when a user approves delegation. The function serializes the transaction, signs it using MPC, and returns a fully signed transaction ready for broadcast.Parameters
Required Parameters
client(DelegatedEvmWalletClient) - The delegated client instance created withcreateDelegatedEvmWalletClient()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(TransactionSerializable) - The transaction object to sign (must be a valid Viem transaction)
Returns
Promise<string> - A hex-encoded signed transaction ready for broadcast
Example
Basic Transaction Signing
Complete Flow with Broadcasting
EIP-1559 Transaction
Contract Interaction
Type Definitions
Common Use Cases
Automated Payments
Batch Transactions
Error Handling
The function throws an error if:- Any required parameter is missing or invalid
- The transaction object is malformed
- The delegation credentials are expired or revoked
- The MPC signing operation fails
- Transaction serialization fails
Security Considerations
- Transaction Validation: Always validate transaction parameters before signing
- Gas Limits: Set appropriate gas limits to prevent excessive gas consumption
- Amount Validation: Validate transaction amounts to prevent unauthorized transfers
- Recipient Validation: Verify recipient addresses are correct and trusted
- Nonce Management: Properly manage nonces to prevent transaction conflicts
- Audit Logging: Log all transaction signing operations
Related Functions
createDelegatedEvmWalletClient()- Create the client for delegated operationsdelegatedSignMessage()- Sign messages instead of transactionssignTransaction()- Sign transactions with direct wallet access- Delegated Access Guide - Complete guide on using delegated access