@cetusprotocol/aggregator-sdk 0.3.22 → 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/dist/index.js +3 -7
- package/dist/index.mjs +3 -7
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/client.ts +2 -3
- package/src/transaction/swap.ts +2 -7
package/dist/index.js
CHANGED
|
@@ -5803,11 +5803,10 @@ function swapInPools(client, params, sender, env) {
|
|
|
5803
5803
|
const targetCoin = completionCoin(target);
|
|
5804
5804
|
const tx = new transactions.Transaction();
|
|
5805
5805
|
const direction = compareCoins(fromCoin, targetCoin);
|
|
5806
|
-
const integratePublishedAt = env === 0 /* Mainnet */ ? "
|
|
5806
|
+
const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
|
|
5807
5807
|
const coinA = direction ? fromCoin : targetCoin;
|
|
5808
5808
|
const coinB = direction ? targetCoin : fromCoin;
|
|
5809
5809
|
const typeArguments = [coinA, coinB];
|
|
5810
|
-
console.log("typeArguments", typeArguments, integratePublishedAt);
|
|
5811
5810
|
for (let i = 0; i < pools.length; i++) {
|
|
5812
5811
|
const args = [
|
|
5813
5812
|
tx.object(pools[i]),
|
|
@@ -5827,7 +5826,6 @@ function swapInPools(client, params, sender, env) {
|
|
|
5827
5826
|
"InvalidWallet" /* InvalidWallet */
|
|
5828
5827
|
);
|
|
5829
5828
|
}
|
|
5830
|
-
printTransaction(tx);
|
|
5831
5829
|
const simulateRes = yield client.devInspectTransactionBlock({
|
|
5832
5830
|
transactionBlock: tx,
|
|
5833
5831
|
sender
|
|
@@ -5869,7 +5867,6 @@ function swapInPools(client, params, sender, env) {
|
|
|
5869
5867
|
}
|
|
5870
5868
|
}
|
|
5871
5869
|
const event = valueData[tempIndex].parsedJson.data;
|
|
5872
|
-
console.log("event", JSON.stringify(event, null, 2));
|
|
5873
5870
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price;
|
|
5874
5871
|
const [decimalA, decimalB] = yield Promise.all([
|
|
5875
5872
|
client.getCoinMetadata({ coinType: coinA }).then((metadata) => metadata == null ? void 0 : metadata.decimals),
|
|
@@ -6473,7 +6470,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6473
6470
|
slippage
|
|
6474
6471
|
);
|
|
6475
6472
|
const packages = isBuilderRouterSwapParams(params) ? void 0 : params.routers.packages;
|
|
6476
|
-
console.log("packages11", packages);
|
|
6477
6473
|
const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(
|
|
6478
6474
|
this.publishedAtV2(),
|
|
6479
6475
|
packages
|
|
@@ -6606,7 +6602,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6606
6602
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6607
6603
|
publishedAtV2() {
|
|
6608
6604
|
if (this.env === 0 /* Mainnet */) {
|
|
6609
|
-
return "
|
|
6605
|
+
return "0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce";
|
|
6610
6606
|
} else {
|
|
6611
6607
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6612
6608
|
}
|
|
@@ -7037,7 +7033,7 @@ function getRouter(endpoint, params) {
|
|
|
7037
7033
|
url += `&providers=${providers.join(",")}`;
|
|
7038
7034
|
}
|
|
7039
7035
|
}
|
|
7040
|
-
url += "&v=
|
|
7036
|
+
url += "&v=1000323";
|
|
7041
7037
|
const response = yield fetch(url);
|
|
7042
7038
|
return response;
|
|
7043
7039
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -5801,11 +5801,10 @@ function swapInPools(client, params, sender, env) {
|
|
|
5801
5801
|
const targetCoin = completionCoin(target);
|
|
5802
5802
|
const tx = new Transaction();
|
|
5803
5803
|
const direction = compareCoins(fromCoin, targetCoin);
|
|
5804
|
-
const integratePublishedAt = env === 0 /* Mainnet */ ? "
|
|
5804
|
+
const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
|
|
5805
5805
|
const coinA = direction ? fromCoin : targetCoin;
|
|
5806
5806
|
const coinB = direction ? targetCoin : fromCoin;
|
|
5807
5807
|
const typeArguments = [coinA, coinB];
|
|
5808
|
-
console.log("typeArguments", typeArguments, integratePublishedAt);
|
|
5809
5808
|
for (let i = 0; i < pools.length; i++) {
|
|
5810
5809
|
const args = [
|
|
5811
5810
|
tx.object(pools[i]),
|
|
@@ -5825,7 +5824,6 @@ function swapInPools(client, params, sender, env) {
|
|
|
5825
5824
|
"InvalidWallet" /* InvalidWallet */
|
|
5826
5825
|
);
|
|
5827
5826
|
}
|
|
5828
|
-
printTransaction(tx);
|
|
5829
5827
|
const simulateRes = yield client.devInspectTransactionBlock({
|
|
5830
5828
|
transactionBlock: tx,
|
|
5831
5829
|
sender
|
|
@@ -5867,7 +5865,6 @@ function swapInPools(client, params, sender, env) {
|
|
|
5867
5865
|
}
|
|
5868
5866
|
}
|
|
5869
5867
|
const event = valueData[tempIndex].parsedJson.data;
|
|
5870
|
-
console.log("event", JSON.stringify(event, null, 2));
|
|
5871
5868
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price;
|
|
5872
5869
|
const [decimalA, decimalB] = yield Promise.all([
|
|
5873
5870
|
client.getCoinMetadata({ coinType: coinA }).then((metadata) => metadata == null ? void 0 : metadata.decimals),
|
|
@@ -6471,7 +6468,6 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6471
6468
|
slippage
|
|
6472
6469
|
);
|
|
6473
6470
|
const packages = isBuilderRouterSwapParams(params) ? void 0 : params.routers.packages;
|
|
6474
|
-
console.log("packages11", packages);
|
|
6475
6471
|
const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(
|
|
6476
6472
|
this.publishedAtV2(),
|
|
6477
6473
|
packages
|
|
@@ -6604,7 +6600,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
6604
6600
|
// Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
|
|
6605
6601
|
publishedAtV2() {
|
|
6606
6602
|
if (this.env === 0 /* Mainnet */) {
|
|
6607
|
-
return "
|
|
6603
|
+
return "0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce";
|
|
6608
6604
|
} else {
|
|
6609
6605
|
return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
|
|
6610
6606
|
}
|
|
@@ -7035,7 +7031,7 @@ function getRouter(endpoint, params) {
|
|
|
7035
7031
|
url += `&providers=${providers.join(",")}`;
|
|
7036
7032
|
}
|
|
7037
7033
|
}
|
|
7038
|
-
url += "&v=
|
|
7034
|
+
url += "&v=1000323";
|
|
7039
7035
|
const response = yield fetch(url);
|
|
7040
7036
|
return response;
|
|
7041
7037
|
} catch (error) {
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -422,8 +422,6 @@ export class AggregatorClient {
|
|
|
422
422
|
? undefined
|
|
423
423
|
: params.routers.packages
|
|
424
424
|
|
|
425
|
-
console.log("packages11", packages)
|
|
426
|
-
|
|
427
425
|
const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(
|
|
428
426
|
this.publishedAtV2(),
|
|
429
427
|
packages
|
|
@@ -583,7 +581,8 @@ export class AggregatorClient {
|
|
|
583
581
|
if (this.env === Env.Mainnet) {
|
|
584
582
|
// return "0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af" // version 6
|
|
585
583
|
// return "0x4069913c4953297b7f08f67f6722e3b04aa5ab2976b4e1b8a456b81590b34ab4"
|
|
586
|
-
return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d"
|
|
584
|
+
// return "0xf9c6f78322ed667909e05f6b42b2f5a67af6297503c905335e02a15148e9440d"
|
|
585
|
+
return "0x2485feb9d42c7c3bcb8ecde555ad40f1b073d9fb4faf354fa2d30a0b183a23ce"
|
|
587
586
|
// return "0x803db8dfcc86fc1afbc7d2212bd14ec9690978ddebea0d590e01147d6b17aa06" // pre
|
|
588
587
|
} else {
|
|
589
588
|
// return "0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637" // version 2
|
package/src/transaction/swap.ts
CHANGED
|
@@ -21,13 +21,12 @@ export async function swapInPools(
|
|
|
21
21
|
const tx = new Transaction()
|
|
22
22
|
const direction = compareCoins(fromCoin, targetCoin)
|
|
23
23
|
const integratePublishedAt = env === Env.Mainnet ?
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" :
|
|
25
|
+
"0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6"
|
|
26
26
|
const coinA = direction ? fromCoin : targetCoin
|
|
27
27
|
const coinB = direction ? targetCoin : fromCoin
|
|
28
28
|
|
|
29
29
|
const typeArguments = [coinA, coinB]
|
|
30
|
-
console.log("typeArguments", typeArguments, integratePublishedAt)
|
|
31
30
|
|
|
32
31
|
for (let i = 0; i < pools.length; i++) {
|
|
33
32
|
const args = [
|
|
@@ -50,8 +49,6 @@ export async function swapInPools(
|
|
|
50
49
|
)
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
printTransaction(tx)
|
|
54
|
-
|
|
55
52
|
const simulateRes = await client.devInspectTransactionBlock({
|
|
56
53
|
transactionBlock: tx,
|
|
57
54
|
sender,
|
|
@@ -99,8 +96,6 @@ export async function swapInPools(
|
|
|
99
96
|
|
|
100
97
|
const event = valueData[tempIndex].parsedJson.data
|
|
101
98
|
|
|
102
|
-
console.log("event", JSON.stringify(event, null, 2))
|
|
103
|
-
|
|
104
99
|
const currentSqrtPrice = event.step_results[0].current_sqrt_price
|
|
105
100
|
|
|
106
101
|
const [decimalA, decimalB] = await Promise.all([
|