@ton/blueprint 0.10.0 → 0.12.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.
- package/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/dist/cli/build.js +3 -5
- package/dist/cli/cli.js +1 -1
- package/dist/compile/CompilerConfig.d.ts +3 -1
- package/dist/compile/OverwritableVirtualFileSystem.d.ts +1 -0
- package/dist/compile/OverwritableVirtualFileSystem.js +6 -3
- package/dist/compile/compile.d.ts +1 -1
- package/dist/compile/compile.js +6 -5
- package/dist/network/NetworkProvider.d.ts +2 -2
- package/dist/network/createNetworkProvider.js +9 -9
- package/dist/network/send/DeeplinkProvider.d.ts +1 -1
- package/dist/network/send/DeeplinkProvider.js +2 -2
- package/dist/network/send/MnemonicProvider.d.ts +2 -2
- package/dist/network/send/MnemonicProvider.js +6 -6
- package/dist/network/send/SendProvider.d.ts +1 -1
- package/dist/network/send/TonConnectProvider.d.ts +1 -1
- package/dist/network/send/TonConnectProvider.js +4 -4
- package/dist/network/send/TonHubProvider.d.ts +1 -1
- package/dist/network/send/TonHubProvider.js +4 -4
- package/dist/templates/func/common/wrappers/compile.ts.template +1 -1
- package/dist/templates/func/counter/scripts/deploy.ts.template +2 -2
- package/dist/templates/func/counter/scripts/increment.ts.template +2 -2
- package/dist/templates/func/counter/tests/spec.ts.template +4 -4
- package/dist/templates/func/counter/wrappers/wrapper.ts.template +1 -1
- package/dist/templates/func/empty/scripts/deploy.ts.template +2 -2
- package/dist/templates/func/empty/tests/spec.ts.template +4 -4
- package/dist/templates/func/empty/wrappers/wrapper.ts.template +1 -1
- package/dist/templates/tact/common/wrappers/compile.ts.template +1 -1
- package/dist/templates/tact/counter/scripts/deploy.ts.template +2 -2
- package/dist/templates/tact/counter/scripts/increment.ts.template +2 -2
- package/dist/templates/tact/counter/tests/spec.ts.template +3 -3
- package/dist/templates/tact/empty/scripts/deploy.ts.template +2 -2
- package/dist/templates/tact/empty/tests/spec.ts.template +3 -3
- package/dist/utils.d.ts +1 -1
- package/package.json +49 -50
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
## [0.12.1] - 2023-07-31
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Updated all dependencies to @ton organization packages
|
|
14
|
+
|
|
15
|
+
## [0.12.0] - 2023-07-14
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed TACT imports
|
|
20
|
+
- Fixed missing newlines when printing error messages while building contracts
|
|
21
|
+
|
|
22
|
+
## [0.11.0] - 2023-07-03
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Added an `options` field to the `tact` variant of `CompilerConfig`, which is of the same type as the `options` of the TACT compiler, and includes fields such as `debug`, `experimental`, etc
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Updated TACT to 1.1.3
|
|
31
|
+
|
|
8
32
|
## [0.10.0] - 2023-06-06
|
|
9
33
|
|
|
10
34
|
### Added
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ npm create ton@latest
|
|
|
42
42
|
### Directory structure
|
|
43
43
|
|
|
44
44
|
* `contracts/` - Source code in [FunC](https://ton.org/docs/develop/func/overview) for all smart contracts and their imports
|
|
45
|
-
* `wrappers/` - TypeScript interface classes for all contracts (implementing `Contract` from [ton
|
|
45
|
+
* `wrappers/` - TypeScript interface classes for all contracts (implementing `Contract` from [@ton/core](https://www.npmjs.com/package/@ton/core))
|
|
46
46
|
* include message [de]serialization primitives, getter wrappers and compilation functions
|
|
47
47
|
* used by the test suite and client code to interact with the contracts from TypeScript
|
|
48
48
|
* `tests/` - TypeScript test suite for all contracts (relying on [Sandbox](https://github.com/ton-org/sandbox) for in-process tests)
|
package/dist/cli/build.js
CHANGED
|
@@ -11,13 +11,13 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
11
11
|
const compile_1 = require("../compile/compile");
|
|
12
12
|
const arg_1 = __importDefault(require("arg"));
|
|
13
13
|
async function buildOne(contract, ui) {
|
|
14
|
-
ui.write(`Build script running, compiling ${contract}`);
|
|
14
|
+
ui.write(`Build script running, compiling ${contract}\n`);
|
|
15
15
|
const buildArtifactPath = path_1.default.join(paths_1.BUILD_DIR, `${contract}.compiled.json`);
|
|
16
16
|
try {
|
|
17
17
|
await promises_1.default.unlink(buildArtifactPath);
|
|
18
18
|
}
|
|
19
19
|
catch (e) { }
|
|
20
|
-
ui.
|
|
20
|
+
ui.write('⏳ Compiling...\n');
|
|
21
21
|
try {
|
|
22
22
|
const result = await (0, compile_1.doCompile)(contract);
|
|
23
23
|
if (result.lang === 'tact') {
|
|
@@ -29,8 +29,7 @@ async function buildOne(contract, ui) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const cell = result.code;
|
|
32
|
-
ui.
|
|
33
|
-
ui.write('\n✅ Compiled successfully! Cell BOC hex result:\n\n');
|
|
32
|
+
ui.write('✅ Compiled successfully! Cell BOC hex result:\n\n');
|
|
34
33
|
ui.write(cell.toBoc().toString('hex'));
|
|
35
34
|
await promises_1.default.mkdir(paths_1.BUILD_DIR, { recursive: true });
|
|
36
35
|
await promises_1.default.writeFile(buildArtifactPath, JSON.stringify({
|
|
@@ -39,7 +38,6 @@ async function buildOne(contract, ui) {
|
|
|
39
38
|
ui.write(`\n✅ Wrote compilation artifact to ${path_1.default.relative(process.cwd(), buildArtifactPath)}`);
|
|
40
39
|
}
|
|
41
40
|
catch (e) {
|
|
42
|
-
ui.clearActionPrompt();
|
|
43
41
|
ui.write(e.toString());
|
|
44
42
|
process.exit(1);
|
|
45
43
|
}
|
package/dist/cli/cli.js
CHANGED
|
@@ -100,7 +100,7 @@ function showHelp() {
|
|
|
100
100
|
console.log(`\t\t\t` + chalk_1.default.gray(`blueprint run deployContractName`));
|
|
101
101
|
console.log(chalk_1.default.cyanBright(` blueprint help`) +
|
|
102
102
|
`\t` +
|
|
103
|
-
chalk_1.default.whiteBright(`shows more detailed help, also see https://github.com/ton-
|
|
103
|
+
chalk_1.default.whiteBright(`shows more detailed help, also see https://github.com/ton-org/blueprint`));
|
|
104
104
|
console.log(`\t\t\t` + chalk_1.default.gray(`blueprint help`));
|
|
105
105
|
console.log(``);
|
|
106
106
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SourceResolver, SourcesMap, SourcesArray } from '@ton-community/func-js';
|
|
2
|
-
import { Cell } from 'ton
|
|
2
|
+
import { Cell } from '@ton/core';
|
|
3
|
+
import { ConfigProject } from '@tact-lang/compiler';
|
|
3
4
|
export type CommonCompilerConfig = {
|
|
4
5
|
preCompileHook?: () => Promise<void>;
|
|
5
6
|
postCompileHook?: (code: Cell) => Promise<void>;
|
|
@@ -7,6 +8,7 @@ export type CommonCompilerConfig = {
|
|
|
7
8
|
export type TactCompilerConfig = {
|
|
8
9
|
lang: 'tact';
|
|
9
10
|
target: string;
|
|
11
|
+
options?: ConfigProject['options'];
|
|
10
12
|
};
|
|
11
13
|
export type FuncCompilerConfig = {
|
|
12
14
|
lang?: 'func';
|
|
@@ -3,6 +3,7 @@ import { VirtualFileSystem } from '@tact-lang/compiler';
|
|
|
3
3
|
export declare class OverwritableVirtualFileSystem implements VirtualFileSystem {
|
|
4
4
|
root: string;
|
|
5
5
|
overwrites: Map<string, Buffer>;
|
|
6
|
+
constructor(root: string);
|
|
6
7
|
resolve(...path: string[]): string;
|
|
7
8
|
exists(path: string): boolean;
|
|
8
9
|
readFile(path: string): Buffer;
|
|
@@ -4,12 +4,15 @@ exports.OverwritableVirtualFileSystem = void 0;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
class OverwritableVirtualFileSystem {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.root = '/';
|
|
7
|
+
constructor(root) {
|
|
9
8
|
this.overwrites = new Map();
|
|
9
|
+
this.root = (0, path_1.normalize)(root);
|
|
10
|
+
if (!this.root.endsWith(path_1.sep)) {
|
|
11
|
+
this.root += path_1.sep;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
resolve(...path) {
|
|
12
|
-
return (0, path_1.resolve)(...path);
|
|
15
|
+
return (0, path_1.normalize)((0, path_1.resolve)(this.root, ...path));
|
|
13
16
|
}
|
|
14
17
|
exists(path) {
|
|
15
18
|
return (0, fs_1.existsSync)(path);
|
package/dist/compile/compile.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.compile = exports.doCompile = void 0;
|
|
|
30
30
|
const func_js_1 = require("@ton-community/func-js");
|
|
31
31
|
const fs_1 = require("fs");
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
33
|
-
const
|
|
33
|
+
const core_1 = require("@ton/core");
|
|
34
34
|
const paths_1 = require("../paths");
|
|
35
35
|
const compiler_1 = require("@tact-lang/compiler");
|
|
36
36
|
const OverwritableVirtualFileSystem_1 = require("./OverwritableVirtualFileSystem");
|
|
@@ -49,7 +49,7 @@ async function doCompileFunc(config) {
|
|
|
49
49
|
throw new Error(cr.message);
|
|
50
50
|
return {
|
|
51
51
|
lang: 'func',
|
|
52
|
-
code:
|
|
52
|
+
code: core_1.Cell.fromBase64(cr.codeBoc),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function findTactBoc(fs) {
|
|
@@ -63,15 +63,16 @@ function findTactBoc(fs) {
|
|
|
63
63
|
if (buf === undefined) {
|
|
64
64
|
throw new Error('Could not find boc in tact compilation result');
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return core_1.Cell.fromBoc(buf)[0];
|
|
67
67
|
}
|
|
68
68
|
async function doCompileTact(config, name) {
|
|
69
|
-
const fs = new OverwritableVirtualFileSystem_1.OverwritableVirtualFileSystem();
|
|
69
|
+
const fs = new OverwritableVirtualFileSystem_1.OverwritableVirtualFileSystem(process.cwd());
|
|
70
70
|
const res = await (0, compiler_1.build)({
|
|
71
71
|
config: {
|
|
72
72
|
name: 'tact',
|
|
73
|
-
path:
|
|
73
|
+
path: config.target,
|
|
74
74
|
output: path_1.default.join(paths_1.BUILD_DIR, name),
|
|
75
|
+
options: config.options,
|
|
75
76
|
},
|
|
76
77
|
stdlib: '/stdlib',
|
|
77
78
|
project: fs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TonClient4 } from 'ton';
|
|
2
|
-
import { Address, Cell, Contract, ContractProvider, OpenedContract, Sender } from 'ton
|
|
1
|
+
import { TonClient4 } from '@ton/ton';
|
|
2
|
+
import { Address, Cell, Contract, ContractProvider, OpenedContract, Sender } from '@ton/core';
|
|
3
3
|
import { UIProvider } from '../ui/UIProvider';
|
|
4
4
|
export interface NetworkProvider {
|
|
5
5
|
network(): 'mainnet' | 'testnet';
|
|
@@ -21,13 +21,13 @@ const arg_1 = __importDefault(require("arg"));
|
|
|
21
21
|
const DeeplinkProvider_1 = require("./send/DeeplinkProvider");
|
|
22
22
|
const TonConnectProvider_1 = require("./send/TonConnectProvider");
|
|
23
23
|
const TonHubProvider_1 = require("./send/TonHubProvider");
|
|
24
|
-
const
|
|
25
|
-
const ton_1 = require("ton");
|
|
24
|
+
const core_1 = require("@ton/core");
|
|
25
|
+
const ton_1 = require("@ton/ton");
|
|
26
26
|
const ton_access_1 = require("@orbs-network/ton-access");
|
|
27
27
|
const FSStorage_1 = require("./storage/FSStorage");
|
|
28
28
|
const path_1 = __importDefault(require("path"));
|
|
29
29
|
const paths_1 = require("../paths");
|
|
30
|
-
const
|
|
30
|
+
const crypto_1 = require("@ton/crypto");
|
|
31
31
|
const MnemonicProvider_1 = require("./send/MnemonicProvider");
|
|
32
32
|
const argSpec = {
|
|
33
33
|
'--mainnet': Boolean,
|
|
@@ -52,7 +52,7 @@ class SendProviderSender {
|
|
|
52
52
|
console.warn("Warning: blueprint's Sender does not support `bounce` flag, because it is ignored by all used Sender APIs");
|
|
53
53
|
console.warn('To silence this warning, change your `bounce` flags passed to Senders to unset or undefined');
|
|
54
54
|
}
|
|
55
|
-
if (!(args.sendMode === undefined || args.sendMode ==
|
|
55
|
+
if (!(args.sendMode === undefined || args.sendMode == core_1.SendMode.PAY_GAS_SEPARATELY)) {
|
|
56
56
|
throw new Error('Deployer sender does not support `sendMode` other than `PAY_GAS_SEPARATELY`');
|
|
57
57
|
}
|
|
58
58
|
await __classPrivateFieldGet(this, _SendProviderSender_provider, "f").sendTransaction(args.to, args.value, args.body ?? undefined, args.init ?? undefined);
|
|
@@ -81,11 +81,11 @@ class WrappedContractProvider {
|
|
|
81
81
|
const init = __classPrivateFieldGet(this, _WrappedContractProvider_init, "f") && (await this.getState()).state.type !== 'active' ? __classPrivateFieldGet(this, _WrappedContractProvider_init, "f") : undefined;
|
|
82
82
|
return await via.send({
|
|
83
83
|
to: __classPrivateFieldGet(this, _WrappedContractProvider_address, "f"),
|
|
84
|
-
value: typeof args.value === 'string' ? (0,
|
|
84
|
+
value: typeof args.value === 'string' ? (0, core_1.toNano)(args.value) : args.value,
|
|
85
85
|
sendMode: args.sendMode,
|
|
86
86
|
bounce: args.bounce,
|
|
87
87
|
init,
|
|
88
|
-
body: typeof args.body === 'string' ? (0,
|
|
88
|
+
body: typeof args.body === 'string' ? (0, core_1.comment)(args.body) : args.body,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -116,7 +116,7 @@ class NetworkProviderImpl {
|
|
|
116
116
|
return __classPrivateFieldGet(this, _NetworkProviderImpl_tc, "f");
|
|
117
117
|
}
|
|
118
118
|
provider(address, init) {
|
|
119
|
-
return new WrappedContractProvider(address, __classPrivateFieldGet(this, _NetworkProviderImpl_tc, "f").provider(address, init ? { code: init.code ?? new
|
|
119
|
+
return new WrappedContractProvider(address, __classPrivateFieldGet(this, _NetworkProviderImpl_tc, "f").provider(address, init ? { code: init.code ?? new core_1.Cell(), data: init.data ?? new core_1.Cell() } : undefined), init);
|
|
120
120
|
}
|
|
121
121
|
async isContractDeployed(address) {
|
|
122
122
|
return __classPrivateFieldGet(this, _NetworkProviderImpl_tc, "f").isContractDeployed((await __classPrivateFieldGet(this, _NetworkProviderImpl_tc, "f").getLastBlock()).last.seqno, address);
|
|
@@ -163,7 +163,7 @@ class NetworkProviderImpl {
|
|
|
163
163
|
await this.waitForDeploy(contract.address, waitAttempts);
|
|
164
164
|
}
|
|
165
165
|
open(contract) {
|
|
166
|
-
return (0,
|
|
166
|
+
return (0, core_1.openContract)(contract, (params) => this.provider(params.address, params.init ?? undefined));
|
|
167
167
|
}
|
|
168
168
|
ui() {
|
|
169
169
|
return __classPrivateFieldGet(this, _NetworkProviderImpl_ui, "f");
|
|
@@ -176,7 +176,7 @@ async function createMnemonicProvider(client, ui) {
|
|
|
176
176
|
if (mnemonic.length === 0 || walletVersion.length === 0) {
|
|
177
177
|
throw new Error('Mnemonic deployer was chosen, but env variables WALLET_MNEMONIC and WALLET_VERSION are not set');
|
|
178
178
|
}
|
|
179
|
-
const keyPair = await (0,
|
|
179
|
+
const keyPair = await (0, crypto_1.mnemonicToPrivateKey)(mnemonic.split(' '));
|
|
180
180
|
return new MnemonicProvider_1.MnemonicProvider({
|
|
181
181
|
version: walletVersion.toLowerCase(),
|
|
182
182
|
client,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Cell, StateInit } from 'ton
|
|
1
|
+
import { Address, Cell, StateInit } from '@ton/core';
|
|
2
2
|
import { SendProvider } from './SendProvider';
|
|
3
3
|
import { UIProvider } from '../../ui/UIProvider';
|
|
4
4
|
export declare class DeeplinkProvider implements SendProvider {
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
var _DeeplinkProvider_ui;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.DeeplinkProvider = void 0;
|
|
19
|
-
const
|
|
19
|
+
const core_1 = require("@ton/core");
|
|
20
20
|
const utils_1 = require("../../utils");
|
|
21
21
|
const qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
|
|
22
22
|
class DeeplinkProvider {
|
|
@@ -28,7 +28,7 @@ class DeeplinkProvider {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
async sendTransaction(address, amount, payload, stateInit) {
|
|
31
|
-
const deepLink = (0, utils_1.tonDeepLink)(address, amount, payload, stateInit ? (0,
|
|
31
|
+
const deepLink = (0, utils_1.tonDeepLink)(address, amount, payload, stateInit ? (0, core_1.beginCell)().storeWritable((0, core_1.storeStateInit)(stateInit)).endCell() : undefined);
|
|
32
32
|
__classPrivateFieldGet(this, _DeeplinkProvider_ui, "f").write('\n');
|
|
33
33
|
qrcode_terminal_1.default.generate(deepLink, { small: true }, (qr) => __classPrivateFieldGet(this, _DeeplinkProvider_ui, "f").write(qr));
|
|
34
34
|
__classPrivateFieldGet(this, _DeeplinkProvider_ui, "f").write('\n');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { TonClient4 } from 'ton';
|
|
3
|
-
import { Address, Cell, StateInit } from 'ton
|
|
2
|
+
import { TonClient4 } from '@ton/ton';
|
|
3
|
+
import { Address, Cell, StateInit } from '@ton/core';
|
|
4
4
|
import { SendProvider } from './SendProvider';
|
|
5
5
|
import { UIProvider } from '../../ui/UIProvider';
|
|
6
6
|
export type WalletVersion = 'v1r1' | 'v1r2' | 'v1r3' | 'v2r1' | 'v2r2' | 'v3r1' | 'v3r2' | 'v4';
|
|
@@ -13,9 +13,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _MnemonicProvider_wallet, _MnemonicProvider_secretKey, _MnemonicProvider_client, _MnemonicProvider_ui;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.MnemonicProvider = void 0;
|
|
16
|
-
const ton_1 = require("ton");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
16
|
+
const ton_1 = require("@ton/ton");
|
|
17
|
+
const core_1 = require("@ton/core");
|
|
18
|
+
const crypto_1 = require("@ton/crypto");
|
|
19
19
|
const wallets = {
|
|
20
20
|
v1r1: ton_1.WalletContractV1R1,
|
|
21
21
|
v1r2: ton_1.WalletContractV1R2,
|
|
@@ -35,9 +35,9 @@ class MnemonicProvider {
|
|
|
35
35
|
if (!(params.version in wallets)) {
|
|
36
36
|
throw new Error(`Unknown wallet version ${params.version}`);
|
|
37
37
|
}
|
|
38
|
-
const kp = (0,
|
|
38
|
+
const kp = (0, crypto_1.keyPairFromSecretKey)(params.secretKey);
|
|
39
39
|
__classPrivateFieldSet(this, _MnemonicProvider_client, params.client, "f");
|
|
40
|
-
__classPrivateFieldSet(this, _MnemonicProvider_wallet, (0,
|
|
40
|
+
__classPrivateFieldSet(this, _MnemonicProvider_wallet, (0, core_1.openContract)(wallets[params.version].create({
|
|
41
41
|
workchain: params.workchain ?? 0,
|
|
42
42
|
publicKey: kp.publicKey,
|
|
43
43
|
}), (params) => __classPrivateFieldGet(this, _MnemonicProvider_client, "f").provider(params.address, params.init)), "f");
|
|
@@ -54,7 +54,7 @@ class MnemonicProvider {
|
|
|
54
54
|
messages: [
|
|
55
55
|
{
|
|
56
56
|
init: stateInit,
|
|
57
|
-
body: payload ?? new
|
|
57
|
+
body: payload ?? new core_1.Cell(),
|
|
58
58
|
info: {
|
|
59
59
|
type: 'internal',
|
|
60
60
|
ihrDisabled: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Cell, StateInit } from 'ton
|
|
1
|
+
import { Address, Cell, StateInit } from '@ton/core';
|
|
2
2
|
export interface SendProvider {
|
|
3
3
|
connect(): Promise<void>;
|
|
4
4
|
sendTransaction(address: Address, amount: bigint, payload?: Cell, stateInit?: StateInit): Promise<any>;
|
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.TonConnectProvider = void 0;
|
|
19
19
|
const qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
|
|
20
20
|
const sdk_1 = __importDefault(require("@tonconnect/sdk"));
|
|
21
|
-
const
|
|
21
|
+
const core_1 = require("@ton/core");
|
|
22
22
|
class TonConnectStorage {
|
|
23
23
|
constructor(inner) {
|
|
24
24
|
_TonConnectStorage_inner.set(this, void 0);
|
|
@@ -50,12 +50,12 @@ class TonConnectProvider {
|
|
|
50
50
|
}
|
|
51
51
|
async connect() {
|
|
52
52
|
await this.connectWallet();
|
|
53
|
-
__classPrivateFieldGet(this, _TonConnectProvider_ui, "f").write(`Connected to wallet at address: ${
|
|
53
|
+
__classPrivateFieldGet(this, _TonConnectProvider_ui, "f").write(`Connected to wallet at address: ${core_1.Address.parse(__classPrivateFieldGet(this, _TonConnectProvider_connector, "f").wallet.account.address).toString()}\n`);
|
|
54
54
|
}
|
|
55
55
|
address() {
|
|
56
56
|
if (!__classPrivateFieldGet(this, _TonConnectProvider_connector, "f").wallet)
|
|
57
57
|
return undefined;
|
|
58
|
-
return
|
|
58
|
+
return core_1.Address.parse(__classPrivateFieldGet(this, _TonConnectProvider_connector, "f").wallet.account.address);
|
|
59
59
|
}
|
|
60
60
|
async connectWallet() {
|
|
61
61
|
const wallets = (await __classPrivateFieldGet(this, _TonConnectProvider_connector, "f").getWallets()).filter(isRemote);
|
|
@@ -94,7 +94,7 @@ class TonConnectProvider {
|
|
|
94
94
|
amount: amount.toString(),
|
|
95
95
|
payload: payload?.toBoc().toString('base64'),
|
|
96
96
|
stateInit: stateInit
|
|
97
|
-
? (0,
|
|
97
|
+
? (0, core_1.beginCell)().storeWritable((0, core_1.storeStateInit)(stateInit)).endCell().toBoc().toString('base64')
|
|
98
98
|
: undefined,
|
|
99
99
|
},
|
|
100
100
|
],
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
var _TonHubProvider_connector, _TonHubProvider_storage, _TonHubProvider_ui, _TonHubProvider_session;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.TonHubProvider = void 0;
|
|
19
|
-
const
|
|
19
|
+
const core_1 = require("@ton/core");
|
|
20
20
|
const ton_x_1 = require("ton-x");
|
|
21
21
|
const qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
|
|
22
22
|
const KEY_NAME = 'tonhub_session';
|
|
@@ -75,12 +75,12 @@ class TonHubProvider {
|
|
|
75
75
|
}
|
|
76
76
|
async connect() {
|
|
77
77
|
__classPrivateFieldSet(this, _TonHubProvider_session, await this.getSession(), "f");
|
|
78
|
-
__classPrivateFieldGet(this, _TonHubProvider_ui, "f").write(`Connected to wallet at address: ${
|
|
78
|
+
__classPrivateFieldGet(this, _TonHubProvider_ui, "f").write(`Connected to wallet at address: ${core_1.Address.parse(__classPrivateFieldGet(this, _TonHubProvider_session, "f").wallet.address).toString()}\n`);
|
|
79
79
|
}
|
|
80
80
|
address() {
|
|
81
81
|
if (!__classPrivateFieldGet(this, _TonHubProvider_session, "f"))
|
|
82
82
|
return undefined;
|
|
83
|
-
return
|
|
83
|
+
return core_1.Address.parse(__classPrivateFieldGet(this, _TonHubProvider_session, "f").wallet.address);
|
|
84
84
|
}
|
|
85
85
|
async sendTransaction(address, amount, payload, stateInit) {
|
|
86
86
|
if (!__classPrivateFieldGet(this, _TonHubProvider_session, "f"))
|
|
@@ -93,7 +93,7 @@ class TonHubProvider {
|
|
|
93
93
|
timeout: 5 * 60 * 1000,
|
|
94
94
|
payload: payload ? payload.toBoc().toString('base64') : undefined,
|
|
95
95
|
stateInit: stateInit
|
|
96
|
-
? (0,
|
|
96
|
+
? (0, core_1.beginCell)().storeWritable((0, core_1.storeStateInit)(stateInit)).endCell().toBoc().toString('base64')
|
|
97
97
|
: undefined,
|
|
98
98
|
};
|
|
99
99
|
__classPrivateFieldGet(this, _TonHubProvider_ui, "f").setActionPrompt('Sending transaction. Approve it in your wallet...');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
deploy{{name}}.ts
|
|
2
|
-
import { toNano } from 'ton
|
|
2
|
+
import { toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { compile, NetworkProvider } from '@ton
|
|
4
|
+
import { compile, NetworkProvider } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider) {
|
|
7
7
|
const {{loweredName}} = provider.open(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
increment{{name}}.ts
|
|
2
|
-
import { Address, toNano } from 'ton
|
|
2
|
+
import { Address, toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { NetworkProvider, sleep } from '@ton
|
|
4
|
+
import { NetworkProvider, sleep } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider, args: string[]) {
|
|
7
7
|
const ui = provider.ui();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{{name}}.spec.ts
|
|
2
|
-
import { Blockchain, SandboxContract } from '@ton
|
|
3
|
-
import { Cell, toNano } from 'ton
|
|
2
|
+
import { Blockchain, SandboxContract } from '@ton/sandbox';
|
|
3
|
+
import { Cell, toNano } from '@ton/core';
|
|
4
4
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
5
|
-
import '@ton
|
|
6
|
-
import { compile } from '@ton
|
|
5
|
+
import '@ton/test-utils';
|
|
6
|
+
import { compile } from '@ton/blueprint';
|
|
7
7
|
|
|
8
8
|
describe('{{name}}', () => {
|
|
9
9
|
let code: Cell;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{name}}.ts
|
|
2
|
-
import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from 'ton
|
|
2
|
+
import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from '@ton/core';
|
|
3
3
|
|
|
4
4
|
export type {{name}}Config = {
|
|
5
5
|
id: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
deploy{{name}}.ts
|
|
2
|
-
import { toNano } from 'ton
|
|
2
|
+
import { toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { compile, NetworkProvider } from '@ton
|
|
4
|
+
import { compile, NetworkProvider } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider) {
|
|
7
7
|
const {{loweredName}} = provider.open({{name}}.createFromConfig({}, await compile('{{name}}')));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{{name}}.spec.ts
|
|
2
|
-
import { Blockchain, SandboxContract } from '@ton
|
|
3
|
-
import { Cell, toNano } from 'ton
|
|
2
|
+
import { Blockchain, SandboxContract } from '@ton/sandbox';
|
|
3
|
+
import { Cell, toNano } from '@ton/core';
|
|
4
4
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
5
|
-
import '@ton
|
|
6
|
-
import { compile } from '@ton
|
|
5
|
+
import '@ton/test-utils';
|
|
6
|
+
import { compile } from '@ton/blueprint';
|
|
7
7
|
|
|
8
8
|
describe('{{name}}', () => {
|
|
9
9
|
let code: Cell;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{name}}.ts
|
|
2
|
-
import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from 'ton
|
|
2
|
+
import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from '@ton/core';
|
|
3
3
|
|
|
4
4
|
export type {{name}}Config = {};
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
deploy{{name}}.ts
|
|
2
|
-
import { toNano } from 'ton
|
|
2
|
+
import { toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { NetworkProvider } from '@ton
|
|
4
|
+
import { NetworkProvider } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider) {
|
|
7
7
|
const {{loweredName}} = provider.open(await {{name}}.fromInit(BigInt(Math.floor(Math.random() * 10000))));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
increment{{name}}.ts
|
|
2
|
-
import { Address, toNano } from 'ton
|
|
2
|
+
import { Address, toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { NetworkProvider, sleep } from '@ton
|
|
4
|
+
import { NetworkProvider, sleep } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider, args: string[]) {
|
|
7
7
|
const ui = provider.ui();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{{name}}.spec.ts
|
|
2
|
-
import { Blockchain, SandboxContract } from '@ton
|
|
3
|
-
import { toNano } from 'ton
|
|
2
|
+
import { Blockchain, SandboxContract } from '@ton/sandbox';
|
|
3
|
+
import { toNano } from '@ton/core';
|
|
4
4
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
5
|
-
import '@ton
|
|
5
|
+
import '@ton/test-utils';
|
|
6
6
|
|
|
7
7
|
describe('{{name}}', () => {
|
|
8
8
|
let blockchain: Blockchain;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
deploy{{name}}.ts
|
|
2
|
-
import { toNano } from 'ton
|
|
2
|
+
import { toNano } from '@ton/core';
|
|
3
3
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
4
|
-
import { NetworkProvider } from '@ton
|
|
4
|
+
import { NetworkProvider } from '@ton/blueprint';
|
|
5
5
|
|
|
6
6
|
export async function run(provider: NetworkProvider) {
|
|
7
7
|
const {{loweredName}} = provider.open(await {{name}}.fromInit());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{{name}}.spec.ts
|
|
2
|
-
import { Blockchain, SandboxContract } from '@ton
|
|
3
|
-
import { toNano } from 'ton
|
|
2
|
+
import { Blockchain, SandboxContract } from '@ton/sandbox';
|
|
3
|
+
import { toNano } from '@ton/core';
|
|
4
4
|
import { {{name}} } from '../wrappers/{{name}}';
|
|
5
|
-
import '@ton
|
|
5
|
+
import '@ton/test-utils';
|
|
6
6
|
|
|
7
7
|
describe('{{name}}', () => {
|
|
8
8
|
let blockchain: Blockchain;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Cell } from 'ton
|
|
1
|
+
import { Address, Cell } from '@ton/core';
|
|
2
2
|
import { UIProvider } from './ui/UIProvider';
|
|
3
3
|
export declare const tonDeepLink: (address: Address, amount: bigint, body?: Cell, stateInit?: Cell) => string;
|
|
4
4
|
export declare function sleep(ms: number): Promise<unknown>;
|
package/package.json
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
2
|
+
"name": "@ton/blueprint",
|
|
3
|
+
"version": "0.12.1",
|
|
4
|
+
"description": "Framework for development of TON smart contracts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": "./dist/cli/cli.js",
|
|
7
|
+
"author": "TonTech",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/ton-org/blueprint.git"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/**/*"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "rm -rf dist && tsc && cp -r src/templates dist/",
|
|
18
|
+
"release": "yarn build && yarn publish --access public",
|
|
19
|
+
"format": "prettier --write src"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@ton/core": "^0.49.2",
|
|
23
|
+
"@ton/crypto": "^3.2.0",
|
|
24
|
+
"@ton/ton": "^13.5.1",
|
|
25
|
+
"@types/inquirer": "^8.2.6",
|
|
26
|
+
"@types/node": "^20.2.5",
|
|
27
|
+
"@types/qrcode-terminal": "^0.12.0",
|
|
28
|
+
"prettier": "^2.8.8",
|
|
29
|
+
"typescript": "^4.9.5"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@ton/core": ">=0.49.2",
|
|
33
|
+
"@ton/crypto": ">=3.2.0",
|
|
34
|
+
"@ton/ton": ">=13.4.1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@orbs-network/ton-access": "^2.3.3",
|
|
38
|
+
"@tact-lang/compiler": "^1.1.3",
|
|
39
|
+
"@ton-community/func-js": "^0.6.2",
|
|
40
|
+
"@tonconnect/sdk": "^2.1.3",
|
|
41
|
+
"arg": "^5.0.2",
|
|
42
|
+
"chalk": "^4.1.0",
|
|
43
|
+
"dotenv": "^16.1.4",
|
|
44
|
+
"inquirer": "^8.2.5",
|
|
45
|
+
"qrcode-terminal": "^0.12.0",
|
|
46
|
+
"ton-x": "^2.1.0",
|
|
47
|
+
"ts-node": "^10.9.1"
|
|
48
|
+
},
|
|
49
|
+
"packageManager": "yarn@3.6.1"
|
|
50
|
+
}
|