test commit

pull/1222/head
aniket-engg 4 years ago committed by Aniket
parent 4ce7228874
commit db1556874b
  1. 45
      apps/remix-ide/src/app/tabs/hardhat-provider.js
  2. 2
      apps/remix-ide/src/app/ui/modal-dialog-custom.js

@ -1,5 +1,6 @@
import * as packageJson from '../../../../../package.json'
import { Plugin } from '@remixproject/engine'
const modalDialogCustom = require('../ui/modal-dialog-custom')
import Web3 from 'web3'
const profile = {
@ -17,17 +18,41 @@ export default class HardhatProvider extends Plugin {
this.provider = new Web3.providers.HttpProvider('http://127.0.0.1:8545')
}
sendAsync (data) {
return new Promise((resolve, reject) => {
if (this.provider) {
this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](data, (error, message) => {
if (error) return reject(error)
resolve(message)
})
} else {
resolve({"jsonrpc": "2.0", "result": [], "id": data.id})
web3ProviderDialogBody () {
const thePath = '<path/to/local/folder/for/test/chain>'
return yo`
<div class="">
Note: To use Geth & https://remix.ethereum.org, configure it to allow requests from Remix:(see <a href="https://geth.ethereum.org/docs/rpc/server" target="_blank">Geth Docs on rpc server</a>)
<div class="border p-1">geth --http --http.corsdomain https://remix.ethereum.org</div>
<br>
To run Remix & a local Geth test node, use this command: (see <a href="https://geth.ethereum.org/getting-started/dev-mode" target="_blank">Geth Docs on Dev mode</a>)
<div class="border p-1">geth --http --http.corsdomain="${window.origin}" --http.api web3,eth,debug,personal,net --vmdebug --datadir ${thePath} --dev console</div>
<br>
<br>
<b>WARNING:</b> It is not safe to use the --http.corsdomain flag with a wildcard: <b>--http.corsdomain *</b>
<br>
<br>For more info: <a href="https://remix-ide.readthedocs.io/en/latest/run.html#more-about-web3-provider" target="_blank">Remix Docs on Web3 Provider</a>
<br>
<br>
Hardhat Provider Endpoint
</div>
`
}
})
sendAsync (data) {
console.log('Inside sendAsync - modalDialogCustom', modalDialogCustom)
modalDialogCustom.prompt('Hardhat node request', this.web3ProviderDialogBody(), 'http://127.0.0.1:8545')
// return new Promise((resolve, reject) => {
// if (this.provider) {
// this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](data, (error, message) => {
// if (error) return reject(error)
// resolve(message)
// })
// } else {
// resolve({"jsonrpc": "2.0", "result": [], "id": data.id})
// }
// })
}
}

@ -8,6 +8,7 @@ module.exports = {
return modal('Alert', yo`<div>${title}</div>`, null, { label: null })
},
prompt: function (title, text, inputValue, ok, cancel, focus) {
console.log('inside prompt -> 1', title)
return prompt(title, text, false, inputValue, ok, cancel, focus)
},
promptPassphrase: function (title, text, inputValue, ok, cancel) {
@ -88,6 +89,7 @@ const validateInput = (e) => {
}
function prompt (title, text, hidden, inputValue, ok, cancel, focus) {
console.log('inside prompt -> 2', title)
if (!inputValue) inputValue = ''
var type = hidden ? 'password' : 'text'
var input = yo`

Loading…
Cancel
Save