@cetusprotocol/aggregator-sdk 0.3.11 → 0.3.12
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -5
- package/dist/index.mjs +7 -5
- package/dist/src/api.d.ts +3 -1
- package/package.json +2 -1
- package/src/api.ts +4 -2
- package/src/client.ts +5 -2
- package/tests/router.test.ts +3 -9
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -206,6 +206,8 @@ type ExtendedDetails = {
|
|
|
206
206
|
afterSqrtPrice?: string;
|
|
207
207
|
deepbookv3DeepFee?: number;
|
|
208
208
|
scallopScoinTreasury?: string;
|
|
209
|
+
haedalPmmBasePriceSeed?: string;
|
|
210
|
+
haedalPmmQuotePriceSeed?: string;
|
|
209
211
|
};
|
|
210
212
|
type Path = {
|
|
211
213
|
id: string;
|
|
@@ -216,8 +218,8 @@ type Path = {
|
|
|
216
218
|
feeRate: number;
|
|
217
219
|
amountIn: number;
|
|
218
220
|
amountOut: number;
|
|
219
|
-
extendedDetails?: ExtendedDetails;
|
|
220
221
|
version?: string;
|
|
222
|
+
extendedDetails?: ExtendedDetails;
|
|
221
223
|
};
|
|
222
224
|
type Router = {
|
|
223
225
|
path: Path[];
|
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,8 @@ type ExtendedDetails = {
|
|
|
206
206
|
afterSqrtPrice?: string;
|
|
207
207
|
deepbookv3DeepFee?: number;
|
|
208
208
|
scallopScoinTreasury?: string;
|
|
209
|
+
haedalPmmBasePriceSeed?: string;
|
|
210
|
+
haedalPmmQuotePriceSeed?: string;
|
|
209
211
|
};
|
|
210
212
|
type Path = {
|
|
211
213
|
id: string;
|
|
@@ -216,8 +218,8 @@ type Path = {
|
|
|
216
218
|
feeRate: number;
|
|
217
219
|
amountIn: number;
|
|
218
220
|
amountOut: number;
|
|
219
|
-
extendedDetails?: ExtendedDetails;
|
|
220
221
|
version?: string;
|
|
222
|
+
extendedDetails?: ExtendedDetails;
|
|
221
223
|
};
|
|
222
224
|
type Router = {
|
|
223
225
|
path: Path[];
|
package/dist/index.js
CHANGED
|
@@ -6434,9 +6434,9 @@ var AggregatorClient9 = class {
|
|
|
6434
6434
|
// Include deepbookv3, scallop, bluefin
|
|
6435
6435
|
publishedAtV2() {
|
|
6436
6436
|
if (this.env === 0 /* Mainnet */) {
|
|
6437
|
-
return "
|
|
6437
|
+
return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502";
|
|
6438
6438
|
} else {
|
|
6439
|
-
return "
|
|
6439
|
+
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
6440
6440
|
}
|
|
6441
6441
|
}
|
|
6442
6442
|
deepbookv3DeepFeeType() {
|
|
@@ -6568,7 +6568,7 @@ function parseRouterResponse(data) {
|
|
|
6568
6568
|
routes: data.routes.map((route) => {
|
|
6569
6569
|
return {
|
|
6570
6570
|
path: route.path.map((path) => {
|
|
6571
|
-
var _a, _b, _c, _d, _e;
|
|
6571
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6572
6572
|
let version;
|
|
6573
6573
|
if (path.provider === AFTERMATH) {
|
|
6574
6574
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
@@ -6580,7 +6580,9 @@ function parseRouterResponse(data) {
|
|
|
6580
6580
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
6581
6581
|
afterSqrtPrice: (_c = path.extended_details) == null ? void 0 : _c.after_sqrt_price,
|
|
6582
6582
|
deepbookv3DeepFee: (_d = path.extended_details) == null ? void 0 : _d.deepbookv3_deep_fee,
|
|
6583
|
-
scallopScoinTreasury: (_e = path.extended_details) == null ? void 0 : _e.scallop_scoin_treasury
|
|
6583
|
+
scallopScoinTreasury: (_e = path.extended_details) == null ? void 0 : _e.scallop_scoin_treasury,
|
|
6584
|
+
haedalPmmBasePriceSeed: (_f = path.extended_details) == null ? void 0 : _f.haedal_pmm_base_price_seed,
|
|
6585
|
+
haedalPmmQuotePriceSeed: (_g = path.extended_details) == null ? void 0 : _g.haedal_pmm_quote_price_seed
|
|
6584
6586
|
};
|
|
6585
6587
|
}
|
|
6586
6588
|
return {
|
|
@@ -6722,7 +6724,7 @@ function getRouter(endpoint, params) {
|
|
|
6722
6724
|
url += `&providers=${providers.join(",")}`;
|
|
6723
6725
|
}
|
|
6724
6726
|
}
|
|
6725
|
-
url += "&v=
|
|
6727
|
+
url += "&v=1000312";
|
|
6726
6728
|
const response = yield fetch(url);
|
|
6727
6729
|
return response;
|
|
6728
6730
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -6432,9 +6432,9 @@ var AggregatorClient9 = class {
|
|
|
6432
6432
|
// Include deepbookv3, scallop, bluefin
|
|
6433
6433
|
publishedAtV2() {
|
|
6434
6434
|
if (this.env === 0 /* Mainnet */) {
|
|
6435
|
-
return "
|
|
6435
|
+
return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502";
|
|
6436
6436
|
} else {
|
|
6437
|
-
return "
|
|
6437
|
+
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
|
|
6438
6438
|
}
|
|
6439
6439
|
}
|
|
6440
6440
|
deepbookv3DeepFeeType() {
|
|
@@ -6566,7 +6566,7 @@ function parseRouterResponse(data) {
|
|
|
6566
6566
|
routes: data.routes.map((route) => {
|
|
6567
6567
|
return {
|
|
6568
6568
|
path: route.path.map((path) => {
|
|
6569
|
-
var _a, _b, _c, _d, _e;
|
|
6569
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6570
6570
|
let version;
|
|
6571
6571
|
if (path.provider === AFTERMATH) {
|
|
6572
6572
|
version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
|
|
@@ -6578,7 +6578,9 @@ function parseRouterResponse(data) {
|
|
|
6578
6578
|
turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
|
|
6579
6579
|
afterSqrtPrice: (_c = path.extended_details) == null ? void 0 : _c.after_sqrt_price,
|
|
6580
6580
|
deepbookv3DeepFee: (_d = path.extended_details) == null ? void 0 : _d.deepbookv3_deep_fee,
|
|
6581
|
-
scallopScoinTreasury: (_e = path.extended_details) == null ? void 0 : _e.scallop_scoin_treasury
|
|
6581
|
+
scallopScoinTreasury: (_e = path.extended_details) == null ? void 0 : _e.scallop_scoin_treasury,
|
|
6582
|
+
haedalPmmBasePriceSeed: (_f = path.extended_details) == null ? void 0 : _f.haedal_pmm_base_price_seed,
|
|
6583
|
+
haedalPmmQuotePriceSeed: (_g = path.extended_details) == null ? void 0 : _g.haedal_pmm_quote_price_seed
|
|
6582
6584
|
};
|
|
6583
6585
|
}
|
|
6584
6586
|
return {
|
|
@@ -6720,7 +6722,7 @@ function getRouter(endpoint, params) {
|
|
|
6720
6722
|
url += `&providers=${providers.join(",")}`;
|
|
6721
6723
|
}
|
|
6722
6724
|
}
|
|
6723
|
-
url += "&v=
|
|
6725
|
+
url += "&v=1000312";
|
|
6724
6726
|
const response = yield fetch(url);
|
|
6725
6727
|
return response;
|
|
6726
6728
|
} catch (error) {
|
package/dist/src/api.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export type ExtendedDetails = {
|
|
|
25
25
|
afterSqrtPrice?: string;
|
|
26
26
|
deepbookv3DeepFee?: number;
|
|
27
27
|
scallopScoinTreasury?: string;
|
|
28
|
+
haedalPmmBasePriceSeed?: string;
|
|
29
|
+
haedalPmmQuotePriceSeed?: string;
|
|
28
30
|
};
|
|
29
31
|
export type Path = {
|
|
30
32
|
id: string;
|
|
@@ -35,8 +37,8 @@ export type Path = {
|
|
|
35
37
|
feeRate: number;
|
|
36
38
|
amountIn: number;
|
|
37
39
|
amountOut: number;
|
|
38
|
-
extendedDetails?: ExtendedDetails;
|
|
39
40
|
version?: string;
|
|
41
|
+
extendedDetails?: ExtendedDetails;
|
|
40
42
|
};
|
|
41
43
|
export type Router = {
|
|
42
44
|
path: Path[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@babel/preset-typescript": "^7.24.1",
|
|
29
29
|
"@jest/globals": "^29.7.0",
|
|
30
30
|
"@mysten/sui": "^1.6.0",
|
|
31
|
+
"@pythnetwork/pyth-sui-js": "^2.1.0",
|
|
31
32
|
"@types/jest": "^29.5.12",
|
|
32
33
|
"@types/node": "^20.12.12",
|
|
33
34
|
"babel-jest": "^29.7.0",
|
package/src/api.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type ExtendedDetails = {
|
|
|
35
35
|
afterSqrtPrice?: string
|
|
36
36
|
deepbookv3DeepFee?: number
|
|
37
37
|
scallopScoinTreasury?: string
|
|
38
|
+
haedalPmmBasePriceSeed?: string
|
|
39
|
+
haedalPmmQuotePriceSeed?: string
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
export type Path = {
|
|
@@ -46,8 +48,8 @@ export type Path = {
|
|
|
46
48
|
feeRate: number
|
|
47
49
|
amountIn: number
|
|
48
50
|
amountOut: number
|
|
49
|
-
extendedDetails?: ExtendedDetails
|
|
50
51
|
version?: string
|
|
52
|
+
extendedDetails?: ExtendedDetails
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export type Router = {
|
|
@@ -168,7 +170,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
|
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
// set newest sdk version
|
|
171
|
-
url += "&v=
|
|
173
|
+
url += "&v=1000312"
|
|
172
174
|
|
|
173
175
|
const response = await fetch(url)
|
|
174
176
|
return response
|
package/src/client.ts
CHANGED
|
@@ -416,9 +416,10 @@ export class AggregatorClient {
|
|
|
416
416
|
// return "0x43811be4677f5a5de7bf2dac740c10abddfaa524aee6b18e910eeadda8a2f6ae" // version 1, deepbookv3
|
|
417
417
|
// return "0x6d70ffa7aa3f924c3f0b573d27d29895a0ee666aaff821073f75cb14af7fd01a" // version 3, deepbookv3 & scallop
|
|
418
418
|
// return "0x16d9418726c26d8cb4ce8c9dd75917fa9b1c7bf47d38d7a1a22603135f0f2a56" // version 4, add suilend
|
|
419
|
-
return "0x3b6d71bdeb8ce5b06febfd3cfc29ecd60d50da729477c8b8038ecdae34541b91"
|
|
419
|
+
// return "0x3b6d71bdeb8ce5b06febfd3cfc29ecd60d50da729477c8b8038ecdae34541b91" // version 5, add bluefin
|
|
420
|
+
return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502" // version 6, force upgrade scallop
|
|
420
421
|
} else {
|
|
421
|
-
return "
|
|
422
|
+
return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"
|
|
422
423
|
}
|
|
423
424
|
}
|
|
424
425
|
|
|
@@ -585,6 +586,8 @@ export function parseRouterResponse(data: any): RouterData {
|
|
|
585
586
|
deepbookv3DeepFee: path.extended_details?.deepbookv3_deep_fee,
|
|
586
587
|
scallopScoinTreasury:
|
|
587
588
|
path.extended_details?.scallop_scoin_treasury,
|
|
589
|
+
haedalPmmBasePriceSeed: path.extended_details?.haedal_pmm_base_price_seed,
|
|
590
|
+
haedalPmmQuotePriceSeed: path.extended_details?.haedal_pmm_quote_price_seed,
|
|
588
591
|
}
|
|
589
592
|
}
|
|
590
593
|
|
package/tests/router.test.ts
CHANGED
|
@@ -36,16 +36,11 @@ describe("router module", () => {
|
|
|
36
36
|
const wallet = keypair.getPublicKey().toSuiAddress()
|
|
37
37
|
console.log("wallet: ", wallet)
|
|
38
38
|
|
|
39
|
-
// // const endpoint =
|
|
40
|
-
// // "https://api-sui-cloudfront.cetus.zone/router_v2/find_routes"
|
|
41
39
|
const endpoint = aggregatorURL
|
|
42
40
|
|
|
43
41
|
const suiClient = new SuiClient({
|
|
44
42
|
url: fullNodeURL,
|
|
45
43
|
})
|
|
46
|
-
// const suiClient = new SuiClient({
|
|
47
|
-
// url: "https://fullnode.testnet.sui.io:443",
|
|
48
|
-
// })
|
|
49
44
|
|
|
50
45
|
client = new AggregatorClient(endpoint, wallet, suiClient, Env.Mainnet)
|
|
51
46
|
})
|
|
@@ -112,9 +107,9 @@ describe("router module", () => {
|
|
|
112
107
|
|
|
113
108
|
test("Build router tx", async () => {
|
|
114
109
|
const byAmountIn = true
|
|
115
|
-
const amount = "
|
|
110
|
+
const amount = "3574839"
|
|
111
|
+
const target = "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI"
|
|
116
112
|
const from = "0x2::sui::SUI"
|
|
117
|
-
const target = "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
|
|
118
113
|
|
|
119
114
|
const res = await client.findRouters({
|
|
120
115
|
from,
|
|
@@ -122,7 +117,7 @@ describe("router module", () => {
|
|
|
122
117
|
amount: new BN(amount),
|
|
123
118
|
byAmountIn,
|
|
124
119
|
depth: 3,
|
|
125
|
-
providers: ["
|
|
120
|
+
providers: ["SCALLOP"],
|
|
126
121
|
})
|
|
127
122
|
|
|
128
123
|
if (res != null) {
|
|
@@ -154,7 +149,6 @@ describe("router module", () => {
|
|
|
154
149
|
for (const event of result.events) {
|
|
155
150
|
console.log("event", JSON.stringify(event, null, 2))
|
|
156
151
|
}
|
|
157
|
-
console.log("txb", )
|
|
158
152
|
|
|
159
153
|
// if (result.effects.status.status === "success") {
|
|
160
154
|
// // console.log("Sim exec transaction success")
|