Using with Blueprint

Using with Blueprint

Blueprint (opens in a new tab) is a tool for compiling, testing and deploying smart contracts in TON. If you have Blueprint installed in your project, it would be easy to integrate smart contract compiled by Blueprint with Foton.

When Blueprint builds a contract, it generates a wrappers directory with a set of .ts files. For example, if you compiled a contract named Counter, then Blueprint will produce the following wrappers/Counter.ts file:

export * from '../build/Counter/tact_Counter';

To use the contract with Foton, all you need to do is import the generated file and pass it to the createContractClient function:

import { createWalletClient, createPublicClient, createContractClient } from '@fotonjs/core';
import { Counter } from './wrappers/Counter';
export const walletClient = createWalletClient({
  chain: 'mainnet',
  manifestUrl: '',
export const publicClient = createPublicClient({
  api: 'mainnet',
export const counterClient = createContractClient({
  contract: Counter,