Skip to content

Commit

Permalink
reset data
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket-Engg committed Dec 20, 2024
1 parent 568e744 commit f6bcb94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/remix-ide/src/blockchain/blockchain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const profile = {
name: 'blockchain',
displayName: 'Blockchain',
description: 'Blockchain - Logic',
methods: ['getCode', 'getTransactionReceipt', 'addProvider', 'removeProvider', 'getCurrentFork', 'getAccounts', 'web3VM', 'web3', 'getProvider', 'getCurrentNetworkStatus', 'getAllProviders', 'getPinnedProviders'],
methods: ['getCode', 'getTransactionReceipt', 'addProvider', 'removeProvider', 'getCurrentFork', 'getAccounts', 'web3VM', 'web3', 'getProvider', 'getCurrentProvider', 'getCurrentNetworkStatus', 'getAllProviders', 'getPinnedProviders'],
version: packageJson.version
}

Expand Down
12 changes: 10 additions & 2 deletions libs/remix-ui/run-tab/src/lib/components/environment.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-use-before-define
import React, { useEffect, useRef } from 'react'
import React, { useRef } from 'react'
import { FormattedMessage, useIntl } from 'react-intl'
import { EnvironmentProps, Provider } from '../types'
import { Dropdown } from 'react-bootstrap'
Expand Down Expand Up @@ -94,7 +94,15 @@ export function EnvironmentUI(props: EnvironmentProps) {
resetVmStatePrompt(context),
intl.formatMessage({ id: 'udapp.reset' }),
async () => {
// let currentStateDb = await props.runTabPlugin.call('fileManager', 'readFile', `.states/${context}/state.json`)
const currentProvider = await props.runTabPlugin.call('blockchain', 'getCurrentProvider')
// Reset environment blocks and account data
currentProvider.resetEnvironment()
// Remove deployed and pinned contracts from UI
props.runTabPlugin.REACT_API.instances.instanceList = {}
// Delete environment state file
await props.runTabPlugin.call('fileManager', 'remove', `.states/${context}/state.json`)
// Delete pinned contracts folder
await props.runTabPlugin.call('fileManager', 'remove', `.deploys/pinned-contracts/${context}`)
props.runTabPlugin.call('notification', 'toast', `VM state reset successfully`)
},
intl.formatMessage({ id: 'udapp.cancel' }),
Expand Down

0 comments on commit f6bcb94

Please sign in to comment.