@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
@@ -6,7 +6,7 @@ const assets_1 = require("../assets");
6
6
  const errors_1 = require("../errors");
7
7
  const instances_1 = require("../errors/instances");
8
8
  const Struct_1 = require("../structs/Struct");
9
- const Consts_1 = require("./Consts");
9
+ const Fees_1 = require("./Fees");
10
10
  const Logger_1 = require("./Logger");
11
11
  const Utils_1 = require("./Utils");
12
12
  const Validator_1 = require("./Validator");
@@ -77,153 +77,63 @@ class Simulator {
77
77
  // Message size
78
78
  msgBits, msgCells,
79
79
  // Gas and computation
80
- gasUsed,
81
- // Config values (defaults for BaseChain)
82
- bitPricePs = 1, cellPricePs = 500, lumpPrice = 400000, gasPrice = 400, firstFrac = 21845, ihrPriceFactor = 0, }) {
80
+ gasUsed, accountBitPrice, accountCellPrice, lumpPrice, gasPrice, firstFrac, ihrPriceFactor, msgBitPrice, msgCellPrice, }) {
83
81
  // Storage Fee (nanotons)
84
- const storageFee = Math.ceil(((accountBits * bitPricePs + accountCells * cellPricePs) * timeDelta) / Consts_1.FIXED_POINT_SHIFT);
82
+ const storageFee = Math.ceil(((accountBits * accountBitPrice + accountCells * accountCellPrice) * timeDelta) / Fees_1.FIXED_POINT_SHIFT);
85
83
  // Computation Fee (nanotons)
86
84
  const computeFee = gasUsed * gasPrice;
87
85
  // Forwarding Fee (nanotons)
88
- const msgFwdFees = lumpPrice + Math.ceil((bitPricePs * msgBits + cellPricePs * msgCells) / Consts_1.FIXED_POINT_SHIFT);
89
- const ihrFwdFees = Math.ceil((msgFwdFees * ihrPriceFactor) / Consts_1.FIXED_POINT_SHIFT);
86
+ const msgFwdFees = lumpPrice + Math.ceil((msgBitPrice * msgBits + msgCellPrice * msgCells) / Fees_1.FIXED_POINT_SHIFT);
87
+ const ihrFwdFees = Math.ceil((msgFwdFees * ihrPriceFactor) / Fees_1.FIXED_POINT_SHIFT);
90
88
  const totalFwdFees = msgFwdFees + ihrFwdFees;
91
89
  // Action Fee (nanotons)
92
- const actionFee = Math.floor((msgFwdFees * firstFrac) / Consts_1.FIXED_POINT_SHIFT);
90
+ const actionFee = Math.floor((msgFwdFees * firstFrac) / Fees_1.FIXED_POINT_SHIFT);
93
91
  // Combine all fees
94
92
  const totalFees = BigInt(storageFee) + BigInt(computeFee) + BigInt(actionFee) + BigInt(totalFwdFees);
95
93
  return totalFees;
96
94
  }
97
95
  calculateTransactionPipeline(steps) {
98
- return steps.reduce((total, step) => total + this.calculateTONFees(step), 0n);
96
+ return steps.reduce((total, step) => total + this.calculateTONFees({ ...step, ...this.config.TONParams.feesParams }), 0n);
99
97
  }
100
98
  calculateTONCrosschainFee(msgBits, msgCells) {
101
- return this.calculateTransactionPipeline([
102
- {
103
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
104
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
105
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
106
- msgBits,
107
- msgCells,
108
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
109
- },
110
- ]);
99
+ return this.calculateTransactionPipeline([(0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(msgBits, msgCells)]);
111
100
  }
112
101
  calculateJettonTransferCrosschainFee(msgBits, msgCells) {
113
102
  return this.calculateTransactionPipeline([
114
- {
115
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
116
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
117
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.internalTransfer,
118
- msgBits,
119
- msgCells,
120
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
121
- },
122
- {
123
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
124
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
125
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.receive,
126
- msgBits,
127
- msgCells,
128
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
129
- },
130
- {
131
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.accountbits,
132
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.accountCells,
133
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonProxy.gas.ownershipAssigned,
134
- msgBits,
135
- msgCells,
136
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
137
- },
138
- {
139
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
140
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
141
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
142
- msgBits,
143
- msgCells,
144
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
145
- },
103
+ (0, Fees_1.createJettonWalletInternalTransferStep)(msgBits, msgCells),
104
+ (0, Fees_1.createJettonWalletReceiveStep)(msgBits, msgCells),
105
+ (0, Fees_1.createJettonProxyOwnershipAssignedStep)(msgBits, msgCells),
106
+ (0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(msgBits, msgCells),
107
+ (0, Fees_1.createErrorNotificationGasStep)(msgBits, msgCells),
108
+ (0, Fees_1.createEstimatedSendTransferGasStep)(msgBits, msgCells),
109
+ (0, Fees_1.createEstimatedReceiveTransferGasStep)(msgBits, msgCells),
146
110
  ]);
147
111
  }
148
112
  calculateJettonBurnCrosschainFee(msgBits, msgCells) {
149
113
  return this.calculateTransactionPipeline([
150
- {
151
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountBits,
152
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.accountCells,
153
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonWallet.gas.burn,
154
- msgBits,
155
- msgCells,
156
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
157
- },
158
- {
159
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountBits,
160
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.accountCells,
161
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.jettonMinter.gas.burnNotification,
162
- msgBits,
163
- msgCells,
164
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
165
- },
166
- {
167
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
168
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
169
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
170
- msgBits,
171
- msgCells,
172
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
173
- },
114
+ (0, Fees_1.createJettonWalletBurnStep)(msgBits, msgCells),
115
+ (0, Fees_1.createJettonMinterBurnNotificationStep)(msgBits, msgCells),
116
+ (0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(msgBits, msgCells),
117
+ (0, Fees_1.createMintAfterErrorGasStep)(msgBits, msgCells),
118
+ (0, Fees_1.createJettonWalletReceiveStep)(msgBits, msgCells),
174
119
  ]);
175
120
  }
176
121
  calculateNftTransferCrosschainFee(msgBits, msgCells) {
177
122
  return this.calculateTransactionPipeline([
178
- {
179
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountBits,
180
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountCells,
181
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.gas.send,
182
- msgBits,
183
- msgCells,
184
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
185
- },
186
- {
187
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftProxy.accountBits,
188
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftProxy.accountCells,
189
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftProxy.gas.ownershipAssigned,
190
- msgBits,
191
- msgCells,
192
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
193
- },
194
- {
195
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
196
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
197
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
198
- msgBits,
199
- msgCells,
200
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
201
- },
123
+ (0, Fees_1.createNftItemSendStep)(msgBits, msgCells),
124
+ (0, Fees_1.createNftProxyOwnershipAssignedStep)(msgBits, msgCells),
125
+ (0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(msgBits, msgCells),
126
+ (0, Fees_1.createNftProxyErrorNotificationStep)(msgBits, msgCells),
127
+ (0, Fees_1.createNftItemSendStep)(msgBits, msgCells),
202
128
  ]);
203
129
  }
204
130
  calculateNftBurnCrosschainFee(msgBits, msgCells) {
205
131
  return this.calculateTransactionPipeline([
206
- {
207
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountBits,
208
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.accountCells,
209
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.nftItem.gas.burn,
210
- msgBits,
211
- msgCells,
212
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
213
- },
214
- {
215
- accountBits: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountBits,
216
- accountCells: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.accountCells,
217
- gasUsed: Consts_1.CONTRACT_FEE_USAGE_PARAMS.crossChainLayer.gas.tvmMsgToEvm,
218
- msgBits,
219
- msgCells,
220
- timeDelta: Consts_1.ONE_YEAR_SECONDS,
221
- },
132
+ (0, Fees_1.createNftItemBurnStep)(msgBits, msgCells),
133
+ (0, Fees_1.createCrossChainLayerTvmMsgToEvmStep)(msgBits, msgCells),
134
+ (0, Fees_1.createNftItemErrorNotificationStep)(),
222
135
  ]);
223
136
  }
224
- estimateTONFees(assets, params) {
225
- return assets.reduce((totalFees, asset) => totalFees + this.estimateTONFee(asset, params), 0n);
226
- }
227
137
  estimateTONFee(asset, params) {
228
138
  const payload = asset.generatePayload(params);
229
139
  const { bits: msgBits, cells: msgCells } = (0, Utils_1.recurisivelyCollectCellStats)(payload);
@@ -71,7 +71,7 @@ async function startTracking(transactionLinker, network, options) {
71
71
  for (const tx of transactions) {
72
72
  try {
73
73
  logger.debug(`Verifying transaction: ${tx.hash}`);
74
- await txFinalizer.trackTransactionTree(cclAddress, tx.hash, { maxDepth: 10 });
74
+ await txFinalizer.trackTransactionTree(cclAddress, tx.hash, { maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH });
75
75
  logger.debug(`Transaction ${tx.hash} verified successfully in TON`);
76
76
  }
77
77
  catch (error) {
@@ -55,7 +55,7 @@ class TONTransactionManager {
55
55
  async prepareCrossChainTransaction(evmProxyMsg, sender, assets, options, skipAssetsBalanceValidation = false) {
56
56
  this.logger.debug('Preparing cross-chain transaction');
57
57
  const caller = sender.getSenderAddress();
58
- const { allowSimulationError = false, isRoundTrip = undefined, calculateRollbackFee = true, validateAssetsBalance = true, } = options || {};
58
+ const { allowSimulationError = false, isRoundTrip = undefined, calculateRollbackFee = true, validateAssetsBalance = true, evmDataBuilder = Utils_1.buildEvmDataCell, } = options || {};
59
59
  const { evmValidExecutors = [], tvmValidExecutors = [] } = options || {};
60
60
  Validator_1.Validator.validateEVMAddress(evmProxyMsg.evmTargetAddress);
61
61
  const aggregatedData = (0, Utils_1.aggregateTokens)(assets);
@@ -91,7 +91,7 @@ class TONTransactionManager {
91
91
  tac: tacExecutors,
92
92
  ton: tonExecutors,
93
93
  };
94
- const evmData = (0, Utils_1.buildEvmDataCell)(transactionLinker, evmProxyMsg, validExecutors);
94
+ const evmData = evmDataBuilder(transactionLinker, evmProxyMsg, validExecutors);
95
95
  const messages = await this.generateCrossChainMessages(caller, evmData, aggregatedData, feeParams);
96
96
  return {
97
97
  transaction: {
@@ -176,7 +176,7 @@ class TONTransactionManager {
176
176
  const hash = (0, Utils_1.getNormalizedExtMessageHash)((0, ton_1.loadMessage)(ton_1.Cell.fromBase64(sendTransactionResult.boc).beginParse()));
177
177
  this.logger.info(`Tracking transaction tree for hash: ${hash}`);
178
178
  await this.txFinalizer.trackTransactionTree(sender.getSenderAddress(), hash, {
179
- maxDepth: 10,
179
+ maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
180
180
  });
181
181
  this.logger.info(`Transaction tree successful`);
182
182
  }
@@ -42,4 +42,9 @@ export declare class TacSdk implements ITacSDK {
42
42
  getEVMNFTAddress(tvmNFTAddress: string, addressType: NFTAddressType): Promise<string>;
43
43
  getOperationTracker(): IOperationTracker;
44
44
  prepareCrossChainTransactionPayload(evmProxyMsg: EvmProxyMsg, senderAddress: string, assets?: AssetLike[], options?: CrossChainTransactionOptions): Promise<CrossChainPayloadResult[]>;
45
+ getTACGasPrice(): Promise<{
46
+ average: number;
47
+ fast: number;
48
+ slow: number;
49
+ }>;
45
50
  }
@@ -183,5 +183,13 @@ class TacSdk {
183
183
  const normalizedAssets = await (0, Utils_1.normalizeAssets)(this.config, assets);
184
184
  return this.tonTransactionManager.prepareCrossChainTransactionPayload(evmProxyMsg, senderAddress, normalizedAssets, options);
185
185
  }
186
+ async getTACGasPrice() {
187
+ const response = await this.operationTracker.getTACGasPrice();
188
+ return {
189
+ average: response.gasPrices.average,
190
+ fast: response.gasPrices.fast,
191
+ slow: response.gasPrices.slow,
192
+ };
193
+ }
186
194
  }
187
195
  exports.TacSdk = TacSdk;
@@ -6,7 +6,7 @@ export declare class TonTxFinalizer implements ITxFinalizer {
6
6
  private contractOpener;
7
7
  constructor(contractOpener: ContractOpener, logger?: ILogger);
8
8
  private fetchAdjacentTransactions;
9
- trackTransactionTree(address: string, hash: string, params: {
9
+ trackTransactionTree(address: string, hash: string, params?: {
10
10
  maxDepth?: number;
11
11
  }): Promise<void>;
12
12
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TonIndexerTxFinalizer = exports.TonTxFinalizer = void 0;
4
4
  const ton_1 = require("@ton/ton");
5
5
  const AxiosHttpClient_1 = require("./AxiosHttpClient");
6
+ const Consts_1 = require("./Consts");
6
7
  const Logger_1 = require("./Logger");
7
8
  const Utils_1 = require("./Utils");
8
9
  const IGNORE_OPCODE = [
@@ -42,8 +43,8 @@ class TonTxFinalizer {
42
43
  return [];
43
44
  }
44
45
  // Checks if all transactions in the tree are successful
45
- async trackTransactionTree(address, hash, params) {
46
- const { maxDepth = 10 } = params;
46
+ async trackTransactionTree(address, hash, params = { maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH }) {
47
+ const { maxDepth = Consts_1.DEFAULT_FIND_TX_MAX_DEPTH } = params;
47
48
  const parsedAddress = ton_1.Address.parse(address);
48
49
  const visitedHashes = new Set();
49
50
  const queue = [{ address: parsedAddress, hash, depth: 0 }];
@@ -64,6 +65,8 @@ class TonTxFinalizer {
64
65
  for (const tx of transactions) {
65
66
  if (tx.description.type !== 'generic' || !tx.inMessage)
66
67
  continue;
68
+ if (tx.inMessage.info.type === 'internal' && tx.inMessage.info.value.coins === Consts_1.IGNORE_MSG_VALUE_1_NANO)
69
+ continue; // we ignore messages with 1 nanoton value as they are for notification purpose only
67
70
  const bodySlice = tx.inMessage.body.beginParse();
68
71
  if (bodySlice.remainingBits < 32)
69
72
  continue;
@@ -141,8 +144,8 @@ class TonIndexerTxFinalizer {
141
144
  return [];
142
145
  }
143
146
  // Checks if all transactions in the tree are successful
144
- async trackTransactionTree(_, hash, params = { maxDepth: 10 }) {
145
- const { maxDepth = 10 } = params;
147
+ async trackTransactionTree(_, hash, params = { maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH }) {
148
+ const { maxDepth = Consts_1.DEFAULT_FIND_TX_MAX_DEPTH } = params;
146
149
  const visitedHashes = new Set();
147
150
  const queue = [{ hash, depth: 0 }];
148
151
  while (queue.length > 0) {
@@ -156,6 +159,8 @@ class TonIndexerTxFinalizer {
156
159
  if (transactions.length === 0)
157
160
  continue;
158
161
  for (const tx of transactions) {
162
+ if (tx.inMsg.value === Consts_1.IGNORE_MSG_VALUE_1_NANO.toString())
163
+ continue; // we ignore messages with 1 nanoton value as they are for notification purpose only
159
164
  if (!IGNORE_OPCODE.includes(Number(tx.inMsg.opcode)) && tx.inMsg.opcode !== null) {
160
165
  const { aborted, computePh: compute_ph, action } = tx.description;
161
166
  if (aborted ||
@@ -341,12 +341,12 @@ async function retry(fn, options) {
341
341
  throw lastError;
342
342
  }
343
343
  function recurisivelyCollectCellStats(cell) {
344
- let bits = 0;
345
- let cells = 0;
344
+ let bits = cell.bits.length;
345
+ let cells = 1;
346
346
  for (const ref of cell.refs) {
347
347
  const stats = recurisivelyCollectCellStats(ref);
348
348
  bits += stats.bits;
349
349
  cells += stats.cells;
350
350
  }
351
- return { bits: cell.bits.length + bits, cells: 1 + cells };
351
+ return { bits, cells };
352
352
  }
@@ -36,6 +36,7 @@ export type InternalTONParams = {
36
36
  jettonWalletCode: Cell;
37
37
  nftItemCode: Cell;
38
38
  nftCollectionCode: Cell;
39
+ feesParams: TONFeesParams;
39
40
  };
40
41
  export type InternalTACParams = {
41
42
  provider: AbstractProvider;
@@ -87,6 +88,7 @@ export type ToncenterTransaction = {
87
88
  inMsg: {
88
89
  hash: string;
89
90
  opcode: string;
91
+ value: string;
90
92
  };
91
93
  outMsgs: {
92
94
  hash: string;
@@ -136,19 +138,15 @@ export type AddressInformation = {
136
138
  hash: string;
137
139
  };
138
140
  };
139
- export type TONFeeCalculationParams = {
140
- accountBits: number;
141
- accountCells: number;
142
- timeDelta: number;
143
- msgBits: number;
144
- msgCells: number;
145
- gasUsed: number;
146
- bitPricePs?: number;
147
- cellPricePs?: number;
148
- lumpPrice?: number;
149
- gasPrice?: number;
150
- firstFrac?: number;
151
- ihrPriceFactor?: number;
141
+ export type TONFeesParams = {
142
+ accountBitPrice: number;
143
+ accountCellPrice: number;
144
+ lumpPrice: number;
145
+ gasPrice: number;
146
+ firstFrac: number;
147
+ ihrPriceFactor: number;
148
+ msgBitPrice: number;
149
+ msgCellPrice: number;
152
150
  };
153
151
  export type TransactionFeeCalculationStep = {
154
152
  accountBits: number;
@@ -158,3 +156,4 @@ export type TransactionFeeCalculationStep = {
158
156
  msgCells: number;
159
157
  timeDelta: number;
160
158
  };
159
+ export type TONFeeCalculationParams = TransactionFeeCalculationStep & TONFeesParams;
@@ -109,7 +109,6 @@ export type EvmProxyMsg = {
109
109
  methodName?: string;
110
110
  encodedParameters?: string;
111
111
  gasLimit?: bigint;
112
- [key: string]: unknown;
113
112
  };
114
113
  export type TransactionLinker = {
115
114
  caller: string;
@@ -287,6 +286,7 @@ export type FeeParams = {
287
286
  tvmExecutorFee: bigint;
288
287
  evmEstimatedGas?: bigint;
289
288
  };
289
+ export type evmDataBuilder = (transactionLinker: TransactionLinker, evmProxyMsg: EvmProxyMsg, validExecutors: ValidExecutors) => Cell;
290
290
  export type CrossChainTransactionOptions = {
291
291
  allowSimulationError?: boolean;
292
292
  isRoundTrip?: boolean;
@@ -300,6 +300,7 @@ export type CrossChainTransactionOptions = {
300
300
  validateAssetsBalance?: boolean;
301
301
  waitOperationId?: boolean;
302
302
  waitOptions?: WaitOptions<string>;
303
+ evmDataBuilder?: evmDataBuilder;
303
304
  };
304
305
  export type BatchCrossChainTransactionOptions = Omit<CrossChainTransactionOptions, 'waitOperationId' | 'waitOptions'>;
305
306
  export type CrossChainTransactionsOptions = {
@@ -445,3 +446,10 @@ export type GeneratePayloadParams = {
445
446
  forwardFeeTonAmount?: bigint;
446
447
  feeParams?: FeeParams;
447
448
  };
449
+ export type TacGasPriceResponse = {
450
+ gasPrices: {
451
+ average: number;
452
+ fast: number;
453
+ slow: number;
454
+ };
455
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonappchain/sdk",
3
- "version": "0.7.2-alpha-3",
3
+ "version": "0.7.2-alpha-5",
4
4
  "repository": "https://github.com/TacBuild/tac-sdk.git",
5
5
  "author": "TAC. <developers@tac>",
6
6
  "license": "MIT",