a godwoken-compatible http provider for web3.js.
now you can call your smart-contract on godwoken with metamask and eth address.
Before:
import Web3 from 'web3';
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
Now:
import Web3 from 'web3';
import PolyjuiceHttpProvider from './PolyjuiceHttpProvider';
var web3 = new Web3(new PolyjuiceHttpProvider('http://localhost:8545', GodwokenOption));
Before:
import Web3 from 'web3';
var provider = new Web3.providers.HttpProvider('http://localhost:8545');
var web3 = new Web3(provider);
var contract = web3.eth.Contract(abi, contract_address);
Now:
import Web3 from 'web3';
import PolyjuiceHttpProvider from './PolyjuiceHttpProvider';
var provider = new PolyjuiceHttpProvider('http://localhost:8545', GodwokenOption);
var web3 = new Web3(provider);
var contract = web3.eth.Contract(abi, contract_address);
for GodwokenOption
: see here.
basically, PolyjuiceHttpProvider is just a extended class of [web3-providers-http]
git clone https://github.com/RetricSu/polyjuice-providers-http.git
cd polyjuice-providers-http
yarn
build browser version:
yarn build
build node version:
yarn build:node
test:
yarn test
yarn example