fix rpc endpoint properties

pull/5318/head
yann300 1 month ago committed by Aniket
parent 8b124483b4
commit 5edf74a4b9
  1. 17
      apps/remix-ide/src/app/providers/injected-arbitrum-one-provider.tsx
  2. 10
      apps/remix-ide/src/app/providers/injected-custom-provider.tsx
  3. 40
      apps/remix-ide/src/app/providers/injected-ephemery-testnet-provider.tsx
  4. 17
      apps/remix-ide/src/app/providers/injected-optimism-provider.tsx
  5. 26
      apps/remix-ide/src/app/providers/injected-provider-trustwallet.tsx
  6. 27
      apps/remix-ide/src/app/providers/injected-skale-chaos-testnet-provider.tsx
  7. 14
      apps/remix-ide/src/app/udapp/run-tab.tsx

@ -1,17 +0,0 @@
import * as packageJson from '../../../../../package.json'
import { InjectedCustomProvider } from './injected-custom-provider'
const profile = {
name: 'injected-arbitrum-one-provider',
displayName: 'Injected Arbitrum One Provider',
kind: 'provider',
description: 'injected Arbitrum One Provider',
methods: ['sendAsync', 'init'],
version: packageJson.version
}
export class InjectedArbitrumOneProvider extends InjectedCustomProvider {
constructor() {
super(profile, 'Arbitrum One', '0xa4b1', ['https://arb1.arbitrum.io/rpc'])
}
}

@ -4,12 +4,14 @@ import { InjectedProviderDefault } from './injected-provider-default'
export class InjectedCustomProvider extends InjectedProviderDefault { export class InjectedCustomProvider extends InjectedProviderDefault {
chainName: string chainName: string
chainId: string chainId: string
pluginName: string
rpcUrls: Array<string> rpcUrls: Array<string>
nativeCurrency: Record<string, any> nativeCurrency: Record<string, any>
blockExplorerUrls: Array<string> blockExplorerUrls: Array<string>
constructor(provider: any, chainName: string, chainId: string, rpcUrls: Array<string>, nativeCurrency?: Record<string, any>, blockExplorerUrls?: Array<string>) { constructor(provider: any, pluginName: string, chainName: string, chainId: string, rpcUrls: Array<string>, nativeCurrency?: Record<string, any>, blockExplorerUrls?: Array<string>) {
super(provider, chainName) super(provider, pluginName)
this.pluginName = pluginName
this.chainName = chainName this.chainName = chainName
this.chainId = chainId this.chainId = chainId
this.rpcUrls = rpcUrls this.rpcUrls = rpcUrls
@ -44,8 +46,8 @@ export const setCustomNetwork = async (chainName: string, chainId: string, rpcUr
chainName: chainName, chainName: chainName,
rpcUrls: rpcUrls, rpcUrls: rpcUrls,
} }
if (nativeCurrency) paramsObj.nativeCurrency = nativeCurrency paramsObj.nativeCurrency = nativeCurrency ? nativeCurrency : null
if (blockExplorerUrls) paramsObj.blockExplorerUrls = blockExplorerUrls paramsObj.blockExplorerUrls = blockExplorerUrls ? blockExplorerUrls : null
await (window as any).ethereum.request({ await (window as any).ethereum.request({
method: 'wallet_addEthereumChain', method: 'wallet_addEthereumChain',
params: [paramsObj] params: [paramsObj]

@ -1,40 +0,0 @@
import * as packageJson from '../../../../../package.json'
import { InjectedCustomProvider } from './injected-custom-provider'
import { Web3 } from 'web3'
const profile = {
name: 'injected-ephemery-testnet-provider',
displayName: 'Injected Ephemery Testnet Provider',
kind: 'provider',
description: 'Injected Ephemery Testnet Provider',
methods: ['sendAsync', 'init'],
version: packageJson.version
}
export class InjectedEphemeryTestnetProvider extends InjectedCustomProvider {
constructor() {
super(profile,
'Ephemery Testnet',
'',
['https://otter.bordel.wtf/erigon', 'https://eth.ephemeral.zeus.fyi'],
{
"name": "Ephemery ETH",
"symbol": "ETH",
"decimals": 18
},
[
'https://otter.bordel.wtf/',
'https://explorer.ephemery.dev/'
]
)
}
async init() {
const chainId = await new Web3(this.rpcUrls[0]).eth.getChainId()
this.chainId = `0x${chainId.toString(16)}`
this.chainName = `Ephemery Testnet ${chainId}`
await super.init()
return {}
}
}

@ -1,17 +0,0 @@
import * as packageJson from '../../../../../package.json'
import { InjectedCustomProvider } from './injected-custom-provider'
const profile = {
name: 'injected-optimism-provider',
displayName: 'Injected Optimism Provider',
kind: 'provider',
description: 'injected Optimism Provider',
methods: ['sendAsync', 'init'],
version: packageJson.version
}
export class Injected0ptimismProvider extends InjectedCustomProvider {
constructor() {
super(profile, 'Optimism', '0xa', ['https://mainnet.optimism.io'])
}
}

@ -1,26 +0,0 @@
/* global ethereum */
import * as packageJson from '../../../../../package.json'
import { InjectedProvider } from './injected-provider'
const profile = {
name: 'injected-trustwallet',
displayName: 'Trust wallet',
kind: 'provider',
description: 'Trust wallet',
methods: ['sendAsync', 'init'],
version: packageJson.version
}
export class InjectedProviderTrustWallet extends InjectedProvider {
constructor() {
super(profile)
}
getInjectedProvider() {
return (window as any).trustwallet
}
notFound() {
return 'Could not find Trust Wallet provider. Please make sure the Trust Wallet extension is active. Download the latest version from https://trustwallet.com/browser-extension'
}
}

@ -1,27 +0,0 @@
import * as packageJson from '../../../../../package.json'
import { InjectedCustomProvider } from './injected-custom-provider'
const profile = {
name: 'injected-skale-chaos-testnet-provider',
displayName: 'Injected SKALE Chaos Testnet',
kind: 'provider',
description: 'Injected SKALE Chaos Testnet Provider',
methods: ['sendAsync', 'init'],
version: packageJson.version
}
export class InjectedSKALEChaosTestnetProvider extends InjectedCustomProvider {
constructor () {
super(profile,
'SKALE Chaos Testnet',
'0x50877ed6',
['https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix'],
{
"name": "sFUEL",
"symbol": "sFUEL",
"decimals": 18
}
)
}
}

@ -215,8 +215,8 @@ export class RunTab extends ViewPlugin {
const addCustomInjectedProvider = async (position, event, name, displayName, networkId, urls, nativeCurrency?) => { const addCustomInjectedProvider = async (position, event, name, displayName, networkId, urls, nativeCurrency?) => {
// name = `${name} through ${event.detail.info.name}` // name = `${name} through ${event.detail.info.name}`
await this.engine.register([new InjectedCustomProvider(event.detail.provider, name, networkId, urls, nativeCurrency)]) await this.engine.register([new InjectedCustomProvider(event.detail.provider, name, displayName, networkId, urls, nativeCurrency)])
await addProvider(position, name, displayName, true, false) await addProvider(position, name, displayName + ' - ' + event.detail.info.name, true, false)
} }
const registerInjectedProvider = async (event) => { const registerInjectedProvider = async (event) => {
const name = 'injected-' + event.detail.info.name const name = 'injected-' + event.detail.info.name
@ -225,21 +225,21 @@ export class RunTab extends ViewPlugin {
await addProvider(0, name, displayName, true, false) await addProvider(0, name, displayName, true, false)
if (event.detail.info.name === 'MetaMask') { if (event.detail.info.name === 'MetaMask') {
await addCustomInjectedProvider(7, event, 'injected-metamask-optimism', 'L2 - Optimism - ' + event.detail.info.name, '0xa', ['https://mainnet.optimism.io']) await addCustomInjectedProvider(7, event, 'injected-metamask-optimism', 'L2 - Optimism', '0xa', ['https://mainnet.optimism.io'])
await addCustomInjectedProvider(8, event, 'injected-metamask-arbitrum', 'L2 - Arbitrum - ' + event.detail.info.name, '0xa4b1', ['https://arb1.arbitrum.io/rpc']) await addCustomInjectedProvider(8, event, 'injected-metamask-arbitrum', 'L2 - Arbitrum', '0xa4b1', ['https://arb1.arbitrum.io/rpc'])
await addCustomInjectedProvider(5, event, 'injected-metamask-sepolia', 'Sepolia Testnet - ' + event.detail.info.name, '0xaa36a7', [], await addCustomInjectedProvider(5, event, 'injected-metamask-sepolia', 'Sepolia Testnet', '0xaa36a7', [],
{ {
"name": "Sepolia ETH", "name": "Sepolia ETH",
"symbol": "ETH", "symbol": "ETH",
"decimals": 18 "decimals": 18
}) })
await addCustomInjectedProvider(9, event, 'injected-metamask-ephemery', 'Ephemery Testnet - ' + event.detail.info.name, '', ['https://otter.bordel.wtf/erigon', 'https://eth.ephemeral.zeus.fyi'], await addCustomInjectedProvider(9, event, 'injected-metamask-ephemery', 'Ephemery Testnet', '', ['https://otter.bordel.wtf/erigon', 'https://eth.ephemeral.zeus.fyi'],
{ {
"name": "Ephemery ETH", "name": "Ephemery ETH",
"symbol": "ETH", "symbol": "ETH",
"decimals": 18 "decimals": 18
}) })
await addCustomInjectedProvider(10, event, 'injected-metamask-gnosis', 'Gnosis Mainnet - ' + event.detail.info.name, '', ['https://rpc.ankr.com/gnosis', 'https://1rpc.io/gnosis'], await addCustomInjectedProvider(10, event, 'injected-metamask-gnosis', 'Gnosis Mainnet', '', ['https://rpc.ankr.com/gnosis', 'https://1rpc.io/gnosis'],
{ {
"name": "XDAI", "name": "XDAI",
"symbol": "XDAI", "symbol": "XDAI",

Loading…
Cancel
Save