@cetusprotocol/aggregator-sdk 0.3.28 → 0.3.29
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 +21 -16
- package/dist/index.mjs +21 -16
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/client.ts +21 -15
- package/tests/router.test.ts +2 -4
package/dist/index.js
CHANGED
|
@@ -6367,23 +6367,28 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6367
6367
|
}
|
|
6368
6368
|
const allCoins = [];
|
|
6369
6369
|
while (true) {
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
for (const coin of gotCoins.data) {
|
|
6377
|
-
allCoins.push({
|
|
6378
|
-
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6379
|
-
coinObjectId: coin.coinObjectId,
|
|
6380
|
-
balance: BigInt(coin.balance)
|
|
6370
|
+
try {
|
|
6371
|
+
const gotCoins = yield this.client.getCoins({
|
|
6372
|
+
owner: this.signer,
|
|
6373
|
+
coinType,
|
|
6374
|
+
cursor,
|
|
6375
|
+
limit
|
|
6381
6376
|
});
|
|
6382
|
-
|
|
6383
|
-
|
|
6377
|
+
for (const coin of gotCoins.data) {
|
|
6378
|
+
allCoins.push({
|
|
6379
|
+
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6380
|
+
coinObjectId: coin.coinObjectId,
|
|
6381
|
+
balance: BigInt(coin.balance)
|
|
6382
|
+
});
|
|
6383
|
+
}
|
|
6384
|
+
if (gotCoins.data.length < limit) {
|
|
6385
|
+
break;
|
|
6386
|
+
}
|
|
6387
|
+
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6388
|
+
} catch (e) {
|
|
6389
|
+
console.error("getCoins error:", e);
|
|
6384
6390
|
break;
|
|
6385
6391
|
}
|
|
6386
|
-
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6387
6392
|
}
|
|
6388
6393
|
this.allCoins.set(coinType, allCoins);
|
|
6389
6394
|
return allCoins;
|
|
@@ -6667,7 +6672,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6667
6672
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6668
6673
|
publishedAtV2() {
|
|
6669
6674
|
if (this.env === 0 /* Mainnet */) {
|
|
6670
|
-
return "
|
|
6675
|
+
return "0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032";
|
|
6671
6676
|
} else {
|
|
6672
6677
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6673
6678
|
}
|
|
@@ -7009,7 +7014,7 @@ function processEndpoint(endpoint) {
|
|
|
7009
7014
|
}
|
|
7010
7015
|
|
|
7011
7016
|
// src/api.ts
|
|
7012
|
-
var SDK_VERSION =
|
|
7017
|
+
var SDK_VERSION = 1000329;
|
|
7013
7018
|
function getRouterResult(endpoint, params) {
|
|
7014
7019
|
return __async(this, null, function* () {
|
|
7015
7020
|
let response;
|
package/dist/index.mjs
CHANGED
|
@@ -6365,23 +6365,28 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6365
6365
|
}
|
|
6366
6366
|
const allCoins = [];
|
|
6367
6367
|
while (true) {
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
for (const coin of gotCoins.data) {
|
|
6375
|
-
allCoins.push({
|
|
6376
|
-
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6377
|
-
coinObjectId: coin.coinObjectId,
|
|
6378
|
-
balance: BigInt(coin.balance)
|
|
6368
|
+
try {
|
|
6369
|
+
const gotCoins = yield this.client.getCoins({
|
|
6370
|
+
owner: this.signer,
|
|
6371
|
+
coinType,
|
|
6372
|
+
cursor,
|
|
6373
|
+
limit
|
|
6379
6374
|
});
|
|
6380
|
-
|
|
6381
|
-
|
|
6375
|
+
for (const coin of gotCoins.data) {
|
|
6376
|
+
allCoins.push({
|
|
6377
|
+
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
6378
|
+
coinObjectId: coin.coinObjectId,
|
|
6379
|
+
balance: BigInt(coin.balance)
|
|
6380
|
+
});
|
|
6381
|
+
}
|
|
6382
|
+
if (gotCoins.data.length < limit) {
|
|
6383
|
+
break;
|
|
6384
|
+
}
|
|
6385
|
+
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6386
|
+
} catch (e) {
|
|
6387
|
+
console.error("getCoins error:", e);
|
|
6382
6388
|
break;
|
|
6383
6389
|
}
|
|
6384
|
-
cursor = gotCoins.data[limit - 1].coinObjectId;
|
|
6385
6390
|
}
|
|
6386
6391
|
this.allCoins.set(coinType, allCoins);
|
|
6387
6392
|
return allCoins;
|
|
@@ -6665,7 +6670,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6665
6670
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6666
6671
|
publishedAtV2() {
|
|
6667
6672
|
if (this.env === 0 /* Mainnet */) {
|
|
6668
|
-
return "
|
|
6673
|
+
return "0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032";
|
|
6669
6674
|
} else {
|
|
6670
6675
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6671
6676
|
}
|
|
@@ -7007,7 +7012,7 @@ function processEndpoint(endpoint) {
|
|
|
7007
7012
|
}
|
|
7008
7013
|
|
|
7009
7014
|
// src/api.ts
|
|
7010
|
-
var SDK_VERSION =
|
|
7015
|
+
var SDK_VERSION = 1000329;
|
|
7011
7016
|
function getRouterResult(endpoint, params) {
|
|
7012
7017
|
return __async(this, null, function* () {
|
|
7013
7018
|
let response;
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -224,23 +224,28 @@ export class AggregatorClient {
|
|
|
224
224
|
|
|
225
225
|
const allCoins: CoinAsset[] = []
|
|
226
226
|
while (true) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
for (const coin of gotCoins.data) {
|
|
234
|
-
allCoins.push({
|
|
235
|
-
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
236
|
-
coinObjectId: coin.coinObjectId,
|
|
237
|
-
balance: BigInt(coin.balance),
|
|
227
|
+
try {
|
|
228
|
+
const gotCoins = await this.client.getCoins({
|
|
229
|
+
owner: this.signer,
|
|
230
|
+
coinType,
|
|
231
|
+
cursor,
|
|
232
|
+
limit,
|
|
238
233
|
})
|
|
239
|
-
|
|
240
|
-
|
|
234
|
+
for (const coin of gotCoins.data) {
|
|
235
|
+
allCoins.push({
|
|
236
|
+
coinAddress: extractStructTagFromType(coin.coinType).source_address,
|
|
237
|
+
coinObjectId: coin.coinObjectId,
|
|
238
|
+
balance: BigInt(coin.balance),
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
if (gotCoins.data.length < limit) {
|
|
242
|
+
break
|
|
243
|
+
}
|
|
244
|
+
cursor = gotCoins.data[limit - 1].coinObjectId
|
|
245
|
+
} catch (e) {
|
|
246
|
+
console.error("getCoins error:", e)
|
|
241
247
|
break
|
|
242
248
|
}
|
|
243
|
-
cursor = gotCoins.data[limit - 1].coinObjectId
|
|
244
249
|
}
|
|
245
250
|
|
|
246
251
|
this.allCoins.set(coinType, allCoins)
|
|
@@ -583,7 +588,8 @@ export class AggregatorClient {
|
|
|
583
588
|
if (this.env === Env.Mainnet) {
|
|
584
589
|
// return "0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af" // version 6
|
|
585
590
|
// return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d" // version 7
|
|
586
|
-
return "0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce" // version 8
|
|
591
|
+
// return "0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce" // version 8
|
|
592
|
+
return "0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032" // version 9
|
|
587
593
|
// return "0x803db8dfcc86fc1afbc7d2212bd14ec9690978ddebea0d590e01147d6b17aa06" // pre
|
|
588
594
|
} else {
|
|
589
595
|
// return "0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637" // version 2
|
package/tests/router.test.ts
CHANGED
|
@@ -33,9 +33,7 @@ describe("router module", () => {
|
|
|
33
33
|
keypair = buildTestAccount()
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
const wallet =
|
|
38
|
-
"0x073dfdcbb5d6552efd954273f7ab9e0b918d7bf30103e3f4e632502289cd92ee"
|
|
36
|
+
const wallet = keypair.getPublicKey().toSuiAddress()
|
|
39
37
|
|
|
40
38
|
console.log("wallet: ", wallet)
|
|
41
39
|
|
|
@@ -49,7 +47,7 @@ describe("router module", () => {
|
|
|
49
47
|
})
|
|
50
48
|
|
|
51
49
|
test("Get coins", () => {
|
|
52
|
-
return client.getCoins(testData.
|
|
50
|
+
return client.getCoins(testData.M_USDC).then((coins) => {
|
|
53
51
|
console.log(coins)
|
|
54
52
|
})
|
|
55
53
|
})
|