create-ton 0.0.5 → 0.0.6

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/cli.js CHANGED
@@ -8,6 +8,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
8
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
+ const chalk_1 = __importDefault(require("chalk"));
11
12
  const PACKAGE_JSON = 'package.json';
12
13
  async function main() {
13
14
  const { name, variant } = await inquirer_1.default.prompt([
@@ -60,21 +61,33 @@ build`);
60
61
  cwd: name,
61
62
  });
62
63
  console.log('\nInitialized git repository.\n');
63
- console.log(`Success!
64
- Now you can run the following to run the default tests:
65
- cd ${name}
66
- npm run test
67
-
68
- You can also run the following commands in your project's directory:
69
-
70
- npx blueprint create MyContract
71
- creates all the necessary files for a new contract
72
-
73
- npx blueprint build
74
- asks you to choose a contract and builds it
75
-
76
- npx blueprint run
77
- asks you to choose a script and runs it
78
- `);
64
+ console.log(`Success!`);
65
+ console.log(chalk_1.default.blueBright(`
66
+ ____ _ _ _ _____ ____ ____ ___ _ _ _____
67
+ | __ )| | | | | | ____| _ \\| _ \\|_ _| \\ | |_ _|
68
+ | _ \\| | | | | | _| | |_) | |_) || || \\| | | |
69
+ | |_) | |__| |_| | |___| __/| _ < | || |\\ | | |
70
+ |____/|_____\\___/|_____|_| |_| \\_\\___|_| \\_| |_| `));
71
+ console.log(chalk_1.default.blue(` TON development for professionals`));
72
+ console.log(``);
73
+ console.log(`Your new project is ready, available commands:`);
74
+ console.log(``);
75
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`cd ${name}`));
76
+ console.log(` change directory to your new project`);
77
+ console.log(``);
78
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`npm run test`));
79
+ console.log(` run the default project test suite`);
80
+ console.log(``);
81
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`npx blueprint build`));
82
+ console.log(` choose a smart contract and build it`);
83
+ console.log(``);
84
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`npx blueprint run`));
85
+ console.log(` choose a script and run it (eg. a deploy script)`);
86
+ console.log(``);
87
+ console.log(chalk_1.default.greenBright(` > `) + chalk_1.default.cyanBright(`npx blueprint create MyNewContract`));
88
+ console.log(` create all the necessary files for a new contract`);
89
+ console.log(``);
90
+ console.log(`For help and docs visit https://github.com/ton-community/blueprint`);
91
+ console.log(``);
79
92
  }
80
93
  main().catch(console.error);
@@ -1,13 +1,13 @@
1
- import {toNano} from 'ton-core'
2
- import {MyContract} from '../wrappers/MyContract'
3
- import {compile, NetworkProvider} from '@ton-community/blueprint'
1
+ import { toNano } from 'ton-core';
2
+ import { MyContract } from '../wrappers/MyContract';
3
+ import { compile, NetworkProvider } from '@ton-community/blueprint';
4
4
 
5
5
  export async function run(provider: NetworkProvider) {
6
- const myContract = MyContract.createFromConfig({}, await compile('MyContract'))
6
+ const myContract = MyContract.createFromConfig({}, await compile('MyContract'));
7
7
 
8
- await provider.deploy(myContract, toNano('0.05'))
8
+ await provider.deploy(myContract, toNano('0.05'));
9
9
 
10
- const openedContract = provider.open(myContract)
10
+ const openedContract = provider.open(myContract);
11
11
 
12
12
  // run methods on `openedContract`
13
13
  }
@@ -1,29 +1,29 @@
1
- import {Blockchain} from '@ton-community/sandbox'
2
- import {Cell, toNano} from 'ton-core'
3
- import {MyContract} from '../wrappers/MyContract'
4
- import '@ton-community/test-utils'
5
- import {compile} from '@ton-community/blueprint'
1
+ import { Blockchain } from '@ton-community/sandbox';
2
+ import { Cell, toNano } from 'ton-core';
3
+ import { MyContract } from '../wrappers/MyContract';
4
+ import '@ton-community/test-utils';
5
+ import { compile } from '@ton-community/blueprint';
6
6
 
7
7
  describe('MyContract', () => {
8
- let code: Cell
8
+ let code: Cell;
9
9
 
10
10
  beforeAll(async () => {
11
- code = await compile('MyContract')
12
- })
11
+ code = await compile('MyContract');
12
+ });
13
13
 
14
14
  it('should deploy', async () => {
15
- const blockchain = await Blockchain.create()
15
+ const blockchain = await Blockchain.create();
16
16
 
17
- const myContract = blockchain.openContract(await MyContract.createFromConfig({}, code))
17
+ const myContract = blockchain.openContract(await MyContract.createFromConfig({}, code));
18
18
 
19
- const deployer = await blockchain.treasury('deployer')
19
+ const deployer = await blockchain.treasury('deployer');
20
20
 
21
- const deployResult = await myContract.sendDeploy(deployer.getSender(), toNano('0.05'))
21
+ const deployResult = await myContract.sendDeploy(deployer.getSender(), toNano('0.05'));
22
22
 
23
23
  expect(deployResult.transactions).toHaveTransaction({
24
24
  from: deployer.address,
25
25
  to: myContract.address,
26
26
  deploy: true,
27
- })
28
- })
29
- })
27
+ });
28
+ });
29
+ });
@@ -1,5 +1,5 @@
1
- import {CompilerConfig} from '@ton-community/blueprint'
1
+ import { CompilerConfig } from '@ton-community/blueprint';
2
2
 
3
3
  export const compile: CompilerConfig = {
4
4
  targets: ['contracts/my_contract.fc'],
5
- }
5
+ };
@@ -1,36 +1,29 @@
1
- import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from "ton-core";
1
+ import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from 'ton-core';
2
2
 
3
- export type MyContractConfig = {
4
-
5
- }
3
+ export type MyContractConfig = {};
6
4
 
7
5
  export function myContractConfigToCell(config: MyContractConfig): Cell {
8
- return beginCell()
9
- .endCell()
6
+ return beginCell().endCell();
10
7
  }
11
8
 
12
9
  export class MyContract implements Contract {
13
- constructor(
14
- readonly address: Address,
15
- readonly init?: { code: Cell, data: Cell },
16
- ) {}
10
+ constructor(readonly address: Address, readonly init?: { code: Cell; data: Cell }) {}
17
11
 
18
12
  static createFromAddress(address: Address) {
19
- return new MyContract(address)
13
+ return new MyContract(address);
20
14
  }
21
15
 
22
16
  static createFromConfig(config: MyContractConfig, code: Cell, workchain = 0) {
23
- const data = myContractConfigToCell(config)
24
- const init = { code, data }
25
- return new MyContract(contractAddress(workchain, init), init)
17
+ const data = myContractConfigToCell(config);
18
+ const init = { code, data };
19
+ return new MyContract(contractAddress(workchain, init), init);
26
20
  }
27
21
 
28
22
  async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) {
29
23
  await provider.internal(via, {
30
24
  value,
31
25
  sendMode: SendMode.PAY_GAS_SEPARATLY,
32
- body: beginCell()
33
- .endCell(),
34
- })
26
+ body: beginCell().endCell(),
27
+ });
35
28
  }
36
- }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ton",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "description": "Tool to quickly create TON projects",
6
6
  "author": "TonTech",