@ton/blueprint 0.44.0-dev.20260119142202.79d051f → 0.44.0-dev.20260220152830.3fec080

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.
@@ -108,6 +108,8 @@ ${chalk_1.default.cyan('--custom')} [api-endpoint] - use a custom API
108
108
  ${chalk_1.default.cyan('--custom-version')} - API version (v2, v4)
109
109
  ${chalk_1.default.cyan('--custom-key')} - API key (v2 only)
110
110
  ${chalk_1.default.cyan('--custom-type')} - network type (custom, mainnet, testnet)
111
+ ${chalk_1.default.cyan('--custom-domain')} - network domain (for custom l2 domain)
112
+ ${chalk_1.default.cyan('--custom-network-id')} - network global ID (for custom network)
111
113
  ${chalk_1.default.cyan('--tonconnect')}, ${chalk_1.default.cyan('--deeplink')}, ${chalk_1.default.cyan('--mnemonic')} - deployer options
112
114
  ${chalk_1.default.cyan('--tonscan')}, ${chalk_1.default.cyan('--tonviewer')}, ${chalk_1.default.cyan('--toncx')}, ${chalk_1.default.cyan('--dton')} - explorer (default: tonviewer)
113
115
  ${chalk_1.default.gray('[...args]')} (array of strings, optional) - Arguments passed directly to the script.
@@ -148,7 +150,7 @@ ${chalk_1.default.cyan('--compiler-version')} - specifies the exact compiler ver
148
150
  ${chalk_1.default.cyan('--custom')} [api-endpoint] - use custom API (requires --custom-type)
149
151
  ${chalk_1.default.cyan('--custom-version')} - API version (v2 default)
150
152
  ${chalk_1.default.cyan('--custom-key')} - API key (v2 only)
151
- ${chalk_1.default.cyan('--custom-type')} - network type (mainnet, testnet)`,
153
+ ${chalk_1.default.cyan('--custom-type')} - network type (mainnet, testnet, tetra)`,
152
154
  convert: `${chalk_1.default.bold('Usage:')} blueprint ${chalk_1.default.cyan('convert')} ${chalk_1.default.yellow('[path to build script]')}
153
155
 
154
156
  Attempts to convert a legacy bash build script to a Blueprint compile wrapper.`,
@@ -29,7 +29,9 @@ export interface Config {
29
29
  * },
30
30
  * };
31
31
  */
