@layerzerolabs/ton-sdk-tools 3.0.81 → 3.0.83
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 +12 -0
- package/dist/index.cjs +58 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +57 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -329,7 +329,6 @@ 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}...`);
|
|
333
332
|
const tonNameRegex = /const int\s+(?:md::)?[\w:]+::NAME = "(.*?)"u;/;
|
|
334
333
|
const tonNameMatch = strInput.match(tonNameRegex);
|
|
335
334
|
const tonName = tonNameMatch ? tonNameMatch[1] : name;
|
|
@@ -1373,8 +1372,6 @@ import {
|
|
|
1373
1372
|
keyMap,
|
|
1374
1373
|
} from '${options.relativeSrcPath}'
|
|
1375
1374
|
|
|
1376
|
-
const RECURSIVE_DECODE = false
|
|
1377
|
-
|
|
1378
1375
|
export const ActionTypes: { [key: string]: bigint } = {
|
|
1379
1376
|
increment: BigInt(1),
|
|
1380
1377
|
aba: BigInt(2),
|
|
@@ -5980,6 +5977,12 @@ var JettonWallet = class _JettonWallet {
|
|
|
5980
5977
|
return res.balance;
|
|
5981
5978
|
}
|
|
5982
5979
|
};
|
|
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
|
+
}
|
|
5983
5986
|
var decimalCount = 9;
|
|
5984
5987
|
var decimal = pow10(decimalCount);
|
|
5985
5988
|
var defaultPath = "gasInfo";
|
|
@@ -6031,58 +6034,62 @@ function formatCoins(value, precision = 6) {
|
|
|
6031
6034
|
function printTransactionTrace(transactions, opcodeInfo, callerStack, profile) {
|
|
6032
6035
|
const { stack } = new Error();
|
|
6033
6036
|
callerStack ?? (callerStack = stack);
|
|
6034
|
-
console.info(callerStack?.split("\n")[2].trim());
|
|
6035
6037
|
let cumulativeFees = 0n;
|
|
6036
6038
|
let gasInfo = {};
|
|
6037
6039
|
let filePath = profile?.filePath ?? defaultPath;
|
|
6038
|
-
|
|
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) {
|
|
6039
6043
|
createDirectoryIfNotExist(filePath);
|
|
6040
|
-
filePath = path__namespace.default.join(filePath, `${profile
|
|
6044
|
+
filePath = path__namespace.default.join(filePath, `${profile?.fileName ?? "gasInfo"}.json`);
|
|
6041
6045
|
gasInfo = readOrCreateJsonFile(filePath);
|
|
6042
6046
|
}
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
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);
|
|
6086
6093
|
}
|
|
6087
6094
|
async function sendMessageViaMultisigAndExpect({
|
|
6088
6095
|
blockchain,
|
|
@@ -6267,6 +6274,8 @@ exports.saveTonObjectUnwrapper = saveTonObjectUnwrapper;
|
|
|
6267
6274
|
exports.saveViewFunctions = saveViewFunctions;
|
|
6268
6275
|
exports.sendInternalMessageAndExpect = sendInternalMessageAndExpect;
|
|
6269
6276
|
exports.sendMessageViaMultisigAndExpect = sendMessageViaMultisigAndExpect;
|
|
6277
|
+
exports.setLzTonSdkSaveToJson = setLzTonSdkSaveToJson;
|
|
6278
|
+
exports.setLzTonSdkWriteToConsole = setLzTonSdkWriteToConsole;
|
|
6270
6279
|
exports.storageCollected = storageCollected;
|
|
6271
6280
|
exports.to32ByteBuffer = to32ByteBuffer;
|
|
6272
6281
|
exports.toHaveTransactions = toHaveTransactions;
|