@pokt-network/web3-provider

0.0.6-rc • Public • Published

Pocket-JS-Web3-Provider

Official Javascript Web3 Provider to use with the Pocket Network

Overview

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Requirements

You should have at least have a basic knowledge of blockchain technology and know your way around JavaScript. You will also need to install the NPM tool.

Installation

npm install --save @pokt-network/web3-provider

Documentation

If you would like to know how to integrate Pocket-JS-Web3-Provider into your DApp, visit our developer portal that has a lot of useful tutorials and material about the Pocket Network.

const lib = require('@pokt-network/web3-provider')
const Pocket = lib.Pocket
const Configuration = lib.Configuration
const HttpRpcProvider = lib.HttpRpcProvider
const Node = lib.Node
const PocketProvider = lib.PocketProvider

const dispatchers = [new URL("http://node1.testnet.pokt.network:8081"), new URL("http://node2.testnet.pokt.network:8081")];


const configuration = new Configuration(5, 1000, undefined, 40000)
const rpcProvider = new HttpRpcProvider(dispatchers)
const pocket = new Pocket(dispatchers, undefined, configuration, undefined)
const blockchainHash = "8cf7f8799c5b30d36c86d18f0f4ca041cf1803e0414ed9e9fd3a19ba2f0938ff"
PocketAAT.from("0.0.1", "0x0","0x0","0x0").then(function(pocketAAT){
  const pocketProvider = new PocketProvider(blockchainHash, pocketAAT, pocket, <ethTransactionSignerGoesHere> | undefined)
  const web3Ins = new Web3(pocketProvider)

  web3Ins.eth.getBalance(clientAccount.addressHex).then(function(response, error){
      console.log("Account balance = "+response)
  })
})

Running the tests

npm run test

Contributing

Please read CONTRIBUTING.md for details on contributions and the process of submitting pull requests.

Support & Contact

License

This project is licensed under the MIT License; see the LICENSE.md file for details.

Package Sidebar

Install

npm i @pokt-network/web3-provider

Weekly Downloads

1

Version

0.0.6-rc

License

MIT

Unpacked Size

48.7 MB

Total Files

11

Last publish

Collaborators

  • crisog
  • luyzdeleon