@cetusprotocol/aggregator-sdk 0.3.20 → 0.3.22
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 -46
- package/dist/index.mjs +161 -47
- 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 +232 -58
- package/src/transaction/haedal.ts +1 -4
- package/src/transaction/haedal_pmm.ts +33 -24
- package/src/transaction/index.ts +9 -4
- package/tests/router.test.ts +25 -11
package/tests/router.test.ts
CHANGED
|
@@ -33,9 +33,11 @@ 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
|
-
// const wallet = "0x02e39bddb06f617112595378fef741f523fbf22ea188cca99ecb61a9904dda2a"
|
|
39
41
|
|
|
40
42
|
const endpoint = aggregatorURL
|
|
41
43
|
|
|
@@ -62,7 +64,7 @@ describe("router module", () => {
|
|
|
62
64
|
amount: new BN(amount),
|
|
63
65
|
byAmountIn,
|
|
64
66
|
pools: [
|
|
65
|
-
|
|
67
|
+
"0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105",
|
|
66
68
|
],
|
|
67
69
|
})
|
|
68
70
|
|
|
@@ -109,8 +111,9 @@ describe("router module", () => {
|
|
|
109
111
|
|
|
110
112
|
test("Build router tx", async () => {
|
|
111
113
|
const byAmountIn = true
|
|
112
|
-
const amount = "
|
|
113
|
-
const from =
|
|
114
|
+
const amount = "100000"
|
|
115
|
+
const from =
|
|
116
|
+
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
|
|
114
117
|
const target = "0x2::sui::SUI"
|
|
115
118
|
|
|
116
119
|
const res = await client.findRouters({
|
|
@@ -119,7 +122,8 @@ describe("router module", () => {
|
|
|
119
122
|
amount: new BN(amount),
|
|
120
123
|
byAmountIn,
|
|
121
124
|
depth: 3,
|
|
122
|
-
providers: ["
|
|
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,
|