@tonappchain/sdk 0.7.2-alpha-18 → 0.7.2-alpha-21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.js +6 -2
- package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/JettonMinter.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +65 -6
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +169 -18
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +4 -2
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +5 -3
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.d.ts +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.js +10 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.js +9 -2
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.d.ts +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.js +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.js +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.js +8 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +1 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +1 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
- package/dist/src/adapters/RetryableContractOpener.js +15 -11
- package/dist/src/adapters/TonClient4Opener.d.ts +1 -0
- package/dist/src/adapters/TonClient4Opener.js +9 -1
- package/dist/src/adapters/TonClientOpener.d.ts +2 -0
- package/dist/src/adapters/TonClientOpener.js +11 -1
- package/dist/src/errors/errors.js +29 -12
- package/dist/src/errors/instances.js +32 -11
- package/dist/src/interfaces/IOperationTracker.d.ts +22 -22
- package/dist/src/sdk/Consts.d.ts +1 -0
- package/dist/src/sdk/Consts.js +2 -1
- package/dist/src/sdk/OperationTracker.d.ts +11 -11
- package/dist/src/sdk/OperationTracker.js +33 -33
- package/dist/src/sdk/StartTracking.d.ts +3 -3
- package/dist/src/sdk/StartTracking.js +3 -2
- package/dist/src/sdk/Utils.js +3 -3
- package/dist/src/structs/Struct.d.ts +3 -3
- package/dist/src/structs/Struct.js +4 -3
- package/package.json +1 -1
|
@@ -3,55 +3,55 @@ export interface IOperationTracker {
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns the operation type for the given id, optionally waiting according to the provided policy.
|
|
5
5
|
* @param operationId Operation identifier.
|
|
6
|
-
* @param waitOptions Optional waiting and polling settings.
|
|
6
|
+
* @param waitOptions Optional waiting and polling settings. Pass `null` to disable retries and use a single attempt.
|
|
7
7
|
*/
|
|
8
|
-
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType>): Promise<OperationType>;
|
|
8
|
+
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType> | null): Promise<OperationType>;
|
|
9
9
|
/**
|
|
10
10
|
* Resolves an operation id for the given transaction linker, optionally waiting until available.
|
|
11
11
|
* @param transactionLinker Reference to originating transaction across chains.
|
|
12
|
-
* @param waitOptions Optional waiting settings.
|
|
12
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
13
13
|
*/
|
|
14
|
-
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string>): Promise<string>;
|
|
14
|
+
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
15
15
|
/**
|
|
16
16
|
* Resolves an operation id by a transaction hash, optionally waiting until available.
|
|
17
17
|
* @param transactionHash Hash of the originating transaction.
|
|
18
|
-
* @param waitOptions Optional waiting settings.
|
|
18
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
19
19
|
*/
|
|
20
|
-
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string>): Promise<string>;
|
|
20
|
+
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
21
21
|
/**
|
|
22
22
|
* Resolves operation ids by shard keys for a particular caller, with optional batching and waiting.
|
|
23
23
|
* @param shardsKeys List of shard keys.
|
|
24
24
|
* @param caller Human-readable identifier of the caller (for tracing/limits).
|
|
25
|
-
* @param waitOptions Optional waiting settings.
|
|
25
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
26
26
|
* @param chunkSize Optional batching size for network requests.
|
|
27
27
|
*/
|
|
28
|
-
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, waitOptions?: WaitOptions<OperationIdsByShardsKey
|
|
28
|
+
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, waitOptions?: WaitOptions<OperationIdsByShardsKey> | null, chunkSize?: number): Promise<OperationIdsByShardsKey>;
|
|
29
29
|
/**
|
|
30
30
|
* Gets detailed stage profiling for a single operation, optionally waiting until available.
|
|
31
31
|
* @param operationId Operation identifier.
|
|
32
|
-
* @param waitOptions Optional waiting settings.
|
|
32
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
33
33
|
*/
|
|
34
|
-
getStageProfiling(operationId: string, waitOptions?: WaitOptions<ExecutionStages>): Promise<ExecutionStages>;
|
|
34
|
+
getStageProfiling(operationId: string, waitOptions?: WaitOptions<ExecutionStages> | null): Promise<ExecutionStages>;
|
|
35
35
|
/**
|
|
36
36
|
* Gets stage profiling for multiple operations in bulk.
|
|
37
37
|
* @param operationIds Operation identifiers.
|
|
38
|
-
* @param waitOptions Optional waiting settings.
|
|
38
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
39
39
|
* @param chunkSize Optional batching size for requests.
|
|
40
40
|
*/
|
|
41
|
-
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId
|
|
41
|
+
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
42
42
|
/**
|
|
43
43
|
* Gets statuses for multiple operations.
|
|
44
44
|
* @param operationIds Operation identifiers.
|
|
45
|
-
* @param waitOptions Optional waiting settings.
|
|
45
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
46
46
|
* @param chunkSize Optional batching size for requests.
|
|
47
47
|
*/
|
|
48
|
-
getOperationStatuses(operationIds: string[], waitOptions?: WaitOptions<StatusInfosByOperationId
|
|
48
|
+
getOperationStatuses(operationIds: string[], waitOptions?: WaitOptions<StatusInfosByOperationId> | null, chunkSize?: number): Promise<StatusInfosByOperationId>;
|
|
49
49
|
/**
|
|
50
50
|
* Gets a single operation status, optionally waiting according to policy.
|
|
51
51
|
* @param operationId Operation identifier.
|
|
52
|
-
* @param waitOptions Optional waiting settings.
|
|
52
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
53
53
|
*/
|
|
54
|
-
getOperationStatus(operationId: string, waitOptions?: WaitOptions<StatusInfo>): Promise<StatusInfo>;
|
|
54
|
+
getOperationStatus(operationId: string, waitOptions?: WaitOptions<StatusInfo> | null): Promise<StatusInfo>;
|
|
55
55
|
/**
|
|
56
56
|
* Returns a simplified status for the provided transaction linker.
|
|
57
57
|
* @param transactionLinker Reference to originating transaction across chains.
|
|
@@ -60,22 +60,22 @@ export interface IOperationTracker {
|
|
|
60
60
|
/**
|
|
61
61
|
* Converts currency using the tracker service, optionally waiting for completion.
|
|
62
62
|
* @param params Conversion parameters.
|
|
63
|
-
* @param waitOptions Optional waiting settings.
|
|
63
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
64
64
|
*/
|
|
65
|
-
convertCurrency(params: ConvertCurrencyParams, waitOptions?: WaitOptions<ConvertedCurrencyResult>): Promise<ConvertedCurrencyResult>;
|
|
65
|
+
convertCurrency(params: ConvertCurrencyParams, waitOptions?: WaitOptions<ConvertedCurrencyResult> | null): Promise<ConvertedCurrencyResult>;
|
|
66
66
|
/**
|
|
67
67
|
* Simulates execution of a TAC message without broadcasting it, optionally waiting until the result is available.
|
|
68
68
|
* Useful to validate inputs and estimate effects before sending a real transaction.
|
|
69
69
|
* @param params Simulation parameters and context.
|
|
70
|
-
* @param waitOptions Optional waiting settings (polling/timeout policy).
|
|
70
|
+
* @param waitOptions Optional waiting settings (polling/timeout policy). Pass `null` to disable retries and use a single attempt.
|
|
71
71
|
* @returns Promise with detailed simulation result.
|
|
72
72
|
*/
|
|
73
|
-
simulateTACMessage(params: TACSimulationParams, waitOptions?: WaitOptions<TACSimulationResult>): Promise<TACSimulationResult>;
|
|
73
|
+
simulateTACMessage(params: TACSimulationParams, waitOptions?: WaitOptions<TACSimulationResult> | null): Promise<TACSimulationResult>;
|
|
74
74
|
/**
|
|
75
75
|
* Suggests/calculates a TVM executor fee for the provided parameters, optionally waiting for completion.
|
|
76
76
|
* @param params Parameters affecting fee calculation.
|
|
77
|
-
* @param waitOptions Optional waiting settings (polling/timeout policy).
|
|
77
|
+
* @param waitOptions Optional waiting settings (polling/timeout policy). Pass `null` to disable retries and use a single attempt.
|
|
78
78
|
* @returns Promise with suggested fee information.
|
|
79
79
|
*/
|
|
80
|
-
getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee>): Promise<SuggestedTVMExecutorFee>;
|
|
80
|
+
getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee> | null): Promise<SuggestedTVMExecutorFee>;
|
|
81
81
|
}
|
package/dist/src/sdk/Consts.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const TAC_DECIMALS = 18;
|
|
|
16
16
|
export declare const FIVE_MINUTES: number;
|
|
17
17
|
export declare const MINUTE: number;
|
|
18
18
|
export declare const TON_BURN_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
|
|
19
|
+
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
19
20
|
export declare const DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
20
21
|
export declare const DEFAULT_RETRY_MAX_COUNT = 5;
|
|
21
22
|
export declare const DEFAULT_RETRY_DELAY_MS = 1000;
|
package/dist/src/sdk/Consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IGNORE_OPCODE = exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_RETRY_DELAY_MS = exports.DEFAULT_RETRY_MAX_COUNT = exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = exports.TON_BURN_ADDRESS = exports.MINUTE = exports.FIVE_MINUTES = exports.TAC_DECIMALS = exports.TON_DECIMALS = exports.ONE_YEAR_SECONDS = exports.FIFTEEN_MINUTES = 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 = void 0;
|
|
3
|
+
exports.IGNORE_OPCODE = exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_RETRY_DELAY_MS = exports.DEFAULT_RETRY_MAX_COUNT = exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = exports.DEFAULT_TIMEOUT_MS = exports.TON_BURN_ADDRESS = exports.MINUTE = exports.FIVE_MINUTES = exports.TAC_DECIMALS = exports.TON_DECIMALS = exports.ONE_YEAR_SECONDS = exports.FIFTEEN_MINUTES = 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 = void 0;
|
|
4
4
|
const ton_1 = require("@ton/ton");
|
|
5
5
|
exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = (0, ton_1.toNano)(0.2);
|
|
6
6
|
exports.NFT_TRANSFER_FORWARD_TON_AMOUNT = (0, ton_1.toNano)(0.3);
|
|
@@ -20,6 +20,7 @@ exports.TAC_DECIMALS = 18;
|
|
|
20
20
|
exports.FIVE_MINUTES = 5 * 60 * 1000;
|
|
21
21
|
exports.MINUTE = 60 * 1000;
|
|
22
22
|
exports.TON_BURN_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
|
|
23
|
+
exports.DEFAULT_TIMEOUT_MS = 300000; // 5 minute
|
|
23
24
|
exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
24
25
|
exports.DEFAULT_RETRY_MAX_COUNT = 5;
|
|
25
26
|
exports.DEFAULT_RETRY_DELAY_MS = 1000;
|
|
@@ -7,16 +7,16 @@ export declare class OperationTracker implements IOperationTracker {
|
|
|
7
7
|
private readonly clients;
|
|
8
8
|
private readonly logger;
|
|
9
9
|
constructor(network: Network, customLiteSequencerEndpoints?: string[], logger?: ILogger, clientFactory?: ILiteSequencerClientFactory);
|
|
10
|
-
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string>): Promise<string>;
|
|
11
|
-
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType>): Promise<OperationType>;
|
|
12
|
-
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string>): Promise<string>;
|
|
13
|
-
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, waitOptions?: WaitOptions<OperationIdsByShardsKey
|
|
14
|
-
getStageProfiling(operationId: string, waitOptions?: WaitOptions<ExecutionStages>): Promise<ExecutionStages>;
|
|
15
|
-
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId
|
|
16
|
-
getOperationStatuses(operationIds: string[], waitOptions?: WaitOptions<StatusInfosByOperationId
|
|
17
|
-
getOperationStatus(operationId: string, waitOptions?: WaitOptions<StatusInfo>): Promise<StatusInfo>;
|
|
10
|
+
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
11
|
+
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType> | null): Promise<OperationType>;
|
|
12
|
+
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
13
|
+
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, waitOptions?: WaitOptions<OperationIdsByShardsKey> | null, chunkSize?: number): Promise<OperationIdsByShardsKey>;
|
|
14
|
+
getStageProfiling(operationId: string, waitOptions?: WaitOptions<ExecutionStages> | null): Promise<ExecutionStages>;
|
|
15
|
+
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
16
|
+
getOperationStatuses(operationIds: string[], waitOptions?: WaitOptions<StatusInfosByOperationId> | null, chunkSize?: number): Promise<StatusInfosByOperationId>;
|
|
17
|
+
getOperationStatus(operationId: string, waitOptions?: WaitOptions<StatusInfo> | null): Promise<StatusInfo>;
|
|
18
18
|
getSimplifiedOperationStatus(transactionLinker: TransactionLinker): Promise<SimplifiedStatuses>;
|
|
19
|
-
convertCurrency(params: ConvertCurrencyParams, waitOptions?: WaitOptions<ConvertedCurrencyResult>): Promise<ConvertedCurrencyResult>;
|
|
20
|
-
simulateTACMessage(params: TACSimulationParams, waitOptions?: WaitOptions<TACSimulationResult>): Promise<TACSimulationResult>;
|
|
21
|
-
getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee>): Promise<SuggestedTVMExecutorFee>;
|
|
19
|
+
convertCurrency(params: ConvertCurrencyParams, waitOptions?: WaitOptions<ConvertedCurrencyResult> | null): Promise<ConvertedCurrencyResult>;
|
|
20
|
+
simulateTACMessage(params: TACSimulationParams, waitOptions?: WaitOptions<TACSimulationResult> | null): Promise<TACSimulationResult>;
|
|
21
|
+
getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee> | null): Promise<SuggestedTVMExecutorFee>;
|
|
22
22
|
}
|
|
@@ -52,9 +52,9 @@ class OperationTracker {
|
|
|
52
52
|
this.logger.error('All endpoints failed to get operation id by transactionHash');
|
|
53
53
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
54
54
|
};
|
|
55
|
-
return waitOptions
|
|
56
|
-
? await (
|
|
57
|
-
: await
|
|
55
|
+
return waitOptions === null
|
|
56
|
+
? await requestFn()
|
|
57
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation ID by transaction hash');
|
|
58
58
|
}
|
|
59
59
|
async getOperationType(operationId, waitOptions) {
|
|
60
60
|
this.logger.debug(`Getting operation type for ${(0, Utils_1.formatObjectForLogging)(operationId)}`);
|
|
@@ -74,9 +74,9 @@ class OperationTracker {
|
|
|
74
74
|
this.logger.error('All endpoints failed to get operation type');
|
|
75
75
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
76
76
|
};
|
|
77
|
-
return waitOptions
|
|
78
|
-
? await (
|
|
79
|
-
: await
|
|
77
|
+
return waitOptions === null
|
|
78
|
+
? await requestFn()
|
|
79
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation type');
|
|
80
80
|
}
|
|
81
81
|
async getOperationId(transactionLinker, waitOptions) {
|
|
82
82
|
this.logger.debug(`Getting operation ID for transaction linker: ${(0, Utils_1.formatObjectForLogging)(transactionLinker)}`);
|
|
@@ -96,9 +96,9 @@ class OperationTracker {
|
|
|
96
96
|
this.logger.error('All endpoints failed to get operation id');
|
|
97
97
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
98
98
|
};
|
|
99
|
-
return waitOptions
|
|
100
|
-
? await (
|
|
101
|
-
: await
|
|
99
|
+
return waitOptions === null
|
|
100
|
+
? await requestFn()
|
|
101
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation ID by transaction linker');
|
|
102
102
|
}
|
|
103
103
|
async getOperationIdsByShardsKeys(shardsKeys, caller, waitOptions, chunkSize = 100) {
|
|
104
104
|
this.logger.debug(`Getting operation IDs for shards keys: ${(0, Utils_1.formatObjectForLogging)(shardsKeys)}`);
|
|
@@ -119,9 +119,9 @@ class OperationTracker {
|
|
|
119
119
|
this.logger.error('All endpoints failed to get operation ids by shards keys');
|
|
120
120
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
121
121
|
};
|
|
122
|
-
return waitOptions
|
|
123
|
-
? await (
|
|
124
|
-
: await
|
|
122
|
+
return waitOptions === null
|
|
123
|
+
? await requestFn()
|
|
124
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation IDs by shards keys');
|
|
125
125
|
}
|
|
126
126
|
async getStageProfiling(operationId, waitOptions) {
|
|
127
127
|
this.logger.debug(`Getting stage profiling for operation ${operationId}`);
|
|
@@ -146,9 +146,9 @@ class OperationTracker {
|
|
|
146
146
|
this.logger.error('All endpoints failed to get stage profiling');
|
|
147
147
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
148
148
|
};
|
|
149
|
-
return waitOptions
|
|
150
|
-
? await (
|
|
151
|
-
: await
|
|
149
|
+
return waitOptions === null
|
|
150
|
+
? await requestFn()
|
|
151
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting stage profiling');
|
|
152
152
|
}
|
|
153
153
|
async getStageProfilings(operationIds, waitOptions, chunkSize = 100) {
|
|
154
154
|
this.logger.debug(`Getting stage profilings for operations: ${operationIds.join(', ')}`);
|
|
@@ -169,9 +169,9 @@ class OperationTracker {
|
|
|
169
169
|
this.logger.error('All endpoints failed to get stage profilings');
|
|
170
170
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
171
171
|
};
|
|
172
|
-
return waitOptions
|
|
173
|
-
? await (
|
|
174
|
-
: await
|
|
172
|
+
return waitOptions === null
|
|
173
|
+
? await requestFn()
|
|
174
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting stage profilings');
|
|
175
175
|
}
|
|
176
176
|
async getOperationStatuses(operationIds, waitOptions, chunkSize = 100) {
|
|
177
177
|
this.logger.debug(`Getting operation statuses for operations: ${(0, Utils_1.formatObjectForLogging)(operationIds)}`);
|
|
@@ -192,9 +192,9 @@ class OperationTracker {
|
|
|
192
192
|
this.logger.error('All endpoints failed to get operation statuses');
|
|
193
193
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
194
194
|
};
|
|
195
|
-
return waitOptions
|
|
196
|
-
? await (
|
|
197
|
-
: await
|
|
195
|
+
return waitOptions === null
|
|
196
|
+
? await requestFn()
|
|
197
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation statuses');
|
|
198
198
|
}
|
|
199
199
|
async getOperationStatus(operationId, waitOptions) {
|
|
200
200
|
this.logger.debug(`Getting operation status for ${(0, Utils_1.formatObjectForLogging)(operationId)}`);
|
|
@@ -218,9 +218,9 @@ class OperationTracker {
|
|
|
218
218
|
this.logger.error('All endpoints failed to get operation status');
|
|
219
219
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
220
220
|
};
|
|
221
|
-
const status = waitOptions
|
|
222
|
-
? await (
|
|
223
|
-
: await
|
|
221
|
+
const status = waitOptions === null
|
|
222
|
+
? await requestFn()
|
|
223
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting operation status');
|
|
224
224
|
this.logger.debug(`operation status resolved stage=${status.stage ?? 'unknown'} success=${(String(status.success))}`);
|
|
225
225
|
return status;
|
|
226
226
|
}
|
|
@@ -261,9 +261,9 @@ class OperationTracker {
|
|
|
261
261
|
this.logger.error('All endpoints failed to convert currency');
|
|
262
262
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
263
263
|
};
|
|
264
|
-
return waitOptions
|
|
265
|
-
? await (
|
|
266
|
-
: await
|
|
264
|
+
return waitOptions === null
|
|
265
|
+
? await requestFn()
|
|
266
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Converting currency');
|
|
267
267
|
}
|
|
268
268
|
async simulateTACMessage(params, waitOptions) {
|
|
269
269
|
Validator_1.Validator.validateTACSimulationParams(params);
|
|
@@ -284,9 +284,9 @@ class OperationTracker {
|
|
|
284
284
|
this.logger.error('All endpoints failed to simulate TAC message');
|
|
285
285
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
286
286
|
};
|
|
287
|
-
return waitOptions
|
|
288
|
-
? await (
|
|
289
|
-
: await
|
|
287
|
+
return waitOptions === null
|
|
288
|
+
? await requestFn()
|
|
289
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Simulating TAC message');
|
|
290
290
|
}
|
|
291
291
|
async getTVMExecutorFee(params, waitOptions) {
|
|
292
292
|
this.logger.debug(`get TVM executor fee: ${(0, Utils_1.formatObjectForLogging)(params)}`);
|
|
@@ -306,9 +306,9 @@ class OperationTracker {
|
|
|
306
306
|
this.logger.error('All endpoints failed to get TVM executor fee');
|
|
307
307
|
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
308
308
|
};
|
|
309
|
-
return waitOptions
|
|
310
|
-
? await (
|
|
311
|
-
: await
|
|
309
|
+
return waitOptions === null
|
|
310
|
+
? await requestFn()
|
|
311
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, 'OperationTracker: Getting TVM executor fee');
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
exports.OperationTracker = OperationTracker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContractOpener, ILogger } from '../interfaces';
|
|
2
2
|
import { ITxFinalizer } from '../interfaces/ITxFinalizer';
|
|
3
|
-
import { ExecutionStages, Network,
|
|
4
|
-
export declare function startTracking(transactionLinker:
|
|
3
|
+
import { ExecutionStages, Network, TransactionLinkerWithOperationId } from '../structs/Struct';
|
|
4
|
+
export declare function startTracking(transactionLinker: TransactionLinkerWithOperationId, network: Network, options?: {
|
|
5
5
|
customLiteSequencerEndpoints?: string[];
|
|
6
6
|
delay?: number;
|
|
7
7
|
maxIterationCount?: number;
|
|
@@ -12,7 +12,7 @@ export declare function startTracking(transactionLinker: TransactionLinker, netw
|
|
|
12
12
|
contractOpener?: ContractOpener;
|
|
13
13
|
cclAddress?: string;
|
|
14
14
|
}): Promise<void | ExecutionStages>;
|
|
15
|
-
export declare function startTrackingMultiple(transactionLinkers:
|
|
15
|
+
export declare function startTrackingMultiple(transactionLinkers: TransactionLinkerWithOperationId[], network: Network, options?: {
|
|
16
16
|
customLiteSequencerEndpoints?: string[];
|
|
17
17
|
delay?: number;
|
|
18
18
|
maxIterationCount?: number;
|
|
@@ -16,7 +16,7 @@ async function startTracking(transactionLinker, network, options) {
|
|
|
16
16
|
`shardsKey: ${transactionLinker.shardsKey}\n` +
|
|
17
17
|
`shardCount: ${transactionLinker.shardCount}\n` +
|
|
18
18
|
`timestamp: ${transactionLinker.timestamp}`);
|
|
19
|
-
let operationId = '';
|
|
19
|
+
let operationId = transactionLinker.operationId ?? '';
|
|
20
20
|
let iteration = 0; // number of iterations
|
|
21
21
|
let operationType = '';
|
|
22
22
|
let ok = true; // finished successfully
|
|
@@ -33,7 +33,8 @@ async function startTracking(transactionLinker, network, options) {
|
|
|
33
33
|
try {
|
|
34
34
|
operationId = await tracker.getOperationId(transactionLinker);
|
|
35
35
|
}
|
|
36
|
-
catch {
|
|
36
|
+
catch (err) {
|
|
37
|
+
logger.debug('failed to get operationId: ' + err);
|
|
37
38
|
// Ignore error and continue
|
|
38
39
|
}
|
|
39
40
|
}
|
package/dist/src/sdk/Utils.js
CHANGED
|
@@ -151,9 +151,9 @@ const generateFeeData = (feeParams) => {
|
|
|
151
151
|
};
|
|
152
152
|
exports.generateFeeData = generateFeeData;
|
|
153
153
|
async function waitUntilSuccess(options = {}, operation, operationDescription, ...args) {
|
|
154
|
-
const timeout = options.timeout ??
|
|
155
|
-
const maxAttempts = options.maxAttempts ??
|
|
156
|
-
const delay = options.delay ??
|
|
154
|
+
const timeout = options.timeout ?? Struct_1.defaultWaitOptions.timeout;
|
|
155
|
+
const maxAttempts = options.maxAttempts ?? Struct_1.defaultWaitOptions.maxAttempts;
|
|
156
|
+
const delay = options.delay ?? Struct_1.defaultWaitOptions.delay;
|
|
157
157
|
const successCheck = options.successCheck;
|
|
158
158
|
const context = options.context;
|
|
159
159
|
const contextPrefix = operationDescription ? `[${operationDescription}] ` : '';
|
|
@@ -353,17 +353,17 @@ export type BatchCrossChainTxWithAssetLike = Omit<BatchCrossChainTx, 'assets'> &
|
|
|
353
353
|
export interface WaitOptions<T = unknown, TContext = unknown> {
|
|
354
354
|
/**
|
|
355
355
|
* Timeout in milliseconds
|
|
356
|
-
* @default
|
|
356
|
+
* @default 30000 (5 minutes)
|
|
357
357
|
*/
|
|
358
358
|
timeout?: number;
|
|
359
359
|
/**
|
|
360
360
|
* Maximum number of attempts
|
|
361
|
-
* @default
|
|
361
|
+
* @default 10
|
|
362
362
|
*/
|
|
363
363
|
maxAttempts?: number;
|
|
364
364
|
/**
|
|
365
365
|
* Delay between attempts in milliseconds
|
|
366
|
-
* @default
|
|
366
|
+
* @default 1000 (1 seconds)
|
|
367
367
|
*/
|
|
368
368
|
delay?: number;
|
|
369
369
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Origin = exports.defaultWaitOptions = exports.TokenSymbol = exports.StageName = exports.NFTAddressType = exports.AssetType = exports.OperationType = exports.CurrencyType = exports.BlockchainType = exports.Network = exports.SimplifiedStatuses = void 0;
|
|
4
|
+
const Consts_1 = require("../sdk/Consts");
|
|
4
5
|
var SimplifiedStatuses;
|
|
5
6
|
(function (SimplifiedStatuses) {
|
|
6
7
|
SimplifiedStatuses["PENDING"] = "PENDING";
|
|
@@ -58,9 +59,9 @@ var TokenSymbol;
|
|
|
58
59
|
TokenSymbol["TON_SYMBOL"] = "TON";
|
|
59
60
|
})(TokenSymbol || (exports.TokenSymbol = TokenSymbol = {}));
|
|
60
61
|
exports.defaultWaitOptions = {
|
|
61
|
-
timeout:
|
|
62
|
-
maxAttempts:
|
|
63
|
-
delay:
|
|
62
|
+
timeout: Consts_1.DEFAULT_TIMEOUT_MS,
|
|
63
|
+
maxAttempts: Consts_1.DEFAULT_RETRY_MAX_COUNT,
|
|
64
|
+
delay: Consts_1.DEFAULT_RETRY_DELAY_MS,
|
|
64
65
|
};
|
|
65
66
|
var Origin;
|
|
66
67
|
(function (Origin) {
|