diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 30e653731d..4eb9423d38 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -27,6 +27,7 @@ import { NotificationPlugin } from './app/plugins/notification' import { Blockchain } from './blockchain/blockchain.js' import { HardhatProvider } from './app/tabs/hardhat-provider' import { GanacheProvider } from './app/tabs/ganache-provider' +import { FoundryProvider } from './app/tabs/foundry-provider' const isElectron = require('is-electron') @@ -177,6 +178,7 @@ class AppComponent { const web3Provider = new Web3ProviderModule(blockchain) const hardhatProvider = new HardhatProvider(blockchain) const ganacheProvider = new GanacheProvider(blockchain) + const foundryProvider = new FoundryProvider(blockchain) // ----------------- convert offset to line/column service ----------- const offsetToLineColumnConverter = new OffsetToLineColumnConverter() Registry.getInstance().put({ @@ -233,6 +235,7 @@ class AppComponent { storagePlugin, hardhatProvider, ganacheProvider, + foundryProvider, this.walkthroughService, search ]) diff --git a/apps/remix-ide/src/app/tabs/foundry-provider.tsx b/apps/remix-ide/src/app/tabs/foundry-provider.tsx new file mode 100644 index 0000000000..47e899865a --- /dev/null +++ b/apps/remix-ide/src/app/tabs/foundry-provider.tsx @@ -0,0 +1,33 @@ +import * as packageJson from '../../../../../package.json' +import { Plugin } from '@remixproject/engine' +import { AppModal, AlertModal, ModalTypes } from '@remix-ui/app' +import React from 'react' // eslint-disable-line +import { Blockchain } from '../../blockchain/blockchain' +import { ethers } from 'ethers' +import { AbstractProvider } from './abstract-provider' + +const profile = { + name: 'foundry-provider', + displayName: 'Foundry Provider', + kind: 'provider', + description: 'Anvil', + methods: ['sendAsync'], + version: packageJson.version +} + +export class FoundryProvider extends AbstractProvider { + constructor (blockchain) { + super(profile, blockchain, 'http://127.0.0.1:8545') + } + + body (): JSX.Element { + return ( +
Note: To run Anvil on your system, run +
curl -L https://foundry.paradigm.xyz | bash
+
anvil
+ For more info, visit: Foundry Documentation +
Anvil JSON-RPC Endpoint:
+
+ ) + } +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index 0f59ddd962..020c2a34df 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -127,6 +127,20 @@ export class RunTab extends ViewPlugin { } }) + await this.call('blockchain', 'addProvider', { + name: 'Foundry Provider', + provider: { + async sendAsync (payload, callback) { + try { + const result = await udapp.call('foundry-provider', 'sendAsync', payload) + callback(null, result) + } catch (e) { + callback(e) + } + } + } + }) + await this.call('blockchain', 'addProvider', { name: 'Wallet Connect', provider: {