@cetusprotocol/aggregator-sdk 0.3.21 → 0.3.23
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/bun.lockb +0 -0
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +161 -47
- package/dist/index.mjs +161 -48
- package/dist/src/client.d.ts +7 -2
- package/dist/src/transaction/haedal_pmm.d.ts +2 -4
- package/package.json +1 -1
- package/src/api.ts +2 -2
- package/src/client.ts +230 -58
- package/src/transaction/haedal_pmm.ts +33 -24
- package/src/transaction/index.ts +9 -4
- package/src/transaction/swap.ts +2 -7
- package/tests/router.test.ts +25 -11
package/tests/router.test.ts
CHANGED
|
@@ -33,7 +33,10 @@ describe("router module", () => {
|
|
|
33
33
|
keypair = buildTestAccount()
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const wallet = keypair.getPublicKey().toSuiAddress()
|
|
36
|
+
// const wallet = keypair.getPublicKey().toSuiAddress()
|
|
37
|
+
const wallet =
|
|
38
|
+
"0x073dfdcbb5d6552efd954273f7ab9e0b918d7bf30103e3f4e632502289cd92ee"
|
|
39
|
+
|
|
37
40
|
console.log("wallet: ", wallet)
|
|
38
41
|
|
|
39
42
|
const endpoint = aggregatorURL
|
|
@@ -61,7 +64,7 @@ describe("router module", () => {
|
|
|
61
64
|
amount: new BN(amount),
|
|
62
65
|
byAmountIn,
|
|
63
66
|
pools: [
|
|
64
|
-
|
|
67
|
+
"0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105",
|
|
65
68
|
],
|
|
66
69
|
})
|
|
67
70
|
|
|
@@ -108,8 +111,9 @@ describe("router module", () => {
|
|
|
108
111
|
|
|
109
112
|
test("Build router tx", async () => {
|
|
110
113
|
const byAmountIn = true
|
|
111
|
-
const amount = "
|
|
112
|
-
const from =
|
|
114
|
+
const amount = "100000"
|
|
115
|
+
const from =
|
|
116
|
+
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
|
|
113
117
|
const target = "0x2::sui::SUI"
|
|
114
118
|
|
|
115
119
|
const res = await client.findRouters({
|
|
@@ -118,8 +122,8 @@ describe("router module", () => {
|
|
|
118
122
|
amount: new BN(amount),
|
|
119
123
|
byAmountIn,
|
|
120
124
|
depth: 3,
|
|
121
|
-
providers: ["
|
|
122
|
-
splitCount:
|
|
125
|
+
providers: ["CETUS"],
|
|
126
|
+
splitCount: 1,
|
|
123
127
|
})
|
|
124
128
|
|
|
125
129
|
if (res != null) {
|
|
@@ -205,8 +209,18 @@ describe("router module", () => {
|
|
|
205
209
|
|
|
206
210
|
test("Test Multi Input", async () => {
|
|
207
211
|
const amounts = [1000000000, 2000000000, 10000000000000]
|
|
208
|
-
const froms = [
|
|
209
|
-
|
|
212
|
+
const froms = [
|
|
213
|
+
testData.M_USDC,
|
|
214
|
+
testData.M_SUI,
|
|
215
|
+
testData.M_CETUS,
|
|
216
|
+
testData.M_NAVI,
|
|
217
|
+
]
|
|
218
|
+
const tos = [
|
|
219
|
+
testData.M_SUI,
|
|
220
|
+
testData.M_USDC,
|
|
221
|
+
testData.M_USDC,
|
|
222
|
+
testData.M_SUI,
|
|
223
|
+
]
|
|
210
224
|
|
|
211
225
|
for (let i = 0; i < froms.length; i++) {
|
|
212
226
|
const from = froms[i]
|
|
@@ -339,12 +353,12 @@ describe("router module", () => {
|
|
|
339
353
|
console.log("config", config)
|
|
340
354
|
}, 60000)
|
|
341
355
|
|
|
342
|
-
|
|
343
356
|
test("Find router", async () => {
|
|
344
357
|
const amount = "4239267610000000000"
|
|
345
358
|
const res = await client.findRouters({
|
|
346
|
-
from:
|
|
347
|
-
target:
|
|
359
|
+
from: "0x2::sui::SUI",
|
|
360
|
+
target:
|
|
361
|
+
"0x188c6239bda71ba5751990cc0271e91b6362c67bccf7aa381e018db7fe39c6d7::BUILD::BUILD",
|
|
348
362
|
amount: new BN(amount),
|
|
349
363
|
byAmountIn: true,
|
|
350
364
|
depth: 3,
|