32
- network?: 'mainnet' | 'testnet' | CustomNetwork;
32
+ network?: 'mainnet' | 'testnet' | 'tetra' | CustomNetwork;
33
+ domain?: number;
34
+ networkId?: number;
33
35
  /**
34
36
  * If true, keeps compilable files (`*.compile.ts`) in a separate directory `compilables`.
35
37
  * When false or unset, compilables are stored in `wrappers` directory.
@@ -1 +1 @@
1
- export type Network = 'mainnet' | 'testnet' | 'custom';
1
+ export type Network = 'mainnet' | 'testnet' | 'tetra' | 'custom';
@@ -5,10 +5,13 @@ import { Config } from '../config/Config';
5
5
  export declare const argSpec: {
6
6
  '--mainnet': BooleanConstructor;
7
7
  '--testnet': BooleanConstructor;
8
+ '--tetra': BooleanConstructor;
8
9
  '--custom': StringConstructor;
9
10
  '--custom-type': StringConstructor;
10
11
  '--custom-version': StringConstructor;
11
12
  '--custom-key': StringConstructor;
13
+ '--custom-domain': NumberConstructor;
14
+ '--custom-network-id': NumberConstructor;
12
15
  '--compiler-version': StringConstructor;
13
16
  '--tonconnect': BooleanConstructor;
14
17
  '--deeplink': BooleanConstructor;
@@ -25,10 +25,13 @@ const CONFIG_ADDRESS = core_1.Address.parse('-1:55555555555555555555555555555555
25
25
  exports.argSpec = {
26
26
  '--mainnet': Boolean,
27
27
  '--testnet': Boolean,
28
+ '--tetra': Boolean,
28
29
  '--custom': String,
29
30
  '--custom-type': String,
30
31
  '--custom-version': String,
31
32
  '--custom-key': String,
33
+ '--custom-domain': Number,
34
+ '--custom-network-id': Number,
32
35
  '--compiler-version': String,
33
36
  '--tonconnect': Boolean,
34
37
  '--deeplink': Boolean,
@@ -276,7 +279,7 @@ function getOptionalNumberEnv(envName) {
276
279
  }
277
280
  return value;
278
281
  }
279
- async function createMnemonicProvider(client, network, ui) {
282
+ async function createMnemonicProvider(client, network, ui, domain, networkId) {
280
283
  const mnemonic = process.env.WALLET_MNEMONIC ?? '';
281
284
  const walletVersion = process.env.WALLET_VERSION ?? '';
282
285
  if (mnemonic.length === 0 || walletVersion.length === 0) {
@@ -293,6 +296,8 @@ async function createMnemonicProvider(client, network, ui) {
293
296
  walletId,
294
297
  subwalletNumber,
295
298
  network,
299
+ domain,
300
+ networkId,
296
301
  });
297
302
  }
298
303
  function intToIP(int) {
@@ -333,6 +338,7 @@ class NetworkProviderBuilder {
333
338
  let network = (0, utils_1.oneOrZeroOf)({
334
339
  mainnet: this.args['--mainnet'],
335
340
  testnet: this.args['--testnet'],
341
+ tetra: this.args['--tetra'],
336
342
  custom: this.args['--custom'] !== undefined,
337
343
  });
338
344
  if (network !== undefined) {
@@ -341,7 +347,7 @@ class NetworkProviderBuilder {
341
347
  if (this.config?.network !== undefined) {
342
348
  return typeof this.config.network === 'string' ? this.config.network : 'custom';
343
349
  }
344
- network = await this.ui.choose('Which network do you want to use?', ['mainnet', 'testnet', 'custom'], (c) => c);
350
+ network = await this.ui.choose('Which network do you want to use?', ['mainnet', 'testnet', 'tetra', 'custom'], (c) => c);
345
351
  if (network === 'custom') {
346
352
  const defaultCustomEndpoint = 'http://localhost:8081/';
347
353
  this.args['--custom'] = (await this.ui.input(`Provide a custom API v2 endpoint (default is ${defaultCustomEndpoint})`)).trim();
@@ -392,7 +398,7 @@ class NetworkProviderBuilder {
392
398
  provider = new TonConnectProvider_1.TonConnectProvider(new FSStorage_1.FSStorage(storagePath), this.ui, network, this.config?.manifestUrl);
393
399
  break;
394
400
  case 'mnemonic':
395
- provider = await createMnemonicProvider(client, network, this.ui);
401
+ provider = await createMnemonicProvider(client, network, this.ui, this.config?.domain, this.config?.networkId);
396
402
  break;
397
403
  default:
398
404
  throw new Error('Unknown deploy option');
@@ -431,6 +437,13 @@ class NetworkProviderBuilder {
431
437
  key: this.args['--custom-key'],
432
438
  type,
433
439
  };
440
+ if (this.config && this.args['--custom-domain']) {
441
+ const customDomain = this.args['--custom-domain'];
442
+ this.config.domain = customDomain;
443
+ }
444
+ if (this.config && this.args['--custom-network-id']) {
445
+ this.config.networkId = this.args['--custom-network-id'];
446
+ }
434
447
  }
435
448
  if (configNetwork === undefined) {
436
449
  throw new Error('Custom network is (somehow) undefined');
@@ -463,7 +476,7 @@ class NetworkProviderBuilder {
463
476
  }
464
477
  if (configNetwork.type !== undefined) {
465
478
  const ct = configNetwork.type.toLowerCase();
466
- if (!['mainnet', 'testnet', 'custom'].includes(ct)) {
479
+ if (!['mainnet', 'testnet', 'custom', 'tetra'].includes(ct)) {
467
480
  throw new Error('Unknown network type: ' + ct);
468
481
  }
469
482
  network = ct;
@@ -473,34 +486,41 @@ class NetworkProviderBuilder {
473
486
  }
474
487
  }
475
488
  else {
476
- const httpAdapter = async (config) => {
477
- let r;
478
- let delay = INITIAL_DELAY;
479
- let attempts = 0;
480
- while (true) {
481
- r = await (0, axios_1.default)({
482
- ...config,
483
- adapter: undefined,
484
- validateStatus: (status) => (status >= 200 && status < 300) || status === 429,
485
- });
486
- if (r.status !== 429) {
487
- return r;
488
- }
489
- await (0, utils_1.sleep)(delay);
490
- delay *= 2;
491
- attempts++;
492
- if (attempts >= MAX_ATTEMPTS) {
493
- throw new Error('Max attempts reached');
489
+ if (network === 'tetra') {
490
+ tc = new ton_adapter_1.ContractAdapter(new client_1.TonApiClient({
491
+ baseUrl: 'https://tetra.tonapi.io',
492
+ }));
493
+ }
494
+ else {
495
+ const httpAdapter = async (config) => {
496
+ let r;
497
+ let delay = INITIAL_DELAY;
498
+ let attempts = 0;
499
+ while (true) {
500
+ r = await (0, axios_1.default)({
501
+ ...config,
502
+ adapter: undefined,
503
+ validateStatus: (status) => (status >= 200 && status < 300) || status === 429,
504
+ });
505
+ if (r.status !== 429) {
506
+ return r;
507
+ }
508
+ await (0, utils_1.sleep)(delay);
509
+ delay *= 2;
510
+ attempts++;
511
+ if (attempts >= MAX_ATTEMPTS) {
512
+ throw new Error('Max attempts reached');
513
+ }
494
514
  }
495
- }
496
- };
497
- tc = new ton_1.TonClient({
498
- timeout: this.config?.requestTimeout,
499
- endpoint: network === 'mainnet'
500
- ? 'https://toncenter.com/api/v2/jsonRPC'
501
- : 'https://testnet.toncenter.com/api/v2/jsonRPC',
502
- httpAdapter,
503
- });
515
+ };
516
+ tc = new ton_1.TonClient({
517
+ timeout: this.config?.requestTimeout,
518
+ endpoint: network === 'mainnet'
519
+ ? 'https://toncenter.com/api/v2/jsonRPC'
520
+ : 'https://testnet.toncenter.com/api/v2/jsonRPC',
521
+ httpAdapter,
522
+ });
523
+ }
504
524
  }
505
525
  const sendProvider = await this.chooseSendProvider(network, tc);
506
526
  try {
@@ -14,6 +14,8 @@ type MnemonicProviderParams = {
14
14
  client: BlueprintTonClient;
15
15
  ui: UIProvider;
16
16
  network: Network;
17
+ domain?: number;
18
+ networkId?: number;
17
19
  };
18
20
  export declare class MnemonicProvider implements SendProvider {
19
21
  private readonly wallet;
@@ -4,6 +4,7 @@ exports.MnemonicProvider = void 0;
4
4
  const core_1 = require("@ton/core");
5
5
  const crypto_1 = require("@ton/crypto");
6
6
  const wallets_1 = require("./wallets");
7
+ const network_utils_1 = require("../../utils/network.utils");
7
8
  class MnemonicProvider {
8
9
  constructor(params) {
9
10
  if (!(params.version in wallets_1.wallets)) {
@@ -21,23 +22,28 @@ class MnemonicProvider {
21
22
  this.ui = params.ui;
22
23
  }
23
24
  createWallet(params, kp) {
25
+ const networkDomain = params.network === 'tetra' ? network_utils_1.TETRA_DOMAIN : undefined;
26
+ const domain = params.domain ? { type: 'l2', globalId: params.domain } : networkDomain;
27
+ const networkGlobalId = params.networkId ?? (0, network_utils_1.getW5NetworkGlobalId)(params.network);
24
28
  if (params.version === 'v5r1') {
25
29
  return wallets_1.wallets[params.version].create({
26
30
  publicKey: kp.publicKey,
27
31
  walletId: {
28
- networkGlobalId: params.network === 'testnet' ? -3 : -239, // networkGlobalId: -3 for Testnet, -239 for Mainnet
32
+ networkGlobalId: networkGlobalId,
29
33
  context: {
30
34
  workchain: params.workchain ?? 0,
31
35
  subwalletNumber: params.subwalletNumber ?? 0,
32
36
  walletVersion: 'v5r1',
33
37
  },
34
38
  },
39
+ domain,
35
40
  });
36
41
  }
37
42
  return wallets_1.wallets[params.version].create({
38
43
  workchain: params.workchain ?? 0,
39
44
  publicKey: kp.publicKey,
40
45
  walletId: params.walletId,
46
+ domain,
41
47
  });
42
48
  }
43
49
  async connect() {
@@ -0,0 +1,6 @@
1
+ import { Network } from '../network/Network';
2
+ export declare const TETRA_DOMAIN: {
3
+ readonly type: "l2";
4
+ readonly globalId: 662387;
5
+ };
6
+ export declare function getW5NetworkGlobalId(network: Network): number;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TETRA_DOMAIN = void 0;
4
+ exports.getW5NetworkGlobalId = getW5NetworkGlobalId;
5
+ const MAINNET_NETWORK_GLOBAL_ID = -239;
6
+ const TESTNET_NETWORK_GLOBAL_ID = -3;
7
+ const TETRA_NETWORK_GLOBAL_ID = 662387;
8
+ exports.TETRA_DOMAIN = {
9
+ type: 'l2',
10
+ globalId: TETRA_NETWORK_GLOBAL_ID,
11
+ };
12
+ function getW5NetworkGlobalId(network) {
13
+ switch (network) {
14
+ case 'testnet':
15
+ return TESTNET_NETWORK_GLOBAL_ID;
16
+ case 'mainnet':
17
+ return MAINNET_NETWORK_GLOBAL_ID;
18
+ case 'tetra':
19
+ return MAINNET_NETWORK_GLOBAL_ID;
20
+ }
21
+ return TESTNET_NETWORK_GLOBAL_ID;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/blueprint",
3
- "version": "0.44.0-dev.20260119142202.79d051f",
3
+ "version": "0.44.0-dev.20260220152830.3fec080",
4
4
  "description": "Framework for development of TON smart contracts",
5
5
  "main": "dist/index.js",
6
6
  "bin": "./dist/cli/cli.js",
@@ -24,11 +24,11 @@
24
24
  "devDependencies": {
25
25
  "@tact-lang/compiler": "^1.6.13",
26
26
  "@ton-community/func-js": "^0.10.0",
27
- "@ton/core": "^0.61.0",
27
+ "@ton/core": "^0.63.1",
28
28
  "@ton/crypto": "^3.3.0",
29
29
  "@ton/sandbox": "^0.40.0",
30
30
  "@ton/tolk-js": "^1.0.0",
31
- "@ton/ton": "^15.3.1",
31
+ "@ton/ton": "^16.2.2",
32
32
  "@ton/toolchain": "the-ton-tech/toolchain#v1.6.0",
33
33
  "@types/inquirer": "^8.2.6",
34
34
  "@types/jest": "^30.0.0",
@@ -43,11 +43,11 @@
43
43
  "peerDependencies": {
44
44
  "@tact-lang/compiler": ">=1.6.5",
45
45
  "@ton-community/func-js": ">=0.10.0",
46
- "@ton/core": ">=0.61.0",
46
+ "@ton/core": ">=0.63.1",
47
47
  "@ton/crypto": ">=3.3.0",
48
48
  "@ton/sandbox": ">=0.40.0",
49
49
  "@ton/tolk-js": ">=0.13.0",
50
- "@ton/ton": ">=15.2.1"
50
+ "@ton/ton": ">=16.2.2"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "@ton/sandbox": {