@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
|
@@ -12,15 +12,19 @@ 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 BLOCK_AT_31_10_25 = 53519168;
|
|
15
16
|
const TESTNET_BLOCK = 32762926;
|
|
16
17
|
const testnetClient = (0, createTestClient4_1.createTestClient4)("testnet");
|
|
17
18
|
describe('ConfigContract', () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
it('should return correct burning config', async () => {
|
|
20
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [13])).config.cell;
|
|
21
|
+
const config13 = (0, ConfigParser_1.configParse13)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 13).beginParse());
|
|
22
|
+
expect(config13).toEqual({
|
|
23
|
+
deposit: 1000000000n,
|
|
24
|
+
bitPrice: 1n,
|
|
25
|
+
cellPrice: 500n
|
|
26
|
+
});
|
|
27
|
+
});
|
|
24
28
|
it('should return correct complaint pricing', async () => {
|
|
25
29
|
const serializedConfigsCell = (await client.getConfig(KNOWN_BLOCK, [5])).config.cell;
|
|
26
30
|
const config5 = (0, ConfigParser_1.configParse5)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 5).beginParse());
|
|
@@ -50,6 +54,112 @@ describe('ConfigContract', () => {
|
|
|
50
54
|
workchain_v2: undefined
|
|
51
55
|
});
|
|
52
56
|
});
|
|
57
|
+
it('should parse config7', async () => {
|
|
58
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [7])).config.cell;
|
|
59
|
+
const config7 = (0, ConfigParser_1.configParse7)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 7).beginParse());
|
|
60
|
+
expect(config7).toEqual({
|
|
61
|
+
toMint: {
|
|
62
|
+
'239': 666666666666n,
|
|
63
|
+
'4294967279': 1000000000000n
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('should parse config9', async () => {
|
|
68
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [9])).config.cell;
|
|
69
|
+
const config9 = (0, ConfigParser_1.configParse9)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 9).beginParse());
|
|
70
|
+
expect(config9).toEqual(new Set([0, 1, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 28, 34]));
|
|
71
|
+
});
|
|
72
|
+
it('should parse config10', async () => {
|
|
73
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [10])).config.cell;
|
|
74
|
+
const config10 = (0, ConfigParser_1.configParse10)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 10).beginParse());
|
|
75
|
+
expect(config10).toEqual(new Set([0, 1, 9, 10, 12, 14, 15, 16, 17, 32, 34, 36, -1001, -1000]));
|
|
76
|
+
});
|
|
77
|
+
it('should parse config14', async () => {
|
|
78
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [14])).config.cell;
|
|
79
|
+
const config14 = (0, ConfigParser_1.configParse14)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 14).beginParse());
|
|
80
|
+
expect(config14).toEqual({
|
|
81
|
+
masterchainBlockFee: 1700000000n,
|
|
82
|
+
workchainBlockFee: 1000000000n
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
it('should parse config22', async () => {
|
|
86
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [22])).config.cell;
|
|
87
|
+
const config22 = (0, ConfigParser_1.configParseBlockLimits)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 22).beginParse());
|
|
88
|
+
expect(config22).toEqual({
|
|
89
|
+
bytes: {
|
|
90
|
+
underload: 131072,
|
|
91
|
+
softLimit: 524288,
|
|
92
|
+
hardLimit: 1048576
|
|
93
|
+
},
|
|
94
|
+
gas: {
|
|
95
|
+
underload: 200000,
|
|
96
|
+
softLimit: 1000000,
|
|
97
|
+
hardLimit: 2500000
|
|
98
|
+
},
|
|
99
|
+
ltDelta: {
|
|
100
|
+
underload: 1000,
|
|
101
|
+
softLimit: 5000,
|
|
102
|
+
hardLimit: 10000
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
it('should parse config23', async () => {
|
|
107
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [23])).config.cell;
|
|
108
|
+
const config23 = (0, ConfigParser_1.configParseBlockLimits)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 23).beginParse());
|
|
109
|
+
expect(config23).toEqual({
|
|
110
|
+
bytes: {
|
|
111
|
+
underload: 262144,
|
|
112
|
+
softLimit: 1048576,
|
|
113
|
+
hardLimit: 2097152
|
|
114
|
+
},
|
|
115
|
+
gas: {
|
|
116
|
+
underload: 2000000,
|
|
117
|
+
softLimit: 10000000,
|
|
118
|
+
hardLimit: 20000000
|
|
119
|
+
},
|
|
120
|
+
ltDelta: {
|
|
121
|
+
underload: 1000,
|
|
122
|
+
softLimit: 5000,
|
|
123
|
+
hardLimit: 10000
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
it('should parse config31', async () => {
|
|
128
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [31])).config.cell;
|
|
129
|
+
const config31 = (0, ConfigParser_1.configParse31)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 31).beginParse());
|
|
130
|
+
expect(config31.map((e) => e.toString())).toEqual([
|
|
131
|
+
core_1.Address.parse('-1:0000000000000000000000000000000000000000000000000000000000000000').toString(),
|
|
132
|
+
core_1.Address.parse('-1:0ebd7ff9ca70e06e9e22a8922f5ae75211a9d6a34a8094e8e1587b606bdbb662').toString(),
|
|
133
|
+
core_1.Address.parse('-1:3333333333333333333333333333333333333333333333333333333333333333').toString(),
|
|
134
|
+
core_1.Address.parse('-1:3b9bbfd0ad5338b9700f0833380ee17d463e51c1ae671ee6f08901bde899b202').toString(),
|
|
135
|
+
core_1.Address.parse('-1:4d5c0210b35daddaa219fac459dba0fdefb1fae4e97a0d0797739fe050d694ca').toString(),
|
|
136
|
+
core_1.Address.parse('-1:dd24c4a1f2b88f8b7053513b5cc6c5a31bc44b2a72dcb4d8c0338af0f0d37ec5').toString(),
|
|
137
|
+
core_1.Address.parse('-1:ead7da389bde317c5fb285807ce507baad31c35fe5534b3c418785e901f64c68').toString()
|
|
138
|
+
]);
|
|
139
|
+
});
|
|
140
|
+
it('should parse config44', async () => {
|
|
141
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [44])).config.cell;
|
|
142
|
+
const config44 = (0, ConfigParser_1.configParse44)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 44).beginParse());
|
|
143
|
+
expect(config44.suspendedUntil).toEqual(1803189600);
|
|
144
|
+
expect(config44.addresses.length).toEqual(180);
|
|
145
|
+
expect(config44.addresses[4].toString()).toEqual(core_1.Address.parse('0:0927afd84711fea63794c619ded2288c7479b3ec16c927f0360ed76603f6df06').toString());
|
|
146
|
+
});
|
|
147
|
+
it('should parse config45', async () => {
|
|
148
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [45])).config.cell;
|
|
149
|
+
const config45 = (0, ConfigParser_1.configParse45)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 45).beginParse());
|
|
150
|
+
expect(config45.map((e) => ({ hash: e.hash.toString('hex'), gasUsed: e.gasUsed }))).toEqual([{
|
|
151
|
+
hash: '89468f02c78e570802e39979c8516fc38df07ea76a48357e0536f2ba7b3ee37b',
|
|
152
|
+
gasUsed: 1000n
|
|
153
|
+
}]);
|
|
154
|
+
});
|
|
155
|
+
it('should parse jettonBridgeParams', async () => {
|
|
156
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25, [79])).config.cell;
|
|
157
|
+
const config79 = (0, ConfigParser_1.loadJettonBridgeParams)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 79).beginParse());
|
|
158
|
+
expect(config79?.bridgeAddress.toString()).toEqual(core_1.Address.parse('Ef-1JetbPF9ubc1ga-57oHoOyDA1IShJt-BVlJnA9rrVTfrB').toString());
|
|
159
|
+
expect(config79?.jettonBridgePrices?.bridgeBurnFee).toEqual(1000000000n);
|
|
160
|
+
expect(config79?.oracles.length).toEqual(9);
|
|
161
|
+
expect(config79?.oracles[3].addr.toString()).toEqual(core_1.Address.parse('Uf8ceN7cTemTe4ZV6AIbg5f8LsHZsYV1UaiGntvkME0KtKP8').toString());
|
|
162
|
+
});
|
|
53
163
|
it('should return correct workchain_v2 description', async () => {
|
|
54
164
|
const serializedConfigsCell = (await testnetClient.getConfig(TESTNET_BLOCK, [12])).config.cell;
|
|
55
165
|
const config12 = (0, ConfigParser_1.configParse12)((0, ConfigParser_1.loadConfigParamById)(serializedConfigsCell, 12).beginParse());
|
|
@@ -126,8 +236,8 @@ describe('ConfigContract', () => {
|
|
|
126
236
|
expect(config71.oracles.get('Ef8DfObDUrNqz66pr_7xMbUYckUFbIIvRh1FSNeVSLWrvo1M')).toEqual(Buffer.from('000000000000000000000000cf4a7c26186aa41390e246fa04115a0495085ab9', 'hex'));
|
|
127
237
|
expect(config71.externalChainAddress).toEqual(Buffer.from('000000000000000000000000582d872a1b094fc48f5de31d3b73f2d9be47def1', 'hex'));
|
|
128
238
|
});
|
|
129
|
-
it('should not
|
|
130
|
-
const serializedConfigsCell = (await client.getConfig(
|
|
239
|
+
it('should not raise error when loading full config', async () => {
|
|
240
|
+
const serializedConfigsCell = (await client.getConfig(BLOCK_AT_31_10_25)).config.cell;
|
|
131
241
|
(0, ConfigParser_1.parseFullConfig)((0, ConfigParser_1.loadConfigParamsAsSlice)(serializedConfigsCell));
|
|
132
242
|
});
|
|
133
243
|
it('should not raise error when parsing testnet config', async () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,5 @@ export { MultisigOrder } from './multisig/MultisigOrder';
|
|
|
25
25
|
export { MultisigOrderBuilder } from './multisig/MultisigOrderBuilder';
|
|
26
26
|
export { MultisigWallet } from './multisig/MultisigWallet';
|
|
27
27
|
export { ElectorContract } from './elector/ElectorContract';
|
|
28
|
-
export { GasLimitsPrices, StoragePrices, MsgPrices, WorkchainDescriptor, configParse5, configParse8, configParse12, configParse13, configParse15, configParse16, configParse17, configParse18, configParse28, configParse29, configParse40, configParseBridge, configParseGasLimitsPrices, configParseMasterAddress, configParseMasterAddressRequired, configParseMsgPrices, configParseValidatorSet, configParseWorkchainDescriptor, parseBridge, parseProposalSetup, parseValidatorSet, parseVotingSetup, parseFullConfig, loadConfigParamById, loadConfigParamsAsSlice } from './config/ConfigParser';
|
|
28
|
+
export { GasLimitsPrices, StoragePrices, MsgPrices, WorkchainDescriptor, configParse5, configParse8, configParse12, configParse13, configParse15, configParse16, configParse17, configParse18, configParse28, configParse29, configParse40, configParseBridge, configParseGasLimitsPrices, configParseMasterAddress, configParseMasterAddressRequired, configParseMsgPrices, configParseValidatorSet, configParseWorkchainDescriptor, parseBridge, parseProposalSetup, parseValidatorSet, parseVotingSetup, parseFullConfig, parseFullerConfig, loadConfigParamById, loadConfigParamsAsSlice } from './config/ConfigParser';
|
|
29
29
|
export { computeExternalMessageFees, computeFwdFees, computeGasPrices, computeMessageForwardFees, computeStorageFees } from './utils/fees';
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.computeStorageFees = exports.computeMessageForwardFees = exports.computeGasPrices = exports.computeFwdFees = exports.computeExternalMessageFees = exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV5R1 = exports.WalletContractV5Beta = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
|
|
24
|
+
exports.computeStorageFees = exports.computeMessageForwardFees = exports.computeGasPrices = exports.computeFwdFees = exports.computeExternalMessageFees = exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullerConfig = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV5R1 = exports.WalletContractV5Beta = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
|
|
25
25
|
__exportStar(require("@ton/core"), exports);
|
|
26
26
|
//
|
|
27
27
|
// toncenter Client
|
|
@@ -106,6 +106,7 @@ Object.defineProperty(exports, "parseProposalSetup", { enumerable: true, get: fu
|
|
|
106
106
|
Object.defineProperty(exports, "parseValidatorSet", { enumerable: true, get: function () { return ConfigParser_1.parseValidatorSet; } });
|
|
107
107
|
Object.defineProperty(exports, "parseVotingSetup", { enumerable: true, get: function () { return ConfigParser_1.parseVotingSetup; } });
|
|
108
108
|
Object.defineProperty(exports, "parseFullConfig", { enumerable: true, get: function () { return ConfigParser_1.parseFullConfig; } });
|
|
109
|
+
Object.defineProperty(exports, "parseFullerConfig", { enumerable: true, get: function () { return ConfigParser_1.parseFullerConfig; } });
|
|
109
110
|
Object.defineProperty(exports, "loadConfigParamById", { enumerable: true, get: function () { return ConfigParser_1.loadConfigParamById; } });
|
|
110
111
|
Object.defineProperty(exports, "loadConfigParamsAsSlice", { enumerable: true, get: function () { return ConfigParser_1.loadConfigParamsAsSlice; } });
|
|
111
112
|
//
|
|
@@ -47,7 +47,7 @@ export declare class WalletContractV5R1 implements Contract {
|
|
|
47
47
|
data: Cell;
|
|
48
48
|
code: Cell;
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
constructor(workchain: number, publicKey: Buffer, walletId: WalletIdV5R1<WalletIdV5R1ClientContext | WalletIdV5R1CustomContext>);
|
|
51
51
|
/**
|
|
52
52
|
* Get Wallet Balance
|
|
53
53
|
*/
|
|
@@ -64,7 +64,7 @@ function storeOutListExtendedV5R1(actions) {
|
|
|
64
64
|
const extendedActions = actions.filter(WalletV5OutActions_1.isOutActionExtended);
|
|
65
65
|
const basicActions = actions.filter(WalletV5OutActions_1.isOutActionBasic);
|
|
66
66
|
return (builder) => {
|
|
67
|
-
const outListPacked = basicActions.length ? (0, core_1.beginCell)().store((0, core_1.storeOutList)(basicActions
|
|
67
|
+
const outListPacked = basicActions.length ? (0, core_1.beginCell)().store((0, core_1.storeOutList)(basicActions)) : null;
|
|
68
68
|
builder.storeMaybeRef(outListPacked);
|
|
69
69
|
if (extendedActions.length === 0) {
|
|
70
70
|
builder.storeUint(0, 1);
|
|
@@ -173,7 +173,7 @@ describe('Wallet V5R1 actions', () => {
|
|
|
173
173
|
}
|
|
174
174
|
];
|
|
175
175
|
const actual = (0, core_1.beginCell)().store((0, WalletV5R1Actions_1.storeOutListExtendedV5R1)(actions)).endCell();
|
|
176
|
-
const expected = core_1.Cell.fromBoc(Buffer.from('
|
|
176
|
+
const expected = core_1.Cell.fromBoc(Buffer.from('b5ee9c724101080100ab000245c0a000888888888888888888888888888888888888888888888888888888888888888c0301010304400200450380022222222222222222222222222222222222222222222222222222222222222230020a0ec3c86d0005040068420011111111111111111111111111111111111111111111111111111111111111110808404404000000000000c0e40007890000020a0ec3c86d030706001cc0000000000000000000000000000000a78e5373', 'hex'))[0];
|
|
177
177
|
expect(actual.equals(expected)).toBeTruthy();
|
|
178
178
|
});
|
|
179
179
|
it('Should deserialize extended out list', () => {
|