Function Signature
Description
Revokes delegated access for a specific wallet, invalidating the delegation credentials (wallet API key and key share). After revocation, the credentials can no longer be used for signing operations. Use this function when:- A user explicitly requests to revoke delegation
- Delegation is no longer needed for a workflow
- Security concerns require immediate credential invalidation
- Delegation credentials may have been compromised
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 webhook
Returns
Promise<void>
- Resolves when delegation is successfully revoked
Example
Basic Revocation
With Error Handling
Complete Cleanup Flow
Common Use Cases
User-Requested Revocation
Automatic Revocation After Task Completion
Batch Revocation
Security-Triggered Revocation
Error Handling
The function throws an error if:- The wallet ID or wallet API key is invalid
- The delegation has already been revoked
- Network communication with Dynamic services fails
- The client is not properly configured
Security Considerations
- Immediate Cleanup: Delete stored credentials immediately after revocation
- Audit Logging: Log all revocation operations for security auditing
- Error Handling: Handle revocation failures gracefully and retry if necessary
- User Notification: Notify users when their delegation is revoked
- Idempotency: Ensure revocation is idempotent and can be safely retried
Best Practices
Revocation Service
Related Functions
createDelegatedEvmWalletClient()
- Create the client for delegated operationsdelegatedSignMessage()
- Sign messages using delegated accessdelegatedSignTransaction()
- Sign transactions using delegated access- Delegated Access Guide - Complete guide on using delegated access
- Webhook Setup - Configure webhooks for delegation