@tonappchain/sdk 0.6.4 → 0.6.5-smart-accounts-1

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/README.md CHANGED
@@ -50,6 +50,7 @@ The TAC SDK enables you to create frontends that:
50
50
  - [`getUserJettonWalletAddress`](./docs/sdks/tac_sdk.md#getuserjettonwalletaddress): Calculates a user's Jetton wallet address.
51
51
  - [`nativeTONAddress (getter)`](./docs/sdks/tac_sdk.md#nativetonaddress-getter): Placeholder address for native TON.
52
52
  - [`nativeTACAddress (getter)`](./docs/sdks/tac_sdk.md#nativetacaddress-getter): Gets the native asset address on the TAC chain.
53
+ - [`getTacSmartAccountAddress`](./docs//sdks//tac_sdk.md#gettacsmartaccountaddress): Gets smart account address for TON user for specific TAC Application
53
54
  - *(See file for more...)*
54
55
 
55
56
  - **[`OperationTracker`](./docs/sdks/operation_tracker.md)**: Tools for monitoring cross-chain operation status.
@@ -70,8 +70,7 @@ async function orbsOpener(network) {
70
70
  const endpoint = await (0, ton_access_1.getHttpEndpoint)({
71
71
  network,
72
72
  });
73
- const client = new ton_1.TonClient({ endpoint });
74
- return client;
73
+ return new ton_1.TonClient({ endpoint });
75
74
  }
76
75
  async function orbsOpener4(network, timeout = 10000) {
77
76
  const endpoint = await (0, ton_access_1.getHttpV4Endpoint)({ network });
@@ -0,0 +1,21 @@
1
+ import { ContractOpener, ContractState } from '../structs/Struct';
2
+ import { Address, Contract, OpenedContract } from '@ton/ton';
3
+ import { SandboxContract } from '@ton/sandbox';
4
+ import { mainnet, testnet } from '@tonappchain/artifacts';
5
+ export interface OpenerConfig {
6
+ opener: ContractOpener;
7
+ retries: number;
8
+ retryDelay: number;
9
+ }
10
+ export declare class RetryableContractOpener implements ContractOpener {
11
+ private readonly openerConfigs;
12
+ constructor(openerConfigs: OpenerConfig[]);
13
+ open<T extends Contract>(src: T): OpenedContract<T> | SandboxContract<T>;
14
+ getContractState(address: Address): Promise<ContractState>;
15
+ closeConnections(): void;
16
+ private executeWithFallback;
17
+ private tryWithRetries;
18
+ private createRetryableContract;
19
+ private callMethodAcrossOpeners;
20
+ }
21
+ export declare function createDefaultRetryableOpener(artifacts: typeof testnet | typeof mainnet, maxRetries?: number, retryDelay?: number): Promise<ContractOpener>;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryableContractOpener = void 0;
4
+ exports.createDefaultRetryableOpener = createDefaultRetryableOpener;
5
+ const Struct_1 = require("../structs/Struct");
6
+ const ton_1 = require("@ton/ton");
7
+ const artifacts_1 = require("@tonappchain/artifacts");
8
+ const contractOpener_1 = require("./contractOpener");
9
+ const instances_1 = require("../errors/instances");
10
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
11
+ class RetryableContractOpener {
12
+ constructor(openerConfigs) {
13
+ if (openerConfigs.length === 0) {
14
+ throw new Error('No ContractOpener instances available');
15
+ }
16
+ this.openerConfigs = openerConfigs;
17
+ }
18
+ open(src) {
19
+ const firstConfig = this.openerConfigs[0];
20
+ const contract = firstConfig.opener.open(src);
21
+ return this.createRetryableContract(contract, src);
22
+ }
23
+ async getContractState(address) {
24
+ const result = await this.executeWithFallback((config) => config.opener.getContractState(address));
25
+ if (result.success && result.data) {
26
+ return result.data;
27
+ }
28
+ throw result.lastError || (0, instances_1.allContractOpenerFailedError)('Failed to get contract state');
29
+ }
30
+ closeConnections() {
31
+ for (const config of this.openerConfigs) {
32
+ config.opener.closeConnections?.();
33
+ }
34
+ }
35
+ async executeWithFallback(operation) {
36
+ let lastError;
37
+ for (const config of this.openerConfigs) {
38
+ const result = await this.tryWithRetries(() => operation(config), config);
39
+ if (result.success) {
40
+ return { success: true, data: result.data };
41
+ }
42
+ lastError = result.lastError;
43
+ }
44
+ return { success: false, lastError };
45
+ }
46
+ async tryWithRetries(operation, config) {
47
+ let lastError;
48
+ for (let attempt = 0; attempt <= config.retries; attempt++) {
49
+ try {
50
+ const data = await operation();
51
+ return { success: true, data };
52
+ }
53
+ catch (error) {
54
+ lastError = error;
55
+ if (attempt < config.retries) {
56
+ await sleep(config.retryDelay);
57
+ }
58
+ }
59
+ }
60
+ return { success: false, lastError };
61
+ }
62
+ createRetryableContract(contract, src) {
63
+ return new Proxy(contract, {
64
+ get: (target, prop) => {
65
+ const value = Reflect.get(target, prop);
66
+ if (typeof value !== 'function')
67
+ return value;
68
+ return async (...args) => {
69
+ return this.callMethodAcrossOpeners(prop, args, src);
70
+ };
71
+ },
72
+ });
73
+ }
74
+ async callMethodAcrossOpeners(methodName, args, src) {
75
+ const result = await this.executeWithFallback((config) => {
76
+ const contract = config.opener.open(src);
77
+ const method = Reflect.get(contract, methodName);
78
+ if (typeof method !== 'function') {
79
+ throw new Error(`Method ${String(methodName)} is not a function`);
80
+ }
81
+ return method.call(contract, ...args);
82
+ });
83
+ if (result.success)
84
+ return result.data;
85
+ throw result.lastError || (0, instances_1.allContractOpenerFailedError)('failed to call method in contract');
86
+ }
87
+ }
88
+ exports.RetryableContractOpener = RetryableContractOpener;
89
+ async function createDefaultRetryableOpener(artifacts, maxRetries = 3, retryDelay = 1000) {
90
+ const tonClient = new ton_1.TonClient({
91
+ endpoint: new URL('api/v2/jsonRPC', artifacts.TON_RPC_ENDPOINT_BY_TAC).toString(),
92
+ });
93
+ const network = artifacts === artifacts_1.testnet ? Struct_1.Network.TESTNET : Struct_1.Network.MAINNET;
94
+ const opener4 = await (0, contractOpener_1.orbsOpener4)(network);
95
+ const opener = await (0, contractOpener_1.orbsOpener)(network);
96
+ return new RetryableContractOpener([
97
+ { opener: tonClient, retries: maxRetries, retryDelay },
98
+ { opener: opener4, retries: maxRetries, retryDelay },
99
+ { opener: opener, retries: maxRetries, retryDelay },
100
+ ]);
101
+ }
@@ -1,2 +1,2 @@
1
- export { emptyContractError, operationFetchError, statusFetchError, tvmAddressError, evmAddressError, unknownWalletError, unsupportedKeyError, unsupportedFormatError, notMultiplyOf8Error, prefixError, emptySettingError, invalidMethodNameError, simulationError, emptyArrayError, profilingFetchError, } from './instances';
1
+ export { emptyContractError, operationFetchError, statusFetchError, tvmAddressError, evmAddressError, unknownWalletError, unsupportedKeyError, unsupportedFormatError, notMultiplyOf8Error, prefixError, emptySettingError, invalidMethodNameError, simulationError, emptyArrayError, profilingFetchError, allEndpointsFailedError, } from './instances';
2
2
  export { ContractError, FetchError, AddressError, WalletError, KeyError, FormatError, BitError, MetadataError, SettingError, EVMCallError, } from './errors';
@@ -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.profilingFetchError = exports.emptyArrayError = 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.EVMCallError = exports.SettingError = exports.MetadataError = exports.BitError = exports.FormatError = exports.KeyError = exports.WalletError = exports.AddressError = exports.FetchError = exports.ContractError = exports.allEndpointsFailedError = exports.profilingFetchError = exports.emptyArrayError = 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
  var instances_1 = require("./instances");
5
5
  Object.defineProperty(exports, "emptyContractError", { enumerable: true, get: function () { return instances_1.emptyContractError; } });
6
6
  Object.defineProperty(exports, "operationFetchError", { enumerable: true, get: function () { return instances_1.operationFetchError; } });
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "invalidMethodNameError", { enumerable: true, get
17
17
  Object.defineProperty(exports, "simulationError", { enumerable: true, get: function () { return instances_1.simulationError; } });
18
18
  Object.defineProperty(exports, "emptyArrayError", { enumerable: true, get: function () { return instances_1.emptyArrayError; } });
19
19
  Object.defineProperty(exports, "profilingFetchError", { enumerable: true, get: function () { return instances_1.profilingFetchError; } });
20
+ Object.defineProperty(exports, "allEndpointsFailedError", { enumerable: true, get: function () { return instances_1.allEndpointsFailedError; } });
20
21
  var errors_1 = require("./errors");
21
22
  Object.defineProperty(exports, "ContractError", { enumerable: true, get: function () { return errors_1.ContractError; } });
22
23
  Object.defineProperty(exports, "FetchError", { enumerable: true, get: function () { return errors_1.FetchError; } });
@@ -1,7 +1,7 @@
1
1
  import { ContractError, FetchError, AddressError, WalletError, KeyError, FormatError, BitError, MetadataError, SettingError, EVMCallError, NoValidGroupFoundError, PrepareMessageGroupError } from './errors';
2
2
  export declare const emptyContractError: ContractError;
3
- export declare const operationFetchError: FetchError;
4
- export declare const statusFetchError: (msg: string) => FetchError;
3
+ export declare const operationFetchError: (msg: string, inner?: unknown) => FetchError;
4
+ export declare const statusFetchError: (msg: string, inner?: unknown) => FetchError;
5
5
  export declare const tvmAddressError: (addr: string) => AddressError;
6
6
  export declare const evmAddressError: (addr: string) => AddressError;
7
7
  export declare const unknownWalletError: (version: string) => WalletError;
@@ -12,8 +12,10 @@ export declare const prefixError: MetadataError;
12
12
  export declare const emptySettingError: (setting: string) => SettingError;
13
13
  export declare const invalidMethodNameError: (methodName: string) => EVMCallError;
14
14
  export declare const simulationError: (inner: unknown) => FetchError;
15
- export declare const profilingFetchError: (msg: string) => FetchError;
15
+ export declare const profilingFetchError: (msg: string, inner?: unknown) => FetchError;
16
16
  export declare const emptyArrayError: (msg: string) => FetchError;
17
17
  export declare const invalidAssetType: FormatError;
18
18
  export declare const prepareMessageGroupError: (isBocSizeValid: boolean, isDepthValid: boolean) => PrepareMessageGroupError;
19
19
  export declare const noValidGroupFoundError: NoValidGroupFoundError;
20
+ export declare const allEndpointsFailedError: (inner: unknown) => FetchError;
21
+ export declare const allContractOpenerFailedError: (inner: unknown) => FetchError;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.allContractOpenerFailedError = exports.allEndpointsFailedError = 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
- exports.operationFetchError = new errors_1.FetchError('failed to fetch OperationId', 101);
7
- const statusFetchError = (msg) => new errors_1.FetchError(`failed to fetch status transaction: ${msg}`, 102);
6
+ const operationFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch OperationId: ${msg}`, 101, inner);
7
+ exports.operationFetchError = operationFetchError;
8
+ const statusFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch status transaction: ${msg}`, 102, inner);
8
9
  exports.statusFetchError = statusFetchError;
9
10
  const tvmAddressError = (addr) => new errors_1.AddressError(`invalid tvm address ${addr}`, 103);
10
11
  exports.tvmAddressError = tvmAddressError;
@@ -23,7 +24,7 @@ const invalidMethodNameError = (methodName) => new errors_1.EVMCallError(`Invali
23
24
  exports.invalidMethodNameError = invalidMethodNameError;
24
25
  const simulationError = (inner) => new errors_1.FetchError(`Failed to simulate EVM call: ${inner}`, 112, inner);
25
26
  exports.simulationError = simulationError;
26
- const profilingFetchError = (msg) => new errors_1.FetchError(`failed to fetch stage profiling: ${msg}`, 113);
27
+ const profilingFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch stage profiling: ${msg}`, 113, inner);
27
28
  exports.profilingFetchError = profilingFetchError;
28
29
  const emptyArrayError = (msg) => new errors_1.FetchError(`empty array: ${msg}`, 114);
29
30
  exports.emptyArrayError = emptyArrayError;
@@ -31,3 +32,7 @@ exports.invalidAssetType = new errors_1.FormatError('Invalid asset type', 115);
31
32
  const prepareMessageGroupError = (isBocSizeValid, isDepthValid) => new errors_1.PrepareMessageGroupError(`Failed to prepare message group: BOC size valid: ${isBocSizeValid}, depth valid: ${isDepthValid}`, 116);
32
33
  exports.prepareMessageGroupError = prepareMessageGroupError;
33
34
  exports.noValidGroupFoundError = new errors_1.NoValidGroupFoundError('Failed to prepare valid message group', 117);
35
+ const allEndpointsFailedError = (inner) => new errors_1.FetchError('All endpoints failed', 118, inner);
36
+ exports.allEndpointsFailedError = allEndpointsFailedError;
37
+ const allContractOpenerFailedError = (inner) => new errors_1.FetchError('All contract opener failed', 119, inner);
38
+ exports.allContractOpenerFailedError = allContractOpenerFailedError;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { TacSdk } from './sdk/TacSdk';
1
+ export { liteClientOpener, orbsOpener } from './adapters/contractOpener';
2
+ export * from './errors';
3
+ export { LiteSequencerClient } from './sdk/LiteSequencerClient';
2
4
  export { OperationTracker } from './sdk/OperationTracker';
3
5
  export { startTracking, startTrackingMultiple } from './sdk/StartTracking';
6
+ export { TacSdk } from './sdk/TacSdk';
4
7
  export * from './sender';
5
8
  export * from './structs/Struct';
6
9
  export { Network, SimplifiedStatuses } from './structs/Struct';
10
+ export { readJettonMetadata } from './wrappers/ContentUtils';
11
+ export { HighloadWalletV3 } from './wrappers/HighloadWalletV3';
7
12
  export type { JettonWalletData } from './wrappers/JettonWallet';
8
13
  export { JettonWallet, JettonWalletOpCodes } from './wrappers/JettonWallet';
9
- export { HighloadWalletV3 } from './wrappers/HighloadWalletV3';
10
- export { orbsOpener, liteClientOpener } from './adapters/contractOpener';
11
- export * from './errors';
12
- export { readJettonMetadata } from './wrappers/ContentUtils';
13
- export { LiteSequencerClient } from './sdk/LiteSequencerClient';
package/dist/index.js CHANGED
@@ -14,29 +14,29 @@ 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.LiteSequencerClient = exports.readJettonMetadata = exports.liteClientOpener = exports.orbsOpener = exports.HighloadWalletV3 = exports.JettonWalletOpCodes = exports.JettonWallet = exports.SimplifiedStatuses = exports.Network = exports.startTrackingMultiple = exports.startTracking = exports.OperationTracker = exports.TacSdk = void 0;
18
- var TacSdk_1 = require("./sdk/TacSdk");
19
- Object.defineProperty(exports, "TacSdk", { enumerable: true, get: function () { return TacSdk_1.TacSdk; } });
17
+ exports.JettonWalletOpCodes = exports.JettonWallet = exports.HighloadWalletV3 = exports.readJettonMetadata = exports.SimplifiedStatuses = exports.Network = exports.TacSdk = exports.startTrackingMultiple = exports.startTracking = exports.OperationTracker = exports.LiteSequencerClient = exports.orbsOpener = exports.liteClientOpener = void 0;
18
+ var contractOpener_1 = require("./adapters/contractOpener");
19
+ Object.defineProperty(exports, "liteClientOpener", { enumerable: true, get: function () { return contractOpener_1.liteClientOpener; } });
20
+ Object.defineProperty(exports, "orbsOpener", { enumerable: true, get: function () { return contractOpener_1.orbsOpener; } });
21
+ __exportStar(require("./errors"), exports);
22
+ var LiteSequencerClient_1 = require("./sdk/LiteSequencerClient");
23
+ Object.defineProperty(exports, "LiteSequencerClient", { enumerable: true, get: function () { return LiteSequencerClient_1.LiteSequencerClient; } });
20
24
  var OperationTracker_1 = require("./sdk/OperationTracker");
21
25
  Object.defineProperty(exports, "OperationTracker", { enumerable: true, get: function () { return OperationTracker_1.OperationTracker; } });
22
26
  var StartTracking_1 = require("./sdk/StartTracking");
23
27
  Object.defineProperty(exports, "startTracking", { enumerable: true, get: function () { return StartTracking_1.startTracking; } });
24
28
  Object.defineProperty(exports, "startTrackingMultiple", { enumerable: true, get: function () { return StartTracking_1.startTrackingMultiple; } });
29
+ var TacSdk_1 = require("./sdk/TacSdk");
30
+ Object.defineProperty(exports, "TacSdk", { enumerable: true, get: function () { return TacSdk_1.TacSdk; } });
25
31
  __exportStar(require("./sender"), exports);
26
32
  __exportStar(require("./structs/Struct"), exports);
27
33
  var Struct_1 = require("./structs/Struct");
28
34
  Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return Struct_1.Network; } });
29
35
  Object.defineProperty(exports, "SimplifiedStatuses", { enumerable: true, get: function () { return Struct_1.SimplifiedStatuses; } });
36
+ var ContentUtils_1 = require("./wrappers/ContentUtils");
37
+ Object.defineProperty(exports, "readJettonMetadata", { enumerable: true, get: function () { return ContentUtils_1.readJettonMetadata; } });
38
+ var HighloadWalletV3_1 = require("./wrappers/HighloadWalletV3");
39
+ Object.defineProperty(exports, "HighloadWalletV3", { enumerable: true, get: function () { return HighloadWalletV3_1.HighloadWalletV3; } });
30
40
  var JettonWallet_1 = require("./wrappers/JettonWallet");
31
41
  Object.defineProperty(exports, "JettonWallet", { enumerable: true, get: function () { return JettonWallet_1.JettonWallet; } });
32
42
  Object.defineProperty(exports, "JettonWalletOpCodes", { enumerable: true, get: function () { return JettonWallet_1.JettonWalletOpCodes; } });
33
- var HighloadWalletV3_1 = require("./wrappers/HighloadWalletV3");
34
- Object.defineProperty(exports, "HighloadWalletV3", { enumerable: true, get: function () { return HighloadWalletV3_1.HighloadWalletV3; } });
35
- var contractOpener_1 = require("./adapters/contractOpener");
36
- Object.defineProperty(exports, "orbsOpener", { enumerable: true, get: function () { return contractOpener_1.orbsOpener; } });
37
- Object.defineProperty(exports, "liteClientOpener", { enumerable: true, get: function () { return contractOpener_1.liteClientOpener; } });
38
- __exportStar(require("./errors"), exports);
39
- var ContentUtils_1 = require("./wrappers/ContentUtils");
40
- Object.defineProperty(exports, "readJettonMetadata", { enumerable: true, get: function () { return ContentUtils_1.readJettonMetadata; } });
41
- var LiteSequencerClient_1 = require("./sdk/LiteSequencerClient");
42
- Object.defineProperty(exports, "LiteSequencerClient", { enumerable: true, get: function () { return LiteSequencerClient_1.LiteSequencerClient; } });
@@ -12,5 +12,5 @@ exports.SOLIDITY_METHOD_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
12
12
  exports.MAX_EXT_MSG_SIZE = 65535;
13
13
  exports.MAX_HIGHLOAD_GROUP_MSG_NUM = 254;
14
14
  exports.MAX_MSG_DEPTH = 512;
15
- exports.TON_SYMBOL = "TON";
16
- exports.TAC_SYMBOL = "TAC";
15
+ exports.TON_SYMBOL = 'TON';
16
+ exports.TAC_SYMBOL = 'TAC';
@@ -1,4 +1,4 @@
1
- import { TransactionLinker, StatusInfosByOperationId, OperationIdsByShardsKey, ExecutionStagesByOperationId, OperationType } from '../structs/Struct';
1
+ import { ExecutionStagesByOperationId, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, TransactionLinker } from '../structs/Struct';
2
2
  export declare class LiteSequencerClient {
3
3
  private readonly endpoint;
4
4
  private readonly maxChunkSize;
@@ -22,8 +22,7 @@ class LiteSequencerClient {
22
22
  return response.data.response || '';
23
23
  }
24
24
  catch (error) {
25
- console.error(`Failed to get operationType with ${this.endpoint}:`, error);
26
- throw errors_1.operationFetchError;
25
+ throw (0, errors_1.operationFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
27
26
  }
28
27
  }
29
28
  async getOperationId(transactionLinker) {
@@ -40,12 +39,10 @@ class LiteSequencerClient {
40
39
  catch (error) {
41
40
  if (axios_1.default.isAxiosError(error)) {
42
41
  if (error.response?.status === 404) {
43
- console.warn(`404 Not Found: ${new URL('ton/operation-id', this.endpoint).toString()}`);
44
42
  return '';
45
43
  }
46
44
  }
47
- console.error(`Failed to get OperationId with ${this.endpoint}:`, error);
48
- throw errors_1.operationFetchError;
45
+ throw (0, errors_1.operationFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
49
46
  }
50
47
  }
51
48
  async getOperationIdsByShardsKeys(shardsKeys, caller, chunkSize = this.maxChunkSize) {
@@ -63,8 +60,7 @@ class LiteSequencerClient {
63
60
  return response.response;
64
61
  }
65
62
  catch (error) {
66
- console.error(`Failed to get OperationIds with ${this.endpoint}:`, error);
67
- throw errors_1.operationFetchError;
63
+ throw (0, errors_1.operationFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
68
64
  }
69
65
  }
70
66
  async getStageProfilings(operationIds, chunkSize = this.maxChunkSize) {
@@ -83,8 +79,7 @@ class LiteSequencerClient {
83
79
  return response.response;
84
80
  }
85
81
  catch (error) {
86
- console.error(`Error fetching stage profiling with ${this.endpoint}:`, error);
87
- throw (0, errors_1.profilingFetchError)('endpoint failed to complete request');
82
+ throw (0, errors_1.profilingFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
88
83
  }
89
84
  }
90
85
  async getOperationStatuses(operationIds, chunkSize = this.maxChunkSize) {
@@ -103,8 +98,7 @@ class LiteSequencerClient {
103
98
  return response.response;
104
99
  }
105
100
  catch (error) {
106
- console.error(`Error fetching status transaction with ${this.endpoint}:`, error);
107
- throw (0, errors_1.statusFetchError)('endpoint failed to complete request');
101
+ throw (0, errors_1.statusFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
108
102
  }
109
103
  }
110
104
  async processChunkedRequest(identificators, requestFn, chunkSize = this.maxChunkSize) {
@@ -1,13 +1,15 @@
1
- import { Network, TransactionLinker, SimplifiedStatuses, OperationType, OperationIdsByShardsKey, ExecutionStages, ExecutionStagesByOperationId, StatusInfosByOperationId, StatusInfo } from '../structs/Struct';
1
+ import { ExecutionStages, ExecutionStagesByOperationId, Network, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, TransactionLinker, WaitOptions } from '../structs/Struct';
2
2
  export declare class OperationTracker {
3
3
  private readonly clients;
4
- constructor(network: Network, customLiteSequencerEndpoints?: string[]);
5
- getOperationType(operationId: string): Promise<OperationType>;
6
- getOperationId(transactionLinker: TransactionLinker): Promise<string>;
7
- getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
8
- getStageProfiling(operationId: string): Promise<ExecutionStages>;
9
- getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
10
- getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
11
- getOperationStatus(operationId: string): Promise<StatusInfo>;
4
+ private readonly debug;
5
+ constructor(network: Network, customLiteSequencerEndpoints?: string[], debug?: boolean);
6
+ private debugLog;
7
+ getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType>): Promise<OperationType>;
8
+ getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string>): Promise<string>;
9
+ getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, waitOptions?: WaitOptions<OperationIdsByShardsKey>, chunkSize?: number): Promise<OperationIdsByShardsKey>;
10
+ getStageProfiling(operationId: string, waitOptions?: WaitOptions<ExecutionStages>): Promise<ExecutionStages>;
11
+ getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId>, chunkSize?: number): Promise<ExecutionStagesByOperationId>;
12
+ getOperationStatuses(operationIds: string[], waitOptions?: WaitOptions<StatusInfosByOperationId>, chunkSize?: number): Promise<StatusInfosByOperationId>;
13
+ getOperationStatus(operationId: string, waitOptions?: WaitOptions<StatusInfo>): Promise<StatusInfo>;
12
14
  getSimplifiedOperationStatus(transactionLinker: TransactionLinker): Promise<SimplifiedStatuses>;
13
15
  }