1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/test/web3/web3.js
Whymarrh Whitby 094e4cf555 Check for unused function arguments (#6583)
* eslint: Check for unused function arguments

* eslint: Ignore unused '_' in argument list

Also allow any number of '_' e.g., '__' or '___' which is to be used sparingly

* Remove and rename unused arguments
2019-05-08 15:51:33 -04:00

35 lines
808 B
JavaScript

/* 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 () {
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)
}
})
})
})
})
})