add eth_unsubscribe

pull/7/head
Iuri Matias 5 years ago
parent 978b80233c
commit 7b8d79517f
  1. 5
      remix-lib/src/execution/logsManager.js
  2. 4
      remix-simulator/README.md
  3. 14
      remix-simulator/src/methods/filters.js

@ -90,6 +90,11 @@ class LogsManager {
return subscriptionId
}
unsubscribe(subscriptionId) {
let subscriptionId = "0x" + crypto.randomBytes(16).toString('hex')
delete this.subscriptions[subscriptionId]
}
getLogsFor(params) {
let results = [{
"logIndex": "0x1", // 1

@ -68,8 +68,8 @@ Implemented:
* [_] bzz_hive (stub)
* [_] bzz_info (stub)
* [_] debug_traceTransaction
* [_] eth_subscribe
* [_] eth_unsubscribe
* [X] eth_subscribe
* [X] eth_unsubscribe
* [_] miner_start
* [_] miner_stop
* [_] personal_listAccounts

@ -8,7 +8,8 @@ var Filters = function (_options) {
Filters.prototype.methods = function () {
return {
eth_getLogs: this.eth_getLogs.bind(this),
eth_subscribe: this.eth_subscribe.bind(this)
eth_subscribe: this.eth_subscribe.bind(this),
eth_unsubscribe: this.eth_unsubscribe.bind(this)
}
}
@ -45,4 +46,15 @@ Filters.prototype.eth_subscribe = function (payload, cb) {
cb(null, subscriptionId)
}
Filters.prototype.eth_unsubscribe = function (payload, cb) {
console.dir("===============================")
console.dir("===============================")
console.dir("=== eth_unsubscribe")
console.dir(payload.params)
executionContext.logsManager.unsubscribe(payload.params[0])
cb(null, true)
}
module.exports = Filters

Loading…
Cancel
Save