1
+ /* eslint-disable @nrwl/nx/enforce-module-boundaries */
1
2
import React from 'react' // eslint-disable-line
2
3
import { RunTabUI } from '@remix-ui/run-tab'
3
4
import { ViewPlugin } from '@remixproject/engine-web'
@@ -12,8 +13,32 @@ import { ProviderConfig } from '@remix-ui/environment-explorer'
12
13
import type { CompilerArtefacts } from '@remix-project/core-plugin'
13
14
import { ForkedVMStateProvider } from '../providers/vm-provider'
14
15
import { Recorder } from '../tabs/runTab/model/recorder'
16
+ import { EnvDropdownLabelStateType } from 'libs/remix-ui/run-tab/src/lib/types'
15
17
const _paq = ( window . _paq = window . _paq || [ ] )
16
18
19
+ const selectedEnvs : EnvDropdownLabelStateType [ ] = [
20
+ { name : 'Remix VM (Cancun)' , value : 'vm-cancun' , chainId : 'vm-cancun' } ,
21
+ { name : 'Gnosis Mainnet - MetaMask' , value : 'injected-metamask-gnosis' , chainId : 100 } ,
22
+ { name : 'L2 - Optimism - MetaMask' , value : 'injected-metamask-optimism' , chainId : 10 } ,
23
+ { name : 'L2 - Arbitrum - MetaMask' , value : 'injected-metamask-arbitrum' , chainId : 42161 } ,
24
+ { name : 'Ephemery Testnet - MetaMask' , value : 'injected-metamask-ephemery' , chainId : 39438143 } ,
25
+ { name : 'Sepolia Testnet - MetaMask' , value : 'injected-metamask-sepolia' , chainId : 11155111 } ,
26
+ { name : 'L2 - Linea - MetaMask' , value : 'injected-metamask-linea' , chainId : 59144 } ,
27
+ { name : 'Injected Provider - MetaMask' , value : 'injected-MetaMask' } ,
28
+ { name : 'WalletConnect' , value : 'walletconnect' } ,
29
+ { name : 'Remix VM - Mainnet fork' , value : 'vm-mainnet-fork' , chainId : 'vm-mainnet-fork' } ,
30
+ { name : 'Remix VM - Sepolia fork' , value : 'vm-sepolia-fork' , chainId : 'vm-sepolia-fork' } ,
31
+ { name : 'Remix VM - Custom fork' , value : 'vm-custom-fork' , chainId : 'vm-custom-fork' } ,
32
+ { name : 'Remix VM (Shanghai)' , value : 'vm-shanghai' , chainId : 'vm-shanghai' } ,
33
+ { name : 'Remix VM (Paris)' , value : 'vm-paris' , chainId : 'vm-paris' } ,
34
+ { name : 'Remix VM (London)' , value : 'vm-london' , chainId : 'vm-london' } ,
35
+ { name : 'Remix VM (Berlin)' , value : 'vm-berlin' , chainId : 'vm-berlin' } ,
36
+ { name : 'Custom - External Http Provider' , value : 'basic-http-provider' , chainId : 1741104841094 } ,
37
+ { name : 'Dev - Hardhat Provider' , value : 'hardhat-provider' , chainId : 31337 } ,
38
+ { name : 'Dev - Foundry Provider' , value : 'foundry-provider' , chainId : 31337 } ,
39
+ { name : 'Dev - Ganache Provider' , value : 'ganache-provider' , chainId : 1741104841094 } ,
40
+ ]
41
+
17
42
const profile = {
18
43
name : 'udapp' ,
19
44
displayName : 'Deploy & run transactions' ,
@@ -36,7 +61,8 @@ const profile = {
36
61
'clearAllInstances' ,
37
62
'addInstance' ,
38
63
'resolveContractAndAddInstance' ,
39
- 'showPluginDetails'
64
+ 'showPluginDetails' ,
65
+ 'getEnvironmentDropdownLabels'
40
66
]
41
67
}
42
68
@@ -53,6 +79,7 @@ export class RunTab extends ViewPlugin {
53
79
fileProvider : any
54
80
recorder : any
55
81
REACT_API : any
82
+ envDropdownLabelState : EnvDropdownLabelStateType [ ]
56
83
el : any
57
84
constructor ( blockchain : Blockchain , config : any , fileManager : any , editor : any , filePanel : any , compilersArtefacts : CompilerArtefacts , networkModule : any , fileProvider : any , engine : any ) {
58
85
super ( profile )
@@ -68,6 +95,7 @@ export class RunTab extends ViewPlugin {
68
95
this . fileProvider = fileProvider
69
96
this . recorder = new Recorder ( blockchain )
70
97
this . REACT_API = { }
98
+ this . setEnvironmentDropdownLabels ( )
71
99
this . setupEvents ( )
72
100
this . el = document . createElement ( 'div' )
73
101
}
@@ -112,6 +140,14 @@ export class RunTab extends ViewPlugin {
112
140
return this . blockchain . createVMAccount ( newAccount )
113
141
}
114
142
143
+ setEnvironmentDropdownLabels ( ) {
144
+ this . envDropdownLabelState = selectedEnvs
145
+ }
146
+
147
+ getEnvironmentDropdownLabels ( ) {
148
+ return this . envDropdownLabelState
149
+ }
150
+
115
151
sendTransaction ( tx ) {
116
152
_paq . push ( [ 'trackEvent' , 'udapp' , 'sendTx' , 'udappTransaction' ] )
117
153
return this . blockchain . sendTransaction ( tx )
0 commit comments