@cetusprotocol/aggregator-sdk 1.4.6 → 1.4.7
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.lock +3 -3
- package/dist/index.cjs +79 -69
- package/dist/index.d.cts +69 -18
- package/dist/index.d.ts +69 -18
- package/dist/index.js +79 -69
- package/package.json +2 -2
package/bun.lock
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mysten/sui": "^2.
|
|
8
|
+
"@mysten/sui": "^2.13.2",
|
|
9
9
|
"@pythnetwork/hermes-client": "^3.1.0",
|
|
10
10
|
"bip39": "^3.1.0",
|
|
11
11
|
"dotenv": "^16.4.5",
|
|
@@ -110,9 +110,9 @@
|
|
|
110
110
|
|
|
111
111
|
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.30", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q=="],
|
|
112
112
|
|
|
113
|
-
"@mysten/bcs": ["@mysten/bcs@2.0.
|
|
113
|
+
"@mysten/bcs": ["@mysten/bcs@2.0.3", "", { "dependencies": { "@mysten/utils": "^0.3.1", "@scure/base": "^2.0.0" } }, "sha512-dwcaL4HNAsEGpU3hKUAsXgCZp9l6++e2A3THpzoYZ8e7bsy4XH1V0dXD5dIzgNcVZiZfb6ZnDMG+gdF6+1WOQA=="],
|
|
114
114
|
|
|
115
|
-
"@mysten/sui": ["@mysten/sui@2.
|
|
115
|
+
"@mysten/sui": ["@mysten/sui@2.13.2", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "@mysten/bcs": "^2.0.3", "@mysten/utils": "^0.3.1", "@noble/curves": "^2.0.1", "@noble/hashes": "^2.0.1", "@protobuf-ts/grpcweb-transport": "^2.11.1", "@protobuf-ts/runtime": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1", "@scure/base": "^2.0.0", "@scure/bip32": "^2.0.1", "@scure/bip39": "^2.0.1", "gql.tada": "^1.9.0", "graphql": "^16.12.0", "poseidon-lite": "0.2.1", "valibot": "^1.2.0" } }, "sha512-M/H2CZJQyLyi0vvCJZ6rRzItJCsnh66v1OTI2VoBad2lau/BTuUKOEPjRpfU4YlVJcGR4h+RLCjDXV4ACuRKSA=="],
|
|
116
116
|
|
|
117
117
|
"@mysten/utils": ["@mysten/utils@0.3.1", "", { "dependencies": { "@scure/base": "^2.0.0" } }, "sha512-36KhxG284uhDdSnlkyNaS6fzKTX9FpP2WQWOwUKIRsqQFFIm2ooCf2TP1IuqrtMpkairwpiWkAS0eg7cpemVzg=="],
|
|
118
118
|
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var transactions = require('@mysten/sui/transactions');
|
|
4
4
|
var JSONbig = require('json-bigint');
|
|
5
5
|
var utils = require('@mysten/sui/utils');
|
|
6
|
-
var
|
|
6
|
+
var grpc = require('@mysten/sui/grpc');
|
|
7
7
|
var hermesClient = require('@pythnetwork/hermes-client');
|
|
8
8
|
var bcs = require('@mysten/sui/bcs');
|
|
9
9
|
|
|
@@ -7857,12 +7857,11 @@ var PythAdapter = class {
|
|
|
7857
7857
|
if (this.baseUpdateFee !== void 0) {
|
|
7858
7858
|
return this.baseUpdateFee;
|
|
7859
7859
|
}
|
|
7860
|
-
const
|
|
7861
|
-
|
|
7862
|
-
|
|
7860
|
+
const { object } = await this.client.getObject({
|
|
7861
|
+
objectId: this.pythStateId,
|
|
7862
|
+
include: { json: true }
|
|
7863
7863
|
});
|
|
7864
|
-
const
|
|
7865
|
-
const json = content && "fields" in content ? content.fields : null;
|
|
7864
|
+
const json = object.json;
|
|
7866
7865
|
if (!json) {
|
|
7867
7866
|
throw new Error("Unable to fetch pyth state object");
|
|
7868
7867
|
}
|
|
@@ -7870,21 +7869,16 @@ var PythAdapter = class {
|
|
|
7870
7869
|
return this.baseUpdateFee;
|
|
7871
7870
|
}
|
|
7872
7871
|
async getPackageId(objectId) {
|
|
7873
|
-
const
|
|
7874
|
-
|
|
7875
|
-
|
|
7872
|
+
const { object } = await this.client.getObject({
|
|
7873
|
+
objectId,
|
|
7874
|
+
include: { json: true }
|
|
7876
7875
|
});
|
|
7877
|
-
const
|
|
7878
|
-
const json = content && "fields" in content ? content.fields : null;
|
|
7876
|
+
const json = object.json;
|
|
7879
7877
|
if (!json) {
|
|
7880
7878
|
throw new Error(`Cannot fetch package id for object ${objectId}`);
|
|
7881
7879
|
}
|
|
7882
7880
|
if ("upgrade_cap" in json) {
|
|
7883
|
-
|
|
7884
|
-
const packageId = upgradeCap?.fields?.package;
|
|
7885
|
-
if (typeof packageId === "string") {
|
|
7886
|
-
return packageId;
|
|
7887
|
-
}
|
|
7881
|
+
return json.upgrade_cap.package;
|
|
7888
7882
|
}
|
|
7889
7883
|
throw new Error("upgrade_cap not found");
|
|
7890
7884
|
}
|
|
@@ -7908,19 +7902,20 @@ var PythAdapter = class {
|
|
|
7908
7902
|
const { id: tableId, fieldType } = await this.getPriceTableInfo();
|
|
7909
7903
|
const feedIdBytes = Buffer.from(normalizedFeedId, "hex");
|
|
7910
7904
|
try {
|
|
7911
|
-
const
|
|
7905
|
+
const PriceIdentifier = bcs.bcs.struct("PriceIdentifier", {
|
|
7906
|
+
bytes: bcs.bcs.vector(bcs.bcs.u8())
|
|
7907
|
+
});
|
|
7908
|
+
const bcsBytes = PriceIdentifier.serialize({ bytes: Array.from(feedIdBytes) }).toBytes();
|
|
7909
|
+
const result = await this.client.getDynamicField({
|
|
7912
7910
|
parentId: tableId,
|
|
7913
7911
|
name: {
|
|
7914
|
-
type:
|
|
7915
|
-
|
|
7912
|
+
type: fieldType,
|
|
7913
|
+
bcs: bcsBytes
|
|
7916
7914
|
}
|
|
7917
7915
|
});
|
|
7918
|
-
const
|
|
7919
|
-
const
|
|
7920
|
-
const objectId =
|
|
7921
|
-
if (!objectId) {
|
|
7922
|
-
return void 0;
|
|
7923
|
-
}
|
|
7916
|
+
const valueBcs = result.dynamicField.value.bcs;
|
|
7917
|
+
const valueBytes = valueBcs instanceof Uint8Array ? valueBcs : new Uint8Array(Object.values(valueBcs));
|
|
7918
|
+
const objectId = "0x" + Array.from(valueBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7924
7919
|
this.priceFeedObjectIdCache.set(normalizedFeedId, objectId);
|
|
7925
7920
|
return objectId;
|
|
7926
7921
|
} catch {
|
|
@@ -7931,22 +7926,35 @@ var PythAdapter = class {
|
|
|
7931
7926
|
if (this.priceTableInfo !== void 0) {
|
|
7932
7927
|
return this.priceTableInfo;
|
|
7933
7928
|
}
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7929
|
+
let cursor = null;
|
|
7930
|
+
let hasNextPage = true;
|
|
7931
|
+
while (hasNextPage) {
|
|
7932
|
+
const dynamicFields = await this.client.listDynamicFields({
|
|
7933
|
+
parentId: this.pythStateId,
|
|
7934
|
+
cursor
|
|
7935
|
+
});
|
|
7936
|
+
for (const field of dynamicFields.dynamicFields) {
|
|
7937
|
+
if (field.name.type === "vector<u8>") {
|
|
7938
|
+
const objectId = field.$kind === "DynamicObject" && field.childId ? field.childId : field.fieldId;
|
|
7939
|
+
const fieldObj = await this.client.getObject({
|
|
7940
|
+
objectId,
|
|
7941
|
+
include: { json: true }
|
|
7942
|
+
});
|
|
7943
|
+
const type = fieldObj.object.type;
|
|
7944
|
+
if (type.includes("table::Table")) {
|
|
7945
|
+
const innerTypes = type.replace(/.*table::Table</, "").replace(/>$/, "");
|
|
7946
|
+
const fieldType = innerTypes.split(",")[0].trim();
|
|
7947
|
+
this.priceTableInfo = { id: fieldObj.object.objectId, fieldType };
|
|
7948
|
+
return this.priceTableInfo;
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7939
7951
|
}
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
throw new Error(
|
|
7943
|
-
"Price Table not found, contract may not be initialized"
|
|
7944
|
-
);
|
|
7952
|
+
hasNextPage = dynamicFields.hasNextPage;
|
|
7953
|
+
cursor = dynamicFields.cursor;
|
|
7945
7954
|
}
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
return this.priceTableInfo;
|
|
7955
|
+
throw new Error(
|
|
7956
|
+
"Price Table not found, contract may not be initialized"
|
|
7957
|
+
);
|
|
7950
7958
|
}
|
|
7951
7959
|
extractVaaBytesFromAccumulatorMessage(accumulatorMessage) {
|
|
7952
7960
|
const trailingPayloadSize = accumulatorMessage.readUint8(6);
|
|
@@ -8130,21 +8138,21 @@ async function getOrCreateAccountCap(txb, client, owner) {
|
|
|
8130
8138
|
}
|
|
8131
8139
|
async function getAccountCap(client, owner) {
|
|
8132
8140
|
const limit = 50;
|
|
8133
|
-
let cursor =
|
|
8141
|
+
let cursor = null;
|
|
8134
8142
|
while (true) {
|
|
8135
|
-
const ownedObjects = await client.
|
|
8143
|
+
const ownedObjects = await client.listOwnedObjects({
|
|
8136
8144
|
owner,
|
|
8137
8145
|
cursor,
|
|
8138
8146
|
limit,
|
|
8139
|
-
|
|
8147
|
+
type: `${DEEPBOOK_PACKAGE_ID}::${DEEPBOOK_CUSTODIAN_V2_MODULE}::AccountCap`
|
|
8140
8148
|
});
|
|
8141
|
-
if (ownedObjects.
|
|
8142
|
-
return ownedObjects.
|
|
8149
|
+
if (ownedObjects.objects.length !== 0) {
|
|
8150
|
+
return ownedObjects.objects[0].objectId;
|
|
8143
8151
|
}
|
|
8144
8152
|
if (!ownedObjects.hasNextPage) {
|
|
8145
8153
|
break;
|
|
8146
8154
|
}
|
|
8147
|
-
cursor = ownedObjects.
|
|
8155
|
+
cursor = ownedObjects.cursor;
|
|
8148
8156
|
}
|
|
8149
8157
|
return null;
|
|
8150
8158
|
}
|
|
@@ -8172,10 +8180,10 @@ function getAggregatorV2Extend2PublishedAt(publishedAt, packages) {
|
|
|
8172
8180
|
// src/utils/gas.ts
|
|
8173
8181
|
var import_bn4 = __toESM(require_bn());
|
|
8174
8182
|
function extractGasMetrics(result) {
|
|
8175
|
-
const
|
|
8176
|
-
const
|
|
8177
|
-
if (!
|
|
8178
|
-
const errorMsg =
|
|
8183
|
+
const txResult = result.Transaction ?? result.FailedTransaction;
|
|
8184
|
+
const effects = txResult?.effects;
|
|
8185
|
+
if (!effects || !effects.status.success) {
|
|
8186
|
+
const errorMsg = effects?.status.success === false ? effects.status.error.message : "Unknown error";
|
|
8179
8187
|
return {
|
|
8180
8188
|
computationCost: "0",
|
|
8181
8189
|
storageCost: "0",
|
|
@@ -8774,8 +8782,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8774
8782
|
constructor(params) {
|
|
8775
8783
|
this.endpoint = params.endpoint ? processEndpoint(params.endpoint) : DEFAULT_ENDPOINT;
|
|
8776
8784
|
const network = params.env === 1 /* Testnet */ ? "testnet" : "mainnet";
|
|
8777
|
-
const
|
|
8778
|
-
this.client = params.client ?? new
|
|
8785
|
+
const grpcUrl = params.env === 1 /* Testnet */ ? "https://fullnode.testnet.sui.io:443" : "https://fullnode.mainnet.sui.io:443";
|
|
8786
|
+
this.client = params.client ?? new grpc.SuiGrpcClient({ network, baseUrl: grpcUrl });
|
|
8779
8787
|
this.signer = params.signer || "";
|
|
8780
8788
|
this.env = params.env || 0 /* Mainnet */;
|
|
8781
8789
|
const config2 = _AggregatorClient.CONFIG[this.env];
|
|
@@ -8816,13 +8824,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8816
8824
|
}
|
|
8817
8825
|
async getOneCoinUsedToMerge(coinType) {
|
|
8818
8826
|
try {
|
|
8819
|
-
const gotCoin = await this.client.
|
|
8827
|
+
const gotCoin = await this.client.listCoins({
|
|
8820
8828
|
owner: this.signer,
|
|
8821
8829
|
coinType,
|
|
8822
8830
|
limit: 1
|
|
8823
8831
|
});
|
|
8824
|
-
if (gotCoin.
|
|
8825
|
-
return gotCoin.
|
|
8832
|
+
if (gotCoin.objects.length === 1) {
|
|
8833
|
+
return gotCoin.objects[0].objectId;
|
|
8826
8834
|
}
|
|
8827
8835
|
return null;
|
|
8828
8836
|
} catch (error) {
|
|
@@ -9565,16 +9573,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9565
9573
|
});
|
|
9566
9574
|
}
|
|
9567
9575
|
tx.setSenderIfNotSet(this.signer || "0x0");
|
|
9568
|
-
const simulateRes = await this.client.
|
|
9569
|
-
|
|
9570
|
-
|
|
9576
|
+
const simulateRes = await this.client.simulateTransaction({
|
|
9577
|
+
transaction: tx,
|
|
9578
|
+
include: { events: true, effects: true }
|
|
9571
9579
|
});
|
|
9572
|
-
|
|
9573
|
-
|
|
9580
|
+
const txResult = simulateRes.Transaction ?? simulateRes.FailedTransaction;
|
|
9581
|
+
if (!txResult || simulateRes.$kind === "FailedTransaction") {
|
|
9582
|
+
const errorMsg = txResult?.status.success === false ? txResult.status.error.message : "Unknown error";
|
|
9583
|
+
throw new Error("Simulation error: " + errorMsg);
|
|
9574
9584
|
}
|
|
9575
|
-
const events =
|
|
9585
|
+
const events = txResult.events ?? [];
|
|
9576
9586
|
const valueData = events.filter((item) => {
|
|
9577
|
-
return item.
|
|
9587
|
+
return item.eventType.includes("CalculatedSwapResultEvent");
|
|
9578
9588
|
});
|
|
9579
9589
|
if (valueData.length === 0 || valueData.length !== pools.length) {
|
|
9580
9590
|
throw new Error("Simulate event result error");
|
|
@@ -9582,7 +9592,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9582
9592
|
let tempMaxAmount = byAmountIn ? new import_bn6.default(0) : new import_bn6.default(U64_MAX);
|
|
9583
9593
|
let tempIndex = 0;
|
|
9584
9594
|
for (let i = 0; i < valueData.length; i += 1) {
|
|
9585
|
-
const eventJson2 = valueData[i].
|
|
9595
|
+
const eventJson2 = valueData[i].json;
|
|
9586
9596
|
if (eventJson2?.data?.is_exceed) {
|
|
9587
9597
|
continue;
|
|
9588
9598
|
}
|
|
@@ -9600,11 +9610,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9600
9610
|
}
|
|
9601
9611
|
}
|
|
9602
9612
|
}
|
|
9603
|
-
const eventJson = valueData[tempIndex].
|
|
9613
|
+
const eventJson = valueData[tempIndex].json;
|
|
9604
9614
|
const eventData = eventJson?.data;
|
|
9605
9615
|
const [decimalA, decimalB] = await Promise.all([
|
|
9606
|
-
this.client.getCoinMetadata({ coinType: coinA }).then((res) => res?.decimals ?? null),
|
|
9607
|
-
this.client.getCoinMetadata({ coinType: coinB }).then((res) => res?.decimals ?? null)
|
|
9616
|
+
this.client.getCoinMetadata({ coinType: coinA }).then((res) => res.coinMetadata?.decimals ?? null),
|
|
9617
|
+
this.client.getCoinMetadata({ coinType: coinB }).then((res) => res.coinMetadata?.decimals ?? null)
|
|
9608
9618
|
]);
|
|
9609
9619
|
if (decimalA == null || decimalB == null) {
|
|
9610
9620
|
throw new Error("Cannot get coin decimals");
|
|
@@ -9673,9 +9683,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9673
9683
|
}
|
|
9674
9684
|
async devInspectTransactionBlock(txb) {
|
|
9675
9685
|
txb.setSenderIfNotSet(this.signer || "0x0");
|
|
9676
|
-
const res = await this.client.
|
|
9677
|
-
|
|
9678
|
-
|
|
9686
|
+
const res = await this.client.simulateTransaction({
|
|
9687
|
+
transaction: txb,
|
|
9688
|
+
include: { events: true, effects: true }
|
|
9679
9689
|
});
|
|
9680
9690
|
return res;
|
|
9681
9691
|
}
|
|
@@ -9683,7 +9693,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9683
9693
|
const res = await this.client.signAndExecuteTransaction({
|
|
9684
9694
|
transaction: txb,
|
|
9685
9695
|
signer,
|
|
9686
|
-
|
|
9696
|
+
include: { effects: true, events: true, balanceChanges: true }
|
|
9687
9697
|
});
|
|
9688
9698
|
return res;
|
|
9689
9699
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
1
|
+
import * as _mysten_sui_client from '@mysten/sui/client';
|
|
3
2
|
import { TransactionObjectArgument, Transaction, TransactionArgument } from '@mysten/sui/transactions';
|
|
4
3
|
import BN from 'bn.js';
|
|
5
4
|
import Decimal from 'decimal.js';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
6
|
import { Signer } from '@mysten/sui/cryptography';
|
|
7
7
|
|
|
8
8
|
interface FindRouterParams {
|
|
@@ -305,7 +305,7 @@ declare class PythAdapter {
|
|
|
305
305
|
private priceTableInfo;
|
|
306
306
|
private priceFeedObjectIdCache;
|
|
307
307
|
private baseUpdateFee;
|
|
308
|
-
constructor(client:
|
|
308
|
+
constructor(client: SuiGrpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
|
|
309
309
|
getPriceFeedsUpdateData(priceIDs: string[]): Promise<Buffer[]>;
|
|
310
310
|
getBaseUpdateFee(): Promise<number>;
|
|
311
311
|
getPackageId(objectId: ObjectId): Promise<string>;
|
|
@@ -399,7 +399,7 @@ declare function getProvidersIncluding(includeProviders: string[]): string[];
|
|
|
399
399
|
type AggregatorClientParams = {
|
|
400
400
|
endpoint?: string;
|
|
401
401
|
signer?: string;
|
|
402
|
-
client?:
|
|
402
|
+
client?: SuiGrpcClient;
|
|
403
403
|
env?: Env;
|
|
404
404
|
pythUrls?: string[];
|
|
405
405
|
apiKey?: string;
|
|
@@ -411,7 +411,7 @@ type AggregatorClientParams = {
|
|
|
411
411
|
declare class AggregatorClient {
|
|
412
412
|
endpoint: string;
|
|
413
413
|
signer: string;
|
|
414
|
-
client:
|
|
414
|
+
client: SuiGrpcClient;
|
|
415
415
|
env: Env;
|
|
416
416
|
apiKey: string;
|
|
417
417
|
protected pythAdapter: PythAdapter;
|
|
@@ -453,8 +453,15 @@ declare class AggregatorClient {
|
|
|
453
453
|
fixableRouterSwapV3(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
|
454
454
|
swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResultV3>;
|
|
455
455
|
updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
|
|
456
|
-
devInspectTransactionBlock(txb: Transaction): Promise<
|
|
457
|
-
|
|
456
|
+
devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.SuiClientTypes.SimulateTransactionResult<{
|
|
457
|
+
events: true;
|
|
458
|
+
effects: true;
|
|
459
|
+
}>>;
|
|
460
|
+
sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiClientTypes.TransactionResult<{
|
|
461
|
+
effects: true;
|
|
462
|
+
events: true;
|
|
463
|
+
balanceChanges: true;
|
|
464
|
+
}>>;
|
|
458
465
|
}
|
|
459
466
|
|
|
460
467
|
/**
|
|
@@ -487,7 +494,7 @@ type GetOrCreateAccountCapResult = {
|
|
|
487
494
|
accountCap: TransactionObjectArgument;
|
|
488
495
|
isCreate: boolean;
|
|
489
496
|
};
|
|
490
|
-
declare function getOrCreateAccountCap(txb: Transaction, client:
|
|
497
|
+
declare function getOrCreateAccountCap(txb: Transaction, client: SuiGrpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
|
|
491
498
|
|
|
492
499
|
/**
|
|
493
500
|
* Represents a SUI address, which is a string.
|
|
@@ -637,23 +644,67 @@ interface Dex {
|
|
|
637
644
|
}
|
|
638
645
|
|
|
639
646
|
/**
|
|
640
|
-
* Matches the shape of
|
|
647
|
+
* Matches the shape of SuiClientTypes.SimulateTransactionResult with effects included.
|
|
641
648
|
* Using a local type so gas.ts can be used without importing the full SDK.
|
|
642
649
|
*/
|
|
643
650
|
type SimulateTransactionResult = {
|
|
644
|
-
|
|
651
|
+
$kind: 'Transaction' | 'FailedTransaction';
|
|
652
|
+
Transaction?: {
|
|
645
653
|
status: {
|
|
646
|
-
|
|
647
|
-
error
|
|
654
|
+
success: true;
|
|
655
|
+
error: null;
|
|
656
|
+
} | {
|
|
657
|
+
success: false;
|
|
658
|
+
error: {
|
|
659
|
+
message: string;
|
|
660
|
+
};
|
|
648
661
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
662
|
+
effects?: {
|
|
663
|
+
status: {
|
|
664
|
+
success: true;
|
|
665
|
+
error: null;
|
|
666
|
+
} | {
|
|
667
|
+
success: false;
|
|
668
|
+
error: {
|
|
669
|
+
message: string;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
gasUsed: {
|
|
673
|
+
computationCost: string;
|
|
674
|
+
storageCost: string;
|
|
675
|
+
storageRebate: string;
|
|
676
|
+
nonRefundableStorageFee: string;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
FailedTransaction?: {
|
|
681
|
+
status: {
|
|
682
|
+
success: true;
|
|
683
|
+
error: null;
|
|
684
|
+
} | {
|
|
685
|
+
success: false;
|
|
686
|
+
error: {
|
|
687
|
+
message: string;
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
effects?: {
|
|
691
|
+
status: {
|
|
692
|
+
success: true;
|
|
693
|
+
error: null;
|
|
694
|
+
} | {
|
|
695
|
+
success: false;
|
|
696
|
+
error: {
|
|
697
|
+
message: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
gasUsed: {
|
|
701
|
+
computationCost: string;
|
|
702
|
+
storageCost: string;
|
|
703
|
+
storageRebate: string;
|
|
704
|
+
nonRefundableStorageFee: string;
|
|
705
|
+
};
|
|
654
706
|
};
|
|
655
707
|
};
|
|
656
|
-
error?: string | null;
|
|
657
708
|
};
|
|
658
709
|
interface GasMetrics {
|
|
659
710
|
computationCost: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
1
|
+
import * as _mysten_sui_client from '@mysten/sui/client';
|
|
3
2
|
import { TransactionObjectArgument, Transaction, TransactionArgument } from '@mysten/sui/transactions';
|
|
4
3
|
import BN from 'bn.js';
|
|
5
4
|
import Decimal from 'decimal.js';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
6
|
import { Signer } from '@mysten/sui/cryptography';
|
|
7
7
|
|
|
8
8
|
interface FindRouterParams {
|
|
@@ -305,7 +305,7 @@ declare class PythAdapter {
|
|
|
305
305
|
private priceTableInfo;
|
|
306
306
|
private priceFeedObjectIdCache;
|
|
307
307
|
private baseUpdateFee;
|
|
308
|
-
constructor(client:
|
|
308
|
+
constructor(client: SuiGrpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId, hermesUrls: string[]);
|
|
309
309
|
getPriceFeedsUpdateData(priceIDs: string[]): Promise<Buffer[]>;
|
|
310
310
|
getBaseUpdateFee(): Promise<number>;
|
|
311
311
|
getPackageId(objectId: ObjectId): Promise<string>;
|
|
@@ -399,7 +399,7 @@ declare function getProvidersIncluding(includeProviders: string[]): string[];
|
|
|
399
399
|
type AggregatorClientParams = {
|
|
400
400
|
endpoint?: string;
|
|
401
401
|
signer?: string;
|
|
402
|
-
client?:
|
|
402
|
+
client?: SuiGrpcClient;
|
|
403
403
|
env?: Env;
|
|
404
404
|
pythUrls?: string[];
|
|
405
405
|
apiKey?: string;
|
|
@@ -411,7 +411,7 @@ type AggregatorClientParams = {
|
|
|
411
411
|
declare class AggregatorClient {
|
|
412
412
|
endpoint: string;
|
|
413
413
|
signer: string;
|
|
414
|
-
client:
|
|
414
|
+
client: SuiGrpcClient;
|
|
415
415
|
env: Env;
|
|
416
416
|
apiKey: string;
|
|
417
417
|
protected pythAdapter: PythAdapter;
|
|
@@ -453,8 +453,15 @@ declare class AggregatorClient {
|
|
|
453
453
|
fixableRouterSwapV3(params: BuildRouterSwapParamsV3): Promise<TransactionObjectArgument>;
|
|
454
454
|
swapInPools(params: SwapInPoolsParams): Promise<SwapInPoolsResultV3>;
|
|
455
455
|
updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
|
|
456
|
-
devInspectTransactionBlock(txb: Transaction): Promise<
|
|
457
|
-
|
|
456
|
+
devInspectTransactionBlock(txb: Transaction): Promise<_mysten_sui_client.SuiClientTypes.SimulateTransactionResult<{
|
|
457
|
+
events: true;
|
|
458
|
+
effects: true;
|
|
459
|
+
}>>;
|
|
460
|
+
sendTransaction(txb: Transaction, signer: Signer): Promise<_mysten_sui_client.SuiClientTypes.TransactionResult<{
|
|
461
|
+
effects: true;
|
|
462
|
+
events: true;
|
|
463
|
+
balanceChanges: true;
|
|
464
|
+
}>>;
|
|
458
465
|
}
|
|
459
466
|
|
|
460
467
|
/**
|
|
@@ -487,7 +494,7 @@ type GetOrCreateAccountCapResult = {
|
|
|
487
494
|
accountCap: TransactionObjectArgument;
|
|
488
495
|
isCreate: boolean;
|
|
489
496
|
};
|
|
490
|
-
declare function getOrCreateAccountCap(txb: Transaction, client:
|
|
497
|
+
declare function getOrCreateAccountCap(txb: Transaction, client: SuiGrpcClient, owner: string): Promise<GetOrCreateAccountCapResult>;
|
|
491
498
|
|
|
492
499
|
/**
|
|
493
500
|
* Represents a SUI address, which is a string.
|
|
@@ -637,23 +644,67 @@ interface Dex {
|
|
|
637
644
|
}
|
|
638
645
|
|
|
639
646
|
/**
|
|
640
|
-
* Matches the shape of
|
|
647
|
+
* Matches the shape of SuiClientTypes.SimulateTransactionResult with effects included.
|
|
641
648
|
* Using a local type so gas.ts can be used without importing the full SDK.
|
|
642
649
|
*/
|
|
643
650
|
type SimulateTransactionResult = {
|
|
644
|
-
|
|
651
|
+
$kind: 'Transaction' | 'FailedTransaction';
|
|
652
|
+
Transaction?: {
|
|
645
653
|
status: {
|
|
646
|
-
|
|
647
|
-
error
|
|
654
|
+
success: true;
|
|
655
|
+
error: null;
|
|
656
|
+
} | {
|
|
657
|
+
success: false;
|
|
658
|
+
error: {
|
|
659
|
+
message: string;
|
|
660
|
+
};
|
|
648
661
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
662
|
+
effects?: {
|
|
663
|
+
status: {
|
|
664
|
+
success: true;
|
|
665
|
+
error: null;
|
|
666
|
+
} | {
|
|
667
|
+
success: false;
|
|
668
|
+
error: {
|
|
669
|
+
message: string;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
gasUsed: {
|
|
673
|
+
computationCost: string;
|
|
674
|
+
storageCost: string;
|
|
675
|
+
storageRebate: string;
|
|
676
|
+
nonRefundableStorageFee: string;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
FailedTransaction?: {
|
|
681
|
+
status: {
|
|
682
|
+
success: true;
|
|
683
|
+
error: null;
|
|
684
|
+
} | {
|
|
685
|
+
success: false;
|
|
686
|
+
error: {
|
|
687
|
+
message: string;
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
effects?: {
|
|
691
|
+
status: {
|
|
692
|
+
success: true;
|
|
693
|
+
error: null;
|
|
694
|
+
} | {
|
|
695
|
+
success: false;
|
|
696
|
+
error: {
|
|
697
|
+
message: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
gasUsed: {
|
|
701
|
+
computationCost: string;
|
|
702
|
+
storageCost: string;
|
|
703
|
+
storageRebate: string;
|
|
704
|
+
nonRefundableStorageFee: string;
|
|
705
|
+
};
|
|
654
706
|
};
|
|
655
707
|
};
|
|
656
|
-
error?: string | null;
|
|
657
708
|
};
|
|
658
709
|
interface GasMetrics {
|
|
659
710
|
computationCost: string;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import JSONbig from 'json-bigint';
|
|
3
3
|
import { normalizeSuiObjectId, SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
5
5
|
import { HermesClient } from '@pythnetwork/hermes-client';
|
|
6
6
|
import { bcs } from '@mysten/sui/bcs';
|
|
7
7
|
|
|
@@ -7851,12 +7851,11 @@ var PythAdapter = class {
|
|
|
7851
7851
|
if (this.baseUpdateFee !== void 0) {
|
|
7852
7852
|
return this.baseUpdateFee;
|
|
7853
7853
|
}
|
|
7854
|
-
const
|
|
7855
|
-
|
|
7856
|
-
|
|
7854
|
+
const { object } = await this.client.getObject({
|
|
7855
|
+
objectId: this.pythStateId,
|
|
7856
|
+
include: { json: true }
|
|
7857
7857
|
});
|
|
7858
|
-
const
|
|
7859
|
-
const json = content && "fields" in content ? content.fields : null;
|
|
7858
|
+
const json = object.json;
|
|
7860
7859
|
if (!json) {
|
|
7861
7860
|
throw new Error("Unable to fetch pyth state object");
|
|
7862
7861
|
}
|
|
@@ -7864,21 +7863,16 @@ var PythAdapter = class {
|
|
|
7864
7863
|
return this.baseUpdateFee;
|
|
7865
7864
|
}
|
|
7866
7865
|
async getPackageId(objectId) {
|
|
7867
|
-
const
|
|
7868
|
-
|
|
7869
|
-
|
|
7866
|
+
const { object } = await this.client.getObject({
|
|
7867
|
+
objectId,
|
|
7868
|
+
include: { json: true }
|
|
7870
7869
|
});
|
|
7871
|
-
const
|
|
7872
|
-
const json = content && "fields" in content ? content.fields : null;
|
|
7870
|
+
const json = object.json;
|
|
7873
7871
|
if (!json) {
|
|
7874
7872
|
throw new Error(`Cannot fetch package id for object ${objectId}`);
|
|
7875
7873
|
}
|
|
7876
7874
|
if ("upgrade_cap" in json) {
|
|
7877
|
-
|
|
7878
|
-
const packageId = upgradeCap?.fields?.package;
|
|
7879
|
-
if (typeof packageId === "string") {
|
|
7880
|
-
return packageId;
|
|
7881
|
-
}
|
|
7875
|
+
return json.upgrade_cap.package;
|
|
7882
7876
|
}
|
|
7883
7877
|
throw new Error("upgrade_cap not found");
|
|
7884
7878
|
}
|
|
@@ -7902,19 +7896,20 @@ var PythAdapter = class {
|
|
|
7902
7896
|
const { id: tableId, fieldType } = await this.getPriceTableInfo();
|
|
7903
7897
|
const feedIdBytes = Buffer.from(normalizedFeedId, "hex");
|
|
7904
7898
|
try {
|
|
7905
|
-
const
|
|
7899
|
+
const PriceIdentifier = bcs.struct("PriceIdentifier", {
|
|
7900
|
+
bytes: bcs.vector(bcs.u8())
|
|
7901
|
+
});
|
|
7902
|
+
const bcsBytes = PriceIdentifier.serialize({ bytes: Array.from(feedIdBytes) }).toBytes();
|
|
7903
|
+
const result = await this.client.getDynamicField({
|
|
7906
7904
|
parentId: tableId,
|
|
7907
7905
|
name: {
|
|
7908
|
-
type:
|
|
7909
|
-
|
|
7906
|
+
type: fieldType,
|
|
7907
|
+
bcs: bcsBytes
|
|
7910
7908
|
}
|
|
7911
7909
|
});
|
|
7912
|
-
const
|
|
7913
|
-
const
|
|
7914
|
-
const objectId =
|
|
7915
|
-
if (!objectId) {
|
|
7916
|
-
return void 0;
|
|
7917
|
-
}
|
|
7910
|
+
const valueBcs = result.dynamicField.value.bcs;
|
|
7911
|
+
const valueBytes = valueBcs instanceof Uint8Array ? valueBcs : new Uint8Array(Object.values(valueBcs));
|
|
7912
|
+
const objectId = "0x" + Array.from(valueBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7918
7913
|
this.priceFeedObjectIdCache.set(normalizedFeedId, objectId);
|
|
7919
7914
|
return objectId;
|
|
7920
7915
|
} catch {
|
|
@@ -7925,22 +7920,35 @@ var PythAdapter = class {
|
|
|
7925
7920
|
if (this.priceTableInfo !== void 0) {
|
|
7926
7921
|
return this.priceTableInfo;
|
|
7927
7922
|
}
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7923
|
+
let cursor = null;
|
|
7924
|
+
let hasNextPage = true;
|
|
7925
|
+
while (hasNextPage) {
|
|
7926
|
+
const dynamicFields = await this.client.listDynamicFields({
|
|
7927
|
+
parentId: this.pythStateId,
|
|
7928
|
+
cursor
|
|
7929
|
+
});
|
|
7930
|
+
for (const field of dynamicFields.dynamicFields) {
|
|
7931
|
+
if (field.name.type === "vector<u8>") {
|
|
7932
|
+
const objectId = field.$kind === "DynamicObject" && field.childId ? field.childId : field.fieldId;
|
|
7933
|
+
const fieldObj = await this.client.getObject({
|
|
7934
|
+
objectId,
|
|
7935
|
+
include: { json: true }
|
|
7936
|
+
});
|
|
7937
|
+
const type = fieldObj.object.type;
|
|
7938
|
+
if (type.includes("table::Table")) {
|
|
7939
|
+
const innerTypes = type.replace(/.*table::Table</, "").replace(/>$/, "");
|
|
7940
|
+
const fieldType = innerTypes.split(",")[0].trim();
|
|
7941
|
+
this.priceTableInfo = { id: fieldObj.object.objectId, fieldType };
|
|
7942
|
+
return this.priceTableInfo;
|
|
7943
|
+
}
|
|
7944
|
+
}
|
|
7933
7945
|
}
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
throw new Error(
|
|
7937
|
-
"Price Table not found, contract may not be initialized"
|
|
7938
|
-
);
|
|
7946
|
+
hasNextPage = dynamicFields.hasNextPage;
|
|
7947
|
+
cursor = dynamicFields.cursor;
|
|
7939
7948
|
}
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
return this.priceTableInfo;
|
|
7949
|
+
throw new Error(
|
|
7950
|
+
"Price Table not found, contract may not be initialized"
|
|
7951
|
+
);
|
|
7944
7952
|
}
|
|
7945
7953
|
extractVaaBytesFromAccumulatorMessage(accumulatorMessage) {
|
|
7946
7954
|
const trailingPayloadSize = accumulatorMessage.readUint8(6);
|
|
@@ -8124,21 +8132,21 @@ async function getOrCreateAccountCap(txb, client, owner) {
|
|
|
8124
8132
|
}
|
|
8125
8133
|
async function getAccountCap(client, owner) {
|
|
8126
8134
|
const limit = 50;
|
|
8127
|
-
let cursor =
|
|
8135
|
+
let cursor = null;
|
|
8128
8136
|
while (true) {
|
|
8129
|
-
const ownedObjects = await client.
|
|
8137
|
+
const ownedObjects = await client.listOwnedObjects({
|
|
8130
8138
|
owner,
|
|
8131
8139
|
cursor,
|
|
8132
8140
|
limit,
|
|
8133
|
-
|
|
8141
|
+
type: `${DEEPBOOK_PACKAGE_ID}::${DEEPBOOK_CUSTODIAN_V2_MODULE}::AccountCap`
|
|
8134
8142
|
});
|
|
8135
|
-
if (ownedObjects.
|
|
8136
|
-
return ownedObjects.
|
|
8143
|
+
if (ownedObjects.objects.length !== 0) {
|
|
8144
|
+
return ownedObjects.objects[0].objectId;
|
|
8137
8145
|
}
|
|
8138
8146
|
if (!ownedObjects.hasNextPage) {
|
|
8139
8147
|
break;
|
|
8140
8148
|
}
|
|
8141
|
-
cursor = ownedObjects.
|
|
8149
|
+
cursor = ownedObjects.cursor;
|
|
8142
8150
|
}
|
|
8143
8151
|
return null;
|
|
8144
8152
|
}
|
|
@@ -8166,10 +8174,10 @@ function getAggregatorV2Extend2PublishedAt(publishedAt, packages) {
|
|
|
8166
8174
|
// src/utils/gas.ts
|
|
8167
8175
|
var import_bn4 = __toESM(require_bn());
|
|
8168
8176
|
function extractGasMetrics(result) {
|
|
8169
|
-
const
|
|
8170
|
-
const
|
|
8171
|
-
if (!
|
|
8172
|
-
const errorMsg =
|
|
8177
|
+
const txResult = result.Transaction ?? result.FailedTransaction;
|
|
8178
|
+
const effects = txResult?.effects;
|
|
8179
|
+
if (!effects || !effects.status.success) {
|
|
8180
|
+
const errorMsg = effects?.status.success === false ? effects.status.error.message : "Unknown error";
|
|
8173
8181
|
return {
|
|
8174
8182
|
computationCost: "0",
|
|
8175
8183
|
storageCost: "0",
|
|
@@ -8768,8 +8776,8 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8768
8776
|
constructor(params) {
|
|
8769
8777
|
this.endpoint = params.endpoint ? processEndpoint(params.endpoint) : DEFAULT_ENDPOINT;
|
|
8770
8778
|
const network = params.env === 1 /* Testnet */ ? "testnet" : "mainnet";
|
|
8771
|
-
const
|
|
8772
|
-
this.client = params.client ?? new
|
|
8779
|
+
const grpcUrl = params.env === 1 /* Testnet */ ? "https://fullnode.testnet.sui.io:443" : "https://fullnode.mainnet.sui.io:443";
|
|
8780
|
+
this.client = params.client ?? new SuiGrpcClient({ network, baseUrl: grpcUrl });
|
|
8773
8781
|
this.signer = params.signer || "";
|
|
8774
8782
|
this.env = params.env || 0 /* Mainnet */;
|
|
8775
8783
|
const config2 = _AggregatorClient.CONFIG[this.env];
|
|
@@ -8810,13 +8818,13 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
8810
8818
|
}
|
|
8811
8819
|
async getOneCoinUsedToMerge(coinType) {
|
|
8812
8820
|
try {
|
|
8813
|
-
const gotCoin = await this.client.
|
|
8821
|
+
const gotCoin = await this.client.listCoins({
|
|
8814
8822
|
owner: this.signer,
|
|
8815
8823
|
coinType,
|
|
8816
8824
|
limit: 1
|
|
8817
8825
|
});
|
|
8818
|
-
if (gotCoin.
|
|
8819
|
-
return gotCoin.
|
|
8826
|
+
if (gotCoin.objects.length === 1) {
|
|
8827
|
+
return gotCoin.objects[0].objectId;
|
|
8820
8828
|
}
|
|
8821
8829
|
return null;
|
|
8822
8830
|
} catch (error) {
|
|
@@ -9559,16 +9567,18 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9559
9567
|
});
|
|
9560
9568
|
}
|
|
9561
9569
|
tx.setSenderIfNotSet(this.signer || "0x0");
|
|
9562
|
-
const simulateRes = await this.client.
|
|
9563
|
-
|
|
9564
|
-
|
|
9570
|
+
const simulateRes = await this.client.simulateTransaction({
|
|
9571
|
+
transaction: tx,
|
|
9572
|
+
include: { events: true, effects: true }
|
|
9565
9573
|
});
|
|
9566
|
-
|
|
9567
|
-
|
|
9574
|
+
const txResult = simulateRes.Transaction ?? simulateRes.FailedTransaction;
|
|
9575
|
+
if (!txResult || simulateRes.$kind === "FailedTransaction") {
|
|
9576
|
+
const errorMsg = txResult?.status.success === false ? txResult.status.error.message : "Unknown error";
|
|
9577
|
+
throw new Error("Simulation error: " + errorMsg);
|
|
9568
9578
|
}
|
|
9569
|
-
const events =
|
|
9579
|
+
const events = txResult.events ?? [];
|
|
9570
9580
|
const valueData = events.filter((item) => {
|
|
9571
|
-
return item.
|
|
9581
|
+
return item.eventType.includes("CalculatedSwapResultEvent");
|
|
9572
9582
|
});
|
|
9573
9583
|
if (valueData.length === 0 || valueData.length !== pools.length) {
|
|
9574
9584
|
throw new Error("Simulate event result error");
|
|
@@ -9576,7 +9586,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9576
9586
|
let tempMaxAmount = byAmountIn ? new import_bn6.default(0) : new import_bn6.default(U64_MAX);
|
|
9577
9587
|
let tempIndex = 0;
|
|
9578
9588
|
for (let i = 0; i < valueData.length; i += 1) {
|
|
9579
|
-
const eventJson2 = valueData[i].
|
|
9589
|
+
const eventJson2 = valueData[i].json;
|
|
9580
9590
|
if (eventJson2?.data?.is_exceed) {
|
|
9581
9591
|
continue;
|
|
9582
9592
|
}
|
|
@@ -9594,11 +9604,11 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9594
9604
|
}
|
|
9595
9605
|
}
|
|
9596
9606
|
}
|
|
9597
|
-
const eventJson = valueData[tempIndex].
|
|
9607
|
+
const eventJson = valueData[tempIndex].json;
|
|
9598
9608
|
const eventData = eventJson?.data;
|
|
9599
9609
|
const [decimalA, decimalB] = await Promise.all([
|
|
9600
|
-
this.client.getCoinMetadata({ coinType: coinA }).then((res) => res?.decimals ?? null),
|
|
9601
|
-
this.client.getCoinMetadata({ coinType: coinB }).then((res) => res?.decimals ?? null)
|
|
9610
|
+
this.client.getCoinMetadata({ coinType: coinA }).then((res) => res.coinMetadata?.decimals ?? null),
|
|
9611
|
+
this.client.getCoinMetadata({ coinType: coinB }).then((res) => res.coinMetadata?.decimals ?? null)
|
|
9602
9612
|
]);
|
|
9603
9613
|
if (decimalA == null || decimalB == null) {
|
|
9604
9614
|
throw new Error("Cannot get coin decimals");
|
|
@@ -9667,9 +9677,9 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9667
9677
|
}
|
|
9668
9678
|
async devInspectTransactionBlock(txb) {
|
|
9669
9679
|
txb.setSenderIfNotSet(this.signer || "0x0");
|
|
9670
|
-
const res = await this.client.
|
|
9671
|
-
|
|
9672
|
-
|
|
9680
|
+
const res = await this.client.simulateTransaction({
|
|
9681
|
+
transaction: txb,
|
|
9682
|
+
include: { events: true, effects: true }
|
|
9673
9683
|
});
|
|
9674
9684
|
return res;
|
|
9675
9685
|
}
|
|
@@ -9677,7 +9687,7 @@ var _AggregatorClient = class _AggregatorClient {
|
|
|
9677
9687
|
const res = await this.client.signAndExecuteTransaction({
|
|
9678
9688
|
transaction: txb,
|
|
9679
9689
|
signer,
|
|
9680
|
-
|
|
9690
|
+
include: { effects: true, events: true, balanceChanges: true }
|
|
9681
9691
|
});
|
|
9682
9692
|
return res;
|
|
9683
9693
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetusprotocol/aggregator-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typescript": "^5.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mysten/sui": "^2.
|
|
25
|
+
"@mysten/sui": "^2.13.2",
|
|
26
26
|
"@pythnetwork/hermes-client": "^3.1.0",
|
|
27
27
|
"bip39": "^3.1.0",
|
|
28
28
|
"dotenv": "^16.4.5",
|