1.1.1 • Published 1 month ago

@suilend/steamm-sdk v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

steamm-fe/sdk

A TypeScript SDK for interacting with the STEAMM program published on npm as @suilend/steamm-sdk.

Mainnet actions

To initiate the sdk:

import { MAINNET_CONFIG, SteammSDK } from "@suilend/steamm-sdk";

const sdk = new SteammSDK(MAINNET_CONFIG);

sdk.signer = keypair;

To fetch the pools:

const pools = await sdk.fetchPoolData();

Alternatively, one can fetch all pools for a dedicated pair:

// Note: type1 and type2 do not correspond to the token type's position in the pool
const pools = await sdk.fetchPoolData([coinType1, coinType2]);

To deposit liquidity:

await sdk.Pool.depositLiquidityEntry(
  {
    pool: pools[0].poolId,
    coinTypeA,
    coinTypeB,
    coinA: usdcCoin,
    coinB: suiCoin,
    maxA: BigInt("1000000000000000000"),
    maxB: BigInt("1000000000000000000"),
  },
  tx,
);

To perform a swap:

await sdk.Pool.swapEntry(
  {
    pool: pools[0].poolId,
    coinTypeA,
    coinTypeB,
    coinA: usdcCoin,
    coinB: suiCoin,
    a2b: false,
    amountIn: BigInt("10000000000000"),
    minAmountOut: BigInt("0"),
  },
  tx,
);

And to redeem liquidity:

await sdk.Pool.redeemLiquidityEntry(
  {
    pool: pools[0].poolId,
    coinTypeA,
    coinTypeB,
    lpCoin: lpToken,
    minA: BigInt("0"),
    minB: BigInt("0"),
  },
  tx,
);

For quotations:

Deposit:

const quote = await sdk.Pool.quoteDeposit({
  pool: pools[0].poolId,
  maxA: BigInt("1000000000000000000"),
  maxB: BigInt("1000000000000000000"),
});

Redeem:

const quote = await sdk.Pool.quoteRedeem({
  pool: pools[0].poolId,
  lpTokens: BigInt("1000000000000000000"),
});

Swap:

const quote = await sdk.Pool.quoteSwap({
  pool: pools[0].poolId,
  a2b: false,
  amountIn: BigInt("10000000000000"),
});

Got a suggestion, running into issues, or have a question? Join our #dev-support channel on Discord.


1.1.1

1 month ago

1.1.0

1 month ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.0

2 months ago

0.0.25

2 months ago

0.0.24

2 months ago

0.0.22

3 months ago

0.0.21

3 months ago

0.0.20

3 months ago

0.0.19

3 months ago

0.0.18

3 months ago

0.0.17

4 months ago

0.0.16

5 months ago

0.0.15

5 months ago

0.0.14

5 months ago

0.0.12

5 months ago

0.0.11

5 months ago

0.0.10

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago