@layerzerolabs/ton-sdk-tools 3.0.111 → 3.0.112-aptos.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 +0 -6
- package/dist/index.cjs +0 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -115
- package/dist/index.d.ts +1 -115
- package/dist/index.mjs +1 -215
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -201,11 +201,6 @@ function addLibToBlockchain(blockchain, newLib) {
|
|
|
201
201
|
libsDict.set(BigInt(`0x${newLib.hash().toString("hex")}`), newLib);
|
|
202
202
|
blockchain.libs = core.beginCell().storeDictDirect(libsDict).endCell();
|
|
203
203
|
}
|
|
204
|
-
function getEncodedMessageFromEncodedPacket(encodedPacket) {
|
|
205
|
-
const packetSlice = encodedPacket.beginParse();
|
|
206
|
-
const messageSlice = packetSlice.skip(8).skip(64).skip(32).skip(256).skip(32).skip(256).skip(256);
|
|
207
|
-
return core.beginCell().storeSlice(messageSlice).endCell();
|
|
208
|
-
}
|
|
209
204
|
|
|
210
205
|
// src/sdk-tools.ts
|
|
211
206
|
var file_signature_header = `////// Generated by sdk/sdk-generator.ts`;
|
|
@@ -7015,215 +7010,6 @@ async function getLzDict(obj, fieldName, wrapper) {
|
|
|
7015
7010
|
return new LzDict(dictCell);
|
|
7016
7011
|
}
|
|
7017
7012
|
|
|
7018
|
-
// src/ton-bit-array.ts
|
|
7019
|
-
var TonBitArray = class _TonBitArray {
|
|
7020
|
-
/**
|
|
7021
|
-
* Creates a new TonBitArray with the specified size.
|
|
7022
|
-
* All bits are initially set to false.
|
|
7023
|
-
*
|
|
7024
|
-
* @param size The number of bits in the array
|
|
7025
|
-
*/
|
|
7026
|
-
constructor(size) {
|
|
7027
|
-
this.size = size;
|
|
7028
|
-
this.bits = new Array(size).fill(false);
|
|
7029
|
-
}
|
|
7030
|
-
/**
|
|
7031
|
-
* Creates a TonBitArray from a single TON Cell.
|
|
7032
|
-
* Reads all bits from the cell sequentially and creates a bit array representation.
|
|
7033
|
-
*
|
|
7034
|
-
* @param cell The TON Cell to extract bits from
|
|
7035
|
-
* @returns A new TonBitArray containing the bits from the cell
|
|
7036
|
-
*/
|
|
7037
|
-
static fromSingleCell(cell) {
|
|
7038
|
-
const slice = cell.beginParse();
|
|
7039
|
-
const bitCount = cell.bits.length;
|
|
7040
|
-
const bitArray = new _TonBitArray(bitCount);
|
|
7041
|
-
for (let i = 0; i < bitCount; i++) {
|
|
7042
|
-
if (slice.loadBit()) {
|
|
7043
|
-
bitArray.set(i);
|
|
7044
|
-
}
|
|
7045
|
-
}
|
|
7046
|
-
return bitArray;
|
|
7047
|
-
}
|
|
7048
|
-
/**
|
|
7049
|
-
* Creates a TonBitArray from a root TON Cell and all its references using depth-first traversal.
|
|
7050
|
-
* Performs a depth-first search through the cell and all its references to collect bits.
|
|
7051
|
-
* The resulting bit array contains bits from the root cell followed by bits from all referenced cells.
|
|
7052
|
-
*
|
|
7053
|
-
* @param input The root TON Cell to traverse
|
|
7054
|
-
* @returns A new TonBitArray containing bits from the root cell and all its references
|
|
7055
|
-
*/
|
|
7056
|
-
static fromRootCellWithDFS(input) {
|
|
7057
|
-
function dfs(cell) {
|
|
7058
|
-
const currentBitArray = _TonBitArray.fromSingleCell(cell);
|
|
7059
|
-
const refBitArrays = cell.refs.map((ref) => dfs(ref));
|
|
7060
|
-
return _TonBitArray.concatMultiple([currentBitArray, ...refBitArrays]);
|
|
7061
|
-
}
|
|
7062
|
-
return dfs(input);
|
|
7063
|
-
}
|
|
7064
|
-
/**
|
|
7065
|
-
* Creates a TonBitArray using a custom iteration algorithm on a TON Cell.
|
|
7066
|
-
* This method provides flexibility for implementing different traversal strategies
|
|
7067
|
-
* (e.g., breadth-first search, filtered traversal, or custom processing logic).
|
|
7068
|
-
*
|
|
7069
|
-
* @param input The TON Cell to process
|
|
7070
|
-
* @param iterationFn Custom iteration function that processes the cell and returns an array of TonBitArray objects
|
|
7071
|
-
* @returns A new TonBitArray created by concatenating all bit arrays returned by the iteration function
|
|
7072
|
-
*/
|
|
7073
|
-
static fromCellWithCustomIteration(input, iterationFn) {
|
|
7074
|
-
const bitArrays = iterationFn(input);
|
|
7075
|
-
return _TonBitArray.concatMultiple(bitArrays);
|
|
7076
|
-
}
|
|
7077
|
-
/**
|
|
7078
|
-
* Sets a bit at the specified index to true.
|
|
7079
|
-
* Does nothing if the index is out of bounds.
|
|
7080
|
-
*
|
|
7081
|
-
* @param index The zero-based index of the bit to set
|
|
7082
|
-
*/
|
|
7083
|
-
set(index) {
|
|
7084
|
-
if (index >= 0 && index < this.size) {
|
|
7085
|
-
this.bits[index] = true;
|
|
7086
|
-
}
|
|
7087
|
-
}
|
|
7088
|
-
/**
|
|
7089
|
-
* Gets the value of a bit at the specified index.
|
|
7090
|
-
* Returns false if the index is out of bounds.
|
|
7091
|
-
*
|
|
7092
|
-
* @param index The zero-based index of the bit to get
|
|
7093
|
-
* @returns The boolean value of the bit at the specified index, or false if out of bounds
|
|
7094
|
-
*/
|
|
7095
|
-
get(index) {
|
|
7096
|
-
if (index >= 0 && index < this.size) {
|
|
7097
|
-
return this.bits[index];
|
|
7098
|
-
}
|
|
7099
|
-
return false;
|
|
7100
|
-
}
|
|
7101
|
-
/**
|
|
7102
|
-
* Compares this TonBitArray with another TonBitArray for equality.
|
|
7103
|
-
* Two bit arrays are considered equal if they have the same size and all bits at corresponding positions are equal.
|
|
7104
|
-
*
|
|
7105
|
-
* @param other The TonBitArray to compare with this one
|
|
7106
|
-
* @returns True if both bit arrays are equal, false otherwise
|
|
7107
|
-
*/
|
|
7108
|
-
equals(other) {
|
|
7109
|
-
if (this.size !== other.size) {
|
|
7110
|
-
return false;
|
|
7111
|
-
}
|
|
7112
|
-
for (let i = 0; i < this.size; i++) {
|
|
7113
|
-
if (this.bits[i] !== other.bits[i]) {
|
|
7114
|
-
return false;
|
|
7115
|
-
}
|
|
7116
|
-
}
|
|
7117
|
-
return true;
|
|
7118
|
-
}
|
|
7119
|
-
/**
|
|
7120
|
-
* Extracts a section of the bit array and returns a new TonBitArray.
|
|
7121
|
-
* Similar to JavaScript's Array.slice() method, this creates a shallow copy of a portion of the bit array.
|
|
7122
|
-
*
|
|
7123
|
-
* @param start The zero-based index at which to start extraction (inclusive).
|
|
7124
|
-
* If negative, it's treated as (size + start). If omitted, defaults to 0.
|
|
7125
|
-
* @param end The zero-based index at which to end extraction (exclusive).
|
|
7126
|
-
* If negative, it's treated as (size + end). If omitted, extracts to the end of the array.
|
|
7127
|
-
* @returns A new TonBitArray containing the extracted bits
|
|
7128
|
-
*
|
|
7129
|
-
* @example
|
|
7130
|
-
* const array = new TonBitArray(8)
|
|
7131
|
-
* array.set(1); array.set(3); array.set(5)
|
|
7132
|
-
* const sliced = array.slice(1, 6) // Gets bits from index 1 to 5 (inclusive)
|
|
7133
|
-
*/
|
|
7134
|
-
slice(start, end) {
|
|
7135
|
-
const actualStart = start ?? 0;
|
|
7136
|
-
const actualEnd = end ?? this.size;
|
|
7137
|
-
const normalizedStart = actualStart < 0 ? Math.max(0, this.size + actualStart) : Math.min(actualStart, this.size);
|
|
7138
|
-
const normalizedEnd = actualEnd < 0 ? Math.max(0, this.size + actualEnd) : Math.min(actualEnd, this.size);
|
|
7139
|
-
const validStart = Math.min(normalizedStart, normalizedEnd);
|
|
7140
|
-
const validEnd = Math.max(normalizedStart, normalizedEnd);
|
|
7141
|
-
const sliceSize = validEnd - validStart;
|
|
7142
|
-
const result = new _TonBitArray(sliceSize);
|
|
7143
|
-
for (let i = 0; i < sliceSize; i++) {
|
|
7144
|
-
if (this.bits[validStart + i]) {
|
|
7145
|
-
result.set(i);
|
|
7146
|
-
}
|
|
7147
|
-
}
|
|
7148
|
-
return result;
|
|
7149
|
-
}
|
|
7150
|
-
/**
|
|
7151
|
-
* Concatenates this TonBitArray with another TonBitArray.
|
|
7152
|
-
* Creates a new TonBitArray containing all bits from this array followed by all bits from the other array.
|
|
7153
|
-
*
|
|
7154
|
-
* @param other The TonBitArray to concatenate with this one
|
|
7155
|
-
* @returns A new TonBitArray containing the concatenated bits
|
|
7156
|
-
*/
|
|
7157
|
-
concat(other) {
|
|
7158
|
-
const result = new _TonBitArray(this.size + other.size);
|
|
7159
|
-
for (let i = 0; i < this.size; i++) {
|
|
7160
|
-
if (this.get(i)) result.set(i);
|
|
7161
|
-
}
|
|
7162
|
-
for (let i = 0; i < other.size; i++) {
|
|
7163
|
-
if (other.get(i)) result.set(this.size + i);
|
|
7164
|
-
}
|
|
7165
|
-
return result;
|
|
7166
|
-
}
|
|
7167
|
-
/**
|
|
7168
|
-
* Concatenates multiple TonBitArray objects into a single TonBitArray.
|
|
7169
|
-
* Creates a new TonBitArray containing all bits from the input arrays in order.
|
|
7170
|
-
*
|
|
7171
|
-
* @param arrays An array of TonBitArray objects to concatenate
|
|
7172
|
-
* @returns A new TonBitArray containing all bits from the input arrays
|
|
7173
|
-
*/
|
|
7174
|
-
static concatMultiple(arrays) {
|
|
7175
|
-
const totalSize = arrays.reduce((sum, arr) => sum + arr.size, 0);
|
|
7176
|
-
const result = new _TonBitArray(totalSize);
|
|
7177
|
-
let offset = 0;
|
|
7178
|
-
for (const arr of arrays) {
|
|
7179
|
-
for (let i = 0; i < arr.size; i++) {
|
|
7180
|
-
if (arr.get(i)) result.set(offset + i);
|
|
7181
|
-
}
|
|
7182
|
-
offset += arr.size;
|
|
7183
|
-
}
|
|
7184
|
-
return result;
|
|
7185
|
-
}
|
|
7186
|
-
/**
|
|
7187
|
-
* Converts the bit array to a padded representation suitable for byte conversion.
|
|
7188
|
-
* Pads the bit array to the nearest byte boundary (multiple of 8 bits) by adding false bits.
|
|
7189
|
-
*
|
|
7190
|
-
* @returns A tuple containing the padded boolean array and its size
|
|
7191
|
-
*/
|
|
7192
|
-
toPadded() {
|
|
7193
|
-
const selfBitCount = this.size;
|
|
7194
|
-
let arrayBits;
|
|
7195
|
-
let arraySize;
|
|
7196
|
-
const rem = selfBitCount % 8;
|
|
7197
|
-
if (rem > 0) {
|
|
7198
|
-
const paddingSize = 8 - rem;
|
|
7199
|
-
const paddingArray = new _TonBitArray(paddingSize);
|
|
7200
|
-
arrayBits = this.concat(paddingArray).bits;
|
|
7201
|
-
arraySize = selfBitCount + paddingSize;
|
|
7202
|
-
} else {
|
|
7203
|
-
arrayBits = this.bits;
|
|
7204
|
-
arraySize = selfBitCount;
|
|
7205
|
-
}
|
|
7206
|
-
return [arrayBits, arraySize];
|
|
7207
|
-
}
|
|
7208
|
-
/**
|
|
7209
|
-
* Converts the bit array to a Node.js Buffer.
|
|
7210
|
-
* The bit array is first padded to byte boundaries, then converted to a buffer
|
|
7211
|
-
* where each byte represents 8 bits in big-endian format.
|
|
7212
|
-
*
|
|
7213
|
-
* @returns A Buffer containing the binary representation of the bit array
|
|
7214
|
-
*/
|
|
7215
|
-
toBuffer() {
|
|
7216
|
-
const [arrayBits, arraySize] = this.toPadded();
|
|
7217
|
-
const buffer = Buffer.alloc(arraySize / 8);
|
|
7218
|
-
for (let i = 0; i < arraySize; i++) {
|
|
7219
|
-
if (arrayBits[i]) {
|
|
7220
|
-
buffer[Math.floor(i / 8)] |= 1 << 7 - i % 8;
|
|
7221
|
-
}
|
|
7222
|
-
}
|
|
7223
|
-
return buffer;
|
|
7224
|
-
}
|
|
7225
|
-
};
|
|
7226
|
-
|
|
7227
7013
|
exports.BASE_CHAIN_ID = BASE_CHAIN_ID;
|
|
7228
7014
|
exports.BaseWrapper = BaseWrapper;
|
|
7229
7015
|
exports.ClasslibWrapper = ClasslibWrapper;
|
|
@@ -7244,7 +7030,6 @@ exports.Order = Order;
|
|
|
7244
7030
|
exports.PUBLIC_KEY_BYTE_LENGTH = PUBLIC_KEY_BYTE_LENGTH;
|
|
7245
7031
|
exports.SEED_SIZE = SEED_SIZE;
|
|
7246
7032
|
exports.SIGNATURE_BYTE_LENGTH = SIGNATURE_BYTE_LENGTH;
|
|
7247
|
-
exports.TonBitArray = TonBitArray;
|
|
7248
7033
|
exports.Txiterator = Txiterator;
|
|
7249
7034
|
exports._getTypeWidth = _getTypeWidth;
|
|
7250
7035
|
exports.addLibToBlockchain = addLibToBlockchain;
|
|
@@ -7308,7 +7093,6 @@ exports.getBocStringFromMessage = getBocStringFromMessage;
|
|
|
7308
7093
|
exports.getCellName = getCellName;
|
|
7309
7094
|
exports.getCellNameNumber = getCellNameNumber;
|
|
7310
7095
|
exports.getClosestByteAlignedBits = getClosestByteAlignedBits;
|
|
7311
|
-
exports.getEncodedMessageFromEncodedPacket = getEncodedMessageFromEncodedPacket;
|
|
7312
7096
|
exports.getLzDict = getLzDict;
|
|
7313
7097
|
exports.getMessageFromBocString = getMessageFromBocString;
|
|
7314
7098
|
exports.getMsgPrices = getMsgPrices;
|