@layerzerolabs/ton-sdk-tools 3.0.90 → 3.0.91
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 +6 -0
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var path = require('path');
|
|
|
5
5
|
var core = require('@ton/core');
|
|
6
6
|
var crc32 = require('crc-32');
|
|
7
7
|
var ethers = require('ethers');
|
|
8
|
-
var bigintBuffer = require('bigint-buffer');
|
|
9
8
|
var Event = require('@ton/sandbox/dist/event/Event');
|
|
10
9
|
var testUtils = require('@ton/test-utils');
|
|
11
10
|
var sha256Js = require('@aws-crypto/sha256-js');
|
|
@@ -35,6 +34,14 @@ var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
|
35
34
|
var crc32__namespace = /*#__PURE__*/_interopNamespace(crc32);
|
|
36
35
|
|
|
37
36
|
// src/sdk-tools.ts
|
|
37
|
+
function bufferToBigInt(value) {
|
|
38
|
+
return BigInt(`0x${value.toString("hex")}`);
|
|
39
|
+
}
|
|
40
|
+
function bigintToSizedBuffer(num, width) {
|
|
41
|
+
const hex = num.toString(16);
|
|
42
|
+
const padded = hex.padStart(width * 2, "0").slice(0, width * 2);
|
|
43
|
+
return Buffer.from(padded, "hex");
|
|
44
|
+
}
|
|
38
45
|
function to32ByteBuffer(value, maxIntermediateBufferSize = 66) {
|
|
39
46
|
if (typeof value === "string") {
|
|
40
47
|
if (!isValidHex(value)) {
|
|
@@ -44,12 +51,12 @@ function to32ByteBuffer(value, maxIntermediateBufferSize = 66) {
|
|
|
44
51
|
if (hex.length % 2 !== 0) {
|
|
45
52
|
hex = "0" + hex;
|
|
46
53
|
}
|
|
47
|
-
value =
|
|
54
|
+
value = bufferToBigInt(Buffer.from(hex, "hex"));
|
|
48
55
|
}
|
|
49
56
|
if (value instanceof Uint8Array) {
|
|
50
|
-
value =
|
|
57
|
+
value = bufferToBigInt(Buffer.from(value));
|
|
51
58
|
}
|
|
52
|
-
const bf =
|
|
59
|
+
const bf = bigintToSizedBuffer(BigInt(value), maxIntermediateBufferSize);
|
|
53
60
|
return bf.subarray(-32);
|
|
54
61
|
}
|
|
55
62
|
function trim0x(str2) {
|
|
@@ -6993,6 +7000,8 @@ exports.baseEncodeClass = baseEncodeClass;
|
|
|
6993
7000
|
exports.bigIntToHex = bigIntToHex;
|
|
6994
7001
|
exports.bigintToAddress = bigintToAddress;
|
|
6995
7002
|
exports.bigintToAsciiString = bigintToAsciiString;
|
|
7003
|
+
exports.bigintToSizedBuffer = bigintToSizedBuffer;
|
|
7004
|
+
exports.bufferToBigInt = bufferToBigInt;
|
|
6996
7005
|
exports.buildOnchainMetadata = buildOnchainMetadata;
|
|
6997
7006
|
exports.calculateCellConsumption = calculateCellConsumption;
|
|
6998
7007
|
exports.calculateCellConsumptionFromHex = calculateCellConsumptionFromHex;
|