pull/4529/head
yann300 1 year ago committed by ioedeveloper
parent f8448f5cab
commit d26d32b36c
  1. 8
      apps/remix-ide/src/blockchain/blockchain.tsx
  2. 25
      apps/remix-ide/src/blockchain/providers/vm.ts

@ -904,11 +904,11 @@ export class Blockchain extends Plugin {
return bufferToHex(value) return bufferToHex(value)
} else if (key === 'db') { } else if (key === 'db') {
return value return value
} else { } else if (key === '') {
return bufferToHex(value) return value
} }
return value return bufferToHex(value)
}, '\t') }, '\t')
this.call('fileManager', 'writeFile', '.states/state.json', stringifyed) this.call('fileManager', 'writeFile', '.states/state.json', stringifyed)
}, 500) }, 500)
} }

@ -39,7 +39,7 @@ export class VMProvider {
let incr = 0 let incr = 0
const stamps = {} const stamps = {}
return new Promise(async (resolve, reject) => { return new Promise((resolve, reject) => {
this.worker.addEventListener('message', (msg) => { this.worker.addEventListener('message', (msg) => {
if (msg.data.cmd === 'sendAsyncResult' && stamps[msg.data.stamp]) { if (msg.data.cmd === 'sendAsyncResult' && stamps[msg.data.stamp]) {
if (stamps[msg.data.stamp].callback) { if (stamps[msg.data.stamp].callback) {
@ -78,17 +78,20 @@ export class VMProvider {
} }
} }
}) })
let stateDb const init = async () => {
if (await this.plugin.call('fileManager', 'exists', '.states/state.json')) { let stateDb
stateDb = await this.plugin.call('fileManager', 'readFile', '.states/state.json') if (await this.plugin.call('fileManager', 'exists', '.states/state.json')) {
stateDb = await this.plugin.call('fileManager', 'readFile', '.states/state.json')
}
this.worker.postMessage({
cmd: 'init',
fork: this.executionContext.getCurrentFork(),
nodeUrl: provider?.options['nodeUrl'],
blockNumber: provider?.options['blockNumber'],
stateDb
})
} }
this.worker.postMessage({ init()
cmd: 'init',
fork: this.executionContext.getCurrentFork(),
nodeUrl: provider?.options['nodeUrl'],
blockNumber: provider?.options['blockNumber'],
stateDb
})
}) })
} }

Loading…
Cancel
Save