@tonappchain/sdk 0.7.2 → 0.7.3-rc1
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/src/adapters/BaseContractOpener.js +8 -5
- 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 +6 -1
- package/dist/src/errors/instances.d.ts +4 -0
- package/dist/src/errors/instances.js +7 -1
- package/dist/src/interfaces/Asset.d.ts +11 -6
- package/dist/src/interfaces/IConfiguration.d.ts +1 -3
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +9 -1
- package/dist/src/interfaces/IOperationTracker.d.ts +20 -1
- package/dist/src/interfaces/ITACTransactionManager.d.ts +19 -1
- package/dist/src/interfaces/ITacSDK.d.ts +29 -8
- package/dist/src/sdk/Consts.d.ts +4 -0
- package/dist/src/sdk/Consts.js +5 -1
- package/dist/src/sdk/LiteSequencerClient.d.ts +3 -1
- package/dist/src/sdk/LiteSequencerClient.js +37 -0
- package/dist/src/sdk/OperationTracker.d.ts +4 -1
- package/dist/src/sdk/OperationTracker.js +58 -0
- package/dist/src/sdk/TACTransactionManager.d.ts +3 -0
- package/dist/src/sdk/TACTransactionManager.js +170 -34
- package/dist/src/sdk/TONTransactionManager.js +28 -6
- package/dist/src/sdk/TacSdk.d.ts +4 -3
- package/dist/src/sdk/TacSdk.js +4 -0
- package/dist/src/sdk/Utils.d.ts +2 -1
- package/dist/src/sdk/Utils.js +4 -0
- package/dist/src/structs/InternalStruct.d.ts +35 -1
- package/dist/src/structs/Struct.d.ts +155 -5
- 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/NFT.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Cell } from '@ton/ton';
|
|
2
2
|
import { NFTCollectionData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
3
|
import { Asset, IConfiguration } from '../interfaces';
|
|
4
|
-
import { AssetType, EVMAddress, FeeParams, Origin, TVMAddress } from '../structs/Struct';
|
|
4
|
+
import { AssetType, BlockchainType, EVMAddress, FeeParams, Origin, TVMAddress } from '../structs/Struct';
|
|
5
5
|
export declare class NFT implements Asset {
|
|
6
6
|
private readonly _addresses;
|
|
7
7
|
readonly origin: Origin;
|
|
@@ -61,8 +61,8 @@ export declare class NFT implements Asset {
|
|
|
61
61
|
feeParams?: FeeParams;
|
|
62
62
|
}): Cell;
|
|
63
63
|
isOwnedBy(userAddress: string): Promise<boolean>;
|
|
64
|
-
checkCanBeTransferredBy(userAddress: string): Promise<void>;
|
|
65
|
-
getBalanceOf(userAddress: string): Promise<bigint>;
|
|
64
|
+
checkCanBeTransferredBy(userAddress: string, blockchainType?: BlockchainType): Promise<void>;
|
|
65
|
+
getBalanceOf(userAddress: string, blockchainType?: BlockchainType): Promise<bigint>;
|
|
66
66
|
private getBurnPayload;
|
|
67
67
|
private getTransferPayload;
|
|
68
68
|
}
|
package/dist/src/assets/NFT.js
CHANGED
|
@@ -207,13 +207,19 @@ class NFT {
|
|
|
207
207
|
const nftData = await NFT.getItemData(this._configuration, this.address.toString());
|
|
208
208
|
return !!nftData.ownerAddress?.equals(ton_1.Address.parse(userAddress));
|
|
209
209
|
}
|
|
210
|
-
async checkCanBeTransferredBy(userAddress) {
|
|
211
|
-
if (
|
|
210
|
+
async checkCanBeTransferredBy(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
211
|
+
if ((await this.getBalanceOf(userAddress, blockchainType)) < 1n) {
|
|
212
212
|
throw (0, errors_1.insufficientBalanceError)(this.address.toString());
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
async getBalanceOf(userAddress) {
|
|
216
|
-
|
|
215
|
+
async getBalanceOf(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
216
|
+
if (blockchainType === Struct_1.BlockchainType.TON) {
|
|
217
|
+
Validator_1.Validator.validateTVMAddress(userAddress);
|
|
218
|
+
return (await this.isOwnedBy(userAddress)) ? 1n : 0n;
|
|
219
|
+
}
|
|
220
|
+
Validator_1.Validator.validateEVMAddress(userAddress);
|
|
221
|
+
const nft = new ethers_1.ethers.Contract(await this.getEVMAddress(), this._configuration.artifacts.tac.compilationArtifacts.IERC721.abi, this._configuration.TACParams.provider);
|
|
222
|
+
return (await nft.ownerOf(this._addresses.index)).toLowerCase() === userAddress.toLowerCase() ? 1n : 0n;
|
|
217
223
|
}
|
|
218
224
|
getBurnPayload(crossChainLayerAddress, evmData, crossChainTonAmount, feeData) {
|
|
219
225
|
const queryId = (0, Utils_1.generateRandomNumberByTimestamp)().randomNumber;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Cell } from '@ton/ton';
|
|
2
|
+
import { Asset, IConfiguration } from '../interfaces';
|
|
3
|
+
import { AssetType, BlockchainType, GeneratePayloadParams, Origin } from '../structs/Struct';
|
|
4
|
+
export declare class TAC implements Asset {
|
|
5
|
+
private readonly _configuration;
|
|
6
|
+
private readonly _evmAddress;
|
|
7
|
+
private _wrappedAsset;
|
|
8
|
+
readonly type: AssetType;
|
|
9
|
+
readonly origin: Origin;
|
|
10
|
+
private constructor();
|
|
11
|
+
static create(configuration: IConfiguration): Promise<TAC>;
|
|
12
|
+
get address(): string;
|
|
13
|
+
get rawAmount(): bigint;
|
|
14
|
+
get clone(): TAC;
|
|
15
|
+
withAmount(amount: number): TAC;
|
|
16
|
+
withRawAmount(rawAmount: bigint): TAC;
|
|
17
|
+
addAmount(amount: number): TAC;
|
|
18
|
+
addRawAmount(rawAmount: bigint): TAC;
|
|
19
|
+
getEVMAddress(): Promise<string>;
|
|
20
|
+
getTVMAddress(): Promise<string>;
|
|
21
|
+
generatePayload(params: GeneratePayloadParams): Cell;
|
|
22
|
+
checkCanBeTransferredBy(userAddress: string, blockchainType?: BlockchainType): Promise<void>;
|
|
23
|
+
getBalanceOf(userAddress: string, blockchainType?: BlockchainType): Promise<bigint>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TAC = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const Validator_1 = require("../sdk/Validator");
|
|
6
|
+
const Struct_1 = require("../structs/Struct");
|
|
7
|
+
const FT_1 = require("./FT");
|
|
8
|
+
class TAC {
|
|
9
|
+
constructor(_configuration, _evmAddress, _wrappedAsset) {
|
|
10
|
+
this._configuration = _configuration;
|
|
11
|
+
this._evmAddress = _evmAddress;
|
|
12
|
+
this._wrappedAsset = _wrappedAsset;
|
|
13
|
+
this.type = Struct_1.AssetType.FT;
|
|
14
|
+
this.origin = Struct_1.Origin.TAC;
|
|
15
|
+
}
|
|
16
|
+
static async create(configuration) {
|
|
17
|
+
const evmAddress = await configuration.nativeTACAddress();
|
|
18
|
+
const wrappedAsset = await FT_1.FT.fromAddress(configuration, evmAddress);
|
|
19
|
+
return new TAC(configuration, evmAddress, wrappedAsset);
|
|
20
|
+
}
|
|
21
|
+
get address() {
|
|
22
|
+
return this._wrappedAsset.address;
|
|
23
|
+
}
|
|
24
|
+
get rawAmount() {
|
|
25
|
+
return this._wrappedAsset.rawAmount;
|
|
26
|
+
}
|
|
27
|
+
get clone() {
|
|
28
|
+
return new TAC(this._configuration, this._evmAddress, this._wrappedAsset.clone);
|
|
29
|
+
}
|
|
30
|
+
withAmount(amount) {
|
|
31
|
+
const nextWrappedAsset = this._wrappedAsset.withAmount(amount);
|
|
32
|
+
if (nextWrappedAsset === this._wrappedAsset) {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
return new TAC(this._configuration, this._evmAddress, nextWrappedAsset);
|
|
36
|
+
}
|
|
37
|
+
withRawAmount(rawAmount) {
|
|
38
|
+
const nextWrappedAsset = this._wrappedAsset.withRawAmount(rawAmount);
|
|
39
|
+
if (nextWrappedAsset === this._wrappedAsset) {
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
return new TAC(this._configuration, this._evmAddress, nextWrappedAsset);
|
|
43
|
+
}
|
|
44
|
+
addAmount(amount) {
|
|
45
|
+
this._wrappedAsset = this._wrappedAsset.addAmount(amount);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
addRawAmount(rawAmount) {
|
|
49
|
+
this._wrappedAsset = this._wrappedAsset.addRawAmount(rawAmount);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
async getEVMAddress() {
|
|
53
|
+
return this._evmAddress;
|
|
54
|
+
}
|
|
55
|
+
async getTVMAddress() {
|
|
56
|
+
return this.address;
|
|
57
|
+
}
|
|
58
|
+
generatePayload(params) {
|
|
59
|
+
return this._wrappedAsset.generatePayload(params);
|
|
60
|
+
}
|
|
61
|
+
async checkCanBeTransferredBy(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
62
|
+
if ((await this.getBalanceOf(userAddress, blockchainType)) < this.rawAmount) {
|
|
63
|
+
throw (0, errors_1.insufficientBalanceError)(this.address);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async getBalanceOf(userAddress, blockchainType = Struct_1.BlockchainType.TON) {
|
|
67
|
+
if (blockchainType === Struct_1.BlockchainType.TAC) {
|
|
68
|
+
Validator_1.Validator.validateEVMAddress(userAddress);
|
|
69
|
+
return this._configuration.TACParams.provider.getBalance(userAddress);
|
|
70
|
+
}
|
|
71
|
+
return this._wrappedAsset.getBalanceOf(userAddress, blockchainType);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.TAC = TAC;
|
package/dist/src/assets/TON.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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, FeeParams, Origin } from '../structs/Struct';
|
|
5
|
+
import { 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;
|
|
@@ -29,6 +29,6 @@ export declare class TON implements Asset {
|
|
|
29
29
|
}): Cell;
|
|
30
30
|
getUserBalance(userAddress: string): Promise<bigint>;
|
|
31
31
|
static checkBalance(sender: SenderAbstraction, config: IConfiguration, transactions: ShardTransaction[]): Promise<void>;
|
|
32
|
-
checkCanBeTransferredBy(userAddress: string): Promise<void>;
|
|
33
|
-
getBalanceOf(userAddress: string): Promise<bigint>;
|
|
32
|
+
checkCanBeTransferredBy(userAddress: string, blockchainType?: BlockchainType): Promise<void>;
|
|
33
|
+
getBalanceOf(userAddress: string, blockchainType?: BlockchainType): Promise<bigint>;
|
|
34
34
|
}
|
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, 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';
|
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.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;
|
|
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,10 +16,14 @@ 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, "executedInTONStageFailedError", { enumerable: true, get: function () { return instances_1.executedInTONStageFailedError; } });
|
|
26
|
+
Object.defineProperty(exports, "gasPriceFetchError", { enumerable: true, get: function () { return instances_1.gasPriceFetchError; } });
|
|
23
27
|
Object.defineProperty(exports, "indexRequiredError", { enumerable: true, get: function () { return instances_1.indexRequiredError; } });
|
|
24
28
|
Object.defineProperty(exports, "insufficientBalanceError", { enumerable: true, get: function () { return instances_1.insufficientBalanceError; } });
|
|
25
29
|
Object.defineProperty(exports, "insufficientFeeParamsError", { enumerable: true, get: function () { return instances_1.insufficientFeeParamsError; } });
|
|
@@ -31,6 +35,7 @@ Object.defineProperty(exports, "missingJettonDataError", { enumerable: true, get
|
|
|
31
35
|
Object.defineProperty(exports, "missingTvmExecutorFeeError", { enumerable: true, get: function () { return instances_1.missingTvmExecutorFeeError; } });
|
|
32
36
|
Object.defineProperty(exports, "notMultiplyOf8Error", { enumerable: true, get: function () { return instances_1.notMultiplyOf8Error; } });
|
|
33
37
|
Object.defineProperty(exports, "operationFetchError", { enumerable: true, get: function () { return instances_1.operationFetchError; } });
|
|
38
|
+
Object.defineProperty(exports, "operationIdRequiredForFinalizationError", { enumerable: true, get: function () { return instances_1.operationIdRequiredForFinalizationError; } });
|
|
34
39
|
Object.defineProperty(exports, "prefixError", { enumerable: true, get: function () { return instances_1.prefixError; } });
|
|
35
40
|
Object.defineProperty(exports, "profilingFetchError", { enumerable: true, get: function () { return instances_1.profilingFetchError; } });
|
|
36
41
|
Object.defineProperty(exports, "simulationFetchError", { enumerable: true, get: function () { return instances_1.simulationFetchError; } });
|
|
@@ -37,3 +37,7 @@ 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;
|
|
@@ -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.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,9 @@ 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;
|
|
@@ -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
|
}
|
|
@@ -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,7 +1,9 @@
|
|
|
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
3
|
/** Retrieves the operation type by id. */
|
|
4
4
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
5
|
+
/** Retrieves the v2 operation route/finalization state by id. */
|
|
6
|
+
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
5
7
|
/** Resolves operation id by a transaction linker. */
|
|
6
8
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
7
9
|
/** Resolves operation id by the originating transaction hash. */
|
|
@@ -19,6 +21,12 @@ export interface ILiteSequencerClient {
|
|
|
19
21
|
* @param chunkSize Optional batching size.
|
|
20
22
|
*/
|
|
21
23
|
getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
24
|
+
/**
|
|
25
|
+
* Fetches stage profiling v2 data for a set of operation ids.
|
|
26
|
+
* @param operationIds Operation ids to get profiling for.
|
|
27
|
+
* @param chunkSize Optional batching size.
|
|
28
|
+
*/
|
|
29
|
+
getStageProfilingsV2(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
22
30
|
/**
|
|
23
31
|
* Fetches statuses for a set of operation ids.
|
|
24
32
|
* @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.
|
|
@@ -39,6 +45,19 @@ export interface IOperationTracker {
|
|
|
39
45
|
* @param chunkSize Optional batching size for requests.
|
|
40
46
|
*/
|
|
41
47
|
getStageProfilings(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets detailed v2 stage profiling for a single operation, including finalized/status/rollback fields.
|
|
50
|
+
* @param operationId Operation identifier.
|
|
51
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
52
|
+
*/
|
|
53
|
+
getStageProfilingV2(operationId: string, waitOptions?: WaitOptions<ExecutionStagesV2> | null): Promise<ExecutionStagesV2>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets v2 stage profiling for multiple operations in bulk.
|
|
56
|
+
* @param operationIds Operation identifiers.
|
|
57
|
+
* @param waitOptions Optional waiting settings. Pass `null` to disable retries and use a single attempt.
|
|
58
|
+
* @param chunkSize Optional batching size for requests.
|
|
59
|
+
*/
|
|
60
|
+
getStageProfilingsV2(operationIds: string[], waitOptions?: WaitOptions<ExecutionStagesV2ByOperationId> | null, chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
42
61
|
/**
|
|
43
62
|
* Gets statuses for multiple operations.
|
|
44
63
|
* @param operationIds Operation identifiers.
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
|
+
import { BridgeTokensToTONOptions, 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
|
+
* computes the worst-case upfront TAC balance requirement, and then submits approvals plus the bridge message.
|
|
12
|
+
* @param signer Ethers Wallet used to sign EVM transaction.
|
|
13
|
+
* @param tonTarget Recipient TVM address on TON.
|
|
14
|
+
* @param assets Optional list of TAC assets to include. Native TAC should be passed here as a TAC asset.
|
|
15
|
+
* @param options Optional bridge configuration object.
|
|
16
|
+
* @returns TAC transaction hash and optional operationId.
|
|
17
|
+
*/
|
|
18
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: Asset[], options?: BridgeTokensToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
4
19
|
/**
|
|
5
20
|
* Bridges native EVM value and optional assets to TON chain via executor.
|
|
21
|
+
* This is a low-level send-only method: it approves assets, sends the TAC -> TON message and
|
|
22
|
+
* returns the TAC transaction hash. It does not perform provider-backed TAC fee / gas-limit
|
|
23
|
+
* prechecks or TAC balance sufficiency validation; use sendCrossChainTransactionToTON for that flow.
|
|
6
24
|
* @param signer Ethers Wallet used to sign EVM transaction.
|
|
7
25
|
* @param value Amount of native EVM currency (wei as bigint).
|
|
8
26
|
* @param tonTarget Recipient TVM address on TON.
|
|
9
27
|
* @param assets Optional list of TAC assets to include.
|
|
10
28
|
* @param tvmExecutorFee Optional explicit TON-side executor fee.
|
|
11
29
|
* @param tvmValidExecutors Optional whitelist of allowed TVM executors.
|
|
12
|
-
* @returns EVM transaction hash
|
|
30
|
+
* @returns EVM transaction hash.
|
|
13
31
|
*/
|
|
14
32
|
bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: Asset[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
|
|
15
33
|
}
|
|
@@ -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
|
|
5
|
+
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, BridgeTokensToTONOptions, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SuggestedTVMExecutorFee, TACCrossChainTransactionResult, TacGasPrice, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended } from '../structs/Struct';
|
|
6
6
|
import { Asset } from './Asset';
|
|
7
7
|
import { ContractOpener } from './ContractOpener';
|
|
8
8
|
import { IConfiguration } from './IConfiguration';
|
|
@@ -35,16 +35,17 @@ export interface ITacSDK {
|
|
|
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,27 @@ 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
|
+
* computes the worst-case upfront TAC balance requirement, and only then submits the TAC transactions.
|
|
110
|
+
* @param signer Ethers Wallet used to sign EVM transaction on TAC side.
|
|
111
|
+
* @param tonTarget Recipient TVM address on TON.
|
|
112
|
+
* @param assets Optional list of TAC assets to include in the bridge transaction.
|
|
113
|
+
* @param options Optional TAC -> TON bridge configuration.
|
|
114
|
+
* @returns Promise with TAC transaction hash and optional operationId.
|
|
115
|
+
*/
|
|
116
|
+
sendCrossChainTransactionToTON(signer: Wallet, tonTarget: string, assets?: AssetLike[], options?: BridgeTokensToTONOptions): Promise<TACCrossChainTransactionResult>;
|
|
99
117
|
/**
|
|
100
118
|
* Sends multiple cross-chain transactions in one batch and optionally waits for tracking info.
|
|
101
119
|
* @param sender Sender abstraction for signing/sending TVM messages.
|
|
@@ -106,13 +124,16 @@ export interface ITacSDK {
|
|
|
106
124
|
sendCrossChainTransactions(sender: SenderAbstraction, txs: BatchCrossChainTxWithAssetLike[], options?: CrossChainTransactionsOptions): Promise<TransactionLinkerWithOperationId[]>;
|
|
107
125
|
/**
|
|
108
126
|
* Bridges tokens/value from EVM to TON chain via the executor.
|
|
127
|
+
* This is a low-level send-only method. It prepares the TAC -> TON message, performs approvals,
|
|
128
|
+
* submits the TAC transaction and returns its hash. It does not run the provider-backed TAC
|
|
129
|
+
* fee / gas-limit checks and balance prechecks performed by sendCrossChainTransactionToTON.
|
|
109
130
|
* @param signer Ethers Wallet used to sign the EVM-side transaction.
|
|
110
131
|
* @param value Amount of native EVM currency to bridge (in wei as bigint).
|
|
111
132
|
* @param tonTarget Recipient TVM address on TON.
|
|
112
133
|
* @param assets Optional list of TAC assets to include for the bridge.
|
|
113
134
|
* @param tvmExecutorFee Optional explicit TON-side executor fee.
|
|
114
135
|
* @param tvmValidExecutors Optional whitelist of allowed TVM executors.
|
|
115
|
-
* @returns Promise resolving to the EVM transaction hash
|
|
136
|
+
* @returns Promise resolving to the EVM transaction hash.
|
|
116
137
|
*/
|
|
117
138
|
bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: AssetLike[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
|
|
118
139
|
/**
|
package/dist/src/sdk/Consts.d.ts
CHANGED
|
@@ -30,4 +30,8 @@ export declare const DEFAULT_RETRY_ON_NOT_FOUND = true;
|
|
|
30
30
|
export declare const DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = 10;
|
|
31
31
|
export declare const DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = 5000;
|
|
32
32
|
export declare const IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
33
|
+
export declare const CROSS_CHAIN_MESSAGE_VERSION_V1 = 1n;
|
|
34
|
+
export declare const NFT_BRIDGE_AMOUNT = 1n;
|
|
35
|
+
export declare const DEFAULT_EIP1559_PRIORITY_FEE = 0n;
|
|
36
|
+
export declare const SHARDS_KEY_RANDOM_RANGE = 1000000000000000000;
|
|
33
37
|
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_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);
|
|
@@ -34,6 +34,10 @@ exports.DEFAULT_RETRY_ON_NOT_FOUND = true;
|
|
|
34
34
|
exports.DEFAULT_RETRY_ON_NOT_FOUND_RETRIES = 10;
|
|
35
35
|
exports.DEFAULT_RETRY_ON_NOT_FOUND_DELAY_MS = 5000;
|
|
36
36
|
exports.IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
37
|
+
exports.CROSS_CHAIN_MESSAGE_VERSION_V1 = 1n;
|
|
38
|
+
exports.NFT_BRIDGE_AMOUNT = 1n;
|
|
39
|
+
exports.DEFAULT_EIP1559_PRIORITY_FEE = 0n;
|
|
40
|
+
exports.SHARDS_KEY_RANDOM_RANGE = 1e18;
|
|
37
41
|
exports.IGNORE_OPCODE = [
|
|
38
42
|
0xd53276db, // Excess
|
|
39
43
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
private readonly endpoint;
|
|
5
5
|
private readonly maxChunkSize;
|
|
@@ -8,9 +8,11 @@ export declare class LiteSequencerClient implements ILiteSequencerClient {
|
|
|
8
8
|
private getRequestLabel;
|
|
9
9
|
getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
|
|
10
10
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
11
|
+
getOperationTypeV2(operationId: string): Promise<OperationTypeV2Info>;
|
|
11
12
|
getOperationId(transactionLinker: TransactionLinker): Promise<string>;
|
|
12
13
|
getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
|
|
13
14
|
getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
|
|
15
|
+
getStageProfilingsV2(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesV2ByOperationId>;
|
|
14
16
|
getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
|
|
15
17
|
convertCurrency(params: ConvertCurrencyParams): Promise<ConvertedCurrencyResult>;
|
|
16
18
|
simulateTACMessage(params: TACSimulationParams): Promise<TACSimulationResult>;
|