@tonappchain/sdk 0.7.2 → 0.7.3-rc2
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/LICENSE +20 -20
- package/README.md +203 -199
- 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/BaseContractOpener.js +8 -5
- 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/AssetFactory.d.ts +4 -1
- package/dist/src/assets/AssetFactory.js +4 -0
- package/dist/src/assets/FT.d.ts +3 -3
- package/dist/src/assets/FT.js +28 -15
- package/dist/src/assets/NFT.d.ts +3 -3
- package/dist/src/assets/NFT.js +10 -4
- package/dist/src/assets/TAC.d.ts +24 -0
- package/dist/src/assets/TAC.js +74 -0
- package/dist/src/assets/TON.d.ts +3 -3
- package/dist/src/assets/TON.js +12 -5
- package/dist/src/assets/index.d.ts +1 -0
- package/dist/src/assets/index.js +3 -1
- package/dist/src/errors/index.d.ts +1 -1
- package/dist/src/errors/index.js +8 -1
- package/dist/src/errors/instances.d.ts +6 -0
- package/dist/src/errors/instances.js +11 -1
- package/dist/src/interfaces/Asset.d.ts +11 -6
- package/dist/src/interfaces/ContractOpener.d.ts +1 -1
- package/dist/src/interfaces/IConfiguration.d.ts +1 -3
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +14 -2
- package/dist/src/interfaces/IOperationTracker.d.ts +26 -1
- package/dist/src/interfaces/ITACTransactionManager.d.ts +20 -1
- package/dist/src/interfaces/ITacSDK.d.ts +52 -10
- 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 +6 -0
- package/dist/src/sdk/Consts.js +7 -1
- package/dist/src/sdk/LiteSequencerClient.d.ts +5 -2
- package/dist/src/sdk/LiteSequencerClient.js +59 -1
- package/dist/src/sdk/OperationTracker.d.ts +5 -1
- package/dist/src/sdk/OperationTracker.js +76 -0
- package/dist/src/sdk/TACTransactionManager.d.ts +4 -0
- package/dist/src/sdk/TACTransactionManager.js +181 -35
- package/dist/src/sdk/TONTransactionManager.js +28 -6
- package/dist/src/sdk/TacSdk.d.ts +8 -3
- package/dist/src/sdk/TacSdk.js +40 -2
- package/dist/src/sdk/Utils.d.ts +2 -1
- package/dist/src/sdk/Utils.js +5 -1
- package/dist/src/structs/InternalStruct.d.ts +41 -2
- package/dist/src/structs/Struct.d.ts +209 -6
- package/dist/src/structs/Struct.js +12 -1
- package/dist/src/wrappers/ContentUtils.d.ts +36 -13
- package/dist/src/wrappers/ContentUtils.js +197 -98
- package/package.json +121 -121
package/dist/src/assets/TON.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TON = void 0;
|
|
4
4
|
const ton_1 = require("@ton/ton");
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
5
6
|
const errors_1 = require("../errors");
|
|
6
7
|
const Consts_1 = require("../sdk/Consts");
|
|
7
8
|
const Utils_1 = require("../sdk/Utils");
|
|
9
|
+
const Validator_1 = require("../sdk/Validator");
|
|
8
10
|
const Struct_1 = require("../structs/Struct");
|
|
9
11
|
class TON {
|
|
10
12
|
constructor(config) {
|
|
@@ -85,14 +87,19 @@ class TON {
|
|
|
85
87
|
throw (0, errors_1.insufficientBalanceError)(Consts_1.TON_SYMBOL);
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
|
-
async checkCanBeTransferredBy(userAddress) {
|
|
89
|
-
|
|
90
|
-
if (balance < this._rawAmount) {
|
|
90
|
+
async checkCanBeTransferredBy(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
91
|
+
if ((await this.getBalanceOf(userAddress, blockchainType)) < this._rawAmount) {
|
|
91
92
|
throw (0, errors_1.insufficientBalanceError)(Consts_1.TON_SYMBOL);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
async getBalanceOf(userAddress) {
|
|
95
|
-
|
|
95
|
+
async getBalanceOf(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
96
|
+
if (blockchainType === Struct_1.BlockchainType.TON) {
|
|
97
|
+
Validator_1.Validator.validateTVMAddress(userAddress);
|
|
98
|
+
return this.getUserBalance(userAddress);
|
|
99
|
+
}
|
|
100
|
+
Validator_1.Validator.validateEVMAddress(userAddress);
|
|
101
|
+
const token = new ethers_1.ethers.Contract(await this.getEVMAddress(), this._config.artifacts.tac.compilationArtifacts.IERC20WithDecimals.abi, this._config.TACParams.provider);
|
|
102
|
+
return token.balanceOf(userAddress);
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
exports.TON = TON;
|
package/dist/src/assets/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TON = exports.NFT = exports.FT = exports.AssetFactory = void 0;
|
|
3
|
+
exports.TON = exports.TAC = exports.NFT = exports.FT = exports.AssetFactory = void 0;
|
|
4
4
|
var AssetFactory_1 = require("./AssetFactory");
|
|
5
5
|
Object.defineProperty(exports, "AssetFactory", { enumerable: true, get: function () { return AssetFactory_1.AssetFactory; } });
|
|
6
6
|
var FT_1 = require("./FT");
|
|
7
7
|
Object.defineProperty(exports, "FT", { enumerable: true, get: function () { return FT_1.FT; } });
|
|
8
8
|
var NFT_1 = require("./NFT");
|
|
9
9
|
Object.defineProperty(exports, "NFT", { enumerable: true, get: function () { return NFT_1.NFT; } });
|
|
10
|
+
var TAC_1 = require("./TAC");
|
|
11
|
+
Object.defineProperty(exports, "TAC", { enumerable: true, get: function () { return TAC_1.TAC; } });
|
|
10
12
|
var TON_1 = require("./TON");
|
|
11
13
|
Object.defineProperty(exports, "TON", { enumerable: true, get: function () { return TON_1.TON; } });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, KeyError, MetadataError, SettingError, TokenError, TransactionError, WalletError, } from './errors';
|
|
2
|
-
export { allEndpointsFailedError, emptyArrayError, emptyContractError, emptySettingError, evmAddressError, indexRequiredError, insufficientBalanceError, insufficientFeeParamsError, invalidMethodNameError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, 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.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidMethodNameError = exports.insufficientFeeParamsError = exports.insufficientBalanceError = exports.indexRequiredError = exports.evmAddressError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = 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; } });
|
|
@@ -16,13 +16,19 @@ Object.defineProperty(exports, "TransactionError", { enumerable: true, get: func
|
|
|
16
16
|
Object.defineProperty(exports, "WalletError", { enumerable: true, get: function () { return errors_1.WalletError; } });
|
|
17
17
|
var instances_1 = require("./instances");
|
|
18
18
|
Object.defineProperty(exports, "allEndpointsFailedError", { enumerable: true, get: function () { return instances_1.allEndpointsFailedError; } });
|
|
19
|
+
Object.defineProperty(exports, "blockGasLimitFetchError", { enumerable: true, get: function () { return instances_1.blockGasLimitFetchError; } });
|
|
19
20
|
Object.defineProperty(exports, "emptyArrayError", { enumerable: true, get: function () { return instances_1.emptyArrayError; } });
|
|
20
21
|
Object.defineProperty(exports, "emptyContractError", { enumerable: true, get: function () { return instances_1.emptyContractError; } });
|
|
21
22
|
Object.defineProperty(exports, "emptySettingError", { enumerable: true, get: function () { return instances_1.emptySettingError; } });
|
|
23
|
+
Object.defineProperty(exports, "estimatedGasExceedsBlockGasLimitError", { enumerable: true, get: function () { return instances_1.estimatedGasExceedsBlockGasLimitError; } });
|
|
22
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; } });
|
|
26
|
+
Object.defineProperty(exports, "executedInTONStageFailedError", { enumerable: true, get: function () { return instances_1.executedInTONStageFailedError; } });
|
|
27
|
+
Object.defineProperty(exports, "gasPriceFetchError", { enumerable: true, get: function () { return instances_1.gasPriceFetchError; } });
|
|
23
28
|
Object.defineProperty(exports, "indexRequiredError", { enumerable: true, get: function () { return instances_1.indexRequiredError; } });
|
|
24
29
|
Object.defineProperty(exports, "insufficientBalanceError", { enumerable: true, get: function () { return instances_1.insufficientBalanceError; } });
|
|
25
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; } });
|
|
26
32
|
Object.defineProperty(exports, "invalidMethodNameError", { enumerable: true, get: function () { return instances_1.invalidMethodNameError; } });
|
|
27
33
|
Object.defineProperty(exports, "missingDecimals", { enumerable: true, get: function () { return instances_1.missingDecimals; } });
|
|
28
34
|
Object.defineProperty(exports, "missingFeeParamsError", { enumerable: true, get: function () { return instances_1.missingFeeParamsError; } });
|
|
@@ -31,6 +37,7 @@ Object.defineProperty(exports, "missingJettonDataError", { enumerable: true, get
|
|
|
31
37
|
Object.defineProperty(exports, "missingTvmExecutorFeeError", { enumerable: true, get: function () { return instances_1.missingTvmExecutorFeeError; } });
|
|
32
38
|
Object.defineProperty(exports, "notMultiplyOf8Error", { enumerable: true, get: function () { return instances_1.notMultiplyOf8Error; } });
|
|
33
39
|
Object.defineProperty(exports, "operationFetchError", { enumerable: true, get: function () { return instances_1.operationFetchError; } });
|
|
40
|
+
Object.defineProperty(exports, "operationIdRequiredForFinalizationError", { enumerable: true, get: function () { return instances_1.operationIdRequiredForFinalizationError; } });
|
|
34
41
|
Object.defineProperty(exports, "prefixError", { enumerable: true, get: function () { return instances_1.prefixError; } });
|
|
35
42
|
Object.defineProperty(exports, "profilingFetchError", { enumerable: true, get: function () { return instances_1.profilingFetchError; } });
|
|
36
43
|
Object.defineProperty(exports, "simulationFetchError", { enumerable: true, get: function () { return instances_1.simulationFetchError; } });
|
|
@@ -37,3 +37,9 @@ export declare const unknownAssetOriginError: (origin: Origin) => TokenError;
|
|
|
37
37
|
export declare const gasPriceFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
38
38
|
export declare const txFinalizationError: (msg: string) => TransactionError;
|
|
39
39
|
export declare const insufficientFeeParamsError: (feeName: string, provided: bigint, required: bigint) => FormatError;
|
|
40
|
+
export declare const operationIdRequiredForFinalizationError: TransactionError;
|
|
41
|
+
export declare const executedInTONStageFailedError: TransactionError;
|
|
42
|
+
export declare const blockGasLimitFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
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.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);
|
|
@@ -121,3 +121,13 @@ const txFinalizationError = (msg) => new errors_1.TransactionError(`Transaction
|
|
|
121
121
|
exports.txFinalizationError = txFinalizationError;
|
|
122
122
|
const insufficientFeeParamsError = (feeName, provided, required) => new errors_1.FormatError(`Provided ${feeName} (${provided}) is lower than required (${required}). Set shouldValidateFees: false to bypass.`, 136);
|
|
123
123
|
exports.insufficientFeeParamsError = insufficientFeeParamsError;
|
|
124
|
+
exports.operationIdRequiredForFinalizationError = new errors_1.TransactionError('Operation ID is required to wait for operation finalization', 137);
|
|
125
|
+
exports.executedInTONStageFailedError = new errors_1.TransactionError('executedInTON stage failed', 138);
|
|
126
|
+
const blockGasLimitFetchError = (msg, inner) => new errors_1.FetchError(`Failed to fetch latest block gas limit: ${msg}`, 139, inner);
|
|
127
|
+
exports.blockGasLimitFetchError = blockGasLimitFetchError;
|
|
128
|
+
const estimatedGasExceedsBlockGasLimitError = (txName, estimatedGas, blockGasLimit) => new errors_1.TransactionError(`Estimated gas for ${txName} (${estimatedGas}) exceeds current TAC block gas limit (${blockGasLimit})`, 140);
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import type { Cell } from '@ton/ton';
|
|
2
|
-
import { AssetType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
2
|
+
import { AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
3
3
|
export interface Asset {
|
|
4
4
|
address: string;
|
|
5
5
|
type: AssetType;
|
|
@@ -64,14 +64,19 @@ export interface Asset {
|
|
|
64
64
|
/**
|
|
65
65
|
* Validates whether the specified user is allowed to transfer this asset.
|
|
66
66
|
* Implementations should throw if the transfer is not permitted (e.g., frozen asset, missing wallet, insufficient permissions).
|
|
67
|
-
* @param userAddress
|
|
67
|
+
* @param userAddress User address on the selected blockchain.
|
|
68
|
+
* @param blockchainType Blockchain where the transferability should be checked. Defaults to TON.
|
|
68
69
|
* @returns Promise that resolves if transfer is allowed; rejects with an error otherwise.
|
|
69
70
|
*/
|
|
70
|
-
checkCanBeTransferredBy(userAddress: string): Promise<void>;
|
|
71
|
+
checkCanBeTransferredBy(userAddress: string, blockchainType?: BlockchainType): Promise<void>;
|
|
71
72
|
/**
|
|
72
|
-
* Retrieves the current balance of this asset for the given user address.
|
|
73
|
-
*
|
|
73
|
+
* Retrieves the current balance of this asset for the given user address on the selected blockchain.
|
|
74
|
+
* For NFTs, implementations should return 1n when the user owns the token and 0n otherwise.
|
|
75
|
+
* Implementations must validate the address format according to the selected blockchain:
|
|
76
|
+
* TVM address for TON, EVM address for TAC.
|
|
77
|
+
* @param userAddress User address on the selected blockchain.
|
|
78
|
+
* @param blockchainType Blockchain where the balance should be read. Defaults to TON.
|
|
74
79
|
* @returns Promise that resolves to the balance in raw base units (bigint).
|
|
75
80
|
*/
|
|
76
|
-
getBalanceOf(userAddress: string): Promise<bigint>;
|
|
81
|
+
getBalanceOf(userAddress: string, blockchainType?: BlockchainType): Promise<bigint>;
|
|
77
82
|
}
|
|
@@ -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
|
/**
|
|
@@ -14,9 +14,7 @@ export interface IConfiguration {
|
|
|
14
14
|
readonly liteSequencerEndpoints: string[];
|
|
15
15
|
/** Native TON coin master address for the configured network. */
|
|
16
16
|
readonly nativeTONAddress: string;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the native TAC token (Jetton master) address for the configured network.
|
|
19
|
-
*/
|
|
17
|
+
/** Returns the native TAC coin address on the TAC chain for the configured network. */
|
|
20
18
|
nativeTACAddress(): Promise<string>;
|
|
21
19
|
/** Whitelisted EVM (TAC) executor addresses considered trusted. */
|
|
22
20
|
readonly getTrustedTACExecutors: string[];
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, 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>;
|
|
7
|
+
/** Retrieves the v2 operation route/finalization state by id. */
|
|
8
|
+
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
5
9
|
/** Resolves operation id by a transaction linker. */
|
|
6
10
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
7
|
-
/** Resolves operation id by the originating transaction hash. */
|
|
11
|
+
/** Resolves operation id by the originating transaction hash (from ccl event in TON and TAC). */
|
|
8
12
|
getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
|
|
13
|
+
/** Resolves operation id by the originating transaction hash (from ccl event in TON). */
|
|
14
|
+
getOperationIdByTonTransactionHash(transactionHash: string): Promise<string>;
|
|
9
15
|
/**
|
|
10
16
|
* Resolves operation ids for multiple shard keys.
|
|
11
17
|
* @param shardsKeys Shard keys to query.
|
|
@@ -19,6 +25,12 @@ export interface ILiteSequencerClient {
|
|
|
19
25
|
* @param chunkSize Optional batching size.
|
|
20
26
|
*/
|
|
21
27
|
getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetches stage profiling v2 data for a set of operation ids.
|
|
30
|
+
* @param operationIds Operation ids to get profiling for.
|
|
31
|
+
* @param chunkSize Optional batching size.
|
|
32
|
+
*/
|
|
33
|
+
getStageProfilingsV2(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
22
34
|
/**
|
|
23
35
|
* Fetches statuses for a set of operation ids.
|
|
24
36
|
* @param operationIds Operation ids to get statuses for.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, ExecutionStagesV2, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, 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.
|
|
@@ -6,6 +6,12 @@ export interface IOperationTracker {
|
|
|
6
6
|
* @param waitOptions Optional waiting and polling settings. Pass `null` to disable retries and use a single attempt.
|
|
7
7
|
*/
|
|
8
8
|
getOperationType(operationId: string, waitOptions?: WaitOptions<OperationType> | null): Promise<OperationType>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the v2 operation route and finalized flag for the given id.
|
|
11
|
+
* @param operationId Operation identifier.
|
|
12
|
+
* @param waitOptions Optional waiting and polling settings. Pass `null` to disable retries and use a single attempt.
|
|
13
|
+
*/
|
|
14
|
+
getOperationTypeV2(operationId: string, waitOptions?: WaitOptions<OperationTypeV2Info> | null): Promise<OperationTypeV2Info>;
|
|
9
15
|
/**
|
|
10
16
|
* Resolves an operation id for the given transaction linker, optionally waiting until available.
|
|
11
17
|
* @param transactionLinker Reference to originating transaction across chains.
|
|
@@ -18,6 +24,12 @@ export interface IOperationTracker {
|
|
|
18
24
|
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
19
25
|
*/
|
|
20
26
|
getOperationIdByTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Resolves an operation id by a TON transaction hash, optionally waiting until available.
|
|
29
|
+
* @param transactionHash Exact TON crossChainLayer transaction hash.
|
|
30
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
31
|
+
*/
|
|
32
|
+
getOperationIdByTonTransactionHash(transactionHash: string, waitOptions?: WaitOptions<string> | null): Promise<string>;
|
|
21
33
|
/**
|
|
22
34
|
* Resolves operation ids by shard keys for a particular caller, with optional batching and waiting.
|
|
23
35
|
* @param shardsKeys List of shard keys.
|
|
@@ -39,6 +51,19 @@ export interface IOperationTracker {
|
|
|
39
51
|
* @param chunkSize Optional batching size for requests.
|
|
40
52
|
*/
|
|
41
53
|
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets detailed v2 stage profiling for a single operation, including finalized/status/rollback fields.
|
|
56
|
+
* @param operationId Operation identifier.
|
|
57
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
58
|
+
*/
|
|
59
|
+
getStageProfilingV2(operationId: string, waitOptions?: WaitOptions<ExecutionStagesV2> | null): Promise<ExecutionStagesV2>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets v2 stage profiling for multiple operations in bulk.
|
|
62
|
+
* @param operationIds Operation identifiers.
|
|
63
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
64
|
+
* @param chunkSize Optional batching size for requests.
|
|
65
|
+
*/
|
|
66
|
+
getStageProfilingsV2(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesV2ByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
42
67
|
/**
|
|
43
68
|
* Gets statuses for multiple operations.
|
|
44
69
|
* @param operationIds Operation identifiers.
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
|
+
import { CrossChainTransactionToTONOptions, TACCrossChainTransactionResult } from '../structs/Struct';
|
|
2
3
|
import { Asset } from './Asset';
|
|
3
4
|
export interface ITACTransactionManager {
|
|
5
|
+
/**
|
|
6
|
+
* Sends a single TAC -> TON cross-chain transaction and optionally waits for operation tracking data.
|
|
7
|
+
* Native TAC amount is bridged separately from required bridge fees. This high-level method
|
|
8
|
+
* performs production-oriented TAC prechecks: requires EIP-1559 fee data from the TAC provider,
|
|
9
|
+
* optionally validates balances / ownership of non-native TAC assets, uses provider gas estimates as-is,
|
|
10
|
+
* validates those estimates against the latest TAC block gas limit,
|
|
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.
|
|
13
|
+
* @param signer Ethers Wallet used to sign EVM transaction.
|
|
14
|
+
* @param tonTarget Recipient TVM address on TON.
|
|
15
|
+
* @param assets Optional list of TAC assets to include. Native TAC should be passed here as a TAC asset.
|
|
16
|
+
* @param options Optional bridge configuration object.
|
|
17
|
+
* @returns TAC transaction hash and optional operationId.
|
|
18
|
+
*/
|
|
19
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: Asset[], options?: CrossChainTransactionToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
4
20
|
/**
|
|
5
21
|
* Bridges native EVM value and optional assets to TON chain via executor.
|
|
22
|
+
* This is a low-level send-only method: it approves assets, sends the TAC -> TON message and
|
|
23
|
+
* returns the TAC transaction hash. It does not perform provider-backed TAC fee / gas-limit
|
|
24
|
+
* prechecks or TAC balance sufficiency validation; use sendCrossChainTransactionToTON for that flow.
|
|
6
25
|
* @param signer Ethers Wallet used to sign EVM transaction.
|
|
7
26
|
* @param value Amount of native EVM currency (wei as bigint).
|
|
8
27
|
* @param tonTarget Recipient TVM address on TON.
|
|
9
28
|
* @param assets Optional list of TAC assets to include.
|
|
10
29
|
* @param tvmExecutorFee Optional explicit TON-side executor fee.
|
|
11
30
|
* @param tvmValidExecutors Optional whitelist of allowed TVM executors.
|
|
12
|
-
* @returns EVM transaction hash
|
|
31
|
+
* @returns EVM transaction hash.
|
|
13
32
|
*/
|
|
14
33
|
bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: Asset[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
|
|
15
34
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
2
|
import { JettonMinterData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
|
-
import { FT, NFT } from '../assets';
|
|
3
|
+
import { FT, NFT, TAC, TON } from '../assets';
|
|
4
4
|
import type { SenderAbstraction } from '../sender';
|
|
5
|
-
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SuggestedTVMExecutorFee, TacGasPrice, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended, WaitOptions } from '../structs/Struct';
|
|
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,22 +29,23 @@ 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
|
/**
|
|
37
37
|
* Creates a typed asset wrapper instance based on provided arguments.
|
|
38
|
-
* Pass FT, NFT collection or NFT item parameters
|
|
38
|
+
* Pass FT, NFT collection or NFT item parameters.
|
|
39
|
+
* FT inputs may resolve to FT, TON, or TAC for native assets.
|
|
39
40
|
* @param args Parameters that describe the asset to wrap (FT/NFT collection/NFT item).
|
|
40
41
|
* @returns Promise resolving to a generic Asset. Use overloads for stronger typing.
|
|
41
42
|
*/
|
|
42
43
|
getAsset(args: AssetFromFTArg | AssetFromNFTCollectionArg | AssetFromNFTItemArg): Promise<Asset>;
|
|
43
|
-
getAsset(args: AssetFromFTArg): Promise<FT>;
|
|
44
|
+
getAsset(args: AssetFromFTArg): Promise<FT | TAC | TON>;
|
|
44
45
|
getAsset(args: AssetFromNFTCollectionArg): Promise<NFT>;
|
|
45
46
|
getAsset(args: AssetFromNFTItemArg): Promise<NFT>;
|
|
46
47
|
/**
|
|
47
|
-
* Returns a fungible
|
|
48
|
+
* Returns a fungible asset wrapper by its TVM or EVM address.
|
|
48
49
|
* @param address TVM or EVM token address.
|
|
49
50
|
* @returns Promise resolving to an FT wrapper.
|
|
50
51
|
*/
|
|
@@ -92,10 +93,28 @@ export interface ITacSDK {
|
|
|
92
93
|
* @param sender Sender abstraction responsible for signing/sending TVM messages.
|
|
93
94
|
* @param assets Optional list of assets to attach to the cross-chain message.
|
|
94
95
|
* @param options Optional cross-chain options (fees, executors, extra data, etc.).
|
|
95
|
-
*
|
|
96
|
+
* Includes operationId wait options and full-operation finalization controls.
|
|
97
|
+
* Finalization waiting is enabled by default and performs profiling resolution plus
|
|
98
|
+
* TON transaction tree validation for EXECUTED_IN_TON transactions when they exist.
|
|
96
99
|
* @returns Promise with a TransactionLinkerWithOperationId to track the operation across chains.
|
|
97
100
|
*/
|
|
98
|
-
sendCrossChainTransaction(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: AssetLike[], options?: CrossChainTransactionOptions
|
|
101
|
+
sendCrossChainTransaction(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: AssetLike[], options?: CrossChainTransactionOptions): Promise<TransactionLinkerWithOperationId>;
|
|
102
|
+
/**
|
|
103
|
+
* Sends a single TAC -> TON cross-chain transaction and optionally waits for operation tracking information.
|
|
104
|
+
* Native TAC should be passed as a TAC asset in `assets`; there is no separate `value` argument.
|
|
105
|
+
* The sender must still have enough extra TAC balance to pay bridge fees and TAC gas on top of
|
|
106
|
+
* the bridged native TAC amount. The SDK requires EIP-1559 fee data from the TAC provider, can
|
|
107
|
+
* validate balances / ownership of non-native TAC assets, uses provider gas estimates as-is,
|
|
108
|
+
* validates those estimates against the latest TAC block gas limit,
|
|
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.
|
|
111
|
+
* @param signer Ethers Wallet used to sign EVM transaction on TAC side.
|
|
112
|
+
* @param tonTarget Recipient TVM address on TON.
|
|
113
|
+
* @param assets Optional list of TAC assets to include in the bridge transaction.
|
|
114
|
+
* @param options Optional TAC -> TON bridge configuration.
|
|
115
|
+
* @returns Promise with TAC transaction hash and optional operationId.
|
|
116
|
+
*/
|
|
117
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: AssetLike[], options?: CrossChainTransactionToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
99
118
|
/**
|
|
100
119
|
* Sends multiple cross-chain transactions in one batch and optionally waits for tracking info.
|
|
101
120
|
* @param sender Sender abstraction for signing/sending TVM messages.
|
|
@@ -104,15 +123,38 @@ export interface ITacSDK {
|
|
|
104
123
|
* @returns Promise with an array of TransactionLinkerWithOperationId for each submitted transaction.
|
|
105
124
|
*/
|
|
106
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>;
|
|
107
146
|
/**
|
|
108
147
|
* Bridges tokens/value from EVM to TON chain via the executor.
|
|
148
|
+
* This is a low-level send-only method. It prepares the TAC -> TON message, performs approvals,
|
|
149
|
+
* submits the TAC transaction and returns its hash. It does not run the provider-backed TAC
|
|
150
|
+
* fee / gas-limit checks and balance prechecks performed by sendCrossChainTransactionToTON.
|
|
109
151
|
* @param signer Ethers Wallet used to sign the EVM-side transaction.
|
|
110
152
|
* @param value Amount of native EVM currency to bridge (in wei as bigint).
|
|
111
153
|
* @param tonTarget Recipient TVM address on TON.
|
|
112
154
|
* @param assets Optional list of TAC assets to include for the bridge.
|
|
113
155
|
* @param tvmExecutorFee Optional explicit TON-side executor fee.
|
|
114
156
|
* @param tvmValidExecutors Optional whitelist of allowed TVM executors.
|
|
115
|
-
* @returns Promise resolving to the EVM transaction hash
|
|
157
|
+
* @returns Promise resolving to the EVM transaction hash.
|
|
116
158
|
*/
|
|
117
159
|
bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: AssetLike[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
|
|
118
160
|
/**
|
|
@@ -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
|
@@ -19,6 +19,8 @@ export declare const TON_BURN_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
19
19
|
export declare const DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
20
20
|
export declare const DEFAULT_RETRY_MAX_COUNT = 5;
|
|
21
21
|
export declare const DEFAULT_RETRY_DELAY_MS = 1000;
|
|
22
|
+
export declare const DEFAULT_RETRY_MAX_DELAY_MS = 30000;
|
|
23
|
+
export declare const DEFAULT_RETRY_BACKOFF_MULTIPLIER = 3;
|
|
22
24
|
export declare const DEFAULT_WAIT_TIMEOUT_MS = 300000;
|
|
23
25
|
export declare const DEFAULT_WAIT_MAX_ATTEMPTS = 30;
|
|
24
26
|
export declare const DEFAULT_WAIT_DELAY_MS = 10000;
|
|
@@ -30,4 +32,8 @@ export declare const DEFAULT_RETRY_ON_NOT_FOUND = true;
|
|
|
30
32
|
export declare const DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = 10;
|
|
31
33
|
export declare const DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = 5000;
|
|
32
34
|
export declare const IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
35
|
+
export declare const CROSS_CHAIN_MESSAGE_VERSION_V1 = 1n;
|
|
36
|
+
export declare const NFT_BRIDGE_AMOUNT = 1n;
|
|
37
|
+
export declare const DEFAULT_EIP1559_PRIORITY_FEE = 0n;
|
|
38
|
+
export declare const SHARDS_KEY_RANDOM_RANGE = 1000000000000000000;
|
|
33
39
|
export declare const IGNORE_OPCODE: number[];
|
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_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.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);
|
|
@@ -23,6 +23,8 @@ exports.TON_BURN_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
|
|
|
23
23
|
exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
24
24
|
exports.DEFAULT_RETRY_MAX_COUNT = 5;
|
|
25
25
|
exports.DEFAULT_RETRY_DELAY_MS = 1000;
|
|
26
|
+
exports.DEFAULT_RETRY_MAX_DELAY_MS = 30000;
|
|
27
|
+
exports.DEFAULT_RETRY_BACKOFF_MULTIPLIER = 3;
|
|
26
28
|
exports.DEFAULT_WAIT_TIMEOUT_MS = 300000; // 5 minutes
|
|
27
29
|
exports.DEFAULT_WAIT_MAX_ATTEMPTS = 30;
|
|
28
30
|
exports.DEFAULT_WAIT_DELAY_MS = 10000; // 10 seconds
|
|
@@ -34,6 +36,10 @@ exports.DEFAULT_RETRY_ON_NOT_FOUND = true;
|
|
|
34
36
|
exports.DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = 10;
|
|
35
37
|
exports.DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = 5000;
|
|
36
38
|
exports.IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
39
|
+
exports.CROSS_CHAIN_MESSAGE_VERSION_V1 = 1n;
|
|
40
|
+
exports.NFT_BRIDGE_AMOUNT = 1n;
|
|
41
|
+
exports.DEFAULT_EIP1559_PRIORITY_FEE = 0n;
|
|
42
|
+
exports.SHARDS_KEY_RANDOM_RANGE = 1e18;
|
|
37
43
|
exports.IGNORE_OPCODE = [
|
|
38
44
|
0xd53276db, // Excess
|
|
39
45
|
];
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { IHttpClient, ILiteSequencerClient } from '../interfaces';
|
|
2
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
2
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, ExecutionStagesV2ByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, 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
9
|
getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
|
|
10
|
+
getOperationIdByTonTransactionHash(transactionHash: string): Promise<string>;
|
|
10
11
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
12
|
+
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
11
13
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
12
14
|
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
|
|
13
15
|
getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
16
|
+
getStageProfilingsV2(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
14
17
|
getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
|
|
15
18
|
convertCurrency(params: ConvertCurrencyParams): Promise<ConvertedCurrencyResult>;
|
|
16
19
|
simulateTACMessage(params: TACSimulationParams): Promise<TACSimulationResult>;
|