Commit 7b8d7951 authored by Iuri Matias's avatar Iuri Matias

add eth_unsubscribe

parent 978b8023
...@@ -90,6 +90,11 @@ class LogsManager { ...@@ -90,6 +90,11 @@ class LogsManager {
return subscriptionId return subscriptionId
} }
unsubscribe(subscriptionId) {
let subscriptionId = "0x" + crypto.randomBytes(16).toString('hex')
delete this.subscriptions[subscriptionId]
}
getLogsFor(params) { getLogsFor(params) {
let results = [{ let results = [{
"logIndex": "0x1", // 1 "logIndex": "0x1", // 1
......
...@@ -68,8 +68,8 @@ Implemented: ...@@ -68,8 +68,8 @@ Implemented:
* [_] bzz_hive (stub) * [_] bzz_hive (stub)
* [_] bzz_info (stub) * [_] bzz_info (stub)
* [_] debug_traceTransaction * [_] debug_traceTransaction
* [_] eth_subscribe * [X] eth_subscribe
* [_] eth_unsubscribe * [X] eth_unsubscribe
* [_] miner_start * [_] miner_start
* [_] miner_stop * [_] miner_stop
* [_] personal_listAccounts * [_] personal_listAccounts
......
...@@ -8,7 +8,8 @@ var Filters = function (_options) { ...@@ -8,7 +8,8 @@ var Filters = function (_options) {
Filters.prototype.methods = function () { Filters.prototype.methods = function () {
return { return {
eth_getLogs: this.eth_getLogs.bind(this), 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) { ...@@ -45,4 +46,15 @@ Filters.prototype.eth_subscribe = function (payload, cb) {
cb(null, subscriptionId) 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 module.exports = Filters
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment