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

tonutils-ts

v0.1.0

Published

TonUtils: TS/JS library with alternative connections to TON APIs, making blockchain interactions easier.

Downloads

40

Readme

TonUtils

Telegram Group Telegram Chanel Licence NPM Version NPM Downloads Stars

The TON blockchain can be tough, especially when you are new to TON. Suppose you are an NFT marketplace developer, trying to sell your collections, but you face confusing docs, random bugs, and unreliable APIs. Official tools often don't work well, making things even harder.

Why TonUtils?

TON is the fastest blockchain, but high activity (such as major listings) can cause endpoints like TonApi or Public Light Servers to go down, leading to failed transactions and frustration. TonUtils helps solve these problems:

  • Minimal dependencies: Simple tools for stable blockchain interaction.

  • Alternative light servers: Automatically connects to other servers when the current one fails, keeping your project running smoothly.

  • Easy to use: No need to spend weeks learning. TonUtils has ready-made solutions so you can start building right away.

Focus on your product, not on fighting with the blockchain.

Features

  • Public Address Utils: Quickly validate and manage wallet addresses, reducing errors and saving time.
  • Wallet Creation: Create secure wallets easily with simple code, no complex guides needed.
  • Transaction Crafting: Effortlessly craft and send transactions, focus on your project, not on blockchain complexity.

Getting Started

Prerequisites

Before you begin, ensure you have installed:

  • Node.js (v16.x or later)
  • npm (v8.x or later)

Installation

To get started with TonUtils, simply install it as a package using npm:

npm install tonutils-ts

Features Description

Public Address Utils

  • getPublicAddressByWallet

    • Description: Returns the public address associated with a given wallet.

    • Example:

      const address = getPublicAddressByWallet(WalletContractV4);
      // Output: EQCgBnDa0omfX3xW-UoxUZNn0fdCm7YWnaj1dVjZz_EDpxZL
  • getPublicAddressByMnemonic

    • Description: Retrieves the public address associated with a given mnemonic.

    • Example:

      const address = await getPublicAddressByMnemonic("one two three...");
      // or
      const address = await getPublicAddressByMnemonic(["one", "two", "three"]);
      // Output: EQCgBnDa0omfX3xW-UoxUZNn0fdCm7YWnaj1dVjZz_EDpxZL
  • getBouncableAddress

    • Description: Returns the bounceable address for the given address.

    • Example:

      const bouncableAddress = getBouncableAddress("UQ...");
      // Output: EQCgBnDa0omfX3xW-UoxUZNn0fdCm7YWnaj1dVjZz_EDpxZL
  • getNonBouncableAddress

    • Description: Returns the non-bounceable address for the given address.

    • Example:

      const nonBouncableAddress = getNonBouncableAddress("EQ...");
      // Output: UQCgBnDa0omfX3xW-UoxUZNn0fdCm7YWnaj1dVjZz_EDp0uO

Wallet Creation

  • createWallet
    • Description: Returns a new wallet.

    • Example:

      const { mnemonic, keyPair, generatedWallet } = await createWallet();
      // Output: { mnemonic, keyPair, generatedWallet }

CLI commands

These features are currently available via the command line. Useful for creating and managing wallets, sending transactions, and testing addresses.

To use them, clone the repository:

git clone https://github.com/baadev/tonutils-ts.git
cd TonUtils

Then, you can run the CLI tools below.

Get Public Address by Mnemonic (CLI)

A CLI command to get a public address from a mnemonic. Helpful for quick wallet creation and testing addresses:

npx ts-node ./modules/public.address.utils.ts -m 'abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt'

# Output:
Bounceable:  EQBDyloUvY25siQu-6XzJ4M7bBWUwUxGQ7BRC7oOB0R1JQ3Y
Not Bounceable:  UQBDyloUvY25siQu-6XzJ4M7bBWUwUxGQ7BRC7oOB0R1JVAd

Wallet Management (CLI)

Wallet Management utility will allow you to generate specified amount of new wallets and send specified amount of TON in order to activate it in blockchain.

Create Activated Wallets with Balance

  1. Create a .env file in your project:
   # Your wallet with funds
   FUNDING_SEED="one two three.."
   # optional, tonapi key
   TONAPI_KEY=""

   # For multisend
   # destination address / giver
   RECEIVER_ADDRESS="UQBFoaSviVB76rjARNE8mz5RJADALWEv_owkRhDNIs326obj" 
   # amount to be sent
   SENT_AMOUNT=0.01
   # 0 will send endlessly until manual stop
   SENT_COUNT=0
   # delay between sends
   SENT_DELAY=""
   # comment for transaction
   SENT_BODY="Any comment here"
  1. Run the command:
npx ts-node ./wallet_gen/multi_wallet_gen.ts --wallets 3 --popup 0.01

Arguments available

| Argument | Description | Example | | ----------- | ---------| ----------- | | --wallets | The number of wallets to be created | --wallets 3| | --popup | The amount of TON to be sent to each wallet | --popup 0.01 |

See the README in the wallet_gen directory for more details.


Transaction Crafting

The wallet_popup directory contains a script for sending TON cryptocurrency from a funding wallet to a list of other wallets.

Here’s how to set up WALLET_LIST in your .env and run the script from the command line:

  1. Create a .env file in project root if it doesn’t exist.
  2. Add WALLET_LIST as a JSON array of wallet addresses. Example:
   FUNDING_SEED="your mnemonic phrase here"
   SEND_VALUE="10"
   WALLET_LIST='["UQBFoaSviVB76rjARNE8mz5RJADALWEv_owkRhDNIs326obj", "EQCDeEg..."]'
  1. Run the script using ts-node:
npx ts-node ./wallet-popup/multi_wallet_popup_ton.ts

The script will read the addresses from WALLET_LIST and send the specified amount of TON to each address.

See the README file in the wallet_popup directory for more details.

How to Contribute

We welcome contributions from the community! If you're interested in helping improve TonUtils, here are ways you can contribute:

  • Reporting Bugs: Open an issue to report a bug.
  • Suggesting Enhancements: Have ideas on how to make TonUtils better? Open an issue with your suggestions.
  • Pull Requests: Submit pull requests with bug fixes or new features.

License

TonUtils is released under the MIT License. Feel free to fork and modify it as per your needs.

Support

If you need assistance or have any questions, feel free to open an issue or contact us directly: