Skip to content

Commit

Permalink
feat: add readme
Browse files Browse the repository at this point in the history
feat: add deploy command

feat: upgrade tact compiler

chore: upgrade tact

feat: Upgrade to 0.3.0

chore: upgrade tact to 0.4.0

chore: upgrade to TACT v0.5.0

feat: upgrade template to 0.6.0

fix: fix deploy code

ref: replace randomAddress with testAddress from ton-emulator

chore: upgrade to 0.7.0

fix: fix dependencies

chore: upgrade tact to 0.7.1

update readme

Added a little guide for devs who will try to launch TACT template projects and examples the first time.

fix json description

fix2

fix: fix base64 url

chore: upgrade to 0.8.1

feat: add multiple deploy options

ref: remove yarn.lock and package-lock.json

Update package.json

Update package.json

Update package.json

Update README.md

Update README.md

Update package.json

feat: update template to match latest versions

chore: upgrade tact to 0.10.0

ref: upgrade to tact v1.0.0 and emulator v3.0.0

feat: upgrade tact template

ref: update readme

ref: update readme

ref: using new deployer

ref: improve deployment

ref: better deployment script

ref: upgrade emulator and ton-core

ref: quality of life improvements

feat: add code coverage

feat: upgrade tact

feat: update emulator, coverage and compiler

Add the read file example

updates

updates

test: update snapshot (#6)

Update @tact-lang/compiler to 1.1.4 (#5)

Also adds `"types": ["jest"]` to tsconfig.json

Update @tact-lang/compiler to 1.1.5 (#8)

Update to @ton/core deps (#9)

chore: improve grammar and wording in README (#13)

* chore: exclude HTML from GitHub's languages report

* chore[README.md]: some fixes and refinements

Update @tact-lang/compiler to 1.2.0 (#14)

fix: issue with contract reader (#12)

Update @tact-lang/compiler to 1.3.0 (#18)

Update @tact-lang/compiler to 1.4.0 (#23)

Update @tact-lang/compiler to 1.4.2 (#26)

Update @tact-lang/compiler to 1.4.4 (#28)

feat: migrate from `@tact-lang/emulator` to `@ton/sandbox` (#29)

Tact release 1.5.0 (#32)

* Use explicit options in tact.config.json

* Update @tact-lang/compiler to 1.5.0

* Remove @tact-lang/coverage

GitHub actions and Misti integration (#34)

feat: Update Misti version (#36)

Started rewriting tests, migraged to tact-template
  • Loading branch information
Shvandre committed Nov 30, 2024
1 parent 409d55e commit 6ab0e6c
Show file tree
Hide file tree
Showing 27 changed files with 3,140 additions and 4,832 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html linguist-vendored

45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
test:
strategy:
fail-fast: false
matrix:
node-version: [22]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Soufflé on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo wget https://souffle-lang.github.io/ppa/souffle-key.public -O /usr/share/keyrings/souffle-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/souffle-archive-keyring.gpg] https://souffle-lang.github.io/ppa/ubuntu/ stable main" | sudo tee /etc/apt/sources.list.d/souffle.list
sudo apt update
sudo apt install souffle
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Run Misti
run: yarn misti --min-severity medium ./tact.config.json

- name: Run tests
run: yarn test
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false
}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Tact template project

This template comes pre-configured to kickstart your new Tact project. It includes the Tact compiler, TypeScript, Jest integrated with [tact-emulator](https://github.com/tact-lang/tact-emulator), and a sample demonstrating how to run tests.

```shell
yarn test # To test contract
yarn build # To build contract
yarn lint # To find code issues in contract
yarn deploy # To deploy contract
```

## Deployment

To deploy a contract, follow these steps:

1. Define the [`contract.tact`](./sources/jetton_minter.tact) file that will be used as entry point of your contract.
2. Customize the [`contract.deploy.ts`](./sources/contract.deploy.ts) file based on your `contract.tact` to generate a deployment link. It is crucial to ensure the proper invocation of the `init()` function within the contract.

If you rename `contract.tact`, make sure to update [`tact.config.json`](./tact.config.json) correspondingly. Refer to the [Tact Documentation](https://docs.tact-lang.org/language/guides/config) for detailed information.

## Testing

You can find some examples of contract tests in [`contract.spec.ts`](./sources/contract.spec.ts). For more information about testing, see the [Tact Documentation](https://docs.tact-lang.org/language/guides/debug).

To add new test files to your contracts, you should create `*.spec.ts` files similar to the template's one and they would be automatically included in testing.

## License

MIT
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ["/node_modules/","/dist/"],
maxWorkers: 1
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
snapshotSerializers: ["@tact-lang/ton-jest/serializers"],
globalSetup: './jest.setup.js',
globalTeardown: './jest.teardown.js',
};
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = async () => { };
3 changes: 3 additions & 0 deletions jest.teardown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const path = require('path');

module.exports = async () => { };
35 changes: 23 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
{
"name": "tact-template",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/ton-community/tact-template.git",
"author": "Steve Korshakov <[email protected]>",
"license": "MIT",
"private": true,
"scripts": {
"build": "tact --config ./tact.config.json"
"build": "tact --config ./tact.config.json",
"lint": "yarn misti ./tact.config.json",
"test": "jest",
"deploy": "ts-node ./sources/contract.deploy.ts",
"read": "ts-node ./sources/contract.read.ts"
},
"dependencies": {
"@nowarp/misti": "~0.5.0",
"@tact-lang/compiler": "~1.5.0",
"@tact-lang/deployer": "^0.2.0",
"@tact-lang/ton-abi": "^0.0.3",
"@tact-lang/ton-jest": "^0.0.4",
"@ton/core": "~0.56.3",
"@ton/crypto": "^3.2.0",
"@ton/sandbox": "^0.20.0",
"@ton/test-utils": "^0.4.2",
"@ton/ton": "^13.9.0",
"@types/jest": "^29.2.4",
"@types/node": "^18.11.14",
"@types/qs": "^6.9.7",
"base64url": "^3.0.1",
"enquirer": "^2.3.6",
"jest": "^29.3.1",
"open": "^8.4.0",
"prando": "^6.0.1",
"ton": "^12.1.5",
"ton-contract-executor": "^0.6.0",
"ton-crypto": "^3.2.0",
"ton-nodejs": "^1.4.2",
"ton-tact": "^0.0.4",
"prettier": "^2.5.1",
"qs": "^6.11.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
}
}
36 changes: 36 additions & 0 deletions sources/contract.deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as fs from "fs";
import * as path from "path";
import { Address, contractAddress } from "@ton/core";
import { prepareTactDeployment } from "@tact-lang/deployer";

(async () => {
// Parameters
let testnet = true;
let packageName = "sample_SampleTactContract.pkg";
let owner = Address.parse("kQBM7QssP28PhrctDOyd47_zpFfDiQvv5V9iXizNopb1d2LB");
let init = await SampleTactContract.init(owner);

// Load required data
let address = contractAddress(0, init);
let data = init.data.toBoc();
let pkg = fs.readFileSync(path.resolve(__dirname, "output", packageName));

// Prepareing
console.log("Uploading package...");
let prepare = await prepareTactDeployment({ pkg, data, testnet });

// Deploying
console.log("============================================================================================");
console.log("Contract Address");
console.log("============================================================================================");
console.log();
console.log(address.toString({ testOnly: testnet }));
console.log();
console.log("============================================================================================");
console.log("Please, follow deployment link");
console.log("============================================================================================");
console.log();
console.log(prepare);
console.log();
console.log("============================================================================================");
})();
22 changes: 22 additions & 0 deletions sources/contract.read.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Address, contractAddress} from "@ton/core";
import { TonClient4 } from "@ton/ton";

(async () => {
const client = new TonClient4({
endpoint: "https://sandbox-v4.tonhubapi.com", // 🔴 Test-net API endpoint
});

// Parameters
let owner = Address.parse("kQBM7QssP28PhrctDOyd47_zpFfDiQvv5V9iXizNopb1d2LB");
let init = await SampleTactContract.init(owner);
let contract_address = contractAddress(0, init);

// Prepareing
console.log("Reading Contract Info...");
console.log(contract_address);

// Input the contract address
let contract = await SampleTactContract.fromAddress(contract_address);
let contract_open = await client.open(contract);
console.log("Counter Value: " + (await contract_open.getCounter()));
})();
Loading

0 comments on commit 6ab0e6c

Please sign in to comment.