mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fb22fb12ca
* schema added * ui for the dapp added and schema.js changed according to the comments in PR * added tests for all web3 methods * Update run-all.sh * Update web3.spec.js to work with new onboarding flow * changes made according to the comments * Create stand alone script for web3 e2e tests. * Lint fixes for web3 e2e tests.
35 lines
813 B
JavaScript
35 lines
813 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 (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)
|
|
}
|
|
})
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
})
|
|
|