1.1.8 • Published 2 years ago

simple-web3 v1.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago