pull/4529/head
yann300 10 months 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)
} else if (key === 'db') {
return value
} else {
return bufferToHex(value)
} else if (key === '') {
return value
}
return value
}, '\t')
return bufferToHex(value)
}, '\t')
this.call('fileManager', 'writeFile', '.states/state.json', stringifyed)
}, 500)
}

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

Loading…
Cancel
Save