@cetusprotocol/aggregator-sdk 0.3.16 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,7 +104,7 @@ if (routerRes != null) {
104
104
  // you can use this target coin object argument to build your ptb.
105
105
  const client.transferOrDestoryCoin(
106
106
  txb,
107
- targetCoinRes.targetCoin,
107
+ targetCoin,
108
108
  targetCoinType
109
109
  )
110
110
 
package/dist/index.js CHANGED
@@ -5708,8 +5708,11 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
5708
5708
  mergedCoin.map((coin) => txb.object(coin))
5709
5709
  );
5710
5710
  }
5711
+ const targetCoin = txb.splitCoins(txb.object(masterCoin), [
5712
+ txb.pure.u64(amount.toString())
5713
+ ]);
5711
5714
  return {
5712
- targetCoin: txb.object(masterCoin),
5715
+ targetCoin,
5713
5716
  isMintZeroCoin: false,
5714
5717
  targetCoinAmount: Number(amount.toString())
5715
5718
  };
@@ -6795,7 +6798,7 @@ function getRouter(endpoint, params) {
6795
6798
  url += `&providers=${providers.join(",")}`;
6796
6799
  }
6797
6800
  }
6798
- url += "&v=1000316";
6801
+ url += "&v=1000317";
6799
6802
  const response = yield fetch(url);
6800
6803
  return response;
6801
6804
  } catch (error) {
package/dist/index.mjs CHANGED
@@ -5706,8 +5706,11 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
5706
5706
  mergedCoin.map((coin) => txb.object(coin))
5707
5707
  );
5708
5708
  }
5709
+ const targetCoin = txb.splitCoins(txb.object(masterCoin), [
5710
+ txb.pure.u64(amount.toString())
5711
+ ]);
5709
5712
  return {
5710
- targetCoin: txb.object(masterCoin),
5713
+ targetCoin,
5711
5714
  isMintZeroCoin: false,
5712
5715
  targetCoinAmount: Number(amount.toString())
5713
5716
  };
@@ -6793,7 +6796,7 @@ function getRouter(endpoint, params) {
6793
6796
  url += `&providers=${providers.join(",")}`;
6794
6797
  }
6795
6798
  }
6796
- url += "&v=1000316";
6799
+ url += "&v=1000317";
6797
6800
  const response = yield fetch(url);
6798
6801
  return response;
6799
6802
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -186,7 +186,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
186
186
  }
187
187
 
188
188
  // set newest sdk version
189
- url += "&v=1000316"
189
+ url += "&v=1000317"
190
190
 
191
191
  const response = await fetch(url)
192
192
  return response
package/src/utils/coin.ts CHANGED
@@ -116,8 +116,12 @@ export function buildInputCoin(
116
116
  )
117
117
  }
118
118
 
119
+ const targetCoin = txb.splitCoins(txb.object(masterCoin), [
120
+ txb.pure.u64(amount.toString()),
121
+ ])
122
+
119
123
  return {
120
- targetCoin: txb.object(masterCoin),
124
+ targetCoin,
121
125
  isMintZeroCoin: false,
122
126
  targetCoinAmount: Number(amount.toString()),
123
127
  }
@@ -33,9 +33,9 @@ describe("router module", () => {
33
33
  keypair = buildTestAccount()
34
34
  }
35
35
 
36
- // const wallet = keypair.getPublicKey().toSuiAddress()
37
- // console.log("wallet: ", wallet)
38
- const wallet = "0x0005e9b405ab0424b6494b64d3d5b79b6715d06d284585faffe1ee1a873ba8a3"
36
+ const wallet = keypair.getPublicKey().toSuiAddress()
37
+ console.log("wallet: ", wallet)
38
+ // const wallet = "0x02e39bddb06f617112595378fef741f523fbf22ea188cca99ecb61a9904dda2a"
39
39
 
40
40
  const endpoint = aggregatorURL
41
41
 
@@ -110,9 +110,9 @@ describe("router module", () => {
110
110
 
111
111
  test("Build router tx", async () => {
112
112
  const byAmountIn = true
113
- const amount = "746028139919"
113
+ const amount = "30000000"
114
114
  const target = "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT"
115
- const from = "0x2::sui::SUI"
115
+ const from = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
116
116
 
117
117
  const res = await client.findRouters({
118
118
  from,