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 with createDelegatedEvmWalletClient()
walletId (string) - The wallet ID from the delegation webhook
walletApiKey (string) - The wallet-specific API key from the delegation webhook
keyShare (ServerKeyShare) - The server key share from the delegation webhook
transaction (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
delegatedSignTypedData
Function Signature
Description
Signs EIP-712 typed data 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.
Use this for permit flows, order signing, and other structured data that requires typed-data signing.
Parameters
Required Parameters
client (DelegatedEvmWalletClient) - The delegated client instance created with createDelegatedEvmWalletClient()
walletId (string) - The wallet ID from the delegation webhook
walletApiKey (string) - The wallet-specific API key from the delegation webhook
keyShare (ServerKeyShare) - The server key share from the delegation webhook
typedData (TypedData) - The EIP-712 typed data to sign (viem’s TypedData type)
Returns
Promise<string> - A hex-encoded ECDSA signature
Example
Security Considerations
- Data Validation: Always validate typed data structure before signing
- Domain Verification: Verify the domain matches the expected contract
- Expiry Times: Set appropriate deadlines to prevent replay attacks
- Nonce Management: Properly track and increment nonces
- Contract Verification: Ensure verifyingContract addresses are correct
- Audit Logging: Log all typed data signing operations
Last modified on September 21, 2026