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 = let mux = "main" "http://127.0.0.1:7545" //or let mux = new Mux("main", "ws://127.0.0.1:7546")
deploy or attach
mux // {abi, bytecode} is a BOXmux
you don't need create contract for each provider. you just need create is once, and mux will load them automatic while calling.
web3
muxprovidermuxeth
contract api
let myContract = mux // glue-contract, not web3 contractmyContractaddressmyContractabimyContractprovidermyContractcontract -- web3 contractasync myContractmyContract //c.listen // IPC needed
Board
board is the structure used to record deployment information of contracts. it is usually represented as the following structure.
there is a easy way to create board from existed glue-contract
myContract
Mux
you can create mux with code like this
const Mux = let 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$HTTPprovider...mux$WSprovider...
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