Function Signature
Description
Creates a delegated EVM wallet client instance that can be used to perform signing operations on behalf of users who have granted delegation permission. The client uses your server API key for authentication and can work with multiple wallets by accepting wallet-specific credentials for each operation. This function follows a functional programming paradigm where you create the client once and reuse it for multiple signing operations across different users.Parameters
Required Parameters
environmentId
(string
) - Your Dynamic environment ID from the Dynamic dashboardapiKey
(string
) - Your server API key for server-to-server authentication
Optional Parameters
baseApiUrl
(string
) - Custom Dynamic API URL. Defaults tohttps://app.dynamic.xyz
baseMPCRelayApiUrl
(string
) - Custom MPC relay service URL. Defaults tohttps://mpc-relay.dynamic.xyz
debug
(boolean
) - Enable debug logging. Defaults tofalse
Returns
DelegatedEvmWalletClient
- A client instance that can be used with delegated signing functions. The client has the following properties:
chainName
: Always'EVM'
for this client typeenvironmentId
: Your environment IDapiKey
: Your server API key (used internally)- Additional internal properties for API communication
Example
Basic Usage
With All Options
Singleton Pattern
Type Definitions
Security Considerations
- API Key Protection: Never expose your server API key in client-side code or public repositories
- Environment Variables: Store API keys in secure environment variables
- Key Rotation: Implement regular API key rotation policies
- Access Control: Limit API key permissions to only what’s necessary
Error Handling
Related Functions
delegatedSignMessage()
- Sign messages using the delegated clientdelegatedSignTransaction()
- Sign transactions using the delegated clientrevokeDelegation()
- Revoke delegation permissions- Delegated Access Guide - Complete guide on using delegated access