create-ton 0.3.0 → 0.4.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/CHANGELOG.md +8 -0
- package/dist/cli.js +6 -3
- package/dist/template/README.md +15 -62
- package/dist/template/jest.config.ts +8 -0
- package/dist/template/package.json +2 -2
- package/package.json +1 -1
- package/dist/template/jest.config.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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
|
+
## [0.4.0] - 2023-05-04
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Updated template readme
|
|
13
|
+
- Updated template jest config to use TypeScript
|
|
14
|
+
- Updated dependencies: blueprint to 0.9.0, sandbox to 0.10.0
|
|
15
|
+
|
|
8
16
|
## [0.3.0] - 2023-04-07
|
|
9
17
|
|
|
10
18
|
### Changed
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,8 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
10
10
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
-
const
|
|
12
|
+
const FILES_WITH_NAME_TEMPLATE = ['package.json', 'README.md'];
|
|
13
|
+
const NAME_TEMPLATE = '{{name}}';
|
|
13
14
|
async function main() {
|
|
14
15
|
console.log();
|
|
15
16
|
const name = process.argv.length > 2
|
|
@@ -58,7 +59,7 @@ async function main() {
|
|
|
58
59
|
console.log(`\n[1/${steps}] Copying files...`);
|
|
59
60
|
const basePath = path_1.default.join(__dirname, 'template');
|
|
60
61
|
for (const file of await fs_extra_1.default.readdir(basePath)) {
|
|
61
|
-
if (file
|
|
62
|
+
if (FILES_WITH_NAME_TEMPLATE.includes(file))
|
|
62
63
|
continue;
|
|
63
64
|
await fs_extra_1.default.copy(path_1.default.join(basePath, file), path_1.default.join(name, file));
|
|
64
65
|
}
|
|
@@ -66,7 +67,9 @@ async function main() {
|
|
|
66
67
|
temp
|
|
67
68
|
build
|
|
68
69
|
`);
|
|
69
|
-
|
|
70
|
+
for (const file of FILES_WITH_NAME_TEMPLATE) {
|
|
71
|
+
await fs_extra_1.default.writeFile(path_1.default.join(name, file), (await fs_extra_1.default.readFile(path_1.default.join(basePath, file))).toString().replace(NAME_TEMPLATE, name));
|
|
72
|
+
}
|
|
70
73
|
console.log(`[2/${steps}] Installing dependencies...\n`);
|
|
71
74
|
const execOpts = {
|
|
72
75
|
stdio: 'inherit',
|
package/dist/template/README.md
CHANGED
|
@@ -1,76 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# {{name}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Project structure
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- `
|
|
8
|
-
- `
|
|
9
|
-
- `tests` - tests for the contracts. Would typically use the wrappers.
|
|
10
|
-
- `scripts` - contains scripts used by the project, mainly the deployment scripts.
|
|
11
|
-
|
|
12
|
-
## Repo contents / tech stack
|
|
13
|
-
1. Compiling FunC - [https://github.com/ton-community/func-js](https://github.com/ton-community/func-js)
|
|
14
|
-
2. Testing TON smart contracts - [https://github.com/ton-community/sandbox](https://github.com/ton-community/sandbox)
|
|
15
|
-
3. Deployment of contracts is supported with [TON Connect 2](https://github.com/ton-connect/), [Tonhub wallet](https://tonhub.com/), using mnemonics, or via a direct `ton://` deeplink
|
|
5
|
+
- `contracts` - source code of all the smart contracts of the project and their dependencies.
|
|
6
|
+
- `wrappers` - wrapper classes (implementing `Contract` from ton-core) for the contracts, including any [de]serialization primitives and compilation functions.
|
|
7
|
+
- `tests` - tests for the contracts.
|
|
8
|
+
- `scripts` - scripts used by the project, mainly the deployment scripts.
|
|
16
9
|
|
|
17
10
|
## How to use
|
|
18
|
-
* Run `npm create ton@latest`
|
|
19
11
|
|
|
20
|
-
###
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
2. Choose the contract you'd like to build
|
|
24
|
-
1. Non-interactively
|
|
25
|
-
1. Run `yarn blueprint build <CONTRACT>`
|
|
26
|
-
2. example: `yarn blueprint build pingpong`
|
|
12
|
+
### Build
|
|
13
|
+
|
|
14
|
+
`npx blueprint build` or `yarn blueprint build`
|
|
27
15
|
|
|
28
|
-
###
|
|
29
|
-
1. Interactively
|
|
30
|
-
1. Run `yarn blueprint run`
|
|
31
|
-
2. Choose the contract you'd like to deploy
|
|
32
|
-
3. Choose whether you're deploying on mainnet or testnet
|
|
33
|
-
4. Choose how to deploy:
|
|
34
|
-
1. With a TON Connect compatible wallet
|
|
35
|
-
2. A `ton://` deep link / QR code
|
|
36
|
-
3. Tonhub wallet
|
|
37
|
-
4. Mnemonic
|
|
38
|
-
5. Deploy the contract
|
|
39
|
-
2. Non-interactively
|
|
40
|
-
1. Run `yarn blueprint run <CONTRACT> --<NETWORK> --<DEPLOY_METHOD>`
|
|
41
|
-
2. example: `yarn blueprint run pingpong --mainnet --tonconnect`
|
|
16
|
+
### Test
|
|
42
17
|
|
|
43
|
-
|
|
44
|
-
1. Run `yarn test`
|
|
18
|
+
`npx blueprint test` or `yarn blueprint test`
|
|
45
19
|
|
|
46
|
-
|
|
47
|
-
1. Run `yarn blueprint create <CONTRACT>`
|
|
48
|
-
2. example: `yarn blueprint create MyContract`
|
|
20
|
+
### Deploy or run another script
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
* FunC contracts are located in `contracts/*.fc`
|
|
52
|
-
* Standalone root contracts are located in `contracts/*.fc`
|
|
53
|
-
* Shared imports (when breaking code to multiple files) are in `contracts/imports/*.fc`
|
|
54
|
-
* Tests in TypeScript are located in `test/*.spec.ts`
|
|
55
|
-
* Wrapper classes for interacting with the contract are located in `wrappers/*.ts`
|
|
56
|
-
* Any scripts (including deployers) are located in `scripts/*.ts`
|
|
22
|
+
`npx blueprint run` or `yarn blueprint run`
|
|
57
23
|
|
|
58
|
-
|
|
59
|
-
* Builder configs are located in `wrappers/*.compile.ts`
|
|
60
|
-
* In the root repo dir, run in terminal `yarn blueprint build`
|
|
61
|
-
* Compilation errors will appear on screen, if applicable
|
|
62
|
-
* Resulting build artifacts include:
|
|
63
|
-
* `build/*.compiled.json` - the binary code cell of the compiled contract (for deployment). Saved in a hex format within a json file to support webapp imports
|
|
24
|
+
### Add a new contract
|
|
64
25
|
|
|
65
|
-
|
|
66
|
-
* In the root repo dir, run in terminal `yarn test`
|
|
67
|
-
* Don't forget to build (or rebuild) before running tests
|
|
68
|
-
* Tests are running inside Node.js by running TVM in web-assembly using [sandbox](https://github.com/ton-community/sandbox)
|
|
26
|
+
`npx blueprint create ContractName` or `yarn blueprint create ContractName`
|
|
69
27
|
|
|
70
|
-
* Deploy
|
|
71
|
-
* Run `yarn blueprint run <deployscript>`
|
|
72
|
-
* Contracts will be rebuilt on each execution
|
|
73
|
-
* Follow the on-screen instructions of the deploy script
|
|
74
|
-
|
|
75
28
|
# License
|
|
76
29
|
MIT
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"test": "jest"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@ton-community/blueprint": "^0.
|
|
10
|
-
"@ton-community/sandbox": "^0.
|
|
9
|
+
"@ton-community/blueprint": "^0.9.0",
|
|
10
|
+
"@ton-community/sandbox": "^0.10.0",
|
|
11
11
|
"@ton-community/test-utils": "^0.2.0",
|
|
12
12
|
"@types/jest": "^29.5.0",
|
|
13
13
|
"@types/node": "^18.15.5",
|
package/package.json
CHANGED