Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
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 Tact formatter
run: yarn tact-fmt --check ./sources

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

- name: Run tests
run: yarn test
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: Run Lint
run: yarn lint

- name: Build
run: yarn build

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

- name: Run tests
run: yarn test
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"printWidth": 120,
"tabWidth": 4,
"useTabs": false
}
}
8 changes: 2 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"recommendations": [
"tonstudio.vscode-tact",
"tonwhales.func-vscode",
"dbaeumer.vscode-eslint"
]
}
"recommendations": ["tonstudio.vscode-tact", "tonwhales.func-vscode", "dbaeumer.vscode-eslint"]
}
84 changes: 42 additions & 42 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,46 @@ import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";

export default [
js.configs.recommended,
{
files: ["sources/**/*.ts"],
ignores: ["sources/output/**/*"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json"
},
globals: {
console: true,
__dirname: true,
jest: true,
node: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true,
beforeAll: true,
afterAll: true
}
js.configs.recommended,
{
files: ["sources/**/*.ts"],
ignores: ["sources/output/**/*"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
},
globals: {
console: true,
__dirname: true,
jest: true,
node: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true,
beforeAll: true,
afterAll: true,
},
},
plugins: {
"@typescript-eslint": tsPlugin,
},
rules: {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-return": "error",
"no-restricted-imports": [
"error",
{
paths: ["@ton/blueprint"],
patterns: ["@ton/blueprint/*"],
},
],
},
},
plugins: {
"@typescript-eslint": tsPlugin
},
rules: {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-return": "error",
"no-restricted-imports": [
"error",
{
"paths": ["@ton/blueprint"],
"patterns": ["@ton/blueprint/*"]
}
]
}
}
];
];
14 changes: 7 additions & 7 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
snapshotSerializers: ["@tact-lang/ton-jest/serializers"],
globalSetup: './jest.setup.ts',
globalTeardown: './jest.teardown.ts',
};
preset: "ts-jest",
testEnvironment: "node",
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
snapshotSerializers: ["@tact-lang/ton-jest/serializers"],
globalSetup: "./jest.setup.ts",
globalTeardown: "./jest.teardown.ts",
};
2 changes: 1 addition & 1 deletion jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default async () => { };
export default async () => {};
2 changes: 1 addition & 1 deletion jest.teardown.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default async () => { };
export default async () => {};
80 changes: 40 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"private": true,
"scripts": {
"build": "tact --config ./tact.config.json",
"fmt": "tact-fmt --write ./sources",
"lint": "tact-fmt --check ./sources && yarn misti ./tact.config.json",
"test": "yarn build && jest",
"deploy": "yarn test && ts-node ./sources/contract.deploy.ts",
"read": "ts-node ./sources/contract.read.ts"
},
"dependencies": {
"@nowarp/misti": "~0.8.0",
"@tact-lang/compiler": "^1.6.13",
"@tact-lang/deployer": "^0.2.0",
"@tact-lang/ton-abi": "^0.0.3",
"@tact-lang/ton-jest": "^0.0.4",
"@ton/core": "^0.60.1",
"@ton/crypto": "^3.2.0",
"@ton/sandbox": "^0.27.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",
"prettier": "^2.5.1",
"qs": "^6.11.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"devDependencies": {
"eslint": "^9.19.0",
"globals": "^13.24.0",
"typescript-eslint": "^8.22.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"private": true,
"scripts": {
"build": "tact --config ./tact.config.json",
"fmt": "prettier --write ./sources && tact-fmt --write ./sources",
"lint": "prettier --check ./sources && tact-fmt --check ./sources && yarn misti ./tact.config.json",
"test": "yarn build && jest",
"deploy": "yarn test && ts-node ./sources/contract.deploy.ts",
"read": "ts-node ./sources/contract.read.ts"
},
"dependencies": {
"@nowarp/misti": "~0.8.0",
"@tact-lang/compiler": "^1.6.13",
"@tact-lang/deployer": "^0.2.0",
"@tact-lang/ton-abi": "^0.0.3",
"@tact-lang/ton-jest": "^0.0.4",
"@ton/core": "^0.60.1",
"@ton/crypto": "^3.2.0",
"@ton/sandbox": "^0.27.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",
"prettier": "^2.5.1",
"qs": "^6.11.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"devDependencies": {
"eslint": "^9.19.0",
"globals": "^13.24.0",
"typescript-eslint": "^8.22.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
2 changes: 1 addition & 1 deletion sources/contract.read.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, contractAddress} from "@ton/core";
import { Address, contractAddress } from "@ton/core";
import { TonClient4 } from "@ton/ton";
import { SampleTactContract } from "./output/sample_SampleTactContract";

Expand Down
3 changes: 1 addition & 2 deletions sources/contract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe("contract", () => {
deploy: true,
success: true,
});

// Check counter
expect(await contract.getCounter()).toEqual(0n);

Expand All @@ -34,7 +33,7 @@ describe("contract", () => {
from: nonOwner.address,
to: contract.address,
success: false,
exitCode: accessDeniedExitCode
exitCode: accessDeniedExitCode,
});
});
});
9 changes: 8 additions & 1 deletion sources/contract.tact
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ contract SampleTactContract(
owner: Address,
counter: Int as uint32,
) with Ownable {
// empty receiver for deployment
// empty receiver for deployment and receiving funds
receive() {
// return the amount to the sender
cashback(sender());
}

receive(_: Increment) {
self.add(1);

// return the amount to the sender
cashback(sender());
}

receive(msg: Add) {
self.add(msg.amount);

// return the amount to the sender
cashback(sender());
}

fun add(v: Int) {
Expand Down
29 changes: 15 additions & 14 deletions tact.config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"projects": [{
"name": "sample",
"path": "./sources/contract.tact",
"output": "./sources/output",
"mode": "full",
"options": {
"external": false,
"debug": false,
"ipfsAbiGetter": false,
"interfacesGetter": false,
"experimental": {
"inline": false
"projects": [
{
"name": "sample",
"path": "./sources/contract.tact",
"output": "./sources/output",
"mode": "full",
"options": {
"external": false,
"debug": false,
"ipfsAbiGetter": false,
"interfacesGetter": false,
"experimental": {
"inline": false
}
}
}
}]
]
}

Loading