Skip to main content
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:
await traderClient.approveUsdc('max');
await traderClient.setDelegate('0xDelegateSafeAddress');
You can get that Safe address from client.getSmartAccountAddress().

Submit-capable client

const client = await OstiumClient.createDelegatedAndGasless({
  delegatePrivateKey: process.env.DELEGATE_PRIVATE_KEY as `0x${string}`,
  traderAddress: '0xTraderAddress',
  pimlicoUrl: 'https://builder.ostium.io/v1/pimlico/sponsor?chainId=42161',
});

Build-only client

const client = await OstiumClient.createDelegatedAndGasless({
  traderAddress: '0xTraderAddress',
  delegateAddress: '0xDelegateAddress',
  safeAddress: '0xDelegateSafeAddress',
});
In build-only mode, get*Tx() returns a Safe-style request whose call data is already wrapped for delegated execution.

Parameters

FieldTypeRequiredNotes
delegatePrivateKey0x${string}Submit-capableDelegate EOA key. A Safe is derived from it and submits via Pimlico.
traderAddress0x${string}YesTrader the delegate acts for. Must have called setDelegate(safeAddress) with the derived Safe (client.getSmartAccountAddress()).
delegateAddress0x${string}Build-onlyDelegate EOA that owns the Safe.
safeAddress0x${string}Build-onlySafe that submits delegated calls.
pimlicoUrlstringOptionalBundler/paymaster URL. Defaults to the Ostium sponsor URL (chain-aware).
rpcUrlstringOptionalRPC URL for reads/simulation. Defaults to the public RPC.
sponsorshipPolicyIdstringOptionalPimlico sponsorship policy ID.
Plus the shared options (testnet, slippageBps, builder, subgraphUrl, builderApiUrl, alchemyApiKey). See Client Configuration.