Official Javascript Web3 Provider to use with the Pocket Network
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
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.
npm install --save @pokt-network/web3-provider
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)
})
})
npm run test
Please read CONTRIBUTING.md for details on contributions and the process of submitting pull requests.
This project is licensed under the MIT License; see the LICENSE.md file for details.