@tonappchain/sdk 0.7.2-alpha-3 → 0.7.2-alpha-5

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.
Files changed (43) hide show
  1. package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  2. package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -1
  3. package/dist/artifacts/testnet/ton/internal/build/JettonMinter.compiled.json +1 -1
  4. package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -1
  5. package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -1
  6. package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -1
  7. package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -1
  8. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +13 -1
  9. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +45 -7
  10. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +2 -2
  11. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +2 -2
  12. package/dist/src/adapters/contractOpener.js +42 -4
  13. package/dist/src/adapters/retryableContractOpener.d.ts +2 -1
  14. package/dist/src/adapters/retryableContractOpener.js +7 -0
  15. package/dist/src/errors/instances.d.ts +1 -0
  16. package/dist/src/errors/instances.js +3 -1
  17. package/dist/src/interfaces/ContractOpener.d.ts +2 -1
  18. package/dist/src/interfaces/ILiteSequencerClient.d.ts +6 -1
  19. package/dist/src/interfaces/IOperationTracker.d.ts +6 -1
  20. package/dist/src/interfaces/ISimulator.d.ts +0 -6
  21. package/dist/src/interfaces/ITxFinalizer.d.ts +1 -1
  22. package/dist/src/sdk/Configuration.d.ts +1 -0
  23. package/dist/src/sdk/Configuration.js +68 -0
  24. package/dist/src/sdk/Consts.d.ts +6 -48
  25. package/dist/src/sdk/Consts.js +8 -50
  26. package/dist/src/sdk/Fees.d.ts +75 -0
  27. package/dist/src/sdk/Fees.js +198 -0
  28. package/dist/src/sdk/LiteSequencerClient.d.ts +2 -1
  29. package/dist/src/sdk/LiteSequencerClient.js +11 -0
  30. package/dist/src/sdk/OperationTracker.d.ts +2 -1
  31. package/dist/src/sdk/OperationTracker.js +20 -0
  32. package/dist/src/sdk/Simulator.d.ts +0 -1
  33. package/dist/src/sdk/Simulator.js +28 -118
  34. package/dist/src/sdk/StartTracking.js +1 -1
  35. package/dist/src/sdk/TONTransactionManager.js +3 -3
  36. package/dist/src/sdk/TacSdk.d.ts +5 -0
  37. package/dist/src/sdk/TacSdk.js +8 -0
  38. package/dist/src/sdk/TxFinalizer.d.ts +1 -1
  39. package/dist/src/sdk/TxFinalizer.js +9 -4
  40. package/dist/src/sdk/Utils.js +3 -3
  41. package/dist/src/structs/InternalStruct.d.ts +12 -13
  42. package/dist/src/structs/Struct.d.ts +9 -1
  43. package/package.json +1 -1
@@ -63,6 +63,7 @@ class Configuration {
63
63
  const jettonMinterCode = allSettings.get((0, Utils_1.sha256toBigInt)('JettonMinterCode'));
64
64
  const nftItemCode = allSettings.get((0, Utils_1.sha256toBigInt)('NFTItemCode'));
65
65
  const nftCollectionCode = allSettings.get((0, Utils_1.sha256toBigInt)('NFTCollectionCode'));
66
+ const feesParams = await this.retrieveTONFeesParams(contractOpener);
66
67
  return {
67
68
  contractOpener,
68
69
  jettonProxyAddress,
@@ -72,6 +73,7 @@ class Configuration {
72
73
  nftProxyAddress,
73
74
  nftItemCode,
74
75
  nftCollectionCode,
76
+ feesParams,
75
77
  };
76
78
  }
77
79
  static async prepareTACParams(network, TACParams) {
@@ -191,5 +193,71 @@ class Configuration {
191
193
  async isContractDeployedOnTVM(address) {
192
194
  return (await this.TONParams.contractOpener.getContractState(ton_1.Address.parse(address))).state === 'active';
193
195
  }
196
+ static async retrieveTONFeesParams(contractOpener) {
197
+ try {
198
+ const config = await contractOpener.getConfig();
199
+ const prices = {
200
+ gasPrice: 0,
201
+ lumpPrice: 0,
202
+ msgBitPrice: 0,
203
+ msgCellPrice: 0,
204
+ ihrPriceFactor: 0,
205
+ firstFrac: 0,
206
+ accountBitPrice: 0,
207
+ accountCellPrice: 0,
208
+ };
209
+ // ───────────────────────────────────────────────
210
+ // Param 21 – Gas prices
211
+ // ───────────────────────────────────────────────
212
+ const param21 = config.get(21);
213
+ if (!param21)
214
+ throw new Error('Param 21 (gas prices) not found in config');
215
+ let slice = param21.beginParse();
216
+ slice.skip(8 + 64 + 64 + 8); // = 144 bits
217
+ const gasPriceRaw = slice.loadUint(64);
218
+ prices.gasPrice = gasPriceRaw / 65536;
219
+ // ───────────────────────────────────────────────
220
+ // Param 25 – Message forwarding prices
221
+ // ───────────────────────────────────────────────
222
+ const param25 = config.get(25);
223
+ if (!param25)
224
+ throw new Error('Param 25 (msg prices) not found in config');
225
+ slice = param25.beginParse();
226
+ slice.skip(8); // usually just flags / version
227
+ prices.lumpPrice = slice.loadUint(64);
228
+ prices.msgBitPrice = slice.loadUint(64);
229
+ prices.msgCellPrice = slice.loadUint(64);
230
+ prices.ihrPriceFactor = slice.loadUint(32);
231
+ prices.firstFrac = slice.loadUint(16);
232
+ // ───────────────────────────────────────────────
233
+ // Param 18 – Storage prices
234
+ // ───────────────────────────────────────────────
235
+ const param18 = config.get(18);
236
+ if (!param18)
237
+ throw new Error('Param 18 (storage prices) not found in config');
238
+ const dict = param18.beginParse().loadDictDirect(ton_1.Dictionary.Keys.Uint(32), ton_1.Dictionary.Values.Cell());
239
+ const entry = await dict.get(0);
240
+ if (!entry)
241
+ throw new Error('Storage price entry for key 0 not found');
242
+ slice = entry.beginParse();
243
+ slice.skip(8 + 32);
244
+ prices.accountBitPrice = slice.loadUint(64);
245
+ prices.accountCellPrice = slice.loadUint(64);
246
+ return prices;
247
+ }
248
+ catch {
249
+ // return standard values from https://tonviewer.com/config#25 in case of failure
250
+ return {
251
+ accountBitPrice: 1,
252
+ accountCellPrice: 500,
253
+ lumpPrice: 400000,
254
+ gasPrice: 400,
255
+ firstFrac: 21845,
256
+ ihrPriceFactor: 98304,
257
+ msgBitPrice: 26214400,
258
+ msgCellPrice: 2621440000,
259
+ };
260
+ }
261
+ }
194
262
  }
195
263
  exports.Configuration = Configuration;
@@ -14,51 +14,9 @@ export declare const ONE_YEAR_SECONDS: number;
14
14
  export declare const TON_DECIMALS = 9;
15
15
  export declare const TAC_DECIMALS = 18;
16
16
  export declare const TON_BURN_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
17
- export declare const FIXED_POINT_SHIFT: number;
18
- export declare const CONTRACT_FEE_USAGE_PARAMS: {
19
- crossChainLayer: {
20
- accountBits: number;
21
- accountCells: number;
22
- gas: {
23
- tvmMsgToEvm: number;
24
- };
25
- };
26
- jettonWallet: {
27
- accountBits: number;
28
- accountCells: number;
29
- gas: {
30
- internalTransfer: number;
31
- receive: number;
32
- burn: number;
33
- };
34
- };
35
- jettonProxy: {
36
- accountbits: number;
37
- accountCells: number;
38
- gas: {
39
- ownershipAssigned: number;
40
- };
41
- };
42
- jettonMinter: {
43
- accountBits: number;
44
- accountCells: number;
45
- gas: {
46
- burnNotification: number;
47
- };
48
- };
49
- nftItem: {
50
- accountBits: number;
51
- accountCells: number;
52
- gas: {
53
- send: number;
54
- burn: number;
55
- };
56
- };
57
- nftProxy: {
58
- accountBits: number;
59
- accountCells: number;
60
- gas: {
61
- ownershipAssigned: number;
62
- };
63
- };
64
- };
17
+ export declare const DEFAULT_FIND_TX_TIMEOUT_MS = 60000;
18
+ export declare const DEFAULT_FIND_TX_RETRY_DELAY_MS = 2000;
19
+ export declare const DEFAULT_FIND_TX_LIMIT = 10;
20
+ export declare const DEFAULT_FIND_TX_ARCHIVAL = true;
21
+ export declare const DEFAULT_FIND_TX_MAX_DEPTH = 10;
22
+ export declare const IGNORE_MSG_VALUE_1_NANO = 1n;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTRACT_FEE_USAGE_PARAMS = exports.FIXED_POINT_SHIFT = exports.TON_BURN_ADDRESS = 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_MSG_VALUE_1_NANO = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_FIND_TX_RETRY_DELAY_MS = exports.DEFAULT_FIND_TX_TIMEOUT_MS = exports.TON_BURN_ADDRESS = 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);
@@ -18,52 +18,10 @@ exports.ONE_YEAR_SECONDS = 365 * 24 * 3600;
18
18
  exports.TON_DECIMALS = 9;
19
19
  exports.TAC_DECIMALS = 18;
20
20
  exports.TON_BURN_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
21
- // FEES
22
- exports.FIXED_POINT_SHIFT = 2 ** 16;
23
- exports.CONTRACT_FEE_USAGE_PARAMS = {
24
- crossChainLayer: {
25
- accountBits: 43514,
26
- accountCells: 100,
27
- gas: {
28
- tvmMsgToEvm: 14619,
29
- },
30
- },
31
- jettonWallet: {
32
- accountBits: 949,
33
- accountCells: 3,
34
- gas: {
35
- internalTransfer: 10669,
36
- receive: 11427,
37
- burn: 8653,
38
- },
39
- },
40
- jettonProxy: {
41
- accountbits: 7760,
42
- accountCells: 16,
43
- gas: {
44
- ownershipAssigned: 8515,
45
- },
46
- },
47
- jettonMinter: {
48
- accountBits: 10208,
49
- accountCells: 28,
50
- gas: {
51
- burnNotification: 10357,
52
- },
53
- },
54
- nftItem: {
55
- accountBits: 1422,
56
- accountCells: 5,
57
- gas: {
58
- send: 11722,
59
- burn: 11552,
60
- },
61
- },
62
- nftProxy: {
63
- accountBits: 7512,
64
- accountCells: 15,
65
- gas: {
66
- ownershipAssigned: 7688,
67
- },
68
- },
69
- };
21
+ // TX TRACKING
22
+ exports.DEFAULT_FIND_TX_TIMEOUT_MS = 60000;
23
+ exports.DEFAULT_FIND_TX_RETRY_DELAY_MS = 2000;
24
+ exports.DEFAULT_FIND_TX_LIMIT = 10;
25
+ exports.DEFAULT_FIND_TX_ARCHIVAL = true;
26
+ exports.DEFAULT_FIND_TX_MAX_DEPTH = 10;
27
+ exports.IGNORE_MSG_VALUE_1_NANO = 1n;
@@ -0,0 +1,75 @@
1
+ import { TransactionFeeCalculationStep } from '../structs/InternalStruct';
2
+ export declare const FIXED_POINT_SHIFT: number;
3
+ export declare const CONTRACT_FEE_USAGE_PARAMS: {
4
+ crossChainLayer: {
5
+ accountBits: number;
6
+ accountCells: number;
7
+ gas: {
8
+ tvmMsgToEvm: number;
9
+ };
10
+ };
11
+ jettonWallet: {
12
+ accountBits: number;
13
+ accountCells: number;
14
+ estimatedAccountBits: number;
15
+ estimatedAccountCells: number;
16
+ initStateBits: number;
17
+ initStateCells: number;
18
+ gas: {
19
+ internalTransfer: number;
20
+ receive: number;
21
+ burn: number;
22
+ estimatedSendTransfer: number;
23
+ estimatedReceiveTransfer: number;
24
+ };
25
+ };
26
+ jettonProxy: {
27
+ accountbits: number;
28
+ accountCells: number;
29
+ gas: {
30
+ ownershipAssigned: number;
31
+ transferNotification: number;
32
+ errorNotification: number;
33
+ };
34
+ };
35
+ jettonMinter: {
36
+ accountBits: number;
37
+ accountCells: number;
38
+ gas: {
39
+ burnNotification: number;
40
+ mintAfterError: number;
41
+ };
42
+ };
43
+ nftItem: {
44
+ accountBits: number;
45
+ accountCells: number;
46
+ gas: {
47
+ send: number;
48
+ burn: number;
49
+ errorNotification: number;
50
+ };
51
+ };
52
+ nftProxy: {
53
+ accountBits: number;
54
+ accountCells: number;
55
+ gas: {
56
+ ownershipAssigned: number;
57
+ errorNotification: number;
58
+ };
59
+ };
60
+ };
61
+ export declare const createCrossChainLayerTvmMsgToEvmStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
62
+ export declare const createJettonWalletInternalTransferStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
63
+ export declare const createJettonWalletReceiveStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
64
+ export declare const createJettonWalletBurnStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
65
+ export declare const createJettonProxyOwnershipAssignedStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
66
+ export declare const createJettonMinterBurnNotificationStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
67
+ export declare const createNftItemSendStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
68
+ export declare const createNftItemBurnStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
69
+ export declare const createNftProxyOwnershipAssignedStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
70
+ export declare const createErrorNotificationGasStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
71
+ export declare const createEstimatedSendTransferGasStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
72
+ export declare const createEstimatedReceiveTransferGasStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
73
+ export declare const createMintAfterErrorGasStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
74
+ export declare const createNftProxyErrorNotificationStep: (msgBits: number, msgCells: number) => TransactionFeeCalculationStep;
75
+ export declare const createNftItemErrorNotificationStep: () => TransactionFeeCalculationStep;
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNftItemErrorNotificationStep = exports.createNftProxyErrorNotificationStep = exports.createMintAfterErrorGasStep = exports.createEstimatedReceiveTransferGasStep = exports.createEstimatedSendTransferGasStep = exports.createErrorNotificationGasStep = exports.createNftProxyOwnershipAssignedStep = exports.createNftItemBurnStep = exports.createNftItemSendStep = exports.createJettonMinterBurnNotificationStep = exports.createJettonProxyOwnershipAssignedStep = exports.createJettonWalletBurnStep = exports.createJettonWalletReceiveStep = exports.createJettonWalletInternalTransferStep = exports.createCrossChainLayerTvmMsgToEvmStep = exports.CONTRACT_FEE_USAGE_PARAMS = exports.FIXED_POINT_SHIFT = void 0;
4
+ const Consts_1 = require("./Consts");
5
+ exports.FIXED_POINT_SHIFT = 2 ** 16;
6
+ exports.CONTRACT_FEE_USAGE_PARAMS = {
7
+ crossChainLayer: {
8
+ accountBits: 43514,
9
+ accountCells: 100,
10
+ gas: {
11
+ tvmMsgToEvm: 14619,
12
+ },
13
+ },
14
+ jettonWallet: {
15
+ accountBits: 949,
16
+ accountCells: 3,
17
+ estimatedAccountBits: 11000,
18
+ estimatedAccountCells: 25,
19
+ initStateBits: 847,
20
+ initStateCells: 3,
21
+ gas: {
22
+ internalTransfer: 10669,
23
+ receive: 11427,
24
+ burn: 8653,
25
+ estimatedSendTransfer: 11000,
26
+ estimatedReceiveTransfer: 12000,
27
+ },
28
+ },
29
+ jettonProxy: {
30
+ accountbits: 7760,
31
+ accountCells: 16,
32
+ gas: {
33
+ ownershipAssigned: 8515,
34
+ transferNotification: 8515,
35
+ errorNotification: 5556,
36
+ },
37
+ },
38
+ jettonMinter: {
39
+ accountBits: 10208,
40
+ accountCells: 28,
41
+ gas: {
42
+ burnNotification: 10357,
43
+ mintAfterError: 9654,
44
+ },
45
+ },
46
+ nftItem: {
47
+ accountBits: 1422,
48
+ accountCells: 5,
49
+ gas: {
50
+ send: 11722,
51
+ burn: 11552,
52
+ errorNotification: 4638,
53
+ },
54
+ },
55
+ nftProxy: {
56
+ accountBits: 7512,
57
+ accountCells: 15,
58
+ gas: {
59
+ ownershipAssigned: 7688,
60
+ errorNotification: 4737,
61
+ },
62
+ },
63
+ };
64
+ const createCrossChainLayerTvmMsgToEvmStep = (msgBits, msgCells) => ({
65
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
66
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
67
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
68
+ msgBits,
69
+ msgCells,
70
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
71
+ });
72
+ exports.createCrossChainLayerTvmMsgToEvmStep = createCrossChainLayerTvmMsgToEvmStep;
73
+ const createJettonWalletInternalTransferStep = (msgBits, msgCells) => ({
74
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
75
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
76
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.internalTransfer,
77
+ msgBits,
78
+ msgCells,
79
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
80
+ });
81
+ exports.createJettonWalletInternalTransferStep = createJettonWalletInternalTransferStep;
82
+ const createJettonWalletReceiveStep = (msgBits, msgCells) => ({
83
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
84
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
85
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.receive,
86
+ msgBits,
87
+ msgCells,
88
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
89
+ });
90
+ exports.createJettonWalletReceiveStep = createJettonWalletReceiveStep;
91
+ const createJettonWalletBurnStep = (msgBits, msgCells) => ({
92
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
93
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
94
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.burn,
95
+ msgBits,
96
+ msgCells,
97
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
98
+ });
99
+ exports.createJettonWalletBurnStep = createJettonWalletBurnStep;
100
+ const createJettonProxyOwnershipAssignedStep = (msgBits, msgCells) => ({
101
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.accountbits,
102
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.accountCells,
103
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.gas.ownershipAssigned,
104
+ msgBits,
105
+ msgCells,
106
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
107
+ });
108
+ exports.createJettonProxyOwnershipAssignedStep = createJettonProxyOwnershipAssignedStep;
109
+ const createJettonMinterBurnNotificationStep = (msgBits, msgCells) => ({
110
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountBits,
111
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountCells,
112
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.gas.burnNotification,
113
+ msgBits,
114
+ msgCells,
115
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
116
+ });
117
+ exports.createJettonMinterBurnNotificationStep = createJettonMinterBurnNotificationStep;
118
+ const createNftItemSendStep = (msgBits, msgCells) => ({
119
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountBits,
120
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountCells,
121
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.gas.send,
122
+ msgBits,
123
+ msgCells,
124
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
125
+ });
126
+ exports.createNftItemSendStep = createNftItemSendStep;
127
+ const createNftItemBurnStep = (msgBits, msgCells) => ({
128
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountBits,
129
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountCells,
130
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.gas.burn,
131
+ msgBits,
132
+ msgCells,
133
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
134
+ });
135
+ exports.createNftItemBurnStep = createNftItemBurnStep;
136
+ const createNftProxyOwnershipAssignedStep = (msgBits, msgCells) => ({
137
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.nftProxy.accountBits,
138
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.nftProxy.accountCells,
139
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.nftProxy.gas.ownershipAssigned,
140
+ msgBits,
141
+ msgCells,
142
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
143
+ });
144
+ exports.createNftProxyOwnershipAssignedStep = createNftProxyOwnershipAssignedStep;
145
+ const createErrorNotificationGasStep = (msgBits, msgCells) => ({
146
+ accountBits: 0,
147
+ accountCells: 0,
148
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.gas.errorNotification,
149
+ msgBits,
150
+ msgCells,
151
+ timeDelta: 0,
152
+ });
153
+ exports.createErrorNotificationGasStep = createErrorNotificationGasStep;
154
+ const createEstimatedSendTransferGasStep = (msgBits, msgCells) => ({
155
+ accountBits: 0,
156
+ accountCells: 0,
157
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.estimatedSendTransfer,
158
+ msgBits,
159
+ msgCells,
160
+ timeDelta: 0,
161
+ });
162
+ exports.createEstimatedSendTransferGasStep = createEstimatedSendTransferGasStep;
163
+ const createEstimatedReceiveTransferGasStep = (msgBits, msgCells) => ({
164
+ accountBits: 0,
165
+ accountCells: 0,
166
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.estimatedReceiveTransfer,
167
+ msgBits,
168
+ msgCells,
169
+ timeDelta: 0,
170
+ });
171
+ exports.createEstimatedReceiveTransferGasStep = createEstimatedReceiveTransferGasStep;
172
+ const createMintAfterErrorGasStep = (msgBits, msgCells) => ({
173
+ accountBits: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountBits,
174
+ accountCells: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountCells,
175
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.gas.mintAfterError,
176
+ msgBits,
177
+ msgCells,
178
+ timeDelta: Consts_1.ONE_YEAR_SECONDS,
179
+ });
180
+ exports.createMintAfterErrorGasStep = createMintAfterErrorGasStep;
181
+ const createNftProxyErrorNotificationStep = (msgBits, msgCells) => ({
182
+ accountBits: 0,
183
+ accountCells: 0,
184
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.nftProxy.gas.errorNotification,
185
+ msgBits,
186
+ msgCells,
187
+ timeDelta: 0,
188
+ });
189
+ exports.createNftProxyErrorNotificationStep = createNftProxyErrorNotificationStep;
190
+ const createNftItemErrorNotificationStep = () => ({
191
+ accountBits: 0,
192
+ accountCells: 0,
193
+ gasUsed: exports.CONTRACT_FEE_USAGE_PARAMS.nftItem.gas.errorNotification,
194
+ msgBits: 0,
195
+ msgCells: 0,
196
+ timeDelta: 0,
197
+ });
198
+ exports.createNftItemErrorNotificationStep = createNftItemErrorNotificationStep;
@@ -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, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, SuggestedTVMExecutorFee, TacGasPriceResponse, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
3
3
  export declare class LiteSequencerClient implements ILiteSequencerClient {
4
4
  private readonly endpoint;
5
5
  private readonly maxChunkSize;
@@ -13,6 +13,7 @@ export declare class LiteSequencerClient implements ILiteSequencerClient {
13
13
  getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
14
14
  convertCurrency(params: ConvertCurrencyParams): Promise<ConvertedCurrencyResult>;
15
15
  simulateTACMessage(params: TACSimulationParams): Promise<TACSimulationResult>;
16
+ getTACGasPrice(): Promise<TacGasPriceResponse>;
16
17
  getTVMExecutorFee(params: GetTVMExecutorFeeParams): Promise<SuggestedTVMExecutorFee>;
17
18
  private processChunkedRequest;
18
19
  }
@@ -29,6 +29,7 @@ class LiteSequencerClient {
29
29
  }
30
30
  }
31
31
  catch (error) {
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
33
  if (error?.response?.status === 404) {
33
34
  return '';
34
35
  }
@@ -60,6 +61,7 @@ class LiteSequencerClient {
60
61
  return response.data.response || '';
61
62
  }
62
63
  catch (error) {
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
65
  if (error?.response?.status === 404) {
64
66
  return '';
65
67
  }
@@ -164,6 +166,15 @@ class LiteSequencerClient {
164
166
  throw (0, instances_1.simulationFetchError)(`endpoint ${this.endpoint} failed to complete request`, error);
165
167
  }
166
168
  }
169
+ async getTACGasPrice() {
170
+ try {
171
+ const response = await this.httpClient.get(new URL('stats', 'https://explorer.tac.build/api/v2/').toString(), { transformResponse: [Utils_1.toCamelCaseTransformer] });
172
+ return response.data;
173
+ }
174
+ catch (error) {
175
+ throw (0, instances_1.gasPriceFetchError)(`endpoint https://explorer.tac.build/api/v2/ failed to complete request`, error);
176
+ }
177
+ }
167
178
  async getTVMExecutorFee(params) {
168
179
  try {
169
180
  const response = await this.httpClient.post(new URL('/ton/calculator/ton-executor-fee', this.endpoint).toString(), params, {
@@ -1,5 +1,5 @@
1
1
  import { ILiteSequencerClient, ILiteSequencerClientFactory, ILogger, IOperationTracker } from '../interfaces';
2
- import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, Network, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
2
+ import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, Network, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TacGasPriceResponse, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
3
3
  export declare class DefaultLiteSequencerClientFactory implements ILiteSequencerClientFactory {
4
4
  createClients(endpoints: string[]): ILiteSequencerClient[];
5
5
  }
@@ -18,5 +18,6 @@ export declare class OperationTracker implements IOperationTracker {
18
18
  getSimplifiedOperationStatus(transactionLinker: TransactionLinker): Promise<SimplifiedStatuses>;
19
19
  convertCurrency(params: ConvertCurrencyParams, waitOptions?: WaitOptions<ConvertedCurrencyResult>): Promise<ConvertedCurrencyResult>;
20
20
  simulateTACMessage(params: TACSimulationParams, waitOptions?: WaitOptions<TACSimulationResult>): Promise<TACSimulationResult>;
21
+ getTACGasPrice(): Promise<TacGasPriceResponse>;
21
22
  getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee>): Promise<SuggestedTVMExecutorFee>;
22
23
  }
@@ -287,6 +287,26 @@ class OperationTracker {
287
287
  ? await (0, Utils_1.waitUntilSuccess)(waitOptions, requestFn, 'OperationTracker: Simulating TAC message')
288
288
  : await requestFn();
289
289
  }
290
+ async getTACGasPrice() {
291
+ this.logger.debug(`Getting TAC gas price`);
292
+ const requestFn = async () => {
293
+ let lastError;
294
+ for (const client of this.clients) {
295
+ try {
296
+ const result = await client.getTACGasPrice();
297
+ this.logger.debug(`TAC gas price retrieved successfully`);
298
+ return result;
299
+ }
300
+ catch (error) {
301
+ this.logger.warn(`Failed to get TAC gas price using one of the endpoints`);
302
+ lastError = error;
303
+ }
304
+ }
305
+ this.logger.error('All endpoints failed to get TAC gas price');
306
+ throw (0, errors_1.allEndpointsFailedError)(lastError);
307
+ };
308
+ return await requestFn();
309
+ }
290
310
  async getTVMExecutorFee(params, waitOptions) {
291
311
  this.logger.debug(`get TVM executor fee: ${(0, Utils_1.formatObjectForLogging)(params)}`);
292
312
  const requestFn = async () => {
@@ -15,6 +15,5 @@ export declare class Simulator implements ISimulator {
15
15
  private calculateJettonBurnCrosschainFee;
16
16
  private calculateNftTransferCrosschainFee;
17
17
  private calculateNftBurnCrosschainFee;
18
- estimateTONFees(assets: Asset[], params: GeneratePayloadParams): bigint;
19
18
  estimateTONFee(asset: Asset, params: GeneratePayloadParams): bigint;
20
19
  }