Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/remix-ide-e2e/src/tests/runAndDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewDivto"]', 30000)
.assert.containsText('*[data-id="stepdetail"]', 'loaded address:\n0x3c943Fb816694d7D1f4C738e3e7823818a88DD6C')
.assert.containsText('*[data-id="solidityLocals"]', 'to: 0x6C3CCC7FBA111707D5A1AAF2758E9D4F4AC5E7B1')
},

'Call web3.eth.getAccounts() using Injected web3 (Metamask)': function (browser: NightwatchBrowser) {
browser
.executeScript(`web3.eth.getAccounts()`)
.pause(2000)
.journalLastChildIncludes(`[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]`)
.end()
},
tearDown: sauce
Expand Down
13 changes: 13 additions & 0 deletions apps/remix-ide-e2e/src/tests/terminal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ module.exports = {
.executeScript(`web3.eth.getAccounts()`)
.pause(2000)
.journalLastChildIncludes(`[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]`)
},

'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal
.clickLaunchIcon('udapp')
.click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick()
.executeScript(`web3.eth.getAccounts()`)
.pause(2000)
.journalLastChildIncludes(`[ "`) // we check if an array is present, don't need to check for the content
.journalLastChildIncludes('" ]')
.journalLastChildIncludes('", "')
.end()
},

Expand Down
4 changes: 3 additions & 1 deletion apps/remix-ide/src/app/tabs/web3-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export class Web3ProviderModule extends Plugin {
*/
sendAsync (payload) {
return new Promise((resolve, reject) => {
this.blockchain.web3().currentProvider.sendAsync(payload, (error, message) => {
const provider = this.blockchain.web3().currentProvider
// see https://github.com/ethereum/web3.js/pull/1018/files#diff-d25786686c1053b786cc2626dc6e048675050593c0ebaafbf0814e1996f22022R129
provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, (error, message) => {
if (error) return reject(error)
resolve(message)
})
Expand Down