From a65ff5ebdcf1e560b7d36fdd5b2e656b0a5f2245 Mon Sep 17 00:00:00 2001 From: McSam Date: Wed, 2 Aug 2023 20:08:57 +0800 Subject: [PATCH] update readme --- ts-client/README.md | 24 ++++++++++++++++++++++-- ts-client/package.json | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ts-client/README.md b/ts-client/README.md index bbf67b32..71e4f442 100644 --- a/ts-client/README.md +++ b/ts-client/README.md @@ -40,8 +40,28 @@ const provider = new AnchorProvider(mainnetConnection, mockWallet, { }); // Alternatively, to use Solana Wallet Adapter -const constantProductPool = await AmmImpl.create(connection, MAINNET_POOL.USDC_SOL); -const stablePool = await AmmImpl.create(connection, MAINNET_POOL.USDT_USDC); +// https://station.jup.ag/blog/jupiter-token-list-api#endpoints +const tokenList = await fetch('https://token.jup.ag/all').then(res => res.json()); +const USDC = tokenList.find(token => token.address === ); +const USDT = tokenList.find(token => token.address === ); +const SOL = tokenList.find(token => token.address === ); +const constantProductPool = await AmmImpl.create(connection, MAINNET_POOL.USDC_SOL, USDC, SOL); +const stablePool = await AmmImpl.create(connection, MAINNET_POOL.USDT_USDC, USDT, USDC); + +// If you need to create multiple, can consider using `createMultiple` +const pools = [ + { + pool: MAINNET_POOL.USDC_SOL, + tokenInfoA: USDC, + tokenInfoB: SOL + }, + { + pool: MAINNET_POOL.USDT_USDC, + tokenInfoA: USDT, + tokenInfoB: USDC + } +] +const [constantProductPool, stablePool] = await AmmImpl.createMultiple(connection, pools) ``` 3. To interact with the AmmImpl diff --git a/ts-client/package.json b/ts-client/package.json index dba09bd5..4c01d321 100644 --- a/ts-client/package.json +++ b/ts-client/package.json @@ -1,6 +1,6 @@ { "name": "@mercurial-finance/dynamic-amm-sdk", - "version": "0.4.7", + "version": "0.4.8", "description": "Mercurial Vaults SDK is a typescript library that allows you to interact with Mercurial v2's AMM.", "main": "dist/cjs/index.js", "module": "dist/esm/index.js",