update ethereumjs-blockstream 6.0.0 -> ^7.0.0 (#2089)

This commit is contained in:
Xianny
2019-08-21 18:39:07 -07:00
committed by GitHub
parent d3c714bd17
commit 0fe4f587d8
4 changed files with 39 additions and 48 deletions

View File

@@ -1,4 +1,13 @@
[
{
"version": "5.3.2",
"changes": [
{
"note": "Updated to ethereumjs-blockstream@^7.0.0",
"pr": 2089
}
]
},
{
"timestamp": 1565296576,
"version": "5.3.1",

View File

@@ -48,7 +48,7 @@
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-blockstream": "^7.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"js-sha3": "^0.7.0",

View File

@@ -101,17 +101,23 @@ export class SubscriptionManager<ContractEventArgs, ContractEvents extends strin
const logWithDecodedArgs = abiDecoder.tryToDecodeLogOrNoop(log);
return logWithDecodedArgs;
}
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void {
const log: LogEntry = marshaller.unmarshalLog(rawLog);
_.forEach(this._filters, (filter: FilterObject, filterToken: string) => {
if (filterUtils.matchesFilter(log, filter)) {
const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>;
const logEvent = {
log: decodedLog,
isRemoved,
};
this._filterCallbacks[filterToken](null, logEvent);
}
private _onLogStateChanged<ArgsType extends ContractEventArgs>(
isRemoved: boolean,
blockHash: string,
rawLogs: RawLogEntry[],
): void {
const logs: LogEntry[] = rawLogs.map(rawLog => marshaller.unmarshalLog(rawLog));
logs.forEach(log => {
_.forEach(this._filters, (filter: FilterObject, filterToken: string) => {
if (filterUtils.matchesFilter(log, filter)) {
const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>;
const logEvent = {
log: decodedLog,
isRemoved,
};
this._filterCallbacks[filterToken](null, logEvent);
}
});
});
}
private _startBlockAndLogStream(isVerbose: boolean, blockPollingIntervalMs?: number): void {
@@ -133,11 +139,11 @@ export class SubscriptionManager<ContractEventArgs, ContractEvents extends strin
SubscriptionManager._onBlockAndLogStreamerError.bind(this, isVerbose),
);
let isRemoved = false;
this._onLogAddedSubscriptionToken = this._blockAndLogStreamerIfExists.subscribeToOnLogAdded(
this._onLogAddedSubscriptionToken = this._blockAndLogStreamerIfExists.subscribeToOnLogsAdded(
this._onLogStateChanged.bind(this, isRemoved),
);
isRemoved = true;
this._onLogRemovedSubscriptionToken = this._blockAndLogStreamerIfExists.subscribeToOnLogRemoved(
this._onLogRemovedSubscriptionToken = this._blockAndLogStreamerIfExists.subscribeToOnLogsRemoved(
this._onLogStateChanged.bind(this, isRemoved),
);
}
@@ -171,8 +177,8 @@ export class SubscriptionManager<ContractEventArgs, ContractEvents extends strin
if (this._blockAndLogStreamerIfExists === undefined) {
throw new Error(SubscriptionErrors.SubscriptionNotFound);
}
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogAdded(this._onLogAddedSubscriptionToken as string);
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogRemoved(this._onLogRemovedSubscriptionToken as string);
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogsAdded(this._onLogAddedSubscriptionToken as string);
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogsRemoved(this._onLogRemovedSubscriptionToken as string);
intervalUtils.clearAsyncExcludingInterval(this._blockAndLogStreamIntervalIfExists as NodeJS.Timer);
delete this._blockAndLogStreamerIfExists;
}

View File

@@ -687,30 +687,6 @@
version "1.5.1"
resolved "https://registry.npmjs.org/@0x/contract-artifacts/-/contract-artifacts-1.5.1.tgz#6fba56a1d3e2d5d897a75fcfa432e49e2ebb17a7"
"@0x/contract-wrappers@9.1.7":
version "9.1.7"
resolved "https://registry.yarnpkg.com/@0x/contract-wrappers/-/contract-wrappers-9.1.7.tgz#a09e8325b3db53af51f916b105f5db1ec35fdd7e"
dependencies:
"@0x/abi-gen-wrappers" "^5.0.2"
"@0x/assert" "^2.1.0"
"@0x/contract-addresses" "^3.0.2"
"@0x/contract-artifacts" "^2.0.1"
"@0x/json-schemas" "^3.0.11"
"@0x/order-utils" "^8.2.2"
"@0x/types" "^2.4.0"
"@0x/typescript-typings" "^4.2.3"
"@0x/utils" "^4.4.0"
"@0x/web3-wrapper" "^6.0.7"
ethereum-types "^2.1.3"
ethereumjs-abi "0.6.5"
ethereumjs-blockstream "6.0.0"
ethereumjs-util "^5.1.1"
ethers "~4.0.4"
http-status-codes "^1.3.2"
js-sha3 "^0.7.0"
lodash "^4.17.11"
uuid "^3.3.2"
"@0x/contract-wrappers@^9.1.6", "@0x/contract-wrappers@^9.1.7":
version "9.1.8"
resolved "https://registry.yarnpkg.com/@0x/contract-wrappers/-/contract-wrappers-9.1.8.tgz#5923d35af3e4b442a57d02f74e02620b2d5b1356"
@@ -1689,10 +1665,6 @@
version "0.4.1"
resolved "https://registry.yarnpkg.com/@types/accounting/-/accounting-0.4.1.tgz#865d9f5694fd7c438fba34eb4bc82eec6f34cdd5"
"@types/bintrees@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/bintrees/-/bintrees-1.0.2.tgz#0dfdce4eeebdf90427bd35b0e79dc248b3d157a6"
"@types/bip39@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@types/bip39/-/bip39-2.4.0.tgz#eee31a14abc8ebbb41a1ff14575c447b18346cbc"
@@ -3874,10 +3846,6 @@ bindings@^1.2.1, bindings@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
bintrees@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8"
bip39@2.5.0, bip39@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235"
@@ -7151,6 +7119,14 @@ ethereumjs-blockstream@6.0.0:
source-map-support "0.5.6"
uuid "3.2.1"
ethereumjs-blockstream@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-7.0.0.tgz#b8d7b6257dd1100bc6ddb36d6bef58c2490f9999"
dependencies:
immutable "3.8.2"
source-map-support "0.5.6"
uuid "3.2.1"
ethereumjs-common@^0.6.0:
version "0.6.1"
resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-0.6.1.tgz#ec98edf315a7f107afb6acc48e937a8266979fae"