> For the complete documentation index, see [llms.txt](https://xpansionchain-1.gitbook.io/xpansionchain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xpansionchain-1.gitbook.io/xpansionchain/advanced-guides/link-sdk/overview.md).

# Overview

## Overview

THE FEE MODEL IS CHANGING IN THE LATEST VERSION (V3) OF THE API.

Please refer to this <mark style="color:blue;">guide</mark> to learn more about maker taker fees when you plan your migration to the upgraded v3 endpoints.

LINK REFERENCE TOOL

Check out our <mark style="color:blue;">**Link reference tool**</mark> to understand how `Link` methods work without having to write any code.

For context, read our <mark style="color:blue;">overview of the XpansionChain JS SDK.</mark>

### Link usage[​](https://docs.x.immutable.com/docs/x/sdk-api#link-usage) <a href="#link-usage" id="link-usage"></a>

The Link SDK is used for frontend, user-facing interactions.

```
import { Link, ETHTokenType } from '@imtbl/imx-sdk';

async function sdkExample() {
  // Pass orderAndTradeAPI version parameter as 'v3' to target the latest version of order & trade API.
  const link = new Link('https://link.sandbox.x.XpansionChain.com', null, 'v3');

  // Register user, you can persist address to local storage etc.
  const { address } = await link.setup({});
  localStorage.setItem('address', address);

  // Deposit ETH into IMX
  link.deposit({
    type: ETHTokenType.ETH,
    amount: '0.01',
  });

  // View transaction history
  link.history({});

  // Create a sell order for token id 123 for 0.01 ETH
  link.sell({
    amount: '0.01',
    tokenId: '123',
    tokenAddress: '0x2ca7e3fa937cae708c32bc2713c20740f3c4fc3b',
  });

  // Cancel a sell order
  link.cancel({
    orderId: '1',
  });

  // Create a buy flow:
  link.buy({
    orderIds: ['1', '2', '3'],
  });

  // Prepare withdrawal, you will need to wait some time before completing the withdrawal
  link.prepareWithdrawal({
    type: ETHTokenType.ETH,
    amount: '0.01',
  });

  // Complete withdrawal
  link.completeWithdrawal({
    type: ETHTokenType.ETH,
  });
}
```

### API client usage[​](https://docs.x.immutable.com/docs/x/sdk-api#api-client-usage) <a href="#api-client-usage" id="api-client-usage"></a>

The API client is a direct mapping to the REST methods documented here: <mark style="color:blue;"><https://docs.iXpansionChain.com/reference></mark>

```
import { XpansionChainClient } from '@imtbl/imx-sdk';

async function libExample() {
  const client = await XpansionChainClient.build({
    publicApiUrl: 'https://api.sandbox.x.XpansionChain.com/v1',
  });
  const address = localStorage.getItem('address');

  if (address) {
    const balances = await client.getBalances({ user: address });
    const orders = await client.getOrders();
    const order = await client.getOrder({ orderId: 1 });
    const assets = await client.getAssets({
      user: address,
    });
  }
}
```
