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

w3glue

v0.0.3-beta.9

Published

a liberary which provide the glue-protocal to communicate with geth nodes.

Downloads

7

Readme

w3glue

init

run one of these command:

  • npm i
  • yarn install

doc gen

the repo using gulp to generate documents.

run gulp doc or gulp

then check them at ./docs/gen/

Usage

Core (glue.w3)

launch

const {Mux} = require("w3glue")
let mux = new Mux("main", "http://127.0.0.1:7545") //or let mux = new Mux("main", "ws://127.0.0.1:7546")

deploy or attach

mux.deployContract(tag, sender, args, {abi, bytecode}, extraGasLimit = 1) // {abi, bytecode} is a BOX
mux.attachContract(tag, address, {abi})

you don't need create contract for each provider. you just need create is once, and mux will load them automatic while calling.

web3

mux.provider
mux.eth

contract api

let myContract = mux.getContract(tag) // glue-contract, not web3 contract
myContract.address
myContract.abi
myContract.provider
myContract.contract -- web3 contract
async myContract.events(eventName, fromBlock = 0, toBlock = 'latest', filter = undefined)
myContract.getMethod(methodName, ...args)

//c.listen // IPC needed

Board

board is the structure used to record deployment information of contracts. it is usually represented as the following structure.

{
    "contractStr": "V1/ERC20",
    "address": "0x0F217cDBbaf75B9b4c5dc1008A5cc5918e672d3d"
}

there is a easy way to create board from existed glue-contract

myContract.toBoard(contractStr)

Mux

you can create mux with code like this

const {Mux} = require("w3glue")
let mux = new Mux("main", {
    urls:{
        http:"http://127.0.0.1:7545",
        ws:"ws://127.0.0.1:7546",
        ipc:"/var/www/test",
    }
})

then you can use code like this to specify a phase before using mux's api

mux.$HTTP.provider...
mux.$WS.provider...

by the way, The phase you choose at the end will be retained. This means that once you have selected a phase, the API after that will call the mux in that phase $HTTP is the default phase of mux, then WS is the default phase when HTTP does not exist, and finally IPC If you using online string to create mux, it must be http