npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@laisky/tact-utils

v0.0.1

Published

useful utilities for TON Tact

Downloads

6

Readme

tact-utils

Awesome TACT Twitter Telegram

A collection of TON Tact templates and tools.

Provides ready-to-use templates for Jetton, NFT, Traits, as well as some commonly used tools.

Click to view my article on using Tact to implement Jetton & NFTs! 🌟

Tested on Node.js v22.9

Still undergoing frequent updates!

Demo

https://s3.laisky.com/public/nft/connect/demo/index.html

Install

Install nodejs: https://github.com/nodesource/distributions

npm i

Build

npx blueprint build

Examples

helloworld is a simple example of a contract, while sample is an example that includes complex contract calls. Please do not use helloworld and sample directly in your development. Instead, use the code in common, jetton, and nft according to your needs.

Hello World

npx blueprint build helloworld
npx blueprint run --testnet --tonconnect helloworld

Jetton

To provide a more comprehensive code template, the sample deliberately includes a more complex Jetton implementation. You don't need to use the Sample directly in your project; rather, you should utilize the contracts and code in jetton and common as per your requirements.

npx blueprint build sample
npx blueprint run --testnet --tonconnect jetton

? input the address of the jetton receiver(default to yourself):
0QARnduCSjymI91urfHE_jXlnTHrmr0e4yaPubtPQkgy553b

Sent transaction
-------------------------------------
jetton master address: EQD9PR60ImXHSE1KIemZGS30F0aHc0QUnfC6sMYyw9HtSGqA
Contract deployed at address EQD9PR60ImXHSE1KIemZGS30F0aHc0QUnfC6sMYyw9HtSGqA
You can view it at https://testnet.tonscan.org/address/EQD9PR60ImXHSE1KIemZGS30F0aHc0QUnfC6sMYyw9HtSGqA
mintable: true
owner: EQDRAI32YdVGZGDq18ygyPyflOpY5qIAA9ukd-OJ0CfYJ8SN
jetton content: https://s3.laisky.com/uploads/2024/09/jetton-sample.json
jetton total supply: 19000000000
-------------------------------------
jetton wallet address: EQDJiYKObYkxFFTR5v53TihdY723W8YCh34jvdu7qcwhBhVx
Contract deployed at address EQDJiYKObYkxFFTR5v53TihdY723W8YCh34jvdu7qcwhBhVx
You can view it at https://testnet.tonscan.org/address/EQDJiYKObYkxFFTR5v53TihdY723W8YCh34jvdu7qcwhBhVx
jetton wallet owner: EQARnduCSjymI91urfHE_jXlnTHrmr0e4yaPubtPQkgy53uU
jetton wallet master: EQD9PR60ImXHSE1KIemZGS30F0aHc0QUnfC6sMYyw9HtSGqA
jetton wallet balance: 19000000000

Jettom Sample

NFT

To provide a more comprehensive code template, the sample deliberately includes a more complex NFT implementation. You don't need to use the Sample directly in your project; rather, you should utilize the contracts and code in nft and common as per your requirements.

npx blueprint build sample
npx blueprint run --testnet --tonconnect nft

Sent transaction
-------------------------------------
nft collection address: EQBHuZqwFHShebGvdOwRCeC1XbWPvYpOZsF7k7gkirDofyXG
Contract deployed at address EQBHuZqwFHShebGvdOwRCeC1XbWPvYpOZsF7k7gkirDofyXG
You can view it at https://testnet.tonscan.org/address/EQBHuZqwFHShebGvdOwRCeC1XbWPvYpOZsF7k7gkirDofyXG
nft collection owner: EQCVjlulLBzq9FSR2wQqZJU3uzE-TDXlvWKJAtHqu5SyHqoh
nft collection next index: 1
nft collection content: https://s3.laisky.com/uploads/2024/09/nft-sample-collection.json
-------------------------------------
nft item address: EQCub9bLM0sjI2qJGafmMFiPsDFJhq5RkDVQRlnNV9Rr_W77
Contract deployed at address EQCub9bLM0sjI2qJGafmMFiPsDFJhq5RkDVQRlnNV9Rr_W77
You can view it at https://testnet.tonscan.org/address/EQCub9bLM0sjI2qJGafmMFiPsDFJhq5RkDVQRlnNV9Rr_W77
nft item owner: EQCVjlulLBzq9FSR2wQqZJU3uzE-TDXlvWKJAtHqu5SyHqoh
nft item collection: EQBHuZqwFHShebGvdOwRCeC1XbWPvYpOZsF7k7gkirDofyXG
nft item index: 0
nft item content: https://s3.laisky.com/uploads/2024/09/nft-sample-item-0.json

NFT Sample

Helpful Traits

Clone this repo to your project:

git clone https://github.com/Laisky/tact-utils.git

Then import the traits you need:

import './tact-utils/contracts/common/traits.tact';
import './tact-utils/contracts/common/messages.tact';

Txable

Set a staticTaxFee to charge a fixed fee for every transaction, keeping it in the contract. Owners can adjust it anytime via SetStaticTaxFee msg.

contract YOUR_CONTRACT with Txable {
    owner: Address;
    staticTaxFee: Int as coins = ton("0.001");
}

Upgradale

Allow the contract to be upgraded by the owner.

contract YOUR_CONTRACT with Upgradable {
    owner: Address;
}

Jetton

Jetton Template

Easily implement your own Jetton contract using Jetton Template.

import './tact-utils/contracts/jetton/jetton.tact';
import './tact-utils/contracts/common/messages.tact';

contract YOUR_CONTRACT {
    owner: Address;

    receive("SOME_MSG") {
        let jettonMaster = initOf JettonMasterTemplate(
            self.owner,
            Tep64TokenData{
                flag: 1,
                content: "https://s3.laisky.com/uploads/2024/09/jetton-sample.json",
            },
        )
    }
}

Jetton Trait

You can also deeply customize Jetton contracts using Jetton Trait.

import './tact-utils/contracts/jetton/jetton.tact';

contract YOUR_CONTRACT with JettonMaster {
    owner: Address;
    staticTaxFee: Int as coins = ton("0.001");
    lockedValue: Int as coins = 0;
    content: Cell;
    totalSupply: Int as coins;
    mintable: Bool;

    init(owner: Address, content: Tep64TokenData) {
        self.owner = owner;

        self.content = content.toCell();
        self.totalSupply = 0;
        self.mintable = true;
    }
}

Helpful Tools

Helpful Communites