|
|
@ -1,18 +1,20 @@ |
|
|
|
'use strict' |
|
|
|
'use strict' |
|
|
|
import Web3, { Web3PluginBase } from 'web3' |
|
|
|
import Web3, { Web3PluginBase } from 'web3' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function extendWeb3 (web3) { |
|
|
|
|
|
|
|
if(!web3.debug){ |
|
|
|
|
|
|
|
web3.registerPlugin(new Web3DebugPlugin()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function loadWeb3 (url) { |
|
|
|
export function loadWeb3 (url) { |
|
|
|
if (!url) url = 'http://localhost:8545' |
|
|
|
if (!url) url = 'http://localhost:8545' |
|
|
|
const web3 = new Web3() |
|
|
|
const web3 = new Web3() |
|
|
|
web3.setProvider(new Web3.providers.HttpProvider(url)) |
|
|
|
web3.setProvider(new Web3.providers.HttpProvider(url)) |
|
|
|
web3.registerPlugin(new Web3DebugPlugin()) |
|
|
|
extendWeb3(web3) |
|
|
|
return web3 |
|
|
|
return web3 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function extendWeb3 (web3) { |
|
|
|
|
|
|
|
web3.registerPlugin(new Web3DebugPlugin()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setProvider (web3, url) { |
|
|
|
export function setProvider (web3, url) { |
|
|
|
web3.setProvider(new web3.providers.HttpProvider(url)) |
|
|
|
web3.setProvider(new web3.providers.HttpProvider(url)) |
|
|
|
} |
|
|
|
} |
|
|
|