JS/TS TON blockchain package

Overview

💎 ton3

npm GitHub top language TON

ton3 is a javascript package inspired by tonweb to work with TON blockchain.\

⚠️ Work in progress, API can (and most likely will) be changed! This is not production ready version yet.

How to install

npm i ton3

Simple usage

import { Providers, Mnemonic, Address, Coins, Builder, BOC } from 'ton3'
import { Wallets } from 'ton3-contracts'

const highloadWalletExample = async () => {
    const endpoint = 'https://testnet.toncenter.com/api/v2'
    const apiKey = 'xxx'
    const provider = new Providers.ProviderRESTV2(endpoint, { apiKey })
    const client = await provider.client()

    const mnemonic = new Mnemonic()
    const highload = new Wallets.ContractHighloadWalletV2(0, mnemonic.keys.public)

    console.log(mnemonic.words) // Get mnemonic phrase
    console.log(highload.address.toString()) // Get contract address

    // You need to deposit 1 ton to your contract address before deployment

    // Contract deployment
    const deploy = highload
        .createDeployMessage()
        .sign(mnemonic.keys.private)

    const { data: deployData } = await client.sendBoc(null, { boc: BOC.toBase64Standard(deploy) })

    console.log(deployData)

    // Create and send payments
    const transfers = Array(5).fill(null).reduce((acc, _el) => acc.concat({
        destination: new Address('xxx'),
        amount: new Coins('0.01'),
        body: new Builder().storeUint(0, 32).storeString('My message').cell(),
        mode: 3
    }), [])

    const payments = highload
        .createTransferMessage(transfers)
        .sign(mnemonic.keys.private)

    const { data: paymentsData } = await client.sendBoc(null, { boc: BOC.toBase64Standard(payments) })

    console.log(paymentsData)
}

License

MIT License

You might also like...

The one DAO to rule them all. A modular DAO written in Clarity for the Stacks blockchain.

ExecutorDAO The one DAO to rule them all. ExecutorDAO is designed to be completely modular and flexible, leveraging Clarity to the fullest extent. The

Oct 5, 2022

Krypt - Web 3.0 Blockchain Application

 Krypt - Web 3.0 Blockchain Application

This is a code repository for the corresponding video tutorial. In this video, we're going to build a Web 3.0 React Solidity Blockchain Application

Jan 5, 2023

An simple blockchain example on node + typescript.

node-ts-blockchain An simple blockchain example on node + typescript. Next steps: Create a usefull README. Add a architecture to store the chain/block

May 30, 2022

marriages, on the blockchain

crypto-marriage crypto-marriage is a smart contract that implements the ERC721 interface and is built to represent marriages on the blockchain. The me

Jan 8, 2022

Using decentralized identities with Web 2 to create a no login required website. Built using the Handshake blockchain.

Blending Web 2/3, is this Web .666? ( •̀ᴗ•́ )و ̑̑ Learn more by joining the Handshake Discord Community applause is a platform I built using centraliz

Mar 3, 2022

Blockchain, Smart Contract, Ganache, Remix, Web3, Solidity, Java Script, MQTT, ESP32, RFID, DHT11,

Blockchain, Smart Contract, Ganache, Remix, Web3, Solidity, Java Script, MQTT, ESP32, RFID, DHT11,

May 24, 2022

A messaging app built on top of Solana blockchain where you can store and view your messages.

Message App on Solana 💬 This Message application written Rust using Anchor ⚓ Setting up the Environment: Rust Installation curl --proto '=https' --tl

Oct 2, 2022

Blockchain for Justice

SecureX 🔐 SecureX is a blockchain-based evidence management system to prevent manipulation in Indian courts. This Decentralized Application can be us

Dec 11, 2022

Context-aware smart contracts for blockchain IoT systems

Context-aware smart contracts for blockchain IoT systems It contains 2 directories: contracts: contains the ContextAwareSmartContract.sol contract wit

Jun 17, 2022
Owner
TonStack
Independent TON developers community focused on making things better
TonStack
The best Discord bot with a shit ton of commands w/ a website.

REAPER An Multi-purpose Discord bot with many features! Getting started Creating a fork: 1). Click here to fork the repository 2). Open your terminal

Ryder 2 Oct 6, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
It is a very basic implementation of how blockchain works, mainly how the bitcoin blockchain.

How to run this program npm install node core/blockchain.js What is this It is a very basic implementation of how blockchain works, mainly how the bit

Anish Jain 12 May 9, 2022
HackMIT 2022. 2nd Place in Blockchain for Society sponsored by Jump Crypto. A revolutionary web application that leverages machine learning and blockchain technology to improve the crowdsourcing experience!

?? Wikisafe ?? Wikisafe is a revolutionary new crowdsourcing web application that innovates the process of crowdsourcing information. This application

Benson Liu 5 Dec 8, 2022
This package is for developers to be able to easily integrate bad word checking into their projects.\r This package can return bad words in array or regular expression (regex) form.

Vietnamese Bad Words This package is for developers to be able to easily integrate bad word checking into their projects. This package can return bad

Nguyễn Quang Sáng 8 Nov 3, 2022
Multi-platform node package bundle to a package.json.

dmpc Multi-platform node package bundle to a package.json. install ### npm mode npm i -g @kingsword/dmpc ### yarn mode yarn global add @kingsword/dmp

Kingsword 2 Oct 16, 2022
How to create an NFT on the Cardano blockchain using JavaScript

How to create an NFT on the Cardano blockchain using JavaScript Youtube Video: https://www.youtube.com/watch?v=OeOliguGn7Y Who is this guide for? For

Armada Alliance 117 Dec 31, 2022
Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain.

Nami Wallet Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain. It's an open-source project and built by Berry Po

Berry 335 Dec 29, 2022
Solana blockchain candy machine app boilerplate on top of Metaplex Candy Machine. NextJS, Tailwind, Anchor, SolanaLabs.React, dev/mainnet automation scripts.

NFT Candy Factory NOTE: This repo will prob only work on unix-based environments. The NFT Candy Factory project is designed to let users fork, customi

Kevin Faveri 261 Dec 30, 2022
created a very simple blockchain. just for fun.

SimpleBlockChain created a very simple blockchain. just for fun. Run: node main.js What happens? basically we create a new blockchain, and later we ad

null 1 Dec 25, 2021