diff --git a/apps/remix-dapp/src/locales/en/udapp.json b/apps/remix-dapp/src/locales/en/udapp.json
index 4315f57a596..3d28dc9dc0a 100644
--- a/apps/remix-dapp/src/locales/en/udapp.json
+++ b/apps/remix-dapp/src/locales/en/udapp.json
@@ -50,12 +50,15 @@
"udapp.hash": "hash",
"udapp.signature": "signature",
"udapp.forkStateTitle": "Fork VM state",
- "udapp.forkStateLabel": "State Name",
+ "udapp.forkStateLabel": "New environment name",
+ "udapp.forkVmStateDesc1":"Forking state will create a new environment with same state as selected environment",
+ "udapp.forkVmStateDesc2":"New environment will be pinned, which can be unpinned or deleted using Envionment Explorer",
"udapp.fork": "Fork",
- "udapp.deleteVmStateTitle": "Delete VM state",
- "udapp.deleteVmStateDesc1": "Deleting the state of this VM will delete the associated transaction details in this Workspace.",
- "udapp.deleteVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
- "udapp.deleteVmStateDesc3": "Do you want to continue?",
+ "udapp.resetVmStateTitle": "Reset VM state",
+ "udapp.resetVmStateDesc1": "Resetting the state of this VM will delete the associated transaction details in this Workspace.",
+ "udapp.resetVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
+ "udapp.resetVmStateDesc3": "Do you want to continue?",
+ "udapp.reset": "Reset",
"udapp.delete": "Delete",
"udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).",
"udapp.createNewAccount": "Create a new account",
diff --git a/apps/remix-ide-e2e/src/tests/vm_state.test.ts b/apps/remix-ide-e2e/src/tests/vm_state.test.ts
index 45dc3e979c4..d22db4809cd 100644
--- a/apps/remix-ide-e2e/src/tests/vm_state.test.ts
+++ b/apps/remix-ide-e2e/src/tests/vm_state.test.ts
@@ -33,7 +33,7 @@ const tests = {
.click('*[data-id="delete-state-icon"]')
.waitForElementVisible(
{
- selector: "//*[@data-shared='tooltipPopup' and contains(.,'State not available to delete')]",
+ selector: "//*[@data-shared='tooltipPopup' and contains(.,'State not available to reset')]",
locateStrategy: 'xpath'
}
)
@@ -140,7 +140,7 @@ const tests = {
.modalFooterOKClick('udappNotify')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 10000)
// check if toaster is shown
- .assert.textContains('*[data-shared="tooltipPopup"]', `VM state deleted successfully.`)
+ .assert.textContains('*[data-shared="tooltipPopup"]', `VM state reset successfully.`)
// check that there are no instances
.assert.textContains('*[data-id="deployedContractsBadge"]', '0')
// check if state file is deleted
diff --git a/apps/remix-ide/src/app/providers/environment-explorer.tsx b/apps/remix-ide/src/app/providers/environment-explorer.tsx
index a38c0d74d3e..dab429a6717 100644
--- a/apps/remix-ide/src/app/providers/environment-explorer.tsx
+++ b/apps/remix-ide/src/app/providers/environment-explorer.tsx
@@ -78,6 +78,15 @@ export class EnvironmentExplorer extends ViewPlugin {
}
}
+ async deleteForkedState (provider) {
+ const providerName = await this.call('blockchain', 'getProvider')
+ if (providerName !== provider.name) {
+ await this.call('fileManager', 'remove', `.states/forked_states/${provider.displayName}.json`)
+ await this.call('blockchain', 'removeProvider', provider.name)
+ this.call('notification', 'toast', `Environment "${provider.displayName}" deleted successfully.`)
+ } else this.call('notification', 'toast', 'Cannot delete the current selected environment')
+ }
+
renderComponent() {
this.dispatch({
...this.state
@@ -86,7 +95,12 @@ export class EnvironmentExplorer extends ViewPlugin {
updateComponent(state: EnvironmentExplorerState) {
return (<>
-
+
>)
}
}
diff --git a/apps/remix-ide/src/app/tabs/locales/en/udapp.json b/apps/remix-ide/src/app/tabs/locales/en/udapp.json
index 00e49554fb7..c4a376cd201 100644
--- a/apps/remix-ide/src/app/tabs/locales/en/udapp.json
+++ b/apps/remix-ide/src/app/tabs/locales/en/udapp.json
@@ -50,12 +50,15 @@
"udapp.hash": "hash",
"udapp.signature": "signature",
"udapp.forkStateTitle": "Fork VM state",
- "udapp.forkStateLabel": "State Name",
+ "udapp.forkStateLabel": "New environment name",
+ "udapp.forkVmStateDesc1":"Forking state will create a new environment with same state as selected environment",
+ "udapp.forkVmStateDesc2":"After forking, new environment will be pinned and selected automatically. It can be unpinned or deleted using Envionment Explorer",
"udapp.fork": "Fork",
- "udapp.deleteVmStateTitle": "Delete VM state",
- "udapp.deleteVmStateDesc1": "Deleting the state of this VM will delete the associated transaction details in this Workspace.",
- "udapp.deleteVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
- "udapp.deleteVmStateDesc3": "Do you want to continue?",
+ "udapp.resetVmStateTitle": "Reset VM state",
+ "udapp.resetVmStateDesc1": "Resetting the state of this VM will delete the associated transaction details in this Workspace.",
+ "udapp.resetVmStateDesc2": "It will also delete the data of contracts deployed and pinned in this Workspace.",
+ "udapp.resetVmStateDesc3": "Do you want to continue?",
+ "udapp.reset": "Reset",
"udapp.delete": "Delete",
"udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).",
"udapp.createNewAccount": "Create new account",
diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx
index d1c0d478f02..ffca9e766b4 100644
--- a/apps/remix-ide/src/blockchain/blockchain.tsx
+++ b/apps/remix-ide/src/blockchain/blockchain.tsx
@@ -157,7 +157,7 @@ export class Blockchain extends Plugin {
_paq.push(['trackEvent', 'blockchain', 'providerPinned', name])
this.emit('providersChanged')
this.changeExecutionContext({ context: name }, null, null, null)
- this.call('notification', 'toast', `VM state '${providerName}' forked and selected as current environment.`)
+ this.call('notification', 'toast', `New environment '${providerName}' created with forked state.`)
})
this.on('environmentExplorer', 'providerUnpinned', (name, provider) => {
@@ -687,6 +687,7 @@ export class Blockchain extends Plugin {
}
removeProvider(name) {
+ if (this.pinnedProviders.includes(name)) this.emit('shouldRemoveProviderFromUdapp', name, this.getProviderObjByName(name))
this.executionContext.removeProvider(name)
this.emit('providersChanged')
}
diff --git a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx
index 0bd67a5c188..b4f374276da 100644
--- a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx
+++ b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx
@@ -102,6 +102,19 @@ export const EnvironmentExplorerUI = (props: environmentExplorerUIProps) => {
}}
>