This template comes pre-configured to kickstart your new Tact project. It includes the Tact compiler, TypeScript, Jest integrated with Sandbox, and a sample demonstrating how to run tests.
First, let's install all the dependencies:
yarn installNow we're ready to build our contract:
yarn buildOnce you've built our contract, you can deploy it:
yarn deployLet's look at some other useful commands.
To test your contract after changes, run:
yarn testIf you want to quickly check your changes for validity, run:
yarn lintThis check will run the Tact source code formatter in the style checking mode and the misti static analyzer to check for common issues.
If you'd like to format the Tact source code in the sources directory, run:
yarn fmtTo deploy a contract, follow these steps:
- Define the
contract.tactfile that will be used as entry point of your contract. - Customize the
contract.deploy.tsfile based on yourcontract.tactto generate a deployment link. It is crucial to ensure the proper invocation of theinit()function within the contract.
If you rename contract.tact, be sure to update tact.config.json accordingly. For a description of tact.config.json, see the Configuration page in the Tact documentation.
You can find some examples of contract tests in contract.spec.ts. For more information about testing, see the Debugging and testing page in the Tact Documentation.
To add new test files to your contracts, create *.spec.ts files similar to the template's one. They will be automatically picked up by the testing commands, such as yarn test.