@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 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago