You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
813 B
35 lines
813 B
6 years ago
|
/* eslint no-undef: 0 */
|
||
|
|
||
|
var json = methods
|
||
|
|
||
|
web3.currentProvider.enable().then(() => {
|
||
|
|
||
|
Object.keys(json).forEach(methodGroupKey => {
|
||
|
|
||
|
console.log(methodGroupKey)
|
||
|
const methodGroup = json[methodGroupKey]
|
||
|
console.log(methodGroup)
|
||
|
Object.keys(methodGroup).forEach(methodKey => {
|
||
|
|
||
|
const methodButton = document.getElementById(methodKey)
|
||
|
methodButton.addEventListener('click', function (event) {
|
||
|
|
||
|
window.ethereum.sendAsync({
|
||
|
method: methodKey,
|
||
|
params: methodGroup[methodKey][1],
|
||
|
}, function (err, result) {
|
||
|
if (err) {
|
||
|
console.log(err)
|
||
|
console.log(methodKey)
|
||
|
} else {
|
||
|
document.getElementById('results').innerHTML = JSON.stringify(result)
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
|
||
|
})
|
||
|
|
||
|
})
|
||
|
})
|
||
|
|