npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kuzirashi/test-provider

v0.0.1-rc8

Published

a godwoken-compatible http provider for web3.js.

Downloads

3

Readme

(THIS BRANCH IS ONLY FOR TEST!) Polyjuice Http Provider

a godwoken-compatible http provider for web3.js.

now you can call your smart-contract on godwoken with metamask and eth address.

init web3

Before:

import Web3 from 'web3';

var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8024'));

Now:

import Web3 from 'web3';
import PolyjuiceHttpProvider from './PolyjuiceHttpProvider';

var web3 = new Web3(new PolyjuiceHttpProvider('http://localhost:8024', GodwokenOption, ['your abi items array']));

for GodwokenOption: see here.

init contract instance

Before:

import Web3 from 'web3';

var provider = new Web3.providers.HttpProvider('http://localhost:8024');
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:8024', GodwokenOption, ['your abi items array']);
var web3 = new Web3(provider);

var contract = web3.eth.Contract(abi, contract_address);

basically, PolyjuiceHttpProvider is just a extended class of [web3-providers-http]

getting started

    git clone https://github.com/RetricSu/polyjuice-providers-http.git
    cd polyjuice-providers-http
    yarn 

build:

    yarn build

node version:

    /lib/index.node.js

usage:

const PolyjuiceHttpProvider = require('./PolyjuiceHttpProvider');

web version:

    /lib/index.js

useage:

import PolyjuiceHttpProvider from './PolyjuiceHttpProvider';

browser version:

    /build/browser/PolyjuiceHttpProvider.js

usage:

<script src="/path/to/PolyjuiceHttpProvider.js"></script>

hardhat

hardhat is using ethers instead of web3.js, you can find ethers-compatibale JsonRpcProvider and WalletSigner in /lib/hardhat/providers

usage:

const { PolyjuiceJsonRpcProvider } = require('PolyjuiceHttpProvider/lib/hardhat/providers');
const PolyjuiceWallet = require('PolyjuiceHttpProvider/lib/hardhat/wallet-signer');

before you can run test and an minimal example, create an .test.env file with some godwoken-polyjuice config.

cat > ./test.env <<EOF
WEB3_JSON_RPC=<godwoken web3 rpc>
ROLLUP_TYPE_HASH=<godwoken rollup type hash>
ETH_ACCOUNT_LOCK_CODE_HASH=<eth account lock code hash>
EXAMPLE_CONTRACT_ADDRESS=<an example test contract deployed address>
PRIVATE_KEY=<your eth test private key, do not use in production>

test

    yarn test

start a minimal dapp example

    yarn example