@cetusprotocol/aggregator-sdk 0.3.20 → 0.3.21
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 +3 -6
- package/dist/index.mjs +3 -6
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/client.ts +3 -2
- package/src/transaction/haedal.ts +1 -4
- package/tests/router.test.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -5936,10 +5936,7 @@ var Haedal = class {
|
|
|
5936
5936
|
swap(client, txb, path, inputCoin, packages) {
|
|
5937
5937
|
return __async(this, null, function* () {
|
|
5938
5938
|
const { direction } = path;
|
|
5939
|
-
|
|
5940
|
-
throw new Error("Haedal not support b2a swap");
|
|
5941
|
-
}
|
|
5942
|
-
const func = "swap_a2b";
|
|
5939
|
+
const func = direction ? "swap_a2b" : "swap_b2a";
|
|
5943
5940
|
const args = [txb.object(path.id), txb.object("0x5"), inputCoin];
|
|
5944
5941
|
const publishedAt = getAggregatorV2PublishedAt(client.publishedAtV2(), packages);
|
|
5945
5942
|
const res = txb.moveCall({
|
|
@@ -6567,7 +6564,7 @@ var AggregatorClient19 = class {
|
|
|
6567
6564
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6568
6565
|
publishedAtV2() {
|
|
6569
6566
|
if (this.env === 0 /* Mainnet */) {
|
|
6570
|
-
return "
|
|
6567
|
+
return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d";
|
|
6571
6568
|
} else {
|
|
6572
6569
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6573
6570
|
}
|
|
@@ -6923,7 +6920,7 @@ function getRouter(endpoint, params) {
|
|
|
6923
6920
|
url += `&providers=${providers.join(",")}`;
|
|
6924
6921
|
}
|
|
6925
6922
|
}
|
|
6926
|
-
url += "&v=
|
|
6923
|
+
url += "&v=1000321";
|
|
6927
6924
|
const response = yield fetch(url);
|
|
6928
6925
|
return response;
|
|
6929
6926
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -5934,10 +5934,7 @@ var Haedal = class {
|
|
|
5934
5934
|
swap(client, txb, path, inputCoin, packages) {
|
|
5935
5935
|
return __async(this, null, function* () {
|
|
5936
5936
|
const { direction } = path;
|
|
5937
|
-
|
|
5938
|
-
throw new Error("Haedal not support b2a swap");
|
|
5939
|
-
}
|
|
5940
|
-
const func = "swap_a2b";
|
|
5937
|
+
const func = direction ? "swap_a2b" : "swap_b2a";
|
|
5941
5938
|
const args = [txb.object(path.id), txb.object("0x5"), inputCoin];
|
|
5942
5939
|
const publishedAt = getAggregatorV2PublishedAt(client.publishedAtV2(), packages);
|
|
5943
5940
|
const res = txb.moveCall({
|
|
@@ -6565,7 +6562,7 @@ var AggregatorClient19 = class {
|
|
|
6565
6562
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6566
6563
|
publishedAtV2() {
|
|
6567
6564
|
if (this.env === 0 /* Mainnet */) {
|
|
6568
|
-
return "
|
|
6565
|
+
return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d";
|
|
6569
6566
|
} else {
|
|
6570
6567
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6571
6568
|
}
|
|
@@ -6921,7 +6918,7 @@ function getRouter(endpoint, params) {
|
|
|
6921
6918
|
url += `&providers=${providers.join(",")}`;
|
|
6922
6919
|
}
|
|
6923
6920
|
}
|
|
6924
|
-
url += "&v=
|
|
6921
|
+
url += "&v=1000321";
|
|
6925
6922
|
const response = yield fetch(url);
|
|
6926
6923
|
return response;
|
|
6927
6924
|
} catch (error) {
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -479,9 +479,10 @@ export class AggregatorClient {
|
|
|
479
479
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
480
480
|
publishedAtV2(): string {
|
|
481
481
|
if (this.env === Env.Mainnet) {
|
|
482
|
-
return "0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af" // version 6
|
|
482
|
+
// return "0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af" // version 6
|
|
483
483
|
// return "0x4069913c4953297b7f08f67f6722e3b04aa5ab2976b4e1b8a456b81590b34ab4"
|
|
484
|
-
|
|
484
|
+
return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d"
|
|
485
|
+
// return "0x803db8dfcc86fc1afbc7d2212bd14ec9690978ddebea0d590e01147d6b17aa06" // pre
|
|
485
486
|
} else {
|
|
486
487
|
// return "0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637" // version 2
|
|
487
488
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"
|
|
@@ -19,10 +19,7 @@ export class Haedal implements Dex {
|
|
|
19
19
|
packages?: Map<string, string>
|
|
20
20
|
): Promise<TransactionObjectArgument> {
|
|
21
21
|
const { direction } = path
|
|
22
|
-
|
|
23
|
-
throw new Error("Haedal not support b2a swap")
|
|
24
|
-
}
|
|
25
|
-
const func = "swap_a2b"
|
|
22
|
+
const func = direction ? "swap_a2b" : "swap_b2a"
|
|
26
23
|
const args = [txb.object(path.id), txb.object("0x5"), inputCoin]
|
|
27
24
|
const publishedAt = getAggregatorV2PublishedAt(client.publishedAtV2(), packages)
|
|
28
25
|
const res = txb.moveCall({
|
package/tests/router.test.ts
CHANGED
|
@@ -35,7 +35,6 @@ describe("router module", () => {
|
|
|
35
35
|
|
|
36
36
|
const wallet = keypair.getPublicKey().toSuiAddress()
|
|
37
37
|
console.log("wallet: ", wallet)
|
|
38
|
-
// const wallet = "0x02e39bddb06f617112595378fef741f523fbf22ea188cca99ecb61a9904dda2a"
|
|
39
38
|
|
|
40
39
|
const endpoint = aggregatorURL
|
|
41
40
|
|
|
@@ -109,8 +108,8 @@ describe("router module", () => {
|
|
|
109
108
|
|
|
110
109
|
test("Build router tx", async () => {
|
|
111
110
|
const byAmountIn = true
|
|
112
|
-
const amount = "
|
|
113
|
-
const from = "
|
|
111
|
+
const amount = "1000000000"
|
|
112
|
+
const from = "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
|
|
114
113
|
const target = "0x2::sui::SUI"
|
|
115
114
|
|
|
116
115
|
const res = await client.findRouters({
|
|
@@ -119,7 +118,8 @@ describe("router module", () => {
|
|
|
119
118
|
amount: new BN(amount),
|
|
120
119
|
byAmountIn,
|
|
121
120
|
depth: 3,
|
|
122
|
-
providers: ["
|
|
121
|
+
providers: ["HAEDAL"],
|
|
122
|
+
splitCount: 1,
|
|
123
123
|
})
|
|
124
124
|
|
|
125
125
|
if (res != null) {
|