load pinned on other event

pull/4720/head
aniket-engg 7 months ago committed by Aniket
parent b511c9d05a
commit d73c966919
  1. 6
      libs/remix-ui/run-tab/src/lib/actions/events.ts

@ -33,6 +33,7 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
} }
setFinalContext(plugin, dispatch) setFinalContext(plugin, dispatch)
fillAccountsList(plugin, dispatch) fillAccountsList(plugin, dispatch)
await loadPinnedContracts(plugin, dispatch)
}) })
plugin.blockchain.event.register('networkStatus', async ({ error, network }) => { plugin.blockchain.event.register('networkStatus', async ({ error, network }) => {
@ -47,7 +48,6 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
const pinnedChainId = !networkProvider().startsWith('vm') ? network.id : networkProvider() const pinnedChainId = !networkProvider().startsWith('vm') ? network.id : networkProvider()
setNetworkNameFromProvider(dispatch, netUI) setNetworkNameFromProvider(dispatch, netUI)
setPinnedChainId(dispatch, pinnedChainId) setPinnedChainId(dispatch, pinnedChainId)
await loadPinnedContracts(plugin, dispatch, pinnedChainId)
}) })
plugin.blockchain.event.register('addProvider', provider => addExternalProvider(dispatch, provider)) plugin.blockchain.event.register('addProvider', provider => addExternalProvider(dispatch, provider))
@ -166,8 +166,10 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
}, 30000) }, 30000)
} }
const loadPinnedContracts = async (plugin, dispatch, dirName) => { const loadPinnedContracts = async (plugin, dispatch) => {
await plugin.call('udapp', 'clearAllPinnedInstances') await plugin.call('udapp', 'clearAllPinnedInstances')
const { network } = await plugin.call('blockchain', 'getCurrentNetworkStatus')
const dirName = plugin.REACT_API.networkName === 'VM' ? plugin.REACT_API.selectExEnv : network.id
const isPinnedAvailable = await plugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${dirName}`) const isPinnedAvailable = await plugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${dirName}`)
if (isPinnedAvailable) { if (isPinnedAvailable) {
try { try {

Loading…
Cancel
Save