@cetusprotocol/aggregator-sdk 0.0.0-experimental-20240929115104 → 0.0.0-experimental-20240929164543

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/dist/index.js CHANGED
@@ -5979,16 +5979,12 @@ var Bluemove = class {
5979
5979
  }
5980
5980
  swap(client, txb, path, inputCoin) {
5981
5981
  return __async(this, null, function* () {
5982
- const { from, target } = path;
5983
- const { direction } = path;
5984
- if (!direction) {
5985
- throw new Error("Bluemove not support b2a swap");
5986
- }
5987
- const func = "swap_a2b";
5982
+ const { direction, from, target } = path;
5983
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5988
5984
  const args = [txb.object(this.dexInfo), inputCoin];
5989
5985
  const res = txb.moveCall({
5990
5986
  target: `${client.publishedAt()}::bluemove::${func}`,
5991
- typeArguments: [from, target],
5987
+ typeArguments: [coinAType, coinBType],
5992
5988
  arguments: args
5993
5989
  });
5994
5990
  return res;
@@ -6246,7 +6242,7 @@ var AggregatorClient6 = class {
6246
6242
  }
6247
6243
  publishedAt() {
6248
6244
  if (this.env === 0 /* Mainnet */) {
6249
- return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622";
6245
+ return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91";
6250
6246
  } else {
6251
6247
  return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
6252
6248
  }
package/dist/index.mjs CHANGED
@@ -5977,16 +5977,12 @@ var Bluemove = class {
5977
5977
  }
5978
5978
  swap(client, txb, path, inputCoin) {
5979
5979
  return __async(this, null, function* () {
5980
- const { from, target } = path;
5981
- const { direction } = path;
5982
- if (!direction) {
5983
- throw new Error("Bluemove not support b2a swap");
5984
- }
5985
- const func = "swap_a2b";
5980
+ const { direction, from, target } = path;
5981
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5986
5982
  const args = [txb.object(this.dexInfo), inputCoin];
5987
5983
  const res = txb.moveCall({
5988
5984
  target: `${client.publishedAt()}::bluemove::${func}`,
5989
- typeArguments: [from, target],
5985
+ typeArguments: [coinAType, coinBType],
5990
5986
  arguments: args
5991
5987
  });
5992
5988
  return res;
@@ -6244,7 +6240,7 @@ var AggregatorClient6 = class {
6244
6240
  }
6245
6241
  publishedAt() {
6246
6242
  if (this.env === 0 /* Mainnet */) {
6247
- return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622";
6243
+ return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91";
6248
6244
  } else {
6249
6245
  return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
6250
6246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.0.0-experimental-20240929115104",
3
+ "version": "0.0.0-experimental-20240929164543",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -337,8 +337,7 @@ export class AggregatorClient {
337
337
 
338
338
  publishedAt(): string {
339
339
  if (this.env === Env.Mainnet) {
340
- // return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302"
341
- return "0x72b5c77a8309d87d7bd7f63fc4ce6e04b58ecc2eaa90a78889af5d14b1729622"
340
+ return "0x764b8132a94d35abc9dfd91b23a0757b2a717d5ecb04c03098794aa2a508db91"
342
341
  } else {
343
342
  return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595"
344
343
  }
@@ -22,20 +22,17 @@ export class Bluemove implements Dex {
22
22
  path: Path,
23
23
  inputCoin: TransactionObjectArgument
24
24
  ): Promise<TransactionObjectArgument> {
25
- const { from, target } = path
25
+ const { direction, from, target } = path
26
26
 
27
- const { direction } = path
28
- if (!direction) {
29
- throw new Error("Bluemove not support b2a swap")
30
- }
31
-
32
- const func = "swap_a2b"
27
+ const [func, coinAType, coinBType] = direction
28
+ ? ["swap_a2b", from, target]
29
+ : ["swap_b2a", target, from]
33
30
 
34
31
  const args = [txb.object(this.dexInfo), inputCoin]
35
32
 
36
33
  const res = txb.moveCall({
37
34
  target: `${client.publishedAt()}::bluemove::${func}`,
38
- typeArguments: [from, target],
35
+ typeArguments: [coinAType, coinBType],
39
36
  arguments: args,
40
37
  }) as TransactionObjectArgument
41
38
 
@@ -137,9 +137,6 @@ describe("router module", () => {
137
137
  const byAmountIn = true
138
138
  const amount = "1000000000"
139
139
 
140
- // const from = M_USDC
141
- // const target = M_SUI
142
-
143
140
  const from = M_SUI
144
141
  // const target =
145
142
  // "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"