add foundry provider draft

pull/5370/head
8times4 2 years ago committed by Aniket
parent 7700406b5c
commit e9c0bc95d8
  1. 3
      apps/remix-ide/src/app.js
  2. 33
      apps/remix-ide/src/app/tabs/foundry-provider.tsx
  3. 14
      apps/remix-ide/src/app/udapp/run-tab.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
])

@ -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 (
<div> Note: To run Anvil on your system, run
<div className="border p-1">curl -L https://foundry.paradigm.xyz | bash</div>
<div className="border p-1">anvil</div>
For more info, visit: <a href="https://github.com/foundry-rs/foundry" target="_blank">Foundry Documentation</a>
<div>Anvil JSON-RPC Endpoint:</div>
</div>
)
}
}

@ -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: {

Loading…
Cancel
Save