Running scripts
Blueprint allows you to run scripts directly from the project.- Place your script in the
scripts/
folder. - Each script file must export a
run
function: - Run the script with:
npx blueprint run <SCRIPT> [arg1, arg2, ...]
command.
Deploying contracts
To deploy a smart contract, create a deployment script inscripts/deploy<Contract>.ts
with following content.
./scripts/deploy<Contract>.ts
Interactive mode
To launch a guided prompt to create a contract step by step, use:Non-interactive mode
To create a contract without prompts, provide the contract name and template type:Deploying methods
Mnemonic provider
Run scripts with a wallet using mnemonic authentication by configuring environment variables and specifying the--mnemonic
for a non-interactive method.
Required variables:
Set the following variables in the .env
file:
WALLET_MNEMONIC
— wallet mnemonic phrase (space-separated words).WALLET_VERSION
— wallet contract version.- Supported versions:
v1r1
,v1r2
,v1r3
,v2r1
,v2r2
,v3r1
,v3r2
,v4r1
,v4r2
(orv4
),v5r1
.
WALLET_ID
— wallet ID for versions earlier thanv5r1
, excludingv5r1
.SUBWALLET_NUMBER
— subwallet number forv5r1
wallets.
WALLET_ID
construction.
Once your environment is set up, you can use the mnemonic wallet for deployment with the appropriate configuration.
TON Connect
Run scripts with a wallet using TON Connect by specifying the--tonconnect
option.
Steps:
- After running the command, select a wallet from the available options.
- Scan the generated QR code in your wallet app or open the provided link.
- Confirm the transaction in the wallet’s interface.
Interaction
After deploying your contracts, you can interact with them using Blueprint scripts. These scripts use the wrappers you’ve created to send messages and call get methods on your deployed contracts. To run following scripts refer to Running scripts section.Sending messages
To send messages to your deployed contracts, create a script that calls thesend
methods defined in your wrapper. These methods trigger contract execution and modify the contract’s state.
./scripts/sendIncrease.ts
Executing get methods
Get methods allow you to read data from your deployed contracts without creating transactions. These methods are free to call and don’t modify the contract’s state../scripts/getCounter.ts