New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonweb-utils

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonweb-utils

Collection of utility functions used in TonWeb.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-7.69%
Maintainers
1
Weekly downloads
 
Created
Source

tonweb-utils

This is a sub package of TonWeb.

This contains useful utility functions for Dapp developers: work with TON Addresses, gram values, byte arrays, hex, hash functions.

Install

tonweb-utils is already included in the main package:

npm install tonweb

import TonWeb from "tonweb";
TonWeb.utils;

const tonweb = new TonWeb();
tonweb.utils;

You can use the tonweb-utils separately, without the main package:

npm install tonweb-utils

import {Address, toNano, ...} from "tonweb-utils"

Address Class

const Address = TonWeb.utils.Address;

const address = new Address(anyForm: string | Address);

address.isUserFriendly: boolean

address.isUrlSafe: boolean

address.isBounceable: boolean

address.isTestOnly: boolean

address.wc: number

address.hashPart: Uint8Array

address.toString(isUserFriendly?: boolean, isUrlSafe?: boolean, isBounceable?: boolean, isTestOnly?: boolean): string

Functions

TonWeb.utils.

  • BN - "bn.js" library

  • nacl - "tweetnacl" library

  • Address - Address class

  • toNano(amount: number | BN | string): BN

  • fromNano(amount: number | BN | string): string

  • bytesToHex(bytes: Uint8Array): string

  • hexToBytes(s: string): Uint8Array

  • stringToBytes(s: string, size?: number): Uint8Array

  • crc32c(bytes: Uint8Array): Uint8Array

  • crc16(data: ArrayLike): Uint8Array

  • concatBytes(a: Uint8Array, b: Uint8Array): Uint8Array

  • bytesToBase64(bytes: Uint8Array): string

  • base64ToBytes(base64: string): Uint8Array

Authors

@rulon and @tolyayanot

Keywords

FAQs

Package last updated on 09 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc