pin and select fork state provider

pull/5563/head
aniket-engg 2 months ago committed by Aniket
parent ac24a8da2e
commit 9c51df6127
  1. 1
      apps/remix-dapp/src/locales/en/udapp.json
  2. 1
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  3. 2
      apps/remix-ide/src/app/udapp/run-tab.tsx
  4. 8
      apps/remix-ide/src/blockchain/blockchain.tsx
  5. 5
      libs/remix-ui/run-tab/src/lib/components/environment.tsx

@ -51,7 +51,6 @@
"udapp.signature": "signature", "udapp.signature": "signature",
"udapp.forkStateTitle": "Fork VM state", "udapp.forkStateTitle": "Fork VM state",
"udapp.forkStateLabel": "State Name", "udapp.forkStateLabel": "State Name",
"udapp.forkStateTip": "VM State, forked for current workspace, can be pinned as an environment using Environment Explorer",
"udapp.fork": "Fork", "udapp.fork": "Fork",
"udapp.deleteVmStateTitle": "Delete VM state", "udapp.deleteVmStateTitle": "Delete VM state",
"udapp.deleteVmStateDesc1": "Deleting state of the selected environment will delete all your previously saved transaction details for current workspace.", "udapp.deleteVmStateDesc1": "Deleting state of the selected environment will delete all your previously saved transaction details for current workspace.",

@ -51,7 +51,6 @@
"udapp.signature": "signature", "udapp.signature": "signature",
"udapp.forkStateTitle": "Fork VM state", "udapp.forkStateTitle": "Fork VM state",
"udapp.forkStateLabel": "State Name", "udapp.forkStateLabel": "State Name",
"udapp.forkStateTip": "VM State, forked for current workspace, can be pinned as an environment using Environment Explorer",
"udapp.fork": "Fork", "udapp.fork": "Fork",
"udapp.deleteVmStateTitle": "Delete VM state", "udapp.deleteVmStateTitle": "Delete VM state",
"udapp.deleteVmStateDesc1": "Deleting state of the selected environment will delete all your previously saved transaction details for current workspace.", "udapp.deleteVmStateDesc1": "Deleting state of the selected environment will delete all your previously saved transaction details for current workspace.",

@ -295,7 +295,7 @@ export class RunTab extends ViewPlugin {
this.on('udapp', 'vmStateForked', async (stateName) => { this.on('udapp', 'vmStateForked', async (stateName) => {
await addFVSProvider(`.states/forked_states/${stateName}.json`, 20) await addFVSProvider(`.states/forked_states/${stateName}.json`, 20)
this.emit('providerPinned', stateName) this.emit('forkStateProviderAdded', stateName)
}) })
// wallet connect // wallet connect

@ -148,14 +148,16 @@ export class Blockchain extends Plugin {
_paq.push(['trackEvent', 'blockchain', 'providerPinned', name]) _paq.push(['trackEvent', 'blockchain', 'providerPinned', name])
this.emit('providersChanged') this.emit('providersChanged')
}) })
// used to pin the provider created from forked state // used to pin and select newly created forked state provider
this.on('udapp', 'providerPinned', (providerName) => { this.on('udapp', 'forkStateProviderAdded', (providerName) => {
const name = `vm-fs-${providerName}` const name = `vm-fs-${providerName}`
this.emit('shouldAddProvidertoUdapp', name, this.getProviderObjByName(name)) this.emit('shouldAddProvidertoUdapp', name, this.getProviderObjByName(name))
this.pinnedProviders.push(name) this.pinnedProviders.push(name)
this.call('config', 'setAppParameter', 'settings/pinned-providers', JSON.stringify(this.pinnedProviders)) this.call('config', 'setAppParameter', 'settings/pinned-providers', JSON.stringify(this.pinnedProviders))
_paq.push(['trackEvent', 'blockchain', 'providerPinned', name]) _paq.push(['trackEvent', 'blockchain', 'providerPinned', name])
this.emit('providersChanged') this.emit('providersChanged')
this.changeExecutionContext({context: name}, null, null, null)
this.call('notification', 'toast', `VM state ${providerName} forked and selected as current envionment.`)
}) })
this.on('environmentExplorer', 'providerUnpinned', (name, provider) => { this.on('environmentExplorer', 'providerUnpinned', (name, provider) => {
@ -579,8 +581,6 @@ export class Blockchain extends Plugin {
getProviderObjByName(name) { getProviderObjByName(name) {
const allProviders = this.getAllProviders() const allProviders = this.getAllProviders()
console.log('allProviders--->', allProviders)
console.log('allProviders--name->', name)
return allProviders[name] return allProviders[name]
} }

@ -40,10 +40,6 @@ export function EnvironmentUI(props: EnvironmentProps) {
className="form-control" className="form-control"
onChange={(e) => vmStateName.current = e.target.value} onChange={(e) => vmStateName.current = e.target.value}
/> />
<br/>
<div className='text-secondary'>
<b>Tip: </b><FormattedMessage id="udapp.forkStateTip" />
</div>
</div> </div>
) )
} }
@ -77,7 +73,6 @@ export function EnvironmentUI(props: EnvironmentProps) {
currentStateDb.savingTimestamp = Date.now() currentStateDb.savingTimestamp = Date.now()
await props.runTabPlugin.call('fileManager', 'writeFile', `.states/forked_states/${vmStateName.current}.json`, JSON.stringify(currentStateDb, null, 2)) await props.runTabPlugin.call('fileManager', 'writeFile', `.states/forked_states/${vmStateName.current}.json`, JSON.stringify(currentStateDb, null, 2))
props.runTabPlugin.emit('vmStateForked', vmStateName.current) props.runTabPlugin.emit('vmStateForked', vmStateName.current)
props.runTabPlugin.call('notification', 'toast', `VM state ${vmStateName.current} forked successfully.`)
}, },
intl.formatMessage({ id: 'udapp.cancel' }), intl.formatMessage({ id: 'udapp.cancel' }),
null null

Loading…
Cancel
Save