1.1.8 • Published 3 years ago

simple-web3 v1.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Simple web3

This package makes it easy to connect to web3 through the MetaMask extension and interact with your smart contract on the blockchain.

Under the hood, simple-web3 handles all the client-side checks you have to make when using some of the native web3.js APIs.

You can use the web3.js library together with simple-web3

Installing simple-web3 auto installs the web3 library

NPM installation

npm i simple-web3

Yarn installation

yarn add simple-web3

Importing simple-web3

    const simpleWeb3 = require('simple-web3')
    
    // ES6
    import { connect, getAllAccounts, getAccount, getMethods  } from 'simple-web3'

Usage

import { connect, getAllAccounts, getAccount  } from 'simple-web3'

const ABI = {...}

async function main() {

    await connect() // connect to web3 through MetaMask

    let accounts = await getAllAccounts() // get all wallet addresses - ['0xdef', '0x123', '0xabc']

    let account = await getAccount() // get first wallet address - 0xb579Dc2d276c6a64A2F654f63209aCdB157c1e61
}

main()

Note:

  • All methods called should be Async.

  • A smart contract ABI is only required when interacting with your smart contract

Get smart contract methods ES6

import { getMethods  } from 'simple-web3'

const ABI = {...}

async function main() {

    const methods = await getMethods(ABI)

    await methods.methodName().call()
}

// methodName is the name of your variable or function in the smart contract

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago