0.0.3-beta.9 • Published 6 years ago

w3glue v0.0.3-beta.9

Weekly downloads
3
License
GNU LESSER GENERA...
Repository
github
Last release
6 years ago

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

0.0.3-beta.9

6 years ago

0.0.3-beta.8

6 years ago

0.0.3-beta.7

6 years ago

0.0.3-beta.6

6 years ago

0.0.3-beta.5

6 years ago

0.0.3-beta.4

6 years ago

0.0.3-beta.3

6 years ago

0.0.3-beta.2

6 years ago

0.0.3-beta.1

6 years ago

0.0.2-r

6 years ago

0.0.2-beta.3

6 years ago

0.0.2-Beta.2

6 years ago

0.0.2-Beta.1

6 years ago

0.0.2

6 years ago

0.0.1-Beta.3

6 years ago

0.0.1-Beta.1

6 years ago

0.0.1

6 years ago