rename token createdcontract=> created

pull/3094/head
yann300 7 years ago
parent eeae86a96e
commit 6a1f4563f6
  1. 30
      src/recorder.js

@ -54,7 +54,7 @@ class Recorder {
} }
} else { } else {
var creationTimestamp = this.data._createdContracts[to] var creationTimestamp = this.data._createdContracts[to]
record.to = `created-contract{${creationTimestamp}}` record.to = `created{${creationTimestamp}}`
record.abi = this.data._contractABIReferences[creationTimestamp] record.abi = this.data._contractABIReferences[creationTimestamp]
} }
@ -93,6 +93,14 @@ class Recorder {
this.data._replay = !listen this.data._replay = !listen
} }
extractTimestamp (value) {
var stamp = /created{(.*)}/g.exec(value)
if (stamp) {
return stamp[1]
}
return null
}
/** /**
* convert back from/to from tokens to real addresses * convert back from/to from tokens to real addresses
* *
@ -103,28 +111,16 @@ class Recorder {
*/ */
resolveAddress (record, accounts, options) { resolveAddress (record, accounts, options) {
if (record.to) { if (record.to) {
var timestamp = /created-contract{(.*)}/g.exec(record.to) var stamp = this.extractTimestamp(record.to)
record.to = this.data._createdContractsReverse[timestamp[1]] if (stamp) {
record.to = this.data._createdContractsReverse[stamp]
}
} }
record.from = accounts[record.from] record.from = accounts[record.from]
// @TODO: writing browser test // @TODO: writing browser test
return record return record
} }
/**
* resolve ABI reference from the timestamp
*
* @param {Object} record
*
*/
resolveABIReference (record) {
if (record.to) {
var timestamp = /created-contract{(.*)}/g.exec(record.to)
return this.data._contractABIReferences[timestamp[1]]
}
return null
}
/** /**
* save the given @arg record * save the given @arg record
* *

Loading…
Cancel
Save