createDelegatedAndGasless() is the most operationally advanced mode.
- the trader EOA owns USDC and positions
- a delegate EOA signs the delegated action
- the delegate’s Safe submits it as a sponsored user operation
When to use it
- backend-driven products that want custody separation and gasless submission
- high-volume builder integrations
- systems that already operate a Safe or Pimlico flow
One-time trader setup
The trader must approve USDC and register the delegate Safe, not the delegate EOA:client.getSmartAccountAddress().
Submit-capable client
Build-only client
get*Tx() returns a Safe-style request whose call data is already wrapped for delegated execution.
Parameters
| Field | Type | Required | Notes |
|---|---|---|---|
delegatePrivateKey | 0x${string} | Submit-capable | Delegate EOA key. A Safe is derived from it and submits via Pimlico. |
traderAddress | 0x${string} | Yes | Trader the delegate acts for. Must have called setDelegate(safeAddress) with the derived Safe (client.getSmartAccountAddress()). |
delegateAddress | 0x${string} | Build-only | Delegate EOA that owns the Safe. |
safeAddress | 0x${string} | Build-only | Safe that submits delegated calls. |
pimlicoUrl | string | Optional | Bundler/paymaster URL. Defaults to the Ostium sponsor URL (chain-aware). |
rpcUrl | string | Optional | RPC URL for reads/simulation. Defaults to the public RPC. |
sponsorshipPolicyId | string | Optional | Pimlico sponsorship policy ID. |
testnet, slippageBps, builder, subgraphUrl, builderApiUrl, alchemyApiKey). See Client Configuration.