@tonappchain/sdk 0.6.1-v3.0.4 → 0.6.1-v3.0.5

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.
@@ -32,3 +32,9 @@ export declare class SettingError extends ErrorWithStatusCode {
32
32
  export declare class EVMCallError extends ErrorWithStatusCode {
33
33
  constructor(message: string, errorCode: number);
34
34
  }
35
+ export declare class PrepareMessageGroupError extends ErrorWithStatusCode {
36
+ constructor(message: string, errorCode: number);
37
+ }
38
+ export declare class NoValidGroupFoundError extends ErrorWithStatusCode {
39
+ constructor(message: string, errorCode: number);
40
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EVMCallError = exports.SettingError = exports.MetadataError = exports.BitError = exports.FormatError = exports.KeyError = exports.WalletError = exports.AddressError = exports.FetchError = exports.ContractError = exports.ErrorWithStatusCode = void 0;
3
+ exports.NoValidGroupFoundError = exports.PrepareMessageGroupError = exports.EVMCallError = exports.SettingError = exports.MetadataError = exports.BitError = exports.FormatError = exports.KeyError = exports.WalletError = exports.AddressError = exports.FetchError = exports.ContractError = exports.ErrorWithStatusCode = void 0;
4
4
  class ErrorWithStatusCode extends Error {
5
5
  constructor(message, errorCode) {
6
6
  super(message);
@@ -78,3 +78,17 @@ class EVMCallError extends ErrorWithStatusCode {
78
78
  }
79
79
  }
80
80
  exports.EVMCallError = EVMCallError;
81
+ class PrepareMessageGroupError extends ErrorWithStatusCode {
82
+ constructor(message, errorCode) {
83
+ super(message, errorCode);
84
+ this.name = 'PrepareMessageGroupError';
85
+ }
86
+ }
87
+ exports.PrepareMessageGroupError = PrepareMessageGroupError;
88
+ class NoValidGroupFoundError extends ErrorWithStatusCode {
89
+ constructor(message, errorCode) {
90
+ super(message, errorCode);
91
+ this.name = 'NoValidGroupFoundError';
92
+ }
93
+ }
94
+ exports.NoValidGroupFoundError = NoValidGroupFoundError;
@@ -1,4 +1,4 @@
1
- import { ContractError, FetchError, AddressError, WalletError, KeyError, FormatError, BitError, MetadataError, SettingError, EVMCallError } from './errors';
1
+ import { ContractError, FetchError, AddressError, WalletError, KeyError, FormatError, BitError, MetadataError, SettingError, EVMCallError, NoValidGroupFoundError, PrepareMessageGroupError } from './errors';
2
2
  export declare const emptyContractError: ContractError;
3
3
  export declare const operationFetchError: FetchError;
4
4
  export declare const statusFetchError: (msg: string) => FetchError;
@@ -15,3 +15,5 @@ export declare const simulationError: FetchError;
15
15
  export declare const profilingFetchError: (msg: string) => FetchError;
16
16
  export declare const emptyArrayError: (msg: string) => FetchError;
17
17
  export declare const invalidAssetType: FormatError;
18
+ export declare const prepareMessageGroupError: (isBocSizeValid: boolean, isDepthValid: boolean) => PrepareMessageGroupError;
19
+ export declare const noValidGroupFoundError: NoValidGroupFoundError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.simulationError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
3
+ exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.simulationError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
4
4
  const errors_1 = require("./errors");
5
5
  exports.emptyContractError = new errors_1.ContractError('unexpected empty contract code of given jetton.', 100);
6
6
  exports.operationFetchError = new errors_1.FetchError('failed to fetch OperationId', 101);
@@ -27,3 +27,6 @@ exports.profilingFetchError = profilingFetchError;
27
27
  const emptyArrayError = (msg) => new errors_1.FetchError(`empty array: ${msg}`, 114);
28
28
  exports.emptyArrayError = emptyArrayError;
29
29
  exports.invalidAssetType = new errors_1.FormatError('Invalid asset type', 115);
30
+ const prepareMessageGroupError = (isBocSizeValid, isDepthValid) => new errors_1.PrepareMessageGroupError(`Failed to prepare message group: BOC size valid: ${isBocSizeValid}, depth valid: ${isDepthValid}`, 116);
31
+ exports.prepareMessageGroupError = prepareMessageGroupError;
32
+ exports.noValidGroupFoundError = new errors_1.NoValidGroupFoundError('Failed to prepare valid message group', 117);
package/dist/index.d.ts CHANGED
@@ -6,5 +6,8 @@ export * from './structs/Struct';
6
6
  export { Network, SimplifiedStatuses } from './structs/Struct';
7
7
  export type { JettonWalletData } from './wrappers/JettonWallet';
8
8
  export { JettonWallet, JettonWalletOpCodes } from './wrappers/JettonWallet';
9
+ export { HighloadWalletV3 } from './wrappers/HighloadWalletV3';
9
10
  export { orbsOpener, liteClientOpener } from './adapters/contractOpener';
10
11
  export * from './errors';
12
+ export { readJettonMetadata } from './wrappers/ContentUtils';
13
+ export { LiteSequencerClient } from './sdk/LiteSequencerClient';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.liteClientOpener = exports.orbsOpener = exports.JettonWalletOpCodes = exports.JettonWallet = exports.SimplifiedStatuses = exports.Network = exports.startTracking = exports.OperationTracker = exports.TacSdk = void 0;
17
+ exports.LiteSequencerClient = exports.readJettonMetadata = exports.liteClientOpener = exports.orbsOpener = exports.HighloadWalletV3 = exports.JettonWalletOpCodes = exports.JettonWallet = exports.SimplifiedStatuses = exports.Network = exports.startTracking = exports.OperationTracker = exports.TacSdk = void 0;
18
18
  var TacSdk_1 = require("./sdk/TacSdk");
19
19
  Object.defineProperty(exports, "TacSdk", { enumerable: true, get: function () { return TacSdk_1.TacSdk; } });
20
20
  var OperationTracker_1 = require("./sdk/OperationTracker");
@@ -29,7 +29,13 @@ Object.defineProperty(exports, "SimplifiedStatuses", { enumerable: true, get: fu
29
29
  var JettonWallet_1 = require("./wrappers/JettonWallet");
30
30
  Object.defineProperty(exports, "JettonWallet", { enumerable: true, get: function () { return JettonWallet_1.JettonWallet; } });
31
31
  Object.defineProperty(exports, "JettonWalletOpCodes", { enumerable: true, get: function () { return JettonWallet_1.JettonWalletOpCodes; } });
32
+ var HighloadWalletV3_1 = require("./wrappers/HighloadWalletV3");
33
+ Object.defineProperty(exports, "HighloadWalletV3", { enumerable: true, get: function () { return HighloadWalletV3_1.HighloadWalletV3; } });
32
34
  var contractOpener_1 = require("./adapters/contractOpener");
33
35
  Object.defineProperty(exports, "orbsOpener", { enumerable: true, get: function () { return contractOpener_1.orbsOpener; } });
34
36
  Object.defineProperty(exports, "liteClientOpener", { enumerable: true, get: function () { return contractOpener_1.liteClientOpener; } });
35
37
  __exportStar(require("./errors"), exports);
38
+ var ContentUtils_1 = require("./wrappers/ContentUtils");
39
+ Object.defineProperty(exports, "readJettonMetadata", { enumerable: true, get: function () { return ContentUtils_1.readJettonMetadata; } });
40
+ var LiteSequencerClient_1 = require("./sdk/LiteSequencerClient");
41
+ Object.defineProperty(exports, "LiteSequencerClient", { enumerable: true, get: function () { return LiteSequencerClient_1.LiteSequencerClient; } });
@@ -5,3 +5,8 @@ export declare const MAX_ITERATION_COUNT = 120;
5
5
  export declare const DEFAULT_DELAY = 0;
6
6
  export declare const SOLIDITY_SIGNATURE_REGEX: RegExp;
7
7
  export declare const SOLIDITY_METHOD_NAME_REGEX: RegExp;
8
+ export declare const MAX_EXT_MSG_SIZE = 65535;
9
+ export declare const MAX_HIGHLOAD_GROUP_MSG_NUM = 254;
10
+ export declare const MAX_MSG_DEPTH = 512;
11
+ export declare const TON_SYMBOL = "TON";
12
+ export declare const TAC_SYMBOL = "TAC";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SOLIDITY_METHOD_NAME_REGEX = exports.SOLIDITY_SIGNATURE_REGEX = exports.DEFAULT_DELAY = exports.MAX_ITERATION_COUNT = exports.NFT_TRANSFER_FORWARD_TON_AMOUNT = exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = exports.TRANSACTION_TON_AMOUNT = void 0;
3
+ exports.TAC_SYMBOL = exports.TON_SYMBOL = exports.MAX_MSG_DEPTH = exports.MAX_HIGHLOAD_GROUP_MSG_NUM = exports.MAX_EXT_MSG_SIZE = exports.SOLIDITY_METHOD_NAME_REGEX = exports.SOLIDITY_SIGNATURE_REGEX = exports.DEFAULT_DELAY = exports.MAX_ITERATION_COUNT = exports.NFT_TRANSFER_FORWARD_TON_AMOUNT = exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = exports.TRANSACTION_TON_AMOUNT = void 0;
4
4
  const ton_1 = require("@ton/ton");
5
5
  exports.TRANSACTION_TON_AMOUNT = (0, ton_1.toNano)(0.55);
6
6
  exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = (0, ton_1.toNano)(0.2);
@@ -9,3 +9,8 @@ exports.MAX_ITERATION_COUNT = 120;
9
9
  exports.DEFAULT_DELAY = 0;
10
10
  exports.SOLIDITY_SIGNATURE_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*(\((bytes,bytes)\))?$/;
11
11
  exports.SOLIDITY_METHOD_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
12
+ exports.MAX_EXT_MSG_SIZE = 65535;
13
+ exports.MAX_HIGHLOAD_GROUP_MSG_NUM = 254;
14
+ exports.MAX_MSG_DEPTH = 512;
15
+ exports.TON_SYMBOL = "TON";
16
+ exports.TAC_SYMBOL = "TAC";
@@ -0,0 +1,12 @@
1
+ import { TransactionLinker, StatusInfosByOperationId, OperationIdsByShardsKey, ExecutionStagesByOperationId, OperationType } from '../structs/Struct';
2
+ export declare class LiteSequencerClient {
3
+ private readonly endpoint;
4
+ private readonly maxChunkSize;
5
+ constructor(endpoint: string, maxChunkSize?: number);
6
+ getOperationType(operationId: string): Promise<OperationType>;
7
+ getOperationId(transactionLinker: TransactionLinker): Promise<string>;
8
+ getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
9
+ getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
10
+ getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
11
+ private processChunkedRequest;
12
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LiteSequencerClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const errors_1 = require("../errors");
9
+ const Utils_1 = require("./Utils");
10
+ class LiteSequencerClient {
11
+ constructor(endpoint, maxChunkSize = 100) {
12
+ this.endpoint = endpoint;
13
+ this.maxChunkSize = maxChunkSize;
14
+ }
15
+ async getOperationType(operationId) {
16
+ try {
17
+ const response = await axios_1.default.get(new URL('operation-type', this.endpoint).toString(), {
18
+ params: {
19
+ operationId,
20
+ },
21
+ });
22
+ return response.data.response || '';
23
+ }
24
+ catch (error) {
25
+ console.error(`Failed to get operationType with ${this.endpoint}:`, error);
26
+ throw errors_1.operationFetchError;
27
+ }
28
+ }
29
+ async getOperationId(transactionLinker) {
30
+ const requestBody = {
31
+ shardsKey: transactionLinker.shardsKey,
32
+ caller: transactionLinker.caller,
33
+ shardCount: transactionLinker.shardCount,
34
+ timestamp: transactionLinker.timestamp,
35
+ };
36
+ try {
37
+ const response = await axios_1.default.post(new URL('ton/operation-id', this.endpoint).toString(), requestBody);
38
+ return response.data.response || '';
39
+ }
40
+ catch (error) {
41
+ if (axios_1.default.isAxiosError(error)) {
42
+ if (error.response?.status === 404) {
43
+ console.warn(`404 Not Found: ${new URL('ton/operation-id', this.endpoint).toString()}`);
44
+ return '';
45
+ }
46
+ }
47
+ console.error(`Failed to get OperationId with ${this.endpoint}:`, error);
48
+ throw errors_1.operationFetchError;
49
+ }
50
+ }
51
+ async getOperationIdsByShardsKeys(shardsKeys, caller, chunkSize = this.maxChunkSize) {
52
+ if (!shardsKeys || shardsKeys.length === 0) {
53
+ throw (0, errors_1.emptyArrayError)('shardsKeys');
54
+ }
55
+ try {
56
+ const response = await this.processChunkedRequest(shardsKeys, async (chunk) => {
57
+ const response = await axios_1.default.post(new URL('operation-ids-by-shards-keys', this.endpoint).toString(), {
58
+ shardsKeys: chunk,
59
+ caller: caller,
60
+ });
61
+ return response.data;
62
+ }, chunkSize);
63
+ return response.response;
64
+ }
65
+ catch (error) {
66
+ console.error(`Failed to get OperationIds with ${this.endpoint}:`, error);
67
+ throw errors_1.operationFetchError;
68
+ }
69
+ }
70
+ async getStageProfilings(operationIds, chunkSize = this.maxChunkSize) {
71
+ if (!operationIds || operationIds.length === 0) {
72
+ throw (0, errors_1.emptyArrayError)('operationIds');
73
+ }
74
+ try {
75
+ const response = await this.processChunkedRequest(operationIds, async (chunk) => {
76
+ const response = await axios_1.default.post(new URL('stage-profiling', this.endpoint).toString(), {
77
+ operationIds: chunk,
78
+ }, {
79
+ transformResponse: [Utils_1.toCamelCaseTransformer],
80
+ });
81
+ return response.data;
82
+ }, chunkSize);
83
+ return response.response;
84
+ }
85
+ catch (error) {
86
+ console.error(`Error fetching stage profiling with ${this.endpoint}:`, error);
87
+ throw (0, errors_1.profilingFetchError)('endpoint failed to complete request');
88
+ }
89
+ }
90
+ async getOperationStatuses(operationIds, chunkSize = this.maxChunkSize) {
91
+ if (!operationIds || operationIds.length === 0) {
92
+ throw (0, errors_1.emptyArrayError)('operationIds');
93
+ }
94
+ try {
95
+ const response = await this.processChunkedRequest(operationIds, async (chunk) => {
96
+ const response = await axios_1.default.post(new URL('status', this.endpoint).toString(), {
97
+ operationIds: chunk,
98
+ }, {
99
+ transformResponse: [Utils_1.toCamelCaseTransformer],
100
+ });
101
+ return response.data;
102
+ }, chunkSize);
103
+ return response.response;
104
+ }
105
+ catch (error) {
106
+ console.error(`Error fetching status transaction with ${this.endpoint}:`, error);
107
+ throw (0, errors_1.statusFetchError)('endpoint failed to complete request');
108
+ }
109
+ }
110
+ async processChunkedRequest(identificators, requestFn, chunkSize = this.maxChunkSize) {
111
+ const results = [];
112
+ for (let i = 0; i < identificators.length; i += chunkSize) {
113
+ const chunk = identificators.slice(i, i + chunkSize);
114
+ const result = await requestFn(chunk);
115
+ results.push(result);
116
+ }
117
+ // Combine results based on the type
118
+ if (Array.isArray(results[0])) {
119
+ return results.flat();
120
+ }
121
+ else if (typeof results[0] === 'object') {
122
+ return Object.assign({}, ...results);
123
+ }
124
+ return results[0];
125
+ }
126
+ }
127
+ exports.LiteSequencerClient = LiteSequencerClient;
@@ -1,14 +1,13 @@
1
- import { Network, TransactionLinker, SimplifiedStatuses, StatusInfosByOperationId, StatusInfo, OperationIdsByShardsKey, ExecutionStages, ExecutionStagesByOperationId, OperationType } from '../structs/Struct';
1
+ import { Network, TransactionLinker, SimplifiedStatuses, OperationType, OperationIdsByShardsKey, ExecutionStages, ExecutionStagesByOperationId, StatusInfosByOperationId, StatusInfo } from '../structs/Struct';
2
2
  export declare class OperationTracker {
3
- readonly network: Network;
4
- readonly customLiteSequencerEndpoints: string[];
3
+ private readonly clients;
5
4
  constructor(network: Network, customLiteSequencerEndpoints?: string[]);
6
5
  getOperationType(operationId: string): Promise<OperationType>;
7
6
  getOperationId(transactionLinker: TransactionLinker): Promise<string>;
8
- getOperationIdsByShardsKeys(shardsKeys: string[], caller: string): Promise<OperationIdsByShardsKey>;
7
+ getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
9
8
  getStageProfiling(operationId: string): Promise<ExecutionStages>;
10
- getStageProfilings(operationIds: string[]): Promise<ExecutionStagesByOperationId>;
11
- getOperationStatuses(operationIds: string[]): Promise<StatusInfosByOperationId>;
9
+ getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
10
+ getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
12
11
  getOperationStatus(operationId: string): Promise<StatusInfo>;
13
12
  getSimplifiedOperationStatus(transactionLinker: TransactionLinker): Promise<SimplifiedStatuses>;
14
13
  }
@@ -1,137 +1,103 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.OperationTracker = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
4
  const Struct_1 = require("../structs/Struct");
9
- const errors_1 = require("../errors");
10
- const Utils_1 = require("./Utils");
11
5
  const artifacts_1 = require("@tonappchain/artifacts");
6
+ const LiteSequencerClient_1 = require("./LiteSequencerClient");
12
7
  class OperationTracker {
13
8
  constructor(network, customLiteSequencerEndpoints) {
14
- this.network = network;
15
- this.customLiteSequencerEndpoints =
16
- customLiteSequencerEndpoints ??
17
- (this.network === Struct_1.Network.TESTNET
18
- ? artifacts_1.testnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS
19
- : artifacts_1.mainnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS);
9
+ const endpoints = customLiteSequencerEndpoints ??
10
+ (network === Struct_1.Network.TESTNET
11
+ ? artifacts_1.testnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS
12
+ : artifacts_1.mainnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS);
13
+ this.clients = endpoints.map((endpoint) => new LiteSequencerClient_1.LiteSequencerClient(endpoint));
20
14
  }
21
15
  async getOperationType(operationId) {
22
- for (const endpoint of this.customLiteSequencerEndpoints) {
16
+ for (const client of this.clients) {
23
17
  try {
24
- const response = await axios_1.default.get(`${endpoint}/operation-type`, {
25
- params: {
26
- operationId,
27
- },
28
- });
29
- return response.data.response || '';
18
+ return await client.getOperationType(operationId);
30
19
  }
31
20
  catch (error) {
32
- console.error(`Failed to get operationType with ${endpoint}:`, error);
21
+ console.error('Failed to get operationType:', error);
33
22
  }
34
23
  }
35
- throw errors_1.operationFetchError;
24
+ throw new Error('All endpoints failed to get operation type');
36
25
  }
37
26
  async getOperationId(transactionLinker) {
38
- const requestBody = {
39
- shardsKey: transactionLinker.shardsKey,
40
- caller: transactionLinker.caller,
41
- shardCount: transactionLinker.shardCount,
42
- timestamp: transactionLinker.timestamp,
43
- };
44
- let operationId = undefined;
45
- for (const endpoint of this.customLiteSequencerEndpoints) {
27
+ for (const client of this.clients) {
46
28
  try {
47
- const response = await axios_1.default.post(`${endpoint}/ton/operation-id`, requestBody);
48
- return response.data.response || '';
29
+ return await client.getOperationId(transactionLinker);
49
30
  }
50
31
  catch (error) {
51
- if (axios_1.default.isAxiosError(error)) {
52
- if (error.response?.status === 404) {
53
- console.warn(`404 Not Found: ${endpoint}/ton/operation-id`);
54
- operationId = '';
55
- continue;
56
- }
57
- }
58
- console.error(`Failed to get OperationId with ${endpoint}:`, error);
32
+ console.error('Failed to get OperationId:', error);
59
33
  }
60
34
  }
61
- if (operationId !== undefined) {
62
- return operationId;
63
- }
64
- throw errors_1.operationFetchError;
35
+ throw new Error('All endpoints failed to get operation id');
65
36
  }
66
- async getOperationIdsByShardsKeys(shardsKeys, caller) {
67
- const requestBody = {
68
- shardsKeys: shardsKeys,
69
- caller: caller,
70
- };
71
- for (const endpoint of this.customLiteSequencerEndpoints) {
37
+ async getOperationIdsByShardsKeys(shardsKeys, caller, chunkSize = 100) {
38
+ for (const client of this.clients) {
72
39
  try {
73
- const response = await axios_1.default.post(`${endpoint}/operation-ids-by-shards-keys`, requestBody);
74
- return response.data.response;
40
+ return await client.getOperationIdsByShardsKeys(shardsKeys, caller, chunkSize);
75
41
  }
76
42
  catch (error) {
77
- console.error(`Failed to get OperationIds with ${endpoint}:`, error);
43
+ console.error('Failed to get OperationIds:', error);
78
44
  }
79
45
  }
80
- throw errors_1.operationFetchError;
46
+ throw new Error('All endpoints failed to get operation ids by shards keys');
81
47
  }
82
48
  async getStageProfiling(operationId) {
83
- const map = await this.getStageProfilings([operationId]);
84
- const result = map[operationId];
85
- if (!result) {
86
- throw new Error(`No stageProfiling data for operationId=${operationId}`);
49
+ for (const client of this.clients) {
50
+ try {
51
+ const map = await client.getStageProfilings([operationId]);
52
+ const result = map[operationId];
53
+ if (!result) {
54
+ throw new Error(`No stageProfiling data for operationId=${operationId}`);
55
+ }
56
+ return result;
57
+ }
58
+ catch (error) {
59
+ console.error('Failed to get stage profiling:', error);
60
+ }
87
61
  }
88
- return result;
62
+ throw new Error('All endpoints failed to get stage profiling');
89
63
  }
90
- async getStageProfilings(operationIds) {
91
- if (!operationIds || operationIds.length === 0) {
92
- throw (0, errors_1.emptyArrayError)('operationIds');
93
- }
94
- for (const endpoint of this.customLiteSequencerEndpoints) {
64
+ async getStageProfilings(operationIds, chunkSize = 100) {
65
+ for (const client of this.clients) {
95
66
  try {
96
- const response = await axios_1.default.post(`${endpoint}/stage-profiling`, {
97
- operationIds,
98
- }, {
99
- transformResponse: [Utils_1.toCamelCaseTransformer],
100
- });
101
- return response.data.response;
67
+ return await client.getStageProfilings(operationIds, chunkSize);
102
68
  }
103
69
  catch (error) {
104
- console.error(`Error fetching status transaction with ${endpoint}:`, error);
70
+ console.error('Failed to get stage profilings:', error);
105
71
  }
106
72
  }
107
- throw (0, errors_1.profilingFetchError)('all endpoints failed to complete request');
73
+ throw new Error('All endpoints failed to get stage profilings');
108
74
  }
109
- async getOperationStatuses(operationIds) {
110
- if (!operationIds || operationIds.length === 0) {
111
- throw (0, errors_1.emptyArrayError)('operationIds');
112
- }
113
- for (const endpoint of this.customLiteSequencerEndpoints) {
75
+ async getOperationStatuses(operationIds, chunkSize = 100) {
76
+ for (const client of this.clients) {
114
77
  try {
115
- const response = await axios_1.default.post(`${endpoint}/status`, {
116
- operationIds,
117
- }, {
118
- transformResponse: [Utils_1.toCamelCaseTransformer],
119
- });
120
- return response.data.response;
78
+ return await client.getOperationStatuses(operationIds, chunkSize);
121
79
  }
122
80
  catch (error) {
123
- console.error(`Error fetching status transaction with ${endpoint}:`, error);
81
+ console.error('Failed to get operation statuses:', error);
124
82
  }
125
83
  }
126
- throw (0, errors_1.statusFetchError)('all endpoints failed to complete request');
84
+ throw new Error('All endpoints failed to get operation statuses');
127
85
  }
128
86
  async getOperationStatus(operationId) {
129
- const result = await this.getOperationStatuses([operationId]);
130
- const currentStatus = result[operationId];
131
- if (!currentStatus) {
132
- throw (0, errors_1.statusFetchError)('operation is not found in response');
87
+ for (const client of this.clients) {
88
+ try {
89
+ const map = await client.getOperationStatuses([operationId]);
90
+ const result = map[operationId];
91
+ if (!result) {
92
+ throw new Error(`No operation status for operationId=${operationId}`);
93
+ }
94
+ return result;
95
+ }
96
+ catch (error) {
97
+ console.error('Failed to get operation status:', error);
98
+ }
133
99
  }
134
- return currentStatus;
100
+ throw new Error('All endpoints failed to get operation status');
135
101
  }
136
102
  async getSimplifiedOperationStatus(transactionLinker) {
137
103
  const operationId = await this.getOperationId(transactionLinker);
@@ -1,6 +1,6 @@
1
1
  import { Wallet } from 'ethers';
2
2
  import type { SenderAbstraction } from '../sender';
3
- import { AssetBridgingData, EvmProxyMsg, Network, SDKParams, TransactionLinker, RawAssetBridgingData, UserWalletBalanceExtended, TACSimulationResult, TACSimulationRequest, CrossChainTransactionOptions, ExecutionFeeEstimationResult, CrosschainTx, WithAddressNFT_CollectionItem, NFTAddressType, NFTItemData } from '../structs/Struct';
3
+ import { AssetBridgingData, EvmProxyMsg, Network, SDKParams, TransactionLinker, RawAssetBridgingData, UserWalletBalanceExtended, TACSimulationResult, TACSimulationRequest, SuggestedTONExecutorFee, CrossChainTransactionOptions, ExecutionFeeEstimationResult, CrosschainTx, WithAddressNFTCollectionItem, NFTAddressType, NFTItemData } from '../structs/Struct';
4
4
  import { InternalTONParams, InternalTACParams } from '../structs/InternalStruct';
5
5
  import { mainnet, testnet } from '@tonappchain/artifacts';
6
6
  export declare class TacSdk {
@@ -24,7 +24,6 @@ export declare class TacSdk {
24
24
  private getJettonBurnPayload;
25
25
  private getNFTBurnPayload;
26
26
  private getNFTTransferPayload;
27
- private generateFeeData;
28
27
  private getTonTransferPayload;
29
28
  private getJettonOpType;
30
29
  private getNFTOpType;
@@ -38,10 +37,11 @@ export declare class TacSdk {
38
37
  private convertAssetsToRawFormat;
39
38
  private getFeeInfo;
40
39
  getTransactionSimulationInfo(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: AssetBridgingData[]): Promise<ExecutionFeeEstimationResult>;
40
+ getTVMExecutorFeeInfo(assets: AssetBridgingData[], feeSymbol: String): Promise<SuggestedTONExecutorFee>;
41
41
  private prepareCrossChainTransaction;
42
42
  sendCrossChainTransaction(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: AssetBridgingData[], options?: CrossChainTransactionOptions): Promise<TransactionLinker>;
43
43
  sendCrossChainTransactions(sender: SenderAbstraction, txs: CrosschainTx[]): Promise<TransactionLinker[]>;
44
- bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: RawAssetBridgingData<WithAddressNFT_CollectionItem>[], tvmExecutorFee?: bigint): Promise<string>;
44
+ bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: RawAssetBridgingData<WithAddressNFTCollectionItem>[], tvmExecutorFee?: bigint): Promise<string>;
45
45
  get getTrustedTACExecutors(): string[];
46
46
  get getTrustedTONExecutors(): string[];
47
47
  getEVMTokenAddress(tvmTokenAddress: string): Promise<string>;