@ton/ton 15.4.0 → 16.1.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/dist/config/ConfigParser.d.ts +221 -409
- package/dist/config/ConfigParser.js +343 -46
- package/dist/config/ConfigParser.spec.js +118 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/wallets/WalletContractV1R1.d.ts +1 -1
- package/dist/wallets/WalletContractV1R2.d.ts +1 -1
- package/dist/wallets/WalletContractV1R3.d.ts +1 -1
- package/dist/wallets/WalletContractV2R1.d.ts +1 -1
- package/dist/wallets/WalletContractV2R2.d.ts +1 -1
- package/dist/wallets/WalletContractV3R1.d.ts +1 -1
- package/dist/wallets/WalletContractV3R2.d.ts +1 -1
- package/dist/wallets/v4/WalletContractV4.d.ts +1 -1
- package/dist/wallets/v5beta/WalletContractV5Beta.d.ts +1 -1
- package/dist/wallets/v5r1/WalletContractV5R1.d.ts +1 -1
- package/dist/wallets/v5r1/WalletV5R1Actions.js +1 -1
- package/dist/wallets/v5r1/WalletV5R1Actions.spec.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,12 @@ exports.parseValidatorSet = parseValidatorSet;
|
|
|
5
5
|
exports.parseBridge = parseBridge;
|
|
6
6
|
exports.configParseMasterAddressRequired = configParseMasterAddressRequired;
|
|
7
7
|
exports.configParse5 = configParse5;
|
|
8
|
+
exports.configParse6 = configParse6;
|
|
9
|
+
exports.configParse7 = configParse7;
|
|
10
|
+
exports.configParse9 = configParse9;
|
|
11
|
+
exports.configParse10 = configParse10;
|
|
8
12
|
exports.configParse13 = configParse13;
|
|
13
|
+
exports.configParse14 = configParse14;
|
|
9
14
|
exports.configParse15 = configParse15;
|
|
10
15
|
exports.configParse16 = configParse16;
|
|
11
16
|
exports.configParse17 = configParse17;
|
|
@@ -16,15 +21,21 @@ exports.configParseWorkchainDescriptor = configParseWorkchainDescriptor;
|
|
|
16
21
|
exports.configParse12 = configParse12;
|
|
17
22
|
exports.configParseValidatorSet = configParseValidatorSet;
|
|
18
23
|
exports.configParseBridge = configParseBridge;
|
|
24
|
+
exports.loadJettonBridgeParams = loadJettonBridgeParams;
|
|
19
25
|
exports.configParseGasLimitsPrices = configParseGasLimitsPrices;
|
|
26
|
+
exports.configParseBlockLimits = configParseBlockLimits;
|
|
20
27
|
exports.configParseMsgPrices = configParseMsgPrices;
|
|
21
28
|
exports.configParse28 = configParse28;
|
|
22
29
|
exports.configParse29 = configParse29;
|
|
30
|
+
exports.configParse31 = configParse31;
|
|
31
|
+
exports.configParse44 = configParse44;
|
|
32
|
+
exports.configParse45 = configParse45;
|
|
23
33
|
exports.parseProposalSetup = parseProposalSetup;
|
|
24
34
|
exports.parseVotingSetup = parseVotingSetup;
|
|
25
35
|
exports.loadConfigParamById = loadConfigParamById;
|
|
26
36
|
exports.loadConfigParamsAsSlice = loadConfigParamsAsSlice;
|
|
27
37
|
exports.parseFullConfig = parseFullConfig;
|
|
38
|
+
exports.parseFullerConfig = parseFullerConfig;
|
|
28
39
|
const core_1 = require("@ton/core");
|
|
29
40
|
function configParseMasterAddress(slice) {
|
|
30
41
|
if (slice) {
|
|
@@ -37,7 +48,7 @@ function configParseMasterAddress(slice) {
|
|
|
37
48
|
function readPublicKey(slice) {
|
|
38
49
|
// 8e81278a
|
|
39
50
|
if (slice.loadUint(32) !== 0x8e81278a) {
|
|
40
|
-
throw Error('Invalid
|
|
51
|
+
throw Error('Invalid publicKey');
|
|
41
52
|
}
|
|
42
53
|
return slice.loadBuffer(32);
|
|
43
54
|
}
|
|
@@ -62,7 +73,7 @@ const ValidatorDescriptionDictValue = {
|
|
|
62
73
|
};
|
|
63
74
|
}
|
|
64
75
|
else {
|
|
65
|
-
throw Error('Invalid
|
|
76
|
+
throw Error('Invalid validator description dict');
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
};
|
|
@@ -99,6 +110,7 @@ function parseValidatorSet(slice) {
|
|
|
99
110
|
list
|
|
100
111
|
};
|
|
101
112
|
}
|
|
113
|
+
return null;
|
|
102
114
|
}
|
|
103
115
|
function parseBridge(slice) {
|
|
104
116
|
const bridgeAddress = new core_1.Address(-1, slice.loadBuffer(32));
|
|
@@ -118,13 +130,13 @@ function parseBridge(slice) {
|
|
|
118
130
|
}
|
|
119
131
|
function configParseMasterAddressRequired(slice) {
|
|
120
132
|
if (!slice) {
|
|
121
|
-
throw Error('Invalid
|
|
133
|
+
throw Error('Invalid master address');
|
|
122
134
|
}
|
|
123
135
|
return configParseMasterAddress(slice);
|
|
124
136
|
}
|
|
125
137
|
function configParse5(slice) {
|
|
126
138
|
if (!slice) {
|
|
127
|
-
throw Error('
|
|
139
|
+
throw Error('No config5 slice');
|
|
128
140
|
}
|
|
129
141
|
const magic = slice.loadUint(8);
|
|
130
142
|
if (magic === 0x01) {
|
|
@@ -137,28 +149,82 @@ function configParse5(slice) {
|
|
|
137
149
|
feeBurnDenominator
|
|
138
150
|
};
|
|
139
151
|
}
|
|
140
|
-
throw new Error('Invalid
|
|
152
|
+
throw new Error('Invalid config5');
|
|
153
|
+
}
|
|
154
|
+
// _ mint_new_price:Grams mint_add_price:Grams = ConfigParam 6;
|
|
155
|
+
function configParse6(slice) {
|
|
156
|
+
if (!slice) {
|
|
157
|
+
// no param in mainnet for now, so throwing will cause crash of parseFullConfig()
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const mintNewPrice = slice.loadCoins();
|
|
161
|
+
const mintAddPrice = slice.loadCoins();
|
|
162
|
+
return {
|
|
163
|
+
mintNewPrice,
|
|
164
|
+
mintAddPrice
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// extra_currencies$_ dict:(HashmapE 32 (VarUInteger 32)) = ExtraCurrencyCollection;
|
|
168
|
+
// _ to_mint:ExtraCurrencyCollection = ConfigParam 7;
|
|
169
|
+
function configParse7(slice) {
|
|
170
|
+
if (!slice) {
|
|
171
|
+
throw Error('No config7 slice');
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
toMint: (0, core_1.loadExtraCurrency)(slice.loadRef()),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// _ mandatory_params:(Hashmap 32 True) = ConfigParam 9;
|
|
178
|
+
function configParse9(slice) {
|
|
179
|
+
if (!slice) {
|
|
180
|
+
throw Error('No config9 slice');
|
|
181
|
+
}
|
|
182
|
+
return new Set(slice.loadDictDirect(core_1.Dictionary.Keys.Int(32), core_1.Dictionary.Values.Uint(0)).keys());
|
|
183
|
+
}
|
|
184
|
+
// _ critical_params:(Hashmap 32 True) = ConfigParam 10;
|
|
185
|
+
function configParse10(slice) {
|
|
186
|
+
if (!slice) {
|
|
187
|
+
throw Error('No config10 slice');
|
|
188
|
+
}
|
|
189
|
+
return new Set(slice.loadDictDirect(core_1.Dictionary.Keys.Int(32), core_1.Dictionary.Values.Uint(0)).keys());
|
|
141
190
|
}
|
|
142
191
|
function configParse13(slice) {
|
|
143
192
|
if (!slice) {
|
|
144
|
-
throw Error('
|
|
193
|
+
throw Error('No config13 slice');
|
|
145
194
|
}
|
|
146
195
|
const magic = slice.loadUint(8);
|
|
147
|
-
if (magic
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
196
|
+
if (magic !== 0x1a) {
|
|
197
|
+
throw new Error('Invalid config13');
|
|
198
|
+
}
|
|
199
|
+
const deposit = slice.loadCoins();
|
|
200
|
+
const bitPrice = slice.loadCoins();
|
|
201
|
+
const cellPrice = slice.loadCoins();
|
|
202
|
+
return {
|
|
203
|
+
deposit,
|
|
204
|
+
bitPrice,
|
|
205
|
+
cellPrice
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// block_grams_created#6b masterchain_block_fee:Grams basechain_block_fee:Grams = BlockCreateFees;
|
|
209
|
+
// _ BlockCreateFees = ConfigParam 14;
|
|
210
|
+
function configParse14(slice) {
|
|
211
|
+
if (!slice) {
|
|
212
|
+
throw Error('No config14 slice');
|
|
213
|
+
}
|
|
214
|
+
const magic = slice.loadUint(8);
|
|
215
|
+
if (magic !== 0x6b) {
|
|
216
|
+
throw new Error('Invalid config14');
|
|
156
217
|
}
|
|
157
|
-
|
|
218
|
+
const masterchainBlockFee = slice.loadCoins();
|
|
219
|
+
const workchainBlockFee = slice.loadCoins();
|
|
220
|
+
return {
|
|
221
|
+
masterchainBlockFee,
|
|
222
|
+
workchainBlockFee
|
|
223
|
+
};
|
|
158
224
|
}
|
|
159
225
|
function configParse15(slice) {
|
|
160
226
|
if (!slice) {
|
|
161
|
-
throw Error('
|
|
227
|
+
throw Error('No config15 slice');
|
|
162
228
|
}
|
|
163
229
|
const validatorsElectedFor = slice.loadUint(32);
|
|
164
230
|
const electorsStartBefore = slice.loadUint(32);
|
|
@@ -173,7 +239,7 @@ function configParse15(slice) {
|
|
|
173
239
|
}
|
|
174
240
|
function configParse16(slice) {
|
|
175
241
|
if (!slice) {
|
|
176
|
-
throw Error('
|
|
242
|
+
throw Error('No config16 slice');
|
|
177
243
|
}
|
|
178
244
|
const maxValidators = slice.loadUint(16);
|
|
179
245
|
const maxMainValidators = slice.loadUint(16);
|
|
@@ -186,7 +252,7 @@ function configParse16(slice) {
|
|
|
186
252
|
}
|
|
187
253
|
function configParse17(slice) {
|
|
188
254
|
if (!slice) {
|
|
189
|
-
throw Error('
|
|
255
|
+
throw Error('No config17 slice');
|
|
190
256
|
}
|
|
191
257
|
const minStake = slice.loadCoins();
|
|
192
258
|
const maxStake = slice.loadCoins();
|
|
@@ -206,7 +272,7 @@ const StoragePricesDictValue = {
|
|
|
206
272
|
parse(src) {
|
|
207
273
|
const header = src.loadUint(8);
|
|
208
274
|
if (header !== 0xcc) {
|
|
209
|
-
throw Error('Invalid
|
|
275
|
+
throw Error('Invalid storage prices dict');
|
|
210
276
|
}
|
|
211
277
|
const utime_since = src.loadUint(32);
|
|
212
278
|
const bit_price_ps = src.loadUintBig(64);
|
|
@@ -224,7 +290,7 @@ const StoragePricesDictValue = {
|
|
|
224
290
|
};
|
|
225
291
|
function configParse18(slice) {
|
|
226
292
|
if (!slice) {
|
|
227
|
-
throw Error('
|
|
293
|
+
throw Error('No config18 slice');
|
|
228
294
|
}
|
|
229
295
|
return slice.loadDictDirect(core_1.Dictionary.Keys.Buffer(4), StoragePricesDictValue).values();
|
|
230
296
|
}
|
|
@@ -248,7 +314,7 @@ function configParse40(slice) {
|
|
|
248
314
|
}
|
|
249
315
|
const header = slice.loadUint(8);
|
|
250
316
|
if (header !== 1) {
|
|
251
|
-
throw Error('Invalid
|
|
317
|
+
throw Error('Invalid config40');
|
|
252
318
|
}
|
|
253
319
|
const defaultFlatFine = slice.loadCoins();
|
|
254
320
|
const defaultProportionaFine = slice.loadCoins();
|
|
@@ -278,7 +344,7 @@ function configParse40(slice) {
|
|
|
278
344
|
function configParseWorkchainDescriptor(slice) {
|
|
279
345
|
const constructorTag = slice.loadUint(8);
|
|
280
346
|
if (!(constructorTag == 0xA6 || constructorTag == 0xA7)) {
|
|
281
|
-
throw Error('Invalid
|
|
347
|
+
throw Error('Invalid workchain descriptor');
|
|
282
348
|
}
|
|
283
349
|
const enabledSince = slice.loadUint(32);
|
|
284
350
|
const actialMinSplit = slice.loadUint(8);
|
|
@@ -293,7 +359,7 @@ function configParseWorkchainDescriptor(slice) {
|
|
|
293
359
|
const version = slice.loadUint(32);
|
|
294
360
|
// Only basic format supported
|
|
295
361
|
if (!slice.loadUint(4)) {
|
|
296
|
-
throw Error('
|
|
362
|
+
throw Error('Not basic workchain descriptor');
|
|
297
363
|
}
|
|
298
364
|
const vmVersion = slice.loadInt(32);
|
|
299
365
|
const vmMode = slice.loadUintBig(64);
|
|
@@ -349,7 +415,7 @@ const WorkchainDescriptorDictValue = {
|
|
|
349
415
|
};
|
|
350
416
|
function configParse12(slice) {
|
|
351
417
|
if (!slice) {
|
|
352
|
-
throw Error('
|
|
418
|
+
throw Error('No config12 slice');
|
|
353
419
|
}
|
|
354
420
|
const wd = slice.loadDict(core_1.Dictionary.Keys.Uint(32), WorkchainDescriptorDictValue);
|
|
355
421
|
if (wd) {
|
|
@@ -369,6 +435,68 @@ function configParseBridge(slice) {
|
|
|
369
435
|
}
|
|
370
436
|
return parseBridge(slice);
|
|
371
437
|
}
|
|
438
|
+
function loadJettonBridgeParams(slice) {
|
|
439
|
+
if (!slice) {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
const magic = slice.loadUint(8);
|
|
443
|
+
// jetton_bridge_params_v0#00 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256)
|
|
444
|
+
// state_flags:uint8 burn_bridge_fee:Coins = JettonBridgeParams;
|
|
445
|
+
if (magic === 0x00) {
|
|
446
|
+
const bridgeAddress = new core_1.Address(-1, slice.loadBuffer(32));
|
|
447
|
+
const oracleAddress = new core_1.Address(-1, slice.loadBuffer(32));
|
|
448
|
+
const oraclesRaw = slice.loadDict(core_1.Dictionary.Keys.Buffer(32), core_1.Dictionary.Values.Buffer(32));
|
|
449
|
+
const oracles = [...oraclesRaw].map(e => ({
|
|
450
|
+
addr: new core_1.Address(-1, e[0]),
|
|
451
|
+
pubkey: e[1],
|
|
452
|
+
}));
|
|
453
|
+
const flags = slice.loadUint(8);
|
|
454
|
+
const bridgeBurnFee = slice.loadCoins();
|
|
455
|
+
return {
|
|
456
|
+
bridgeAddress,
|
|
457
|
+
oracleAddress,
|
|
458
|
+
oracles,
|
|
459
|
+
flags,
|
|
460
|
+
bridgeBurnFee
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
// jetton_bridge_params_v1#01 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256)
|
|
464
|
+
// state_flags:uint8 prices:^JettonBridgePrices external_chain_address:bits256 = JettonBridgeParams;
|
|
465
|
+
if (magic === 0x01) {
|
|
466
|
+
const bridgeAddress = new core_1.Address(-1, slice.loadBuffer(32));
|
|
467
|
+
const oracleAddress = new core_1.Address(-1, slice.loadBuffer(32));
|
|
468
|
+
const oraclesRaw = slice.loadDict(core_1.Dictionary.Keys.Buffer(32), core_1.Dictionary.Values.Buffer(32));
|
|
469
|
+
const oracles = [...oraclesRaw].map(e => ({
|
|
470
|
+
addr: new core_1.Address(-1, e[0]),
|
|
471
|
+
pubkey: e[1],
|
|
472
|
+
}));
|
|
473
|
+
const flags = slice.loadUint(8);
|
|
474
|
+
const pricesRef = slice.loadRef().beginParse();
|
|
475
|
+
const bridgeBurnFee = pricesRef.loadCoins();
|
|
476
|
+
const bridgeMintFee = pricesRef.loadCoins();
|
|
477
|
+
const walletMinTonsForStorage = pricesRef.loadCoins();
|
|
478
|
+
const walletGasConsumption = pricesRef.loadCoins();
|
|
479
|
+
const minterMinTonsForStorage = pricesRef.loadCoins();
|
|
480
|
+
const discoverGasConsumption = pricesRef.loadCoins();
|
|
481
|
+
const externalChainAddress = slice.loadBuffer(32);
|
|
482
|
+
return {
|
|
483
|
+
bridgeAddress,
|
|
484
|
+
oracleAddress,
|
|
485
|
+
oracles,
|
|
486
|
+
flags,
|
|
487
|
+
jettonBridgePrices: {
|
|
488
|
+
bridgeBurnFee,
|
|
489
|
+
bridgeMintFee,
|
|
490
|
+
walletMinTonsForStorage,
|
|
491
|
+
walletGasConsumption,
|
|
492
|
+
minterMinTonsForStorage,
|
|
493
|
+
discoverGasConsumption
|
|
494
|
+
},
|
|
495
|
+
externalChainAddress
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
throw new Error('Invalid msg prices param');
|
|
499
|
+
}
|
|
372
500
|
function parseGasLimitsInternal(slice) {
|
|
373
501
|
const tag = slice.loadUint(8);
|
|
374
502
|
if (tag === 0xde) {
|
|
@@ -406,12 +534,12 @@ function parseGasLimitsInternal(slice) {
|
|
|
406
534
|
};
|
|
407
535
|
}
|
|
408
536
|
else {
|
|
409
|
-
throw Error('Invalid
|
|
537
|
+
throw Error('Invalid gas limits internal');
|
|
410
538
|
}
|
|
411
539
|
}
|
|
412
540
|
function configParseGasLimitsPrices(slice) {
|
|
413
541
|
if (!slice) {
|
|
414
|
-
throw Error('
|
|
542
|
+
throw Error('No gas limits slice');
|
|
415
543
|
}
|
|
416
544
|
const tag = slice.loadUint(8);
|
|
417
545
|
if (tag === 0xd1) {
|
|
@@ -425,12 +553,74 @@ function configParseGasLimitsPrices(slice) {
|
|
|
425
553
|
};
|
|
426
554
|
}
|
|
427
555
|
else {
|
|
428
|
-
throw Error('Invalid
|
|
556
|
+
throw Error('Invalid gas limits');
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
// param_limits#c3 underload:# soft_limit:# { underload <= soft_limit }
|
|
560
|
+
// hard_limit:# { soft_limit <= hard_limit } = ParamLimits;
|
|
561
|
+
function configParseLimitParams(slice) {
|
|
562
|
+
const paramsLimitTag = slice.loadUint(8);
|
|
563
|
+
if (paramsLimitTag !== 0xc3) {
|
|
564
|
+
throw Error('Invalid params limit slice');
|
|
565
|
+
}
|
|
566
|
+
const underload = slice.loadUint(32);
|
|
567
|
+
const softLimit = slice.loadUint(32);
|
|
568
|
+
const hardLimit = slice.loadUint(32);
|
|
569
|
+
if ((underload > softLimit) || (softLimit > hardLimit)) {
|
|
570
|
+
throw Error('Incosistent limitParams');
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
underload,
|
|
574
|
+
softLimit,
|
|
575
|
+
hardLimit
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function configParseBlockLimits(slice) {
|
|
579
|
+
if (!slice) {
|
|
580
|
+
throw Error('No block limits slice');
|
|
581
|
+
}
|
|
582
|
+
const blockLimitTag = slice.loadUint(8);
|
|
583
|
+
// block_limits#5d bytes:ParamLimits gas:ParamLimits lt_delta:ParamLimits = BlockLimits;
|
|
584
|
+
if (blockLimitTag === 0x5d) {
|
|
585
|
+
const bytes = configParseLimitParams(slice);
|
|
586
|
+
const gas = configParseLimitParams(slice);
|
|
587
|
+
const ltDelta = configParseLimitParams(slice);
|
|
588
|
+
return {
|
|
589
|
+
bytes,
|
|
590
|
+
gas,
|
|
591
|
+
ltDelta
|
|
592
|
+
};
|
|
429
593
|
}
|
|
594
|
+
// imported_msg_queue_limits#d3 max_bytes:# max_msgs:# = ImportedMsgQueueLimits;
|
|
595
|
+
// block_limits_v2#5e bytes:ParamLimits gas:ParamLimits lt_delta:ParamLimits
|
|
596
|
+
// collated_data:ParamLimits imported_msg_queue:ImportedMsgQueueLimits = BlockLimits;
|
|
597
|
+
if (blockLimitTag === 0x5e) {
|
|
598
|
+
const bytes = configParseLimitParams(slice);
|
|
599
|
+
const gas = configParseLimitParams(slice);
|
|
600
|
+
const ltDelta = configParseLimitParams(slice);
|
|
601
|
+
const collatedData = configParseLimitParams(slice);
|
|
602
|
+
const importedMsgQueueTag = slice.loadUint(8);
|
|
603
|
+
if (importedMsgQueueTag !== 0xd3) {
|
|
604
|
+
throw Error('Invalid importedMsgQueue');
|
|
605
|
+
}
|
|
606
|
+
const maxBytes = slice.loadUint(32);
|
|
607
|
+
const maxMsgs = slice.loadUint(32);
|
|
608
|
+
return {
|
|
609
|
+
bytes,
|
|
610
|
+
gas,
|
|
611
|
+
ltDelta,
|
|
612
|
+
collatedData,
|
|
613
|
+
importedMsgQueue: {
|
|
614
|
+
maxBytes,
|
|
615
|
+
maxMsgs
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
throw Error('Invalid block limits');
|
|
430
620
|
}
|
|
431
621
|
function configParseMsgPrices(slice) {
|
|
432
622
|
if (!slice) {
|
|
433
|
-
throw new Error('
|
|
623
|
+
throw new Error('No msg prices slice');
|
|
434
624
|
}
|
|
435
625
|
const magic = slice.loadUint(8);
|
|
436
626
|
if (magic !== 0xea) {
|
|
@@ -445,14 +635,9 @@ function configParseMsgPrices(slice) {
|
|
|
445
635
|
nextFrac: slice.loadUint(16)
|
|
446
636
|
};
|
|
447
637
|
}
|
|
448
|
-
// catchain_config#c1 mc_catchain_lifetime:uint32 shard_catchain_lifetime:uint32
|
|
449
|
-
// shard_validators_lifetime:uint32 shard_validators_num:uint32 = CatchainConfig;
|
|
450
|
-
// catchain_config_new#c2 flags:(## 7) { flags = 0 } shuffle_mc_validators:Bool
|
|
451
|
-
// mc_catchain_lifetime:uint32 shard_catchain_lifetime:uint32
|
|
452
|
-
// shard_validators_lifetime:uint32 shard_validators_num:uint32 = CatchainConfig;
|
|
453
638
|
function configParse28(slice) {
|
|
454
639
|
if (!slice) {
|
|
455
|
-
throw new Error('
|
|
640
|
+
throw new Error('No config28 slice');
|
|
456
641
|
}
|
|
457
642
|
const magic = slice.loadUint(8);
|
|
458
643
|
if (magic === 0xc1) {
|
|
@@ -483,7 +668,7 @@ function configParse28(slice) {
|
|
|
483
668
|
shardValidatorsCount
|
|
484
669
|
};
|
|
485
670
|
}
|
|
486
|
-
throw new Error('Invalid
|
|
671
|
+
throw new Error('Invalid config28');
|
|
487
672
|
}
|
|
488
673
|
// consensus_config#d6 round_candidates:# { round_candidates >= 1 }
|
|
489
674
|
// next_candidate_delay_ms:uint32 consensus_timeout_ms:uint32
|
|
@@ -502,7 +687,7 @@ function configParse28(slice) {
|
|
|
502
687
|
// proto_version:uint16 = ConsensusConfig;
|
|
503
688
|
function configParse29(slice) {
|
|
504
689
|
if (!slice) {
|
|
505
|
-
throw new Error('
|
|
690
|
+
throw new Error('No config29 slice');
|
|
506
691
|
}
|
|
507
692
|
const magic = slice.loadUint(8);
|
|
508
693
|
if (magic === 0xd6) {
|
|
@@ -603,13 +788,69 @@ function configParse29(slice) {
|
|
|
603
788
|
catchainMaxBlocksCoeff
|
|
604
789
|
};
|
|
605
790
|
}
|
|
606
|
-
throw new Error('Invalid
|
|
791
|
+
throw new Error('Invalid config29');
|
|
792
|
+
}
|
|
793
|
+
// _ fundamental_smc_addr:(HashmapE 256 True) = ConfigParam 31;
|
|
794
|
+
function configParse31(slice) {
|
|
795
|
+
if (!slice) {
|
|
796
|
+
throw Error('No config31 slice');
|
|
797
|
+
}
|
|
798
|
+
const rawAddrsDict = slice.loadDict(core_1.Dictionary.Keys.Buffer(32), core_1.Dictionary.Values.Uint(0));
|
|
799
|
+
// only masterchain addrs here - https://docs.ton.org/v3/documentation/network/config-params/overview#param-31
|
|
800
|
+
return [...rawAddrsDict].map(e => new core_1.Address(-1, e[0]));
|
|
801
|
+
}
|
|
802
|
+
// suspended_address_list#00 addresses:(HashmapE 288 Unit) suspended_until:uint32 = SuspendedAddressList;
|
|
803
|
+
// _ SuspendedAddressList = ConfigParam 44;
|
|
804
|
+
function configParse44(slice) {
|
|
805
|
+
if (!slice) {
|
|
806
|
+
throw Error('No config44 slice');
|
|
807
|
+
}
|
|
808
|
+
const magic = slice.loadUint(8);
|
|
809
|
+
if (magic !== 0x00) {
|
|
810
|
+
throw new Error('Invalid config44');
|
|
811
|
+
}
|
|
812
|
+
// buffer36 = uint288
|
|
813
|
+
const rawAddrsDict = slice.loadDict(core_1.Dictionary.Keys.Buffer(36), core_1.Dictionary.Values.Uint(0));
|
|
814
|
+
const suspendedUntil = slice.loadUint(32);
|
|
815
|
+
// uint288 = [wc:int32 addr:uint256]
|
|
816
|
+
const constructedAddrs = [...rawAddrsDict].map(e => new core_1.Address(e[0].readInt32BE(), e[0].subarray(4)));
|
|
817
|
+
return {
|
|
818
|
+
addresses: constructedAddrs,
|
|
819
|
+
suspendedUntil
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
const PrecompiledContractsDictValue = {
|
|
823
|
+
serialize: () => { throw Error('not implemented'); },
|
|
824
|
+
parse: (src) => {
|
|
825
|
+
const tag = src.loadUint(8);
|
|
826
|
+
if (tag !== 0xb0) {
|
|
827
|
+
throw new Error('Invalid precompiled contracts dict');
|
|
828
|
+
}
|
|
829
|
+
return src.loadUintBig(64);
|
|
830
|
+
},
|
|
831
|
+
};
|
|
832
|
+
// precompiled_smc#b0 gas_usage:uint64 = PrecompiledSmc;
|
|
833
|
+
// precompiled_contracts_config#c0 list:(HashmapE 256 PrecompiledSmc) = PrecompiledContractsConfig;
|
|
834
|
+
// _ PrecompiledContractsConfig = ConfigParam 45;
|
|
835
|
+
function configParse45(slice) {
|
|
836
|
+
if (!slice) {
|
|
837
|
+
throw Error('No config45 slice');
|
|
838
|
+
}
|
|
839
|
+
const magic = slice.loadUint(8);
|
|
840
|
+
if (magic !== 0xc0) {
|
|
841
|
+
throw new Error('Invalid config45');
|
|
842
|
+
}
|
|
843
|
+
const precompiledContracts = slice.loadDict(core_1.Dictionary.Keys.Buffer(32), PrecompiledContractsDictValue);
|
|
844
|
+
return [...precompiledContracts].map((e) => ({
|
|
845
|
+
hash: e[0],
|
|
846
|
+
gasUsed: e[1]
|
|
847
|
+
}));
|
|
607
848
|
}
|
|
608
849
|
// cfg_vote_cfg#36 min_tot_rounds:uint8 max_tot_rounds:uint8 min_wins:uint8 max_losses:uint8 min_store_sec:uint32 max_store_sec:uint32 bit_price:uint32 cell_price:uint32 = ConfigProposalSetup;
|
|
609
850
|
function parseProposalSetup(slice) {
|
|
610
851
|
const magic = slice.loadUint(8);
|
|
611
852
|
if (magic !== 0x36) {
|
|
612
|
-
throw new Error('Invalid
|
|
853
|
+
throw new Error('Invalid proposal setup');
|
|
613
854
|
}
|
|
614
855
|
const minTotalRounds = slice.loadUint(8);
|
|
615
856
|
const maxTotalRounds = slice.loadUint(8);
|
|
@@ -624,11 +865,11 @@ function parseProposalSetup(slice) {
|
|
|
624
865
|
// cfg_vote_setup#91 normal_params:^ConfigProposalSetup critical_params:^ConfigProposalSetup = ConfigVotingSetup;
|
|
625
866
|
function parseVotingSetup(slice) {
|
|
626
867
|
if (!slice) {
|
|
627
|
-
throw new Error('
|
|
868
|
+
throw new Error('No voting setup');
|
|
628
869
|
}
|
|
629
870
|
const magic = slice.loadUint(8);
|
|
630
871
|
if (magic !== 0x91) {
|
|
631
|
-
throw new Error('Invalid
|
|
872
|
+
throw new Error('Invalid voting setup');
|
|
632
873
|
}
|
|
633
874
|
const normalParams = parseProposalSetup(slice.loadRef().beginParse());
|
|
634
875
|
const criticalParams = parseProposalSetup(slice.loadRef().beginParse());
|
|
@@ -690,10 +931,66 @@ function parseFullConfig(configs) {
|
|
|
690
931
|
},
|
|
691
932
|
catchain: configParse28(configs.get(28)),
|
|
692
933
|
consensus: configParse29(configs.get(29))
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function parseFullerConfig(configs) {
|
|
937
|
+
return {
|
|
938
|
+
configAddress: configParseMasterAddressRequired(configs.get(0)),
|
|
939
|
+
electorAddress: configParseMasterAddressRequired(configs.get(1)),
|
|
940
|
+
minterAddress: configParseMasterAddress(configs.get(2)),
|
|
941
|
+
feeCollectorAddress: configParseMasterAddress(configs.get(3)),
|
|
942
|
+
dnsRootAddress: configParseMasterAddress(configs.get(4)),
|
|
943
|
+
burningConfig: configParse5(configs.get(5)),
|
|
944
|
+
extraCurrenciesMintPrices: configParse6(configs.get(6)),
|
|
945
|
+
extraCurrencies: configParse7(configs.get(7)),
|
|
946
|
+
globalVersion: configParse8(configs.get(8)),
|
|
947
|
+
configMandatoryParams: configParse9(configs.get(9)),
|
|
948
|
+
configCriticalParams: configParse10(configs.get(10)),
|
|
949
|
+
voting: parseVotingSetup(configs.get(11)),
|
|
950
|
+
workchains: configParse12(configs.get(12)),
|
|
951
|
+
complaintCost: configParse13(configs.get(13)),
|
|
952
|
+
blockCreationRewards: configParse14(configs.get(14)),
|
|
953
|
+
validators: {
|
|
954
|
+
...configParse15(configs.get(15)),
|
|
955
|
+
...configParse16(configs.get(16)),
|
|
956
|
+
...configParse17(configs.get(17))
|
|
957
|
+
},
|
|
958
|
+
storagePrices: configParse18(configs.get(18)),
|
|
959
|
+
gasPrices: {
|
|
960
|
+
masterchain: configParseGasLimitsPrices(configs.get(20)),
|
|
961
|
+
workchain: configParseGasLimitsPrices(configs.get(21)),
|
|
962
|
+
},
|
|
963
|
+
blockLimits: {
|
|
964
|
+
masterchain: configParseBlockLimits(configs.get(22)),
|
|
965
|
+
workchain: configParseBlockLimits(configs.get(23)),
|
|
966
|
+
},
|
|
967
|
+
msgPrices: {
|
|
968
|
+
masterchain: configParseMsgPrices(configs.get(24)),
|
|
969
|
+
workchain: configParseMsgPrices(configs.get(25)),
|
|
970
|
+
},
|
|
971
|
+
catchain: configParse28(configs.get(28)),
|
|
972
|
+
consensus: configParse29(configs.get(29)),
|
|
973
|
+
fundamentalSmcAddr: configParse31(configs.get(31)),
|
|
974
|
+
validatorSets: {
|
|
975
|
+
prevValidators: configParseValidatorSet(configs.get(32)),
|
|
976
|
+
prevTempValidators: configParseValidatorSet(configs.get(33)),
|
|
977
|
+
currentValidators: configParseValidatorSet(configs.get(34)),
|
|
978
|
+
currentTempValidators: configParseValidatorSet(configs.get(35)),
|
|
979
|
+
nextValidators: configParseValidatorSet(configs.get(36)),
|
|
980
|
+
nextTempValidators: configParseValidatorSet(configs.get(37))
|
|
981
|
+
},
|
|
982
|
+
validatorsPunish: configParse40(configs.get(40)),
|
|
983
|
+
suspended: configParse44(configs.get(44)),
|
|
984
|
+
precompiledContracts: configParse45(configs.get(45)),
|
|
985
|
+
bridges: {
|
|
986
|
+
ethereum: configParseBridge(configs.get(71)),
|
|
987
|
+
binance: configParseBridge(configs.get(72)),
|
|
988
|
+
polygon: configParseBridge(configs.get(73))
|
|
989
|
+
},
|
|
990
|
+
tokenBridges: {
|
|
991
|
+
ethereum: loadJettonBridgeParams(configs.get(79)),
|
|
992
|
+
binance: loadJettonBridgeParams(configs.get(81)),
|
|
993
|
+
polygon: loadJettonBridgeParams(configs.get(82)),
|
|
994
|
+
}
|
|
698
995
|
};
|
|
699
996
|
}
|