@tonappchain/sdk 0.7.3-rc1 → 0.7.3-rc3
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/index.d.ts +2 -2
- package/dist/artifacts/dev/index.js +2 -1
- package/dist/artifacts/dev/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/dev/ton/endpoints.js +2 -1
- package/dist/artifacts/mainnet/index.d.ts +2 -2
- package/dist/artifacts/mainnet/index.js +2 -1
- package/dist/artifacts/mainnet/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/mainnet/ton/endpoints.js +2 -1
- package/dist/artifacts/testnet/index.d.ts +2 -2
- package/dist/artifacts/testnet/index.js +2 -1
- package/dist/artifacts/testnet/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/testnet/ton/endpoints.js +2 -1
- package/dist/src/adapters/RetryableContractOpener.d.ts +6 -1
- package/dist/src/adapters/RetryableContractOpener.js +35 -8
- package/dist/src/adapters/ToncenterV3Indexer.d.ts +34 -0
- package/dist/src/adapters/ToncenterV3Indexer.js +123 -0
- package/dist/src/adapters/index.d.ts +1 -0
- package/dist/src/adapters/index.js +1 -0
- package/dist/src/assets/FT.d.ts +3 -2
- package/dist/src/assets/FT.js +30 -14
- package/dist/src/assets/NFT.d.ts +4 -2
- package/dist/src/assets/NFT.js +6 -2
- package/dist/src/assets/TAC.d.ts +2 -1
- package/dist/src/assets/TAC.js +1 -0
- package/dist/src/assets/TON.d.ts +2 -1
- package/dist/src/assets/TON.js +1 -0
- package/dist/src/errors/index.d.ts +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/errors/instances.d.ts +2 -0
- package/dist/src/errors/instances.js +5 -1
- package/dist/src/interfaces/Asset.d.ts +2 -1
- package/dist/src/interfaces/ContractOpener.d.ts +1 -1
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +8 -2
- package/dist/src/interfaces/IOperationTracker.d.ts +13 -1
- package/dist/src/interfaces/ITACTransactionManager.d.ts +4 -3
- package/dist/src/interfaces/ITacSDK.d.ts +26 -5
- package/dist/src/interfaces/IToncenterV3Indexer.d.ts +35 -0
- package/dist/src/interfaces/IToncenterV3Indexer.js +2 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/sdk/Consts.d.ts +13 -0
- package/dist/src/sdk/Consts.js +15 -1
- package/dist/src/sdk/LiteSequencerClient.d.ts +4 -2
- package/dist/src/sdk/LiteSequencerClient.js +29 -13
- package/dist/src/sdk/OperationTracker.d.ts +3 -1
- package/dist/src/sdk/OperationTracker.js +36 -0
- package/dist/src/sdk/Simulator.d.ts +3 -0
- package/dist/src/sdk/Simulator.js +27 -0
- package/dist/src/sdk/TACTransactionManager.d.ts +3 -2
- package/dist/src/sdk/TACTransactionManager.js +45 -35
- package/dist/src/sdk/TacSdk.d.ts +6 -2
- package/dist/src/sdk/TacSdk.js +36 -2
- package/dist/src/sdk/Utils.js +2 -2
- package/dist/src/structs/InternalStruct.d.ts +8 -7
- package/dist/src/structs/Struct.d.ts +64 -2
- package/dist/src/structs/Struct.js +7 -1
- package/package.json +1 -1
package/dist/src/assets/TAC.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Cell } from '@ton/ton';
|
|
2
2
|
import { Asset, IConfiguration } from '../interfaces';
|
|
3
|
-
import { AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
3
|
+
import { AssetFeeMode, AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
4
4
|
export declare class TAC implements Asset {
|
|
5
5
|
private readonly _configuration;
|
|
6
6
|
private readonly _evmAddress;
|
|
7
7
|
private _wrappedAsset;
|
|
8
8
|
readonly type: AssetType;
|
|
9
9
|
readonly origin: Origin;
|
|
10
|
+
readonly feeMode: AssetFeeMode;
|
|
10
11
|
private constructor();
|
|
11
12
|
static create(configuration: IConfiguration): Promise<TAC>;
|
|
12
13
|
get address(): string;
|
package/dist/src/assets/TAC.js
CHANGED
|
@@ -12,6 +12,7 @@ class TAC {
|
|
|
12
12
|
this._wrappedAsset = _wrappedAsset;
|
|
13
13
|
this.type = Struct_1.AssetType.FT;
|
|
14
14
|
this.origin = Struct_1.Origin.TAC;
|
|
15
|
+
this.feeMode = Struct_1.AssetFeeMode.TAC_ORIGINAL;
|
|
15
16
|
}
|
|
16
17
|
static async create(configuration) {
|
|
17
18
|
const evmAddress = await configuration.nativeTACAddress();
|
package/dist/src/assets/TON.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { Cell } from '@ton/ton';
|
|
|
2
2
|
import { Asset, IConfiguration } from '../interfaces';
|
|
3
3
|
import type { SenderAbstraction } from '../sender';
|
|
4
4
|
import type { ShardTransaction } from '../structs/InternalStruct';
|
|
5
|
-
import { AssetType, BlockchainType, FeeParams, Origin } from '../structs/Struct';
|
|
5
|
+
import { AssetFeeMode, AssetType, BlockchainType, FeeParams, Origin } from '../structs/Struct';
|
|
6
6
|
export declare class TON implements Asset {
|
|
7
7
|
readonly address: string;
|
|
8
8
|
readonly type: AssetType;
|
|
9
|
+
readonly feeMode: AssetFeeMode;
|
|
9
10
|
private evmAddress;
|
|
10
11
|
private _rawAmount;
|
|
11
12
|
private _config;
|
package/dist/src/assets/TON.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, KeyError, MetadataError, SettingError, TokenError, TransactionError, WalletError, } from './errors';
|
|
2
|
-
export { allEndpointsFailedError, blockGasLimitFetchError, emptyArrayError, emptyContractError, emptySettingError, estimatedGasExceedsBlockGasLimitError, evmAddressError, executedInTONStageFailedError, gasPriceFetchError, indexRequiredError, insufficientBalanceError, insufficientFeeParamsError, invalidMethodNameError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, operationIdRequiredForFinalizationError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tvmAddressError, txFinalizationError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
|
|
2
|
+
export { allEndpointsFailedError, blockGasLimitFetchError, emptyArrayError, emptyContractError, emptySettingError, estimatedGasExceedsBlockGasLimitError, evmAddressError, externalInMessageRequiredError, executedInTONStageFailedError, gasPriceFetchError, indexRequiredError, insufficientBalanceError, insufficientFeeParamsError, invalidTonExternalMessageBocError, invalidMethodNameError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, operationIdRequiredForFinalizationError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tvmAddressError, txFinalizationError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.txFinalizationError = exports.tvmAddressError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationIdRequiredForFinalizationError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidMethodNameError = exports.insufficientFeeParamsError = exports.insufficientBalanceError = exports.indexRequiredError = exports.gasPriceFetchError = exports.executedInTONStageFailedError = exports.evmAddressError = exports.estimatedGasExceedsBlockGasLimitError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.blockGasLimitFetchError = exports.allEndpointsFailedError = exports.WalletError = exports.TransactionError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
|
|
3
|
+
exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.txFinalizationError = exports.tvmAddressError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationIdRequiredForFinalizationError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidMethodNameError = exports.invalidTonExternalMessageBocError = exports.insufficientFeeParamsError = exports.insufficientBalanceError = exports.indexRequiredError = exports.gasPriceFetchError = exports.executedInTONStageFailedError = exports.externalInMessageRequiredError = exports.evmAddressError = exports.estimatedGasExceedsBlockGasLimitError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.blockGasLimitFetchError = exports.allEndpointsFailedError = exports.WalletError = exports.TransactionError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
|
|
4
4
|
var errors_1 = require("./errors");
|
|
5
5
|
Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return errors_1.AddressError; } });
|
|
6
6
|
Object.defineProperty(exports, "BitError", { enumerable: true, get: function () { return errors_1.BitError; } });
|
|
@@ -22,11 +22,13 @@ Object.defineProperty(exports, "emptyContractError", { enumerable: true, get: fu
|
|
|
22
22
|
Object.defineProperty(exports, "emptySettingError", { enumerable: true, get: function () { return instances_1.emptySettingError; } });
|
|
23
23
|
Object.defineProperty(exports, "estimatedGasExceedsBlockGasLimitError", { enumerable: true, get: function () { return instances_1.estimatedGasExceedsBlockGasLimitError; } });
|
|
24
24
|
Object.defineProperty(exports, "evmAddressError", { enumerable: true, get: function () { return instances_1.evmAddressError; } });
|
|
25
|
+
Object.defineProperty(exports, "externalInMessageRequiredError", { enumerable: true, get: function () { return instances_1.externalInMessageRequiredError; } });
|
|
25
26
|
Object.defineProperty(exports, "executedInTONStageFailedError", { enumerable: true, get: function () { return instances_1.executedInTONStageFailedError; } });
|
|
26
27
|
Object.defineProperty(exports, "gasPriceFetchError", { enumerable: true, get: function () { return instances_1.gasPriceFetchError; } });
|
|
27
28
|
Object.defineProperty(exports, "indexRequiredError", { enumerable: true, get: function () { return instances_1.indexRequiredError; } });
|
|
28
29
|
Object.defineProperty(exports, "insufficientBalanceError", { enumerable: true, get: function () { return instances_1.insufficientBalanceError; } });
|
|
29
30
|
Object.defineProperty(exports, "insufficientFeeParamsError", { enumerable: true, get: function () { return instances_1.insufficientFeeParamsError; } });
|
|
31
|
+
Object.defineProperty(exports, "invalidTonExternalMessageBocError", { enumerable: true, get: function () { return instances_1.invalidTonExternalMessageBocError; } });
|
|
30
32
|
Object.defineProperty(exports, "invalidMethodNameError", { enumerable: true, get: function () { return instances_1.invalidMethodNameError; } });
|
|
31
33
|
Object.defineProperty(exports, "missingDecimals", { enumerable: true, get: function () { return instances_1.missingDecimals; } });
|
|
32
34
|
Object.defineProperty(exports, "missingFeeParamsError", { enumerable: true, get: function () { return instances_1.missingFeeParamsError; } });
|
|
@@ -41,3 +41,5 @@ export declare const operationIdRequiredForFinalizationError: TransactionError;
|
|
|
41
41
|
export declare const executedInTONStageFailedError: TransactionError;
|
|
42
42
|
export declare const blockGasLimitFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
43
43
|
export declare const estimatedGasExceedsBlockGasLimitError: (txName: string, estimatedGas: bigint, blockGasLimit: bigint) => TransactionError;
|
|
44
|
+
export declare const invalidTonExternalMessageBocError: (reason?: string) => FormatError;
|
|
45
|
+
export declare const externalInMessageRequiredError: (actualType: string) => FormatError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.estimatedGasExceedsBlockGasLimitError = exports.blockGasLimitFetchError = exports.executedInTONStageFailedError = exports.operationIdRequiredForFinalizationError = exports.insufficientFeeParamsError = exports.txFinalizationError = exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = 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.externalInMessageRequiredError = exports.invalidTonExternalMessageBocError = exports.estimatedGasExceedsBlockGasLimitError = exports.blockGasLimitFetchError = exports.executedInTONStageFailedError = exports.operationIdRequiredForFinalizationError = exports.insufficientFeeParamsError = exports.txFinalizationError = exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = 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
|
const operationFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch OperationId: ${msg}`, 101, inner);
|
|
@@ -127,3 +127,7 @@ const blockGasLimitFetchError = (msg, inner) => new errors_1.FetchError(`Failed
|
|
|
127
127
|
exports.blockGasLimitFetchError = blockGasLimitFetchError;
|
|
128
128
|
const estimatedGasExceedsBlockGasLimitError = (txName, estimatedGas, blockGasLimit) => new errors_1.TransactionError(`Estimated gas for ${txName} (${estimatedGas}) exceeds current TAC block gas limit (${blockGasLimit})`, 140);
|
|
129
129
|
exports.estimatedGasExceedsBlockGasLimitError = estimatedGasExceedsBlockGasLimitError;
|
|
130
|
+
const invalidTonExternalMessageBocError = (reason) => new errors_1.FormatError(`Invalid external TON message BOC${reason ? `: ${reason}` : ''}`, 141);
|
|
131
|
+
exports.invalidTonExternalMessageBocError = invalidTonExternalMessageBocError;
|
|
132
|
+
const externalInMessageRequiredError = (actualType) => new errors_1.FormatError(`Expected external-in TON message, got ${actualType}`, 142);
|
|
133
|
+
exports.externalInMessageRequiredError = externalInMessageRequiredError;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Cell } from '@ton/ton';
|
|
2
|
-
import { AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
2
|
+
import { AssetFeeMode, AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
3
3
|
export interface Asset {
|
|
4
4
|
address: string;
|
|
5
5
|
type: AssetType;
|
|
6
6
|
rawAmount: bigint;
|
|
7
7
|
clone: Asset;
|
|
8
8
|
origin: Origin;
|
|
9
|
+
feeMode: AssetFeeMode;
|
|
9
10
|
/**
|
|
10
11
|
* Returns a new asset instance with the specified transfer amount in human-readable units.
|
|
11
12
|
* Does not mutate the current asset instance.
|
|
@@ -16,7 +16,7 @@ export interface ContractOpener {
|
|
|
16
16
|
*/
|
|
17
17
|
getContractState(address: Address): Promise<ContractState>;
|
|
18
18
|
/**
|
|
19
|
-
* Closes
|
|
19
|
+
* Closes TON lite client connections. Use only with LiteClientOpener.
|
|
20
20
|
*/
|
|
21
21
|
closeConnections?: () => unknown;
|
|
22
22
|
/**
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, OperationTypeV2Info, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationIdWithLogIndex, OperationType, OperationTypeV2Info, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
2
2
|
export interface ILiteSequencerClient {
|
|
3
|
+
/** Base URL of the lite sequencer endpoint used by this client. */
|
|
4
|
+
readonly endpoint: string;
|
|
3
5
|
/** Retrieves the operation type by id. */
|
|
4
6
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
5
7
|
/** Retrieves the v2 operation route/finalization state by id. */
|
|
6
8
|
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
7
9
|
/** Resolves operation id by a transaction linker. */
|
|
8
10
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
9
|
-
/** Resolves operation
|
|
11
|
+
/** Resolves TAC operation ids with log indexes by TAC transaction hash. */
|
|
12
|
+
getOperationIdByTacTransactionHash(transactionHash: string): Promise<OperationIdWithLogIndex[]>;
|
|
13
|
+
/** Resolves operation id by the originating transaction hash (from ccl event in TON and TAC). */
|
|
10
14
|
getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
|
|
15
|
+
/** Resolves operation id by the originating transaction hash (from ccl event in TON). */
|
|
16
|
+
getOperationIdByTonTransactionHash(transactionHash: string): Promise<string>;
|
|
11
17
|
/**
|
|
12
18
|
* Resolves operation ids for multiple shard keys.
|
|
13
19
|
* @param shardsKeys Shard keys to query.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, ExecutionStagesV2, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, OperationTypeV2Info, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, ExecutionStagesV2, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationIdWithLogIndex, OperationType, OperationTypeV2Info, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
2
2
|
export interface IOperationTracker {
|
|
3
3
|
/**
|
|
4
4
|
* Returns the operation type for the given id, optionally waiting according to the provided policy.
|
|
@@ -18,12 +18,24 @@ export interface IOperationTracker {
|
|
|
18
18
|
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
19
19
|
*/
|
|
20
20
|
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves TAC operation ids with log indexes by TAC transaction hash, optionally waiting until available.
|
|
23
|
+
* @param transactionHash Hash of the originating TAC transaction.
|
|
24
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
25
|
+
*/
|
|
26
|
+
getOperationIdByTacTransactionHash(transactionHash: string, waitOptions?: WaitOptions<OperationIdWithLogIndex[]> | null): Promise<OperationIdWithLogIndex[]>;
|
|
21
27
|
/**
|
|
22
28
|
* Resolves an operation id by a transaction hash, optionally waiting until available.
|
|
23
29
|
* @param transactionHash Hash of the originating transaction.
|
|
24
30
|
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
25
31
|
*/
|
|
26
32
|
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves an operation id by a TON transaction hash, optionally waiting until available.
|
|
35
|
+
* @param transactionHash Exact TON crossChainLayer transaction hash.
|
|
36
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
37
|
+
*/
|
|
38
|
+
getOperationIdByTonTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
27
39
|
/**
|
|
28
40
|
* Resolves operation ids by shard keys for a particular caller, with optional batching and waiting.
|
|
29
41
|
* @param shardsKeys List of shard keys.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
|
-
import {
|
|
2
|
+
import { CrossChainTransactionToTONOptions, TACCrossChainTransactionResult } from '../structs/Struct';
|
|
3
3
|
import { Asset } from './Asset';
|
|
4
4
|
export interface ITACTransactionManager {
|
|
5
5
|
/**
|
|
@@ -8,14 +8,15 @@ export interface ITACTransactionManager {
|
|
|
8
8
|
* performs production-oriented TAC prechecks: requires EIP-1559 fee data from the TAC provider,
|
|
9
9
|
* optionally validates balances / ownership of non-native TAC assets, uses provider gas estimates as-is,
|
|
10
10
|
* validates those estimates against the latest TAC block gas limit,
|
|
11
|
-
*
|
|
11
|
+
* first estimates approval gas and checks TAC balance for approvals, submits approvals,
|
|
12
|
+
* then estimates the bridge message and checks the remaining TAC balance before sending it.
|
|
12
13
|
* @param signer Ethers Wallet used to sign EVM transaction.
|
|
13
14
|
* @param tonTarget Recipient TVM address on TON.
|
|
14
15
|
* @param assets Optional list of TAC assets to include. Native TAC should be passed here as a TAC asset.
|
|
15
16
|
* @param options Optional bridge configuration object.
|
|
16
17
|
* @returns TAC transaction hash and optional operationId.
|
|
17
18
|
*/
|
|
18
|
-
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: Asset[], options?:
|
|
19
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: Asset[], options?: CrossChainTransactionToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
19
20
|
/**
|
|
20
21
|
* Bridges native EVM value and optional assets to TON chain via executor.
|
|
21
22
|
* This is a low-level send-only method: it approves assets, sends the TAC -> TON message and
|
|
@@ -2,7 +2,7 @@ import { Wallet } from 'ethers';
|
|
|
2
2
|
import { JettonMinterData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
3
|
import { FT, NFT, TAC, TON } from '../assets';
|
|
4
4
|
import type { SenderAbstraction } from '../sender';
|
|
5
|
-
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike,
|
|
5
|
+
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrossChainTransactionToTONOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SuggestedTVMExecutorFee, TACCrossChainTransactionResult, TacGasPrice, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended, WaitOptions } from '../structs/Struct';
|
|
6
6
|
import { Asset } from './Asset';
|
|
7
7
|
import { ContractOpener } from './ContractOpener';
|
|
8
8
|
import { IConfiguration } from './IConfiguration';
|
|
@@ -29,8 +29,8 @@ export interface ITacSDK {
|
|
|
29
29
|
*/
|
|
30
30
|
get getTrustedTONExecutors(): string[];
|
|
31
31
|
/**
|
|
32
|
-
* Closes
|
|
33
|
-
*
|
|
32
|
+
* Closes TON liteclient connections.
|
|
33
|
+
* Use only with LiteClientOpener.
|
|
34
34
|
*/
|
|
35
35
|
closeConnections(): unknown;
|
|
36
36
|
/**
|
|
@@ -106,14 +106,15 @@ export interface ITacSDK {
|
|
|
106
106
|
* the bridged native TAC amount. The SDK requires EIP-1559 fee data from the TAC provider, can
|
|
107
107
|
* validate balances / ownership of non-native TAC assets, uses provider gas estimates as-is,
|
|
108
108
|
* validates those estimates against the latest TAC block gas limit,
|
|
109
|
-
*
|
|
109
|
+
* first estimates approval gas and checks TAC balance for approvals, submits approvals,
|
|
110
|
+
* then estimates the bridge message and checks the remaining TAC balance before sending it.
|
|
110
111
|
* @param signer Ethers Wallet used to sign EVM transaction on TAC side.
|
|
111
112
|
* @param tonTarget Recipient TVM address on TON.
|
|
112
113
|
* @param assets Optional list of TAC assets to include in the bridge transaction.
|
|
113
114
|
* @param options Optional TAC -> TON bridge configuration.
|
|
114
115
|
* @returns Promise with TAC transaction hash and optional operationId.
|
|
115
116
|
*/
|
|
116
|
-
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: AssetLike[], options?:
|
|
117
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: AssetLike[], options?: CrossChainTransactionToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
117
118
|
/**
|
|
118
119
|
* Sends multiple cross-chain transactions in one batch and optionally waits for tracking info.
|
|
119
120
|
* @param sender Sender abstraction for signing/sending TVM messages.
|
|
@@ -122,6 +123,26 @@ export interface ITacSDK {
|
|
|
122
123
|
* @returns Promise with an array of TransactionLinkerWithOperationId for each submitted transaction.
|
|
123
124
|
*/
|
|
124
125
|
sendCrossChainTransactions(sender: SenderAbstraction, txs: BatchCrossChainTxWithAssetLike[], options?: CrossChainTransactionsOptions): Promise<TransactionLinkerWithOperationId[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Resolves operation id by any TON hash from a linked chain of TON transactions.
|
|
128
|
+
* The SDK first resolves indexed TON transaction context, traverses adjacent TON transactions
|
|
129
|
+
* until it finds the crossChainLayer transaction that the sequencer would collect as a TVM event,
|
|
130
|
+
* and only then queries the sequencer with that exact transaction hash.
|
|
131
|
+
* @param transactionHash Any TON transaction hash from the relevant linked chain of TON transactions.
|
|
132
|
+
* @param waitOptions Optional waiting settings for the final sequencer lookup. Pass `null` to disable retries.
|
|
133
|
+
* @returns Promise resolving to operation id, or empty string when the sequencer-collected crossChainLayer event transaction is not found.
|
|
134
|
+
*/
|
|
135
|
+
getOperationIdByTonTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Resolves operation id by the BOC of an external TON message that was sent to the blockchain.
|
|
138
|
+
* The SDK derives the normalized external-in message hash from the BOC, finds the root TON transaction
|
|
139
|
+
* that processed that external message through the configured contract opener, and then reuses the same
|
|
140
|
+
* linked chain of TON transactions lookup as `getOperationIdByTonTransactionHash(...)`.
|
|
141
|
+
* @param boc BOC of the external TON message that was sent to the blockchain.
|
|
142
|
+
* @param waitOptions Optional waiting settings for the final sequencer lookup. Pass `null` to disable retries.
|
|
143
|
+
* @returns Promise resolving to operation id, or empty string when the sequencer-collected crossChainLayer event transaction is not found.
|
|
144
|
+
*/
|
|
145
|
+
getOperationIdByTonTransactionBoc(boc: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
125
146
|
/**
|
|
126
147
|
* Bridges tokens/value from EVM to TON chain via the executor.
|
|
127
148
|
* This is a low-level send-only method. It prepares the TAC -> TON message, performs approvals,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ToncenterV3IndexedTransaction, ToncenterV3TraversalParams } from '../structs/Struct';
|
|
2
|
+
/**
|
|
3
|
+
* Contract for indexed TON transaction lookup by hash.
|
|
4
|
+
* Used when the SDK must resolve any TON transaction hash from a linked chain of TON transactions
|
|
5
|
+
* into indexed transaction context and then find the sequencer-collected event transaction on crossChainLayer.
|
|
6
|
+
*/
|
|
7
|
+
export interface IToncenterV3Indexer {
|
|
8
|
+
/** Indexed Toncenter v3 endpoint used by this client. */
|
|
9
|
+
readonly endpoint: string;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves TON transaction context by hash using an indexed backend.
|
|
12
|
+
* Accepts any TON transaction hash format supported by the indexer, including hashes from
|
|
13
|
+
* any point in the same linked chain of TON transactions.
|
|
14
|
+
* @param transactionHash TON transaction hash to resolve in the indexed backend.
|
|
15
|
+
* @returns Indexed transaction with owning account context, or null if not found.
|
|
16
|
+
*/
|
|
17
|
+
getTransactionByHash(transactionHash: string): Promise<ToncenterV3IndexedTransaction | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves adjacent indexed transactions for the provided hash from the same linked chain of TON transactions.
|
|
20
|
+
* The result may contain both parent and child transactions.
|
|
21
|
+
* @param transactionHash TON transaction hash to resolve around.
|
|
22
|
+
* @returns Adjacent indexed transactions, or an empty array when none were found.
|
|
23
|
+
*/
|
|
24
|
+
getAdjacentTransactions(transactionHash: string): Promise<ToncenterV3IndexedTransaction[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Traverses the linked chain of TON transactions in both directions starting from any TON transaction hash
|
|
27
|
+
* from that linked transaction chain, and returns the transaction on crossChainLayer that the sequencer would collect
|
|
28
|
+
* as a TVM event.
|
|
29
|
+
* @param transactionHash Any TON transaction hash from the target linked chain of TON transactions.
|
|
30
|
+
* @param crossChainLayerAddress crossChainLayer address whose sequencer-collected event transaction should be found in that linked chain of TON transactions.
|
|
31
|
+
* @param params Optional traversal settings. Defaults are applied when omitted.
|
|
32
|
+
* @returns Indexed crossChainLayer transaction that matches the sequencer event collector rules, or null if it was not found.
|
|
33
|
+
*/
|
|
34
|
+
findCollectibleCrossChainLayerTransaction(transactionHash: string, crossChainLayerAddress: string, params?: ToncenterV3TraversalParams): Promise<ToncenterV3IndexedTransaction | null>;
|
|
35
|
+
}
|
|
@@ -10,6 +10,7 @@ export * from './ISimulator';
|
|
|
10
10
|
export * from './ITacExplorerClient';
|
|
11
11
|
export * from './ITacSDK';
|
|
12
12
|
export * from './ITACTransactionManager';
|
|
13
|
+
export * from './IToncenterV3Indexer';
|
|
13
14
|
export * from './ITONTransactionManager';
|
|
14
15
|
export * from './SenderAbstraction';
|
|
15
16
|
export * from './WalletInstanse';
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./ISimulator"), exports);
|
|
|
26
26
|
__exportStar(require("./ITacExplorerClient"), exports);
|
|
27
27
|
__exportStar(require("./ITacSDK"), exports);
|
|
28
28
|
__exportStar(require("./ITACTransactionManager"), exports);
|
|
29
|
+
__exportStar(require("./IToncenterV3Indexer"), exports);
|
|
29
30
|
__exportStar(require("./ITONTransactionManager"), exports);
|
|
30
31
|
__exportStar(require("./SenderAbstraction"), exports);
|
|
31
32
|
__exportStar(require("./WalletInstanse"), exports);
|
package/dist/src/sdk/Consts.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export declare const JETTON_TRANSFER_FORWARD_TON_AMOUNT: bigint;
|
|
2
2
|
export declare const NFT_TRANSFER_FORWARD_TON_AMOUNT: bigint;
|
|
3
|
+
export declare const LEGACY_FORWARD_FEE_ESTIMATE_NUMERATOR = 3n;
|
|
4
|
+
export declare const LEGACY_FORWARD_FEE_ESTIMATE_DENOMINATOR = 2n;
|
|
5
|
+
export declare const LEGACY_STRICTLY_GREATER_THAN_FEE_EPSILON = 1n;
|
|
6
|
+
export declare const LEGACY_JETTON_WALLET_MIN_TONS_FOR_STORAGE = 10000000n;
|
|
7
|
+
export declare const LEGACY_JETTON_WALLET_GAS_CONSUMPTION = 15000000n;
|
|
8
|
+
export declare const LEGACY_JETTON_WALLET_GAS_CONSUMPTION_COUNT = 2n;
|
|
9
|
+
export declare const LEGACY_JETTON_TRANSFER_BASE_OUTBOUND_MESSAGE_COUNT = 1n;
|
|
10
|
+
export declare const LEGACY_JETTON_TRANSFER_WITH_FORWARD_OUTBOUND_MESSAGE_COUNT = 2n;
|
|
11
|
+
export declare const LEGACY_JETTON_WALLET_TRANSFER_GAS_AND_STORAGE: bigint;
|
|
12
|
+
export declare const USDT_JETTON_WALLET_CODE_HASH = "89468f02c78e570802e39979c8516fc38df07ea76a48357e0536f2ba7b3ee37b";
|
|
13
|
+
export declare const DYNAMIC_JETTON_WALLET_CODE_HASHES: string[];
|
|
3
14
|
export declare const MAX_ITERATION_COUNT = 120;
|
|
4
15
|
export declare const DEFAULT_DELAY = 0;
|
|
5
16
|
export declare const SOLIDITY_SIGNATURE_REGEX: RegExp;
|
|
@@ -19,6 +30,8 @@ export declare const TON_BURN_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
19
30
|
export declare const DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
20
31
|
export declare const DEFAULT_RETRY_MAX_COUNT = 5;
|
|
21
32
|
export declare const DEFAULT_RETRY_DELAY_MS = 1000;
|
|
33
|
+
export declare const DEFAULT_RETRY_MAX_DELAY_MS = 30000;
|
|
34
|
+
export declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 3;
|
|
22
35
|
export declare const DEFAULT_WAIT_TIMEOUT_MS = 300000;
|
|
23
36
|
export declare const DEFAULT_WAIT_MAX_ATTEMPTS = 30;
|
|
24
37
|
export declare const DEFAULT_WAIT_DELAY_MS = 10000;
|
package/dist/src/sdk/Consts.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IGNORE_OPCODE = exports.SHARDS_KEY_RANDOM_RANGE = exports.DEFAULT_EIP1559_PRIORITY_FEE = exports.NFT_BRIDGE_AMOUNT = exports.CROSS_CHAIN_MESSAGE_VERSION_V1 = exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = exports.DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = exports.DEFAULT_RETRY_ON_NOT_FOUND = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_WAIT_DELAY_MS = exports.DEFAULT_WAIT_MAX_ATTEMPTS = exports.DEFAULT_WAIT_TIMEOUT_MS = 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.SHARDS_KEY_RANDOM_RANGE = exports.DEFAULT_EIP1559_PRIORITY_FEE = exports.NFT_BRIDGE_AMOUNT = exports.CROSS_CHAIN_MESSAGE_VERSION_V1 = exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = exports.DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = exports.DEFAULT_RETRY_ON_NOT_FOUND = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_WAIT_DELAY_MS = exports.DEFAULT_WAIT_MAX_ATTEMPTS = exports.DEFAULT_WAIT_TIMEOUT_MS = exports.DEFAULT_RETRY_BACKOFF_MULTIPLIER = exports.DEFAULT_RETRY_MAX_DELAY_MS = 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.DYNAMIC_JETTON_WALLET_CODE_HASHES = exports.USDT_JETTON_WALLET_CODE_HASH = exports.LEGACY_JETTON_WALLET_TRANSFER_GAS_AND_STORAGE = exports.LEGACY_JETTON_TRANSFER_WITH_FORWARD_OUTBOUND_MESSAGE_COUNT = exports.LEGACY_JETTON_TRANSFER_BASE_OUTBOUND_MESSAGE_COUNT = exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION_COUNT = exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION = exports.LEGACY_JETTON_WALLET_MIN_TONS_FOR_STORAGE = exports.LEGACY_STRICTLY_GREATER_THAN_FEE_EPSILON = exports.LEGACY_FORWARD_FEE_ESTIMATE_DENOMINATOR = exports.LEGACY_FORWARD_FEE_ESTIMATE_NUMERATOR = 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);
|
|
7
|
+
exports.LEGACY_FORWARD_FEE_ESTIMATE_NUMERATOR = 3n;
|
|
8
|
+
exports.LEGACY_FORWARD_FEE_ESTIMATE_DENOMINATOR = 2n;
|
|
9
|
+
exports.LEGACY_STRICTLY_GREATER_THAN_FEE_EPSILON = 1n;
|
|
10
|
+
exports.LEGACY_JETTON_WALLET_MIN_TONS_FOR_STORAGE = 10000000n;
|
|
11
|
+
exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION = 15000000n;
|
|
12
|
+
exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION_COUNT = 2n;
|
|
13
|
+
exports.LEGACY_JETTON_TRANSFER_BASE_OUTBOUND_MESSAGE_COUNT = 1n;
|
|
14
|
+
exports.LEGACY_JETTON_TRANSFER_WITH_FORWARD_OUTBOUND_MESSAGE_COUNT = 2n;
|
|
15
|
+
exports.LEGACY_JETTON_WALLET_TRANSFER_GAS_AND_STORAGE = exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION_COUNT * exports.LEGACY_JETTON_WALLET_GAS_CONSUMPTION +
|
|
16
|
+
exports.LEGACY_JETTON_WALLET_MIN_TONS_FOR_STORAGE;
|
|
17
|
+
exports.USDT_JETTON_WALLET_CODE_HASH = '89468f02c78e570802e39979c8516fc38df07ea76a48357e0536f2ba7b3ee37b';
|
|
18
|
+
exports.DYNAMIC_JETTON_WALLET_CODE_HASHES = [exports.USDT_JETTON_WALLET_CODE_HASH];
|
|
7
19
|
exports.MAX_ITERATION_COUNT = 120;
|
|
8
20
|
exports.DEFAULT_DELAY = 0;
|
|
9
21
|
exports.SOLIDITY_SIGNATURE_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*(\((bytes,bytes)\))?$/;
|
|
@@ -23,6 +35,8 @@ exports.TON_BURN_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
|
|
|
23
35
|
exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
24
36
|
exports.DEFAULT_RETRY_MAX_COUNT = 5;
|
|
25
37
|
exports.DEFAULT_RETRY_DELAY_MS = 1000;
|
|
38
|
+
exports.DEFAULT_RETRY_MAX_DELAY_MS = 30000;
|
|
39
|
+
exports.DEFAULT_RETRY_BACKOFF_MULTIPLIER = 3;
|
|
26
40
|
exports.DEFAULT_WAIT_TIMEOUT_MS = 300000; // 5 minutes
|
|
27
41
|
exports.DEFAULT_WAIT_MAX_ATTEMPTS = 30;
|
|
28
42
|
exports.DEFAULT_WAIT_DELAY_MS = 10000; // 10 seconds
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { IHttpClient, ILiteSequencerClient } from '../interfaces';
|
|
2
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, OperationTypeV2Info, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
2
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationIdWithLogIndex, OperationType, OperationTypeV2Info, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
3
3
|
export declare class LiteSequencerClient implements ILiteSequencerClient {
|
|
4
|
-
|
|
4
|
+
readonly endpoint: string;
|
|
5
5
|
private readonly maxChunkSize;
|
|
6
6
|
private readonly httpClient;
|
|
7
7
|
constructor(endpoint: string, maxChunkSize?: number, httpClient?: IHttpClient);
|
|
8
8
|
private getRequestLabel;
|
|
9
|
+
getOperationIdByTacTransactionHash(transactionHash: string): Promise<OperationIdWithLogIndex[]>;
|
|
9
10
|
getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
|
|
11
|
+
getOperationIdByTonTransactionHash(transactionHash: string): Promise<string>;
|
|
10
12
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
11
13
|
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
12
14
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
@@ -14,23 +14,39 @@ class LiteSequencerClient {
|
|
|
14
14
|
getRequestLabel(method, path) {
|
|
15
15
|
return `${method} ${new URL(path, this.endpoint).toString()}`;
|
|
16
16
|
}
|
|
17
|
+
async getOperationIdByTacTransactionHash(transactionHash) {
|
|
18
|
+
const path = 'tac/operation-id';
|
|
19
|
+
const requestLabel = this.getRequestLabel('GET', path);
|
|
20
|
+
try {
|
|
21
|
+
const response = await this.httpClient.get(new URL(path, this.endpoint).toString(), {
|
|
22
|
+
params: { transactionHash },
|
|
23
|
+
});
|
|
24
|
+
return response.data.response || [];
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
if (error?.response?.status === 404) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
throw (0, errors_1.operationFetchError)(`request ${requestLabel} failed to complete request`, error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
17
34
|
async getOperationIdByTransactionHash(transactionHash) {
|
|
18
35
|
const isEthHash = /^0x[a-fA-F0-9]{64}$/.test(transactionHash);
|
|
19
|
-
|
|
36
|
+
if (isEthHash) {
|
|
37
|
+
const operationResponse = await this.getOperationIdByTacTransactionHash(transactionHash);
|
|
38
|
+
return operationResponse[0]?.operationId || '';
|
|
39
|
+
}
|
|
40
|
+
return this.getOperationIdByTonTransactionHash(transactionHash);
|
|
41
|
+
}
|
|
42
|
+
async getOperationIdByTonTransactionHash(transactionHash) {
|
|
43
|
+
const path = 'ton/operation-id';
|
|
20
44
|
const requestLabel = this.getRequestLabel('GET', path);
|
|
21
45
|
try {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return response.data.response?.operationId || '';
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const response = await this.httpClient.get(new URL(path, this.endpoint).toString(), {
|
|
30
|
-
params: { transactionHash },
|
|
31
|
-
});
|
|
32
|
-
return response.data.response || '';
|
|
33
|
-
}
|
|
46
|
+
const response = await this.httpClient.get(new URL(path, this.endpoint).toString(), {
|
|
47
|
+
params: { transactionHash },
|
|
48
|
+
});
|
|
49
|
+
return response.data.response || '';
|
|
34
50
|
}
|
|
35
51
|
catch (error) {
|
|
36
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILiteSequencerClient, ILiteSequencerClientFactory, ILogger, IOperationTracker } from '../interfaces';
|
|
2
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, ExecutionStagesV2, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, Network, OperationIdsByShardsKey, OperationType, OperationTypeV2Info, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
2
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, ExecutionStagesV2, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, Network, OperationIdsByShardsKey, OperationIdWithLogIndex, OperationType, OperationTypeV2Info, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
3
3
|
export declare class DefaultLiteSequencerClientFactory implements ILiteSequencerClientFactory {
|
|
4
4
|
createClients(endpoints: string[]): ILiteSequencerClient[];
|
|
5
5
|
}
|
|
@@ -8,6 +8,8 @@ export declare class OperationTracker implements IOperationTracker {
|
|
|
8
8
|
private readonly logger;
|
|
9
9
|
constructor(network: Network, customLiteSequencerEndpoints?: string[], logger?: ILogger, clientFactory?: ILiteSequencerClientFactory);
|
|
10
10
|
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
11
|
+
getOperationIdByTacTransactionHash(transactionHash: string, waitOptions?: WaitOptions<OperationIdWithLogIndex[]> | null): Promise<OperationIdWithLogIndex[]>;
|
|
12
|
+
getOperationIdByTonTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
11
13
|
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType> | null): Promise<OperationType>;
|
|
12
14
|
getOperationTypeV2(operationId: string, waitOptions?: WaitOptions<OperationTypeV2Info> | null): Promise<OperationTypeV2Info>;
|
|
13
15
|
getOperationId(transactionLinker: TransactionLinker, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
@@ -52,6 +52,42 @@ class OperationTracker {
|
|
|
52
52
|
? await requestFn()
|
|
53
53
|
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, `OperationTracker: Getting operation ID by transaction hash ${(0, Utils_1.formatObjectForLogging)(transactionHash)}`);
|
|
54
54
|
}
|
|
55
|
+
async getOperationIdByTacTransactionHash(transactionHash, waitOptions) {
|
|
56
|
+
const requestFn = async () => {
|
|
57
|
+
let lastError;
|
|
58
|
+
for (const client of this.clients) {
|
|
59
|
+
try {
|
|
60
|
+
const ids = await client.getOperationIdByTacTransactionHash(transactionHash);
|
|
61
|
+
return ids;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
lastError = error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
68
|
+
};
|
|
69
|
+
return waitOptions === null
|
|
70
|
+
? await requestFn()
|
|
71
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, `OperationTracker: Getting operation IDs by TAC transaction hash ${(0, Utils_1.formatObjectForLogging)(transactionHash)}`);
|
|
72
|
+
}
|
|
73
|
+
async getOperationIdByTonTransactionHash(transactionHash, waitOptions) {
|
|
74
|
+
const requestFn = async () => {
|
|
75
|
+
let lastError;
|
|
76
|
+
for (const client of this.clients) {
|
|
77
|
+
try {
|
|
78
|
+
const id = await client.getOperationIdByTonTransactionHash(transactionHash);
|
|
79
|
+
return id;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
lastError = error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
throw (0, errors_1.allEndpointsFailedError)(lastError, waitOptions?.includeErrorTrace ?? false);
|
|
86
|
+
};
|
|
87
|
+
return waitOptions === null
|
|
88
|
+
? await requestFn()
|
|
89
|
+
: await (0, Utils_1.waitUntilSuccess)({ logger: this.logger, ...waitOptions }, requestFn, `OperationTracker: Getting operation ID by TON transaction hash ${(0, Utils_1.formatObjectForLogging)(transactionHash)}`);
|
|
90
|
+
}
|
|
55
91
|
async getOperationType(operationId, waitOptions) {
|
|
56
92
|
const requestFn = async () => {
|
|
57
93
|
let lastError;
|
|
@@ -10,8 +10,11 @@ export declare class Simulator implements ISimulator {
|
|
|
10
10
|
getSimulationInfo(sender: SenderAbstraction, tx: CrosschainTx): Promise<ExecutionFeeEstimationResult>;
|
|
11
11
|
private calculateTONFees;
|
|
12
12
|
private calculateTransactionPipeline;
|
|
13
|
+
private calculateMessageForwardFee;
|
|
14
|
+
private calculateLegacyJettonTransferNetworkFee;
|
|
13
15
|
private calculateTONCrosschainFee;
|
|
14
16
|
private calculateJettonTransferCrosschainFee;
|
|
17
|
+
private calculateLegacyJettonTransferCrosschainFee;
|
|
15
18
|
private calculateJettonBurnCrosschainFee;
|
|
16
19
|
private calculateNftTransferCrosschainFee;
|
|
17
20
|
private calculateNftBurnCrosschainFee;
|
|
@@ -6,6 +6,7 @@ const assets_1 = require("../assets");
|
|
|
6
6
|
const errors_1 = require("../errors");
|
|
7
7
|
const instances_1 = require("../errors/instances");
|
|
8
8
|
const Struct_1 = require("../structs/Struct");
|
|
9
|
+
const Consts_1 = require("./Consts");
|
|
9
10
|
const Fees_1 = require("./Fees");
|
|
10
11
|
const Logger_1 = require("./Logger");
|
|
11
12
|
const Utils_1 = require("./Utils");
|
|
@@ -95,6 +96,24 @@ class Simulator {
|
|
|
95
96
|
calculateTransactionPipeline(steps) {
|
|
96
97
|
return steps.reduce((total, step) => total + this.calculateTONFees({ ...step, ...this.config.TONParams.feesParams }), 0n);
|
|
97
98
|
}
|
|
99
|
+
calculateMessageForwardFee(msgBits, msgCells) {
|
|
100
|
+
const { lumpPrice, msgBitPrice, msgCellPrice } = this.config.TONParams.feesParams;
|
|
101
|
+
const msgFwdFees = lumpPrice + Math.ceil((msgBitPrice * msgBits + msgCellPrice * msgCells) / Fees_1.FIXED_POINT_SHIFT);
|
|
102
|
+
return BigInt(msgFwdFees);
|
|
103
|
+
}
|
|
104
|
+
calculateLegacyJettonTransferNetworkFee(params, msgBits, msgCells) {
|
|
105
|
+
const forwardTonAmount = Consts_1.JETTON_TRANSFER_FORWARD_TON_AMOUNT +
|
|
106
|
+
(params.forwardFeeTonAmount ?? 0n) +
|
|
107
|
+
(params.crossChainTonAmount ?? 0n);
|
|
108
|
+
const outboundMessageCount = forwardTonAmount > 0n
|
|
109
|
+
? Consts_1.LEGACY_JETTON_TRANSFER_WITH_FORWARD_OUTBOUND_MESSAGE_COUNT
|
|
110
|
+
: Consts_1.LEGACY_JETTON_TRANSFER_BASE_OUTBOUND_MESSAGE_COUNT;
|
|
111
|
+
const inboundForwardFee = (this.calculateMessageForwardFee(msgBits, msgCells) * Consts_1.LEGACY_FORWARD_FEE_ESTIMATE_NUMERATOR) /
|
|
112
|
+
Consts_1.LEGACY_FORWARD_FEE_ESTIMATE_DENOMINATOR;
|
|
113
|
+
return (outboundMessageCount * inboundForwardFee +
|
|
114
|
+
Consts_1.LEGACY_JETTON_WALLET_TRANSFER_GAS_AND_STORAGE +
|
|
115
|
+
Consts_1.LEGACY_STRICTLY_GREATER_THAN_FEE_EPSILON);
|
|
116
|
+
}
|
|
98
117
|
calculateTONCrosschainFee(msgBits, msgCells) {
|
|
99
118
|
return this.calculateTransactionPipeline([
|
|
100
119
|
(0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(this.config.TONParams.contractFeeUsageParams, msgBits, msgCells),
|
|
@@ -111,6 +130,11 @@ class Simulator {
|
|
|
111
130
|
(0, Fees_1.createEstimatedReceiveTransferGasStep)(this.config.TONParams.contractFeeUsageParams, msgBits, msgCells),
|
|
112
131
|
]);
|
|
113
132
|
}
|
|
133
|
+
calculateLegacyJettonTransferCrosschainFee(params, msgBits, msgCells) {
|
|
134
|
+
const dynamicFee = this.calculateJettonTransferCrosschainFee(msgBits, msgCells);
|
|
135
|
+
const legacyNetworkFee = this.calculateLegacyJettonTransferNetworkFee(params, msgBits, msgCells);
|
|
136
|
+
return dynamicFee > legacyNetworkFee ? dynamicFee : legacyNetworkFee;
|
|
137
|
+
}
|
|
114
138
|
calculateJettonBurnCrosschainFee(msgBits, msgCells) {
|
|
115
139
|
return this.calculateTransactionPipeline([
|
|
116
140
|
(0, Fees_1.createJettonWalletBurnStep)(this.config.TONParams.contractFeeUsageParams, msgBits, msgCells),
|
|
@@ -147,6 +171,9 @@ class Simulator {
|
|
|
147
171
|
}
|
|
148
172
|
if (asset.origin === Struct_1.Origin.TON) {
|
|
149
173
|
// Pipeline: wallet -> jetton wallet -> jetton wallet -> jetton proxy -> ccl -> log
|
|
174
|
+
if (asset.feeMode === Struct_1.AssetFeeMode.LEGACY) {
|
|
175
|
+
return this.calculateLegacyJettonTransferCrosschainFee(params, msgBits, msgCells);
|
|
176
|
+
}
|
|
150
177
|
return this.calculateJettonTransferCrosschainFee(msgBits, msgCells);
|
|
151
178
|
}
|
|
152
179
|
if (asset.origin === Struct_1.Origin.TAC) {
|