> ## 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.

# transaction builders

> Build unsigned Ostium SDK transactions with the get*Tx helpers for EOA or Safe-based client applications.

The SDK exposes `get*Tx()` helpers for every write action. Use them when your app wants the SDK to build the correct calldata, but your wallet or Safe flow will handle signing and submission.

## Available methods

* `getSetupGaslessDelegationTx()`
* `getApproveUsdcTx(amount)`
* `getSetDelegateTx(delegateAddress)`
* `getRemoveDelegateTx()`
* `getOpenTradeTx(params)`
* `getCloseTradeTx(params)`
* `getCancelOrderTx(params)`
* `getModifyOrderTx(params)`
* `getUpdateCollateralTx(params)`

## Return shape

Depending on the mode, the SDK returns one of two request types:

```ts theme={null}
type BuiltTxRequest =
  | {
      kind: 'eoa';
      to: `0x${string}`;
      data: `0x${string}`;
      value: bigint;
      from: `0x${string}`;
      traderAddress: `0x${string}`;
    }
  | {
      kind: 'safe';
      safeAddress: `0x${string}`;
      traderAddress: `0x${string}`;
      calls: [
        {
          to: `0x${string}`;
          data: `0x${string}`;
          value: bigint;
        },
      ];
    };
```

## Example

```ts theme={null}
const client = await OstiumClient.createSelfAndSelf({
  traderAddress: '0xTraderAddress',
});

const tx = client.getOpenTradeTx({
  pairId: 0,
  buy: true,
  price: '65000',
  collateral: '100',
  leverage: '5',
  type: OrderType.Market,
});
```

Use `createSelfAndSelf()` or `createDelegatedAndSelf()` for EOA-style build output, and use `createSelfAndGasless()` or `createDelegatedAndGasless()` for Safe-style build output.
