@cetusprotocol/aggregator-sdk 0.3.27 → 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 +25 -18
- package/dist/index.mjs +25 -18
- package/package.json +1 -1
- package/src/api.ts +4 -1
- package/src/client.ts +23 -16
- 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
|
}
|
|
@@ -6675,7 +6680,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6675
6680
|
// Include deepbookv3, scallop, bluefin
|
|
6676
6681
|
publishedAtV2Extend() {
|
|
6677
6682
|
if (this.env === 0 /* Mainnet */) {
|
|
6678
|
-
return "
|
|
6683
|
+
return "0x34ef25b60b51f9d07cd9b7dc5b08dfdf26c7b0ff00c57bb17454c161fa6b6b83";
|
|
6679
6684
|
} else {
|
|
6680
6685
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
6681
6686
|
}
|
|
@@ -7009,6 +7014,7 @@ function processEndpoint(endpoint) {
|
|
|
7009
7014
|
}
|
|
7010
7015
|
|
|
7011
7016
|
// src/api.ts
|
|
7017
|
+
var SDK_VERSION = 1000329;
|
|
7012
7018
|
function getRouterResult(endpoint, params) {
|
|
7013
7019
|
return __async(this, null, function* () {
|
|
7014
7020
|
let response;
|
|
@@ -7106,7 +7112,7 @@ function getRouter(endpoint, params) {
|
|
|
7106
7112
|
url += `&providers=${providers.join(",")}`;
|
|
7107
7113
|
}
|
|
7108
7114
|
}
|
|
7109
|
-
url +=
|
|
7115
|
+
url += `&v=${SDK_VERSION}`;
|
|
7110
7116
|
const response = yield fetch(url);
|
|
7111
7117
|
return response;
|
|
7112
7118
|
} catch (error) {
|
|
@@ -7148,7 +7154,8 @@ function postRouterWithLiquidityChanges(endpoint, params) {
|
|
|
7148
7154
|
tick_lower: change.ticklower,
|
|
7149
7155
|
tick_upper: change.tickUpper,
|
|
7150
7156
|
delta_liquidity: change.deltaLiquidity
|
|
7151
|
-
}))
|
|
7157
|
+
})),
|
|
7158
|
+
v: SDK_VERSION
|
|
7152
7159
|
};
|
|
7153
7160
|
try {
|
|
7154
7161
|
const response = yield fetch(url, {
|
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
|
}
|
|
@@ -6673,7 +6678,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6673
6678
|
// Include deepbookv3, scallop, bluefin
|
|
6674
6679
|
publishedAtV2Extend() {
|
|
6675
6680
|
if (this.env === 0 /* Mainnet */) {
|
|
6676
|
-
return "
|
|
6681
|
+
return "0x34ef25b60b51f9d07cd9b7dc5b08dfdf26c7b0ff00c57bb17454c161fa6b6b83";
|
|
6677
6682
|
} else {
|
|
6678
6683
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
6679
6684
|
}
|
|
@@ -7007,6 +7012,7 @@ function processEndpoint(endpoint) {
|
|
|
7007
7012
|
}
|
|
7008
7013
|
|
|
7009
7014
|
// src/api.ts
|
|
7015
|
+
var SDK_VERSION = 1000329;
|
|
7010
7016
|
function getRouterResult(endpoint, params) {
|
|
7011
7017
|
return __async(this, null, function* () {
|
|
7012
7018
|
let response;
|
|
@@ -7104,7 +7110,7 @@ function getRouter(endpoint, params) {
|
|
|
7104
7110
|
url += `&providers=${providers.join(",")}`;
|
|
7105
7111
|
}
|
|
7106
7112
|
}
|
|
7107
|
-
url +=
|
|
7113
|
+
url += `&v=${SDK_VERSION}`;
|
|
7108
7114
|
const response = yield fetch(url);
|
|
7109
7115
|
return response;
|
|
7110
7116
|
} catch (error) {
|
|
@@ -7146,7 +7152,8 @@ function postRouterWithLiquidityChanges(endpoint, params) {
|
|
|
7146
7152
|
tick_lower: change.ticklower,
|
|
7147
7153
|
tick_upper: change.tickUpper,
|
|
7148
7154
|
delta_liquidity: change.deltaLiquidity
|
|
7149
|
-
}))
|
|
7155
|
+
})),
|
|
7156
|
+
v: SDK_VERSION
|
|
7150
7157
|
};
|
|
7151
7158
|
try {
|
|
7152
7159
|
const response = yield fetch(url, {
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
} from "./errors"
|
|
9
9
|
import { parseRouterResponse } from "./client"
|
|
10
10
|
|
|
11
|
+
const SDK_VERSION = 1000329
|
|
12
|
+
|
|
11
13
|
export interface FindRouterParams {
|
|
12
14
|
from: string
|
|
13
15
|
target: string
|
|
@@ -205,7 +207,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
|
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
// set newest sdk version
|
|
208
|
-
url +=
|
|
210
|
+
url += `&v=${SDK_VERSION}`
|
|
209
211
|
|
|
210
212
|
const response = await fetch(url)
|
|
211
213
|
return response
|
|
@@ -252,6 +254,7 @@ async function postRouterWithLiquidityChanges(
|
|
|
252
254
|
tick_upper: change.tickUpper,
|
|
253
255
|
delta_liquidity: change.deltaLiquidity,
|
|
254
256
|
})),
|
|
257
|
+
v: SDK_VERSION,
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
try {
|
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
|
|
@@ -601,7 +607,8 @@ export class AggregatorClient {
|
|
|
601
607
|
// return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502" // version 6, force upgrade scallop
|
|
602
608
|
// return "0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b" // version 7
|
|
603
609
|
// return "0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613" // version 8
|
|
604
|
-
return "0xa2d8a4279d69d8fec04b2fea8852d0d467d3cc0d39c5890180d439ae7a9953ed" // version 9
|
|
610
|
+
// return "0xa2d8a4279d69d8fec04b2fea8852d0d467d3cc0d39c5890180d439ae7a9953ed" // version 9
|
|
611
|
+
return "0x34ef25b60b51f9d07cd9b7dc5b08dfdf26c7b0ff00c57bb17454c161fa6b6b83" // version 10
|
|
605
612
|
} else {
|
|
606
613
|
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"
|
|
607
614
|
}
|
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
|
})
|