refactor storageSlot

pull/62/head
Iuri Matias 4 years ago committed by aniket-engg
parent d8c64f75b8
commit ad8cfc967f
  1. 10
      libs/remix-debug/src/storage/storageResolver.js
  2. 10
      libs/remix-debug/src/storage/storageViewer.js

@ -61,10 +61,12 @@ class StorageResolver {
* @param {String} - address - lookup address
* @param {Function} - callback - {key, hashedKey, value} -
*/
storageSlot (slot, tx, stepIndex, address, callback) {
this.storageRangeInternal(this, slot, tx, stepIndex, address).then((storage) => {
callback(null, storage[slot] !== undefined ? storage[slot] : null)
}).catch(callback)
storageSlot (slot, tx, stepIndex, address) {
return new Promise((resolve, reject) => {
this.storageRangeInternal(this, slot, tx, stepIndex, address).then((storage) => {
resolve(storage[slot] !== undefined ? storage[slot] : null)
}).catch(reject)
})
}
/**

@ -46,13 +46,9 @@ class StorageViewer {
if (this.storageChanges[hashed]) {
return callback(null, this.storageChanges[hashed])
}
this.storageResolver.storageSlot(hashed, this.context.tx, this.context.stepIndex, this.context.address, (error, storage) => {
if (error) {
callback(error)
} else {
callback(null, storage)
}
})
this.storageResolver.storageSlot(hashed, this.context.tx, this.context.stepIndex, this.context.address).then((storage) => {
callback(null, storage)
}).catch(callback)
}
/**

Loading…
Cancel
Save