1.1.1 • Published 12 months ago
@suilend/steamm-sdk v1.1.1
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
12 months ago
1.1.0
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.0
1 year ago
0.0.25
1 year ago
0.0.24
1 year ago
0.0.22
1 year ago
0.0.21
1 year ago
0.0.20
1 year ago
0.0.19
1 year ago
0.0.18
1 year ago
0.0.17
1 year ago
0.0.16
1 year ago
0.0.15
1 year ago
0.0.14
1 year ago
0.0.12
1 year ago
0.0.11
1 year ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago