Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ostium.com/llms.txt

Use this file to discover all available pages before exploring further.

createDelegatedAndSelf() separates the trader from the executor.
  • the trader EOA owns USDC and positions
  • a delegate EOA signs each action
  • the delegate EOA submits the transaction and pays gas

When to use it

  • backend systems trading on behalf of users
  • managed execution products
  • integrations where users keep custody but your server handles submission

One-time trader setup

Before this mode can trade, the trader must:
await traderClient.approveUsdc('max');
await traderClient.setDelegate('0xDelegateAddress');

Submit-capable client

const client = await OstiumClient.createDelegatedAndSelf({
  delegatePrivateKey: process.env.DELEGATE_PRIVATE_KEY as `0x${string}`,
  traderAddress: '0xTraderAddress',
  rpcUrl: process.env.ARB_RPC_URL!,
});

Build-only client

const client = await OstiumClient.createDelegatedAndSelf({
  traderAddress: '0xTraderAddress',
  delegateAddress: '0xDelegateAddress',
});
In build-only mode, get*Tx() returns an EOA request whose calldata is already wrapped for delegated execution.