This package has been deprecated

Author message:

This package was renamed to 0xweb. Visit https://0xweb.org for more inf

web3m
TypeScript icon, indicating that this package has built-in type declarations

0.9.7 • Public • Published

web3m


Build Status NPM version

Contract Package Manager

Generate TypeScript classes for contracts fetched from Etherscan and Co.

We use 📦 dequanto library for the wrapped classes

Here the example of generated classes: tenbits/web3m-sample 🔗

Install

$ npm i web3m -g

# Boostrap dequanto library in cwd
$ web3m init

# Download sources/ABI and generate TS classes
$ web3m install 0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419 --name chainlink/oracle-eth

API Usage

Use autogenerated TypeScript classes for much safer and faster backend implementation

import { ChainlinkOracleEth } from './web3m/eth/chainlink/oracle-eth/oracle-eth';
import { Config } from '@dequanto/Config';
import { $bigint } from '@dequanto/utils/$bigint';

async function example () {
    await Config.fetch();

    let oracle = new ChainlinkOracleEth();
    let decimals = await oracle.decimals();
    let price = await oracle.latestAnswer();

    console.log(`ETH Price ${$bigint.toEther(price, decimals)}`);
    process.exit(0);
}
example();

CLI Usage

READ and WRITE to installed contracts directly from the command line

$ web3m contract chainlink/oracle-eth latestAnswer

Config

❣️ We include our default KEYs for etherscan/co and infura. They are rate-limited. Please, create and insert your keys. Thank you!

$ web3m config --edit

Various Blockchain tools

Get the commands overview

$ web3m --help
$ web3m install --help

block

  1. Get current block info
$ web3 block get latest

token

  1. Get Token Price
$ web3m token price WETH

accounts

🔐 Ledger feature allows to store accounts in encrypted local storage. We use local machine KEY and provided PIN in arguments to create cryptographically strong secrets 🔑 for encryption.

When calling contracts WRITE methods, you should first add an account to the wallet, and then use PIN to unlock the storage

$ web3m account add --name foo --key the_private_key --pin foobar
$ web3m token transfer USDC --from foo --to 0x123456 --amount 20 --pin foobar

🏁


©️ MIT License.

Readme

Keywords

Package Sidebar

Install

npm i web3m

Weekly Downloads

0

Version

0.9.7

License

MIT

Unpacked Size

5.3 MB

Total Files

457

Last publish

Collaborators

  • tenbits