parent
6c1c567790
commit
a1f50eb141
@ -0,0 +1,15 @@ |
|||||||
|
{ |
||||||
|
"extends": "../../.eslintrc", |
||||||
|
"rules": { |
||||||
|
"@typescript-eslint/no-var-requires": "off", |
||||||
|
"@typescript-eslint/no-empty-function": "off", |
||||||
|
"@typescript-eslint/no-unused-vars": "off" |
||||||
|
}, |
||||||
|
"env": { |
||||||
|
"browser": true, |
||||||
|
"amd": true, |
||||||
|
"node": true, |
||||||
|
"es6": true |
||||||
|
}, |
||||||
|
"ignorePatterns": ["!**/*"] |
||||||
|
} |
@ -1,61 +1,63 @@ |
|||||||
|
|
||||||
const Filters = function (executionContext) { |
class Filters {
|
||||||
|
constructor(executionContext) { |
||||||
this.executionContext = executionContext |
this.executionContext = executionContext |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.methods = function () { |
methods () { |
||||||
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) |
eth_unsubscribe: this.eth_unsubscribe.bind(this) |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_getLogs = function (payload, cb) { |
eth_getLogs (payload, cb) { |
||||||
let results = this.executionContext.logsManager.getLogsFor(payload.params[0]) |
let results = this.executionContext.logsManager.getLogsFor(payload.params[0]) |
||||||
cb(null, results) |
cb(null, results) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_subscribe = function (payload, cb) { |
eth_subscribe (payload, cb) { |
||||||
let subscriptionId = this.executionContext.logsManager.subscribe(payload.params) |
let subscriptionId = this.executionContext.logsManager.subscribe(payload.params) |
||||||
cb(null, subscriptionId) |
cb(null, subscriptionId) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_unsubscribe = function (payload, cb) { |
eth_unsubscribe (payload, cb) { |
||||||
this.executionContext.logsManager.unsubscribe(payload.params[0]) |
this.executionContext.logsManager.unsubscribe(payload.params[0]) |
||||||
cb(null, true) |
cb(null, true) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_newFilter = function (payload, cb) { |
eth_newFilter (payload, cb) { |
||||||
const filterId = this.executionContext.logsManager.newFilter('filter', payload.params[0]) |
const filterId = this.executionContext.logsManager.newFilter('filter', payload.params[0]) |
||||||
cb(null, filterId) |
cb(null, filterId) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_newBlockFilter = function (payload, cb) { |
eth_newBlockFilter (payload, cb) { |
||||||
const filterId = this.executionContext.logsManager.newFilter('block') |
const filterId = this.executionContext.logsManager.newFilter('block') |
||||||
cb(null, filterId) |
cb(null, filterId) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_newPendingTransactionFilter = function (payload, cb) { |
eth_newPendingTransactionFilter (payload, cb) { |
||||||
const filterId = this.executionContext.logsManager.newFilter('pendingTransactions') |
const filterId = this.executionContext.logsManager.newFilter('pendingTransactions') |
||||||
cb(null, filterId) |
cb(null, filterId) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_uninstallfilter = function (payload, cb) { |
eth_uninstallfilter (payload, cb) { |
||||||
const result = this.executionContext.logsManager.uninstallFilter(payload.params[0]) |
const result = this.executionContext.logsManager.uninstallFilter(payload.params[0]) |
||||||
cb(null, result) |
cb(null, result) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_getFilterChanges = function (payload, cb) { |
eth_getFilterChanges (payload, cb) { |
||||||
const filterId = payload.params[0] |
const filterId = payload.params[0] |
||||||
let results = this.executionContext.logsManager.getLogsForFilter(filterId) |
let results = this.executionContext.logsManager.getLogsForFilter(filterId) |
||||||
cb(null, results) |
cb(null, results) |
||||||
} |
} |
||||||
|
|
||||||
Filters.prototype.eth_getFilterLogs = function (payload, cb) { |
eth_getFilterLogs (payload, cb) { |
||||||
const filterId = payload.params[0] |
const filterId = payload.params[0] |
||||||
let results = this.executionContext.logsManager.getLogsForFilter(filterId, true) |
let results = this.executionContext.logsManager.getLogsForFilter(filterId, true) |
||||||
cb(null, results) |
cb(null, results) |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
module.exports = Filters |
module.exports = Filters |
||||||
|
@ -0,0 +1,18 @@ |
|||||||
|
{ |
||||||
|
"extends": "../../tsconfig.json", |
||||||
|
"compilerOptions": { |
||||||
|
"module": "commonjs", |
||||||
|
"outDir": "../../dist/out-tsc", |
||||||
|
"allowJs": true, |
||||||
|
"declaration": true, |
||||||
|
"rootDir": "./", |
||||||
|
"types": ["node"] |
||||||
|
}, |
||||||
|
"exclude": ["**/*.spec.js"], |
||||||
|
"include": [ |
||||||
|
"src/**/*.js", |
||||||
|
"./index.js", |
||||||
|
"bin/" |
||||||
|
] |
||||||
|
} |
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue