> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gains.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK

> Gains' SDK technical reference

The [@gainsnetwork/sdk](https://www.npmjs.com/package/@gainsnetwork/sdk) is a TypeScript library for building on Gains: fetching trades and trading variables, computing borrowing/funding fees, liquidation prices, and PnL with the same logic as the contracts.

* Source code: [github.com/GainsNetwork-org/sdk](https://github.com/GainsNetwork-org/sdk)
* Types used by the SDK: [Client types](/developer/technical-reference/sdk/client-types)

For end-to-end examples, see the [integration guides](/developer/integrators/guides).

## Trading fee helpers

Use these helpers to derive v9 fee-floor values from normalized SDK trading variables:

```typescript theme={null}
getPairMinFeeUsd(pairIndex, { fees, pairs });
getMinCollateral(pairIndex, { fees, pairs, collateralPriceUsd });
```

`getPairMinFeeUsd` mirrors the contracts' `pairMinFeeUsd` getter after SDK normalization.
`getMinCollateral` returns the minimum opening collateral in collateral tokens using the v9 rule `collateral >= 5 * minFeeUsd`.

For direct `Fee` objects, use `getMinTradeFeeUsd(fee)`, `getMinOpeningCollateralUsd(fee)`, or
`getMinOpeningCollateral(fee, collateralPriceUsd)`.
