@ton/ton 15.2.1 → 15.3.1
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.
|
@@ -118,7 +118,7 @@ export declare class TonClient4 {
|
|
|
118
118
|
used: {
|
|
119
119
|
bits: number;
|
|
120
120
|
cells: number;
|
|
121
|
-
publicCells
|
|
121
|
+
publicCells?: number | undefined;
|
|
122
122
|
};
|
|
123
123
|
} | null;
|
|
124
124
|
};
|
|
@@ -162,7 +162,7 @@ export declare class TonClient4 {
|
|
|
162
162
|
used: {
|
|
163
163
|
bits: number;
|
|
164
164
|
cells: number;
|
|
165
|
-
publicCells
|
|
165
|
+
publicCells?: number | undefined;
|
|
166
166
|
};
|
|
167
167
|
} | null;
|
|
168
168
|
};
|
|
@@ -490,7 +490,7 @@ const storageStatCodec = zod_1.z.object({
|
|
|
490
490
|
used: zod_1.z.object({
|
|
491
491
|
bits: zod_1.z.number(),
|
|
492
492
|
cells: zod_1.z.number(),
|
|
493
|
-
publicCells: zod_1.z.number()
|
|
493
|
+
publicCells: zod_1.z.number().optional()
|
|
494
494
|
})
|
|
495
495
|
});
|
|
496
496
|
const accountCodec = zod_1.z.object({
|
|
@@ -83,6 +83,12 @@ export declare function configParse40(slice: Slice | null | undefined): {
|
|
|
83
83
|
mediumProportionalMult: number;
|
|
84
84
|
} | null;
|
|
85
85
|
export declare function configParseWorkchainDescriptor(slice: Slice): WorkchainDescriptor;
|
|
86
|
+
export type WcSplitMergeTimings = {
|
|
87
|
+
split_merge_delay: number;
|
|
88
|
+
split_merge_interval: number;
|
|
89
|
+
min_split_merge_interval: number;
|
|
90
|
+
max_split_merge_delay: number;
|
|
91
|
+
};
|
|
86
92
|
export type WorkchainDescriptor = {
|
|
87
93
|
enabledSince: number;
|
|
88
94
|
actialMinSplit: number;
|
|
@@ -99,6 +105,10 @@ export type WorkchainDescriptor = {
|
|
|
99
105
|
vmVersion: number;
|
|
100
106
|
vmMode: bigint;
|
|
101
107
|
};
|
|
108
|
+
workchain_v2?: {
|
|
109
|
+
split_merge_timings: WcSplitMergeTimings;
|
|
110
|
+
persistent_state_split_depth: number;
|
|
111
|
+
};
|
|
102
112
|
};
|
|
103
113
|
export declare function configParse12(slice: Slice | null | undefined): Dictionary<number, WorkchainDescriptor>;
|
|
104
114
|
export declare function configParseValidatorSet(slice: Slice | null | undefined): {
|
|
@@ -276,7 +276,8 @@ function configParse40(slice) {
|
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
function configParseWorkchainDescriptor(slice) {
|
|
279
|
-
|
|
279
|
+
const constructorTag = slice.loadUint(8);
|
|
280
|
+
if (!(constructorTag == 0xA6 || constructorTag == 0xA7)) {
|
|
280
281
|
throw Error('Invalid config');
|
|
281
282
|
}
|
|
282
283
|
const enabledSince = slice.loadUint(32);
|
|
@@ -291,11 +292,23 @@ function configParseWorkchainDescriptor(slice) {
|
|
|
291
292
|
const zerostateFileHash = slice.loadBuffer(32);
|
|
292
293
|
const version = slice.loadUint(32);
|
|
293
294
|
// Only basic format supported
|
|
294
|
-
if (slice.
|
|
295
|
+
if (!slice.loadUint(4)) {
|
|
295
296
|
throw Error('Invalid config');
|
|
296
297
|
}
|
|
297
|
-
const vmVersion = slice.
|
|
298
|
+
const vmVersion = slice.loadInt(32);
|
|
298
299
|
const vmMode = slice.loadUintBig(64);
|
|
300
|
+
let extension = undefined;
|
|
301
|
+
if (constructorTag == 0xA7) {
|
|
302
|
+
const splitMergeTimings = parseWorkchainSplitMergeTimings(slice);
|
|
303
|
+
const stateSplitDepth = slice.loadUint(8);
|
|
304
|
+
if (stateSplitDepth > 63) {
|
|
305
|
+
throw RangeError(`Invalid persistent_state_split_depth: ${stateSplitDepth} expected <= 63`);
|
|
306
|
+
}
|
|
307
|
+
extension = {
|
|
308
|
+
split_merge_timings: splitMergeTimings,
|
|
309
|
+
persistent_state_split_depth: stateSplitDepth
|
|
310
|
+
};
|
|
311
|
+
}
|
|
299
312
|
return {
|
|
300
313
|
enabledSince,
|
|
301
314
|
actialMinSplit,
|
|
@@ -311,7 +324,19 @@ function configParseWorkchainDescriptor(slice) {
|
|
|
311
324
|
format: {
|
|
312
325
|
vmVersion,
|
|
313
326
|
vmMode
|
|
314
|
-
}
|
|
327
|
+
},
|
|
328
|
+
workchain_v2: extension
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function parseWorkchainSplitMergeTimings(slice) {
|
|
332
|
+
if (slice.loadUint(4) !== 0) {
|
|
333
|
+
throw Error(`Invalid WcSplitMergeTimings tag expected 0!`);
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
split_merge_delay: slice.loadUint(32),
|
|
337
|
+
split_merge_interval: slice.loadUint(32),
|
|
338
|
+
min_split_merge_interval: slice.loadUint(32),
|
|
339
|
+
max_split_merge_delay: slice.loadUint(32)
|
|
315
340
|
};
|
|
316
341
|
}
|
|
317
342
|
const WorkchainDescriptorDictValue = {
|
|
@@ -319,43 +344,7 @@ const WorkchainDescriptorDictValue = {
|
|
|
319
344
|
throw Error("not implemented");
|
|
320
345
|
},
|
|
321
346
|
parse(src) {
|
|
322
|
-
|
|
323
|
-
throw Error('Invalid config');
|
|
324
|
-
}
|
|
325
|
-
const enabledSince = src.loadUint(32);
|
|
326
|
-
const actialMinSplit = src.loadUint(8);
|
|
327
|
-
const min_split = src.loadUint(8);
|
|
328
|
-
const max_split = src.loadUint(8);
|
|
329
|
-
const basic = src.loadBit();
|
|
330
|
-
const active = src.loadBit();
|
|
331
|
-
const accept_msgs = src.loadBit();
|
|
332
|
-
const flags = src.loadUint(13);
|
|
333
|
-
const zerostateRootHash = src.loadBuffer(32);
|
|
334
|
-
const zerostateFileHash = src.loadBuffer(32);
|
|
335
|
-
const version = src.loadUint(32);
|
|
336
|
-
// Only basic format supported
|
|
337
|
-
if (src.loadBit()) {
|
|
338
|
-
throw Error('Invalid config');
|
|
339
|
-
}
|
|
340
|
-
const vmVersion = src.loadUint(32);
|
|
341
|
-
const vmMode = src.loadUintBig(64);
|
|
342
|
-
return {
|
|
343
|
-
enabledSince,
|
|
344
|
-
actialMinSplit,
|
|
345
|
-
min_split,
|
|
346
|
-
max_split,
|
|
347
|
-
basic,
|
|
348
|
-
active,
|
|
349
|
-
accept_msgs,
|
|
350
|
-
flags,
|
|
351
|
-
zerostateRootHash,
|
|
352
|
-
zerostateFileHash,
|
|
353
|
-
version,
|
|
354
|
-
format: {
|
|
355
|
-
vmVersion,
|
|
356
|
-
vmMode
|
|
357
|
-
}
|
|
358
|
-
};
|
|
347
|
+
return configParseWorkchainDescriptor(src);
|
|
359
348
|
}
|
|
360
349
|
};
|
|
361
350
|
function configParse12(slice) {
|
|
@@ -12,6 +12,8 @@ const core_1 = require("@ton/core");
|
|
|
12
12
|
const ConfigParser_1 = require("./ConfigParser");
|
|
13
13
|
const client = (0, createTestClient4_1.createTestClient4)("mainnet");
|
|
14
14
|
const KNOWN_BLOCK = 31091335;
|
|
15
|
+
const TESTNET_BLOCK = 32762926;
|
|
16
|
+
const testnetClient = (0, createTestClient4_1.createTestClient4)("testnet");
|
|
15
17
|
describe('ConfigContract', () => {
|
|
16
18
|
// for some reason api returns 500 for this reques
|
|
17
19
|
// it('should return correct burning config', async () => {
|
|
@@ -42,9 +44,43 @@ describe('ConfigContract', () => {
|
|
|
42
44
|
zerostateFileHash: Buffer.from('ee0bedfe4b32761fb35e9e1d8818ea720cad1a0e7b4d2ed673c488e72e910342', 'hex'),
|
|
43
45
|
version: 0,
|
|
44
46
|
format: {
|
|
45
|
-
vmMode:
|
|
46
|
-
vmVersion:
|
|
47
|
+
vmMode: 0n,
|
|
48
|
+
vmVersion: -1
|
|
47
49
|
},
|
|
50
|
+
workchain_v2: undefined
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it('should return correct workchain_v2 description', async () => {
|
|
54
|
+
const serializedConfigsCell = (await testnetClient.getConfig(TESTNET_BLOCK, [12])).config.cell;
|
|
55
|
+
const config12 = (0, ConfigParser_1.configParse12)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 12).beginParse());
|
|
56
|
+
const wcData = config12.get(0);
|
|
57
|
+
expect(wcData.workchain_v2).not.toBeUndefined();
|
|
58
|
+
// https://test-explorer.toncenter.com/config?workchain=-1&shard=8000000000000000&seqno=32764024&roothash=B17E08E4F2C06630D5DF348BE2D2545784515B772AB645CE9A05DA37AFB80D48&filehash=5A60AAA67F3F20BB7F1DAA5A14CEA90CDDA508FB3B18B64EF1144183833B8618#configparam12
|
|
59
|
+
expect(wcData).toEqual({
|
|
60
|
+
enabledSince: 1573821854,
|
|
61
|
+
actialMinSplit: 0,
|
|
62
|
+
min_split: 0,
|
|
63
|
+
max_split: 0,
|
|
64
|
+
basic: true,
|
|
65
|
+
active: true,
|
|
66
|
+
accept_msgs: true,
|
|
67
|
+
flags: 0,
|
|
68
|
+
zerostateRootHash: Buffer.from('55b13f6d0e1d0c34c9c2160f6f918e92d82bf9ddcf8de2e4c94a3fdf39d15446', 'hex'),
|
|
69
|
+
zerostateFileHash: Buffer.from('ee0bedfe4b32761fb35e9e1d8818ea720cad1a0e7b4d2ed673c488e72e910342', 'hex'),
|
|
70
|
+
version: 0,
|
|
71
|
+
format: {
|
|
72
|
+
vmMode: 0n,
|
|
73
|
+
vmVersion: -1
|
|
74
|
+
},
|
|
75
|
+
workchain_v2: {
|
|
76
|
+
split_merge_timings: {
|
|
77
|
+
split_merge_delay: 100,
|
|
78
|
+
split_merge_interval: 100,
|
|
79
|
+
min_split_merge_interval: 30,
|
|
80
|
+
max_split_merge_delay: 1000,
|
|
81
|
+
},
|
|
82
|
+
persistent_state_split_depth: 4
|
|
83
|
+
}
|
|
48
84
|
});
|
|
49
85
|
});
|
|
50
86
|
it('should return correct config17', async () => {
|
|
@@ -94,4 +130,8 @@ describe('ConfigContract', () => {
|
|
|
94
130
|
const serializedConfigsCell = (await client.getConfig(KNOWN_BLOCK)).config.cell;
|
|
95
131
|
(0, ConfigParser_1.parseFullConfig)((0, ConfigParser_1.loadConfigParamsAsSlice)(serializedConfigsCell));
|
|
96
132
|
});
|
|
133
|
+
it('should not raise error when parsing testnet config', async () => {
|
|
134
|
+
const serializedConfigsCell = (await testnetClient.getConfig(TESTNET_BLOCK)).config.cell;
|
|
135
|
+
(0, ConfigParser_1.parseFullConfig)((0, ConfigParser_1.loadConfigParamsAsSlice)(serializedConfigsCell));
|
|
136
|
+
});
|
|
97
137
|
});
|