@layerzerolabs/ton-sdk-tools 3.0.83 → 3.0.84-aptos-301.0

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/CHANGELOG.md CHANGED
@@ -1,17 +1,5 @@
1
1
  # @layerzerolabs/ton-sdk-tools
2
2
 
3
- ## 3.0.83
4
-
5
- ### Patch Changes
6
-
7
- - 6f36477: add flags for ton sdk to print tx log
8
-
9
- ## 3.0.82
10
-
11
- ### Patch Changes
12
-
13
- - e0e402e: animechain
14
-
15
3
  ## 3.0.81
16
4
 
17
5
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -329,6 +329,7 @@ function parseClasses(strInput) {
329
329
  const name = rawName.replace(/::New$/, "");
330
330
  const functionName = snakeToCamelCase("getnew_" + name);
331
331
  const [fieldMap, inverseFieldMap] = parseFieldNames(strInput);
332
+ console.log(`Parsing ${name}...`);
332
333
  const tonNameRegex = /const int\s+(?:md::)?[\w:]+::NAME = "(.*?)"u;/;
333
334
  const tonNameMatch = strInput.match(tonNameRegex);
334
335
  const tonName = tonNameMatch ? tonNameMatch[1] : name;
@@ -1372,6 +1373,8 @@ import {
1372
1373
  keyMap,
1373
1374
  } from '${options.relativeSrcPath}'
1374
1375
 
1376
+ const RECURSIVE_DECODE = false
1377
+
1375
1378
  export const ActionTypes: { [key: string]: bigint } = {
1376
1379
  increment: BigInt(1),
1377
1380
  aba: BigInt(2),
@@ -5977,12 +5980,6 @@ var JettonWallet = class _JettonWallet {
5977
5980
  return res.balance;
5978
5981
  }
5979
5982
  };
5980
- function setLzTonSdkWriteToConsole(enabled) {
5981
- process.env.LZ_TON_SDK_WRITE_TO_CONSOLE = enabled.toString();
5982
- }
5983
- function setLzTonSdkSaveToJson(enabled) {
5984
- process.env.LZ_TON_SDK_SAVE_TO_JSON = enabled.toString();
5985
- }
5986
5983
  var decimalCount = 9;
5987
5984
  var decimal = pow10(decimalCount);
5988
5985
  var defaultPath = "gasInfo";
@@ -6034,62 +6031,58 @@ function formatCoins(value, precision = 6) {
6034
6031
  function printTransactionTrace(transactions, opcodeInfo, callerStack, profile) {
6035
6032
  const { stack } = new Error();
6036
6033
  callerStack ?? (callerStack = stack);
6034
+ console.info(callerStack?.split("\n")[2].trim());
6037
6035
  let cumulativeFees = 0n;
6038
6036
  let gasInfo = {};
6039
6037
  let filePath = profile?.filePath ?? defaultPath;
6040
- const shouldProfileGas = profile?.profileGas ?? process.env.LZ_TON_SDK_SAVE_TO_JSON === "true";
6041
- const shouldWriteToConsole = profile?.writeToConsole ?? process.env.LZ_TON_SDK_WRITE_TO_CONSOLE === "true";
6042
- if (shouldProfileGas) {
6038
+ if (profile?.profileGas) {
6043
6039
  createDirectoryIfNotExist(filePath);
6044
- filePath = path__namespace.default.join(filePath, `${profile?.fileName ?? "gasInfo"}.json`);
6040
+ filePath = path__namespace.default.join(filePath, `${profile.fileName}.json`);
6045
6041
  gasInfo = readOrCreateJsonFile(filePath);
6046
6042
  }
6047
- if (shouldWriteToConsole) {
6048
- console.info(callerStack?.split("\n")[2].trim());
6049
- console.table(
6050
- transactions.map((tx) => {
6051
- if (tx.description.type !== "generic") return void 0;
6052
- const body = tx.inMessage?.info.type === "internal" ? tx.inMessage.body.beginParse() : void 0;
6053
- const op = body === void 0 ? 0n : body.remainingBits >= 32 ? body.preloadUint(32) : 0n;
6054
- const totalFees = formatCoins(tx.totalFees.coins);
6055
- const computeFees = formatCoins(
6056
- tx.description.computePhase.type === "vm" ? tx.description.computePhase.gasFees : void 0
6057
- );
6058
- const totalFwdFees = formatCoins(tx.description.actionPhase?.totalFwdFees ?? void 0);
6059
- formatCoins(
6060
- tx.inMessage?.info.type === "internal" ? tx.inMessage.info.value.coins : void 0
6061
- );
6062
- formatCoins(
6063
- tx.outMessages.values().reduce(
6064
- (total, message) => total + (message.info.type === "internal" ? message.info.value.coins : 0n),
6065
- 0n
6066
- )
6067
- );
6068
- const forwardIn = formatCoins(
6069
- tx.inMessage?.info.type === "internal" ? tx.inMessage.info.forwardFee : void 0
6070
- );
6071
- const addressString = tx.address.toString(16).length != 64 ? "UNKNOWN" : core.Address.parseRaw("1:" + tx.address.toString(16));
6072
- const opString = op.toString() in opcodeInfo ? opcodeInfo[op.toString()] : op.toString();
6073
- cumulativeFees += tx.totalFees.coins + (tx.description.actionPhase?.totalFwdFees ?? 0n);
6074
- if (shouldProfileGas) gasInfo[opString] = formatCoins(cumulativeFees);
6075
- return {
6076
- address: addressString,
6077
- op: opString,
6078
- // valueIn,
6079
- // valueOut,
6080
- totalFees,
6081
- inForwardFee: forwardIn,
6082
- outForwardFee: totalFwdFees,
6083
- // outActions: tx.description.actionPhase?.totalActions ?? 'N/A',
6084
- computeFee: computeFees,
6085
- // exitCode: tx.description.computePhase.type === 'vm' ? tx.description.computePhase.exitCode : 'N/A',
6086
- // actionCode: tx.description.actionPhase?.resultCode ?? 'N/A',
6087
- cumulativeFee: formatCoins(cumulativeFees)
6088
- };
6089
- }).filter((v) => v !== void 0)
6090
- );
6091
- }
6092
- if (shouldProfileGas) sortAndSave(filePath, gasInfo);
6043
+ console.table(
6044
+ transactions.map((tx) => {
6045
+ if (tx.description.type !== "generic") return void 0;
6046
+ const body = tx.inMessage?.info.type === "internal" ? tx.inMessage.body.beginParse() : void 0;
6047
+ const op = body === void 0 ? 0n : body.remainingBits >= 32 ? body.preloadUint(32) : 0n;
6048
+ const totalFees = formatCoins(tx.totalFees.coins);
6049
+ const computeFees = formatCoins(
6050
+ tx.description.computePhase.type === "vm" ? tx.description.computePhase.gasFees : void 0
6051
+ );
6052
+ const totalFwdFees = formatCoins(tx.description.actionPhase?.totalFwdFees ?? void 0);
6053
+ formatCoins(
6054
+ tx.inMessage?.info.type === "internal" ? tx.inMessage.info.value.coins : void 0
6055
+ );
6056
+ formatCoins(
6057
+ tx.outMessages.values().reduce(
6058
+ (total, message) => total + (message.info.type === "internal" ? message.info.value.coins : 0n),
6059
+ 0n
6060
+ )
6061
+ );
6062
+ const forwardIn = formatCoins(
6063
+ tx.inMessage?.info.type === "internal" ? tx.inMessage.info.forwardFee : void 0
6064
+ );
6065
+ const addressString = tx.address.toString(16).length != 64 ? "UNKNOWN" : core.Address.parseRaw("1:" + tx.address.toString(16));
6066
+ const opString = op.toString() in opcodeInfo ? opcodeInfo[op.toString()] : op.toString();
6067
+ cumulativeFees += tx.totalFees.coins + (tx.description.actionPhase?.totalFwdFees ?? 0n);
6068
+ if (profile?.profileGas) gasInfo[opString] = formatCoins(cumulativeFees);
6069
+ return {
6070
+ address: addressString,
6071
+ op: opString,
6072
+ // valueIn,
6073
+ // valueOut,
6074
+ totalFees,
6075
+ inForwardFee: forwardIn,
6076
+ outForwardFee: totalFwdFees,
6077
+ // outActions: tx.description.actionPhase?.totalActions ?? 'N/A',
6078
+ computeFee: computeFees,
6079
+ // exitCode: tx.description.computePhase.type === 'vm' ? tx.description.computePhase.exitCode : 'N/A',
6080
+ // actionCode: tx.description.actionPhase?.resultCode ?? 'N/A',
6081
+ cumulativeFee: formatCoins(cumulativeFees)
6082
+ };
6083
+ }).filter((v) => v !== void 0)
6084
+ );
6085
+ if (profile?.profileGas) sortAndSave(filePath, gasInfo);
6093
6086
  }
6094
6087
  async function sendMessageViaMultisigAndExpect({
6095
6088
  blockchain,
@@ -6274,8 +6267,6 @@ exports.saveTonObjectUnwrapper = saveTonObjectUnwrapper;
6274
6267
  exports.saveViewFunctions = saveViewFunctions;
6275
6268
  exports.sendInternalMessageAndExpect = sendInternalMessageAndExpect;
6276
6269
  exports.sendMessageViaMultisigAndExpect = sendMessageViaMultisigAndExpect;
6277
- exports.setLzTonSdkSaveToJson = setLzTonSdkSaveToJson;
6278
- exports.setLzTonSdkWriteToConsole = setLzTonSdkWriteToConsole;
6279
6270
  exports.storageCollected = storageCollected;
6280
6271
  exports.to32ByteBuffer = to32ByteBuffer;
6281
6272
  exports.toHaveTransactions = toHaveTransactions;