Comparing version 4.1.4 to 4.1.5
@@ -350,5 +350,5 @@ "use strict"; | ||
} | ||
getContractEvents(eventName, fromBlock) { | ||
getContractEvents(eventName, fromBlock, toBlock) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.contract.getPastEvents(eventName, [this.opts.user], fromBlock); | ||
return this.contract.getPastEvents(eventName, [this.opts.user], fromBlock, toBlock || 'latest'); | ||
}); | ||
@@ -355,0 +355,0 @@ } |
@@ -34,7 +34,7 @@ "use strict"; | ||
} | ||
getPastEvents(eventName, args, fromBlock) { | ||
getPastEvents(eventName, args, fromBlock, toBlock) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const filter = this.cm.filters[eventName](...args); | ||
filter.fromBlock = fromBlock; | ||
filter.toBlock = 'latest'; | ||
filter.toBlock = toBlock; | ||
const logs = yield this.provider.getLogs(filter); | ||
@@ -41,0 +41,0 @@ const events = []; |
@@ -431,3 +431,5 @@ "use strict"; | ||
} | ||
const evts = yield this.connext.getContractEvents('DidUpdateChannel', Math.max(block.number - 4000, 0)); | ||
const currentBlockNumber = yield this.connext.wallet.provider.getBlockNumber(); | ||
const evts = yield this.connext.getContractEvents('DidUpdateChannel', Math.max(block.number - 4000, 0), // 4000 blocks = ~16 hours | ||
Math.min(block.number + 4000, currentBlockNumber)); | ||
const event = evts.find((e) => e.values.txCount[0] === channel.txCountGlobal); | ||
@@ -434,0 +436,0 @@ if (event) { |
{ | ||
"name": "connext", | ||
"description": "Shared code between wallet and hub", | ||
"version": "4.1.4", | ||
"version": "4.1.5", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "types/index.d.ts", |
@@ -499,4 +499,4 @@ import { ethers as eth } from 'ethers' | ||
public async getContractEvents(eventName: string, fromBlock: number): Promise<any> { | ||
return this.contract.getPastEvents(eventName, [this.opts.user], fromBlock) | ||
public async getContractEvents(eventName: string, fromBlock: number, toBlock?: number): Promise<any> { | ||
return this.contract.getPastEvents(eventName, [this.opts.user], fromBlock, toBlock || 'latest') | ||
} | ||
@@ -503,0 +503,0 @@ |
@@ -31,3 +31,3 @@ import { ethers as eth } from 'ethers' | ||
getChannelDetails(user: string): Promise<ChannelManagerChannelDetails> | ||
getPastEvents(eventName: string, args: string[], fromBlock: number): Promise<LogDescription[]> | ||
getPastEvents(eventName: string, args: string[], fromBlock: number, toBlock: number | string): Promise<LogDescription[]> | ||
nukeThreads(state: ChannelState): Promise<Transaction> | ||
@@ -69,6 +69,6 @@ startExit(state: ChannelState): Promise<Transaction> | ||
public async getPastEvents(eventName: string, args: string[], fromBlock: number): Promise<any> { | ||
public async getPastEvents(eventName: string, args: string[], fromBlock: number, toBlock: number | string): Promise<any> { | ||
const filter = this.cm.filters[eventName](...args) as Filter | ||
filter.fromBlock = fromBlock | ||
filter.toBlock = 'latest' | ||
filter.toBlock = toBlock | ||
const logs = await this.provider.getLogs(filter) | ||
@@ -75,0 +75,0 @@ const events = [] |
@@ -504,5 +504,7 @@ import { ethers as eth } from 'ethers' | ||
const currentBlockNumber = await this.connext.wallet.provider.getBlockNumber() | ||
const evts = await this.connext.getContractEvents( | ||
'DidUpdateChannel', | ||
Math.max(block.number - 4000, 0), // 4000 blocks = ~16 hours | ||
Math.min(block.number + 4000, currentBlockNumber), | ||
) | ||
@@ -513,2 +515,3 @@ const event: any = evts.find((e: any): any => e.values.txCount[0] === channel.txCountGlobal) | ||
} | ||
return { didEmit: 'no', latestBlock: block } | ||
@@ -515,0 +518,0 @@ } |
@@ -110,3 +110,3 @@ /// <reference types="node" /> | ||
generateSecret(): string; | ||
getContractEvents(eventName: string, fromBlock: number): Promise<any>; | ||
getContractEvents(eventName: string, fromBlock: number, toBlock?: number): Promise<any>; | ||
signChannelState(state: UnsignedChannelState): Promise<ChannelState>; | ||
@@ -113,0 +113,0 @@ signThreadState(state: UnsignedThreadState): Promise<ThreadState>; |
@@ -12,3 +12,3 @@ import { ChannelManagerChannelDetails, ChannelState, Interface, LogDescription, ThreadState, Transaction } from '../types'; | ||
getChannelDetails(user: string): Promise<ChannelManagerChannelDetails>; | ||
getPastEvents(eventName: string, args: string[], fromBlock: number): Promise<LogDescription[]>; | ||
getPastEvents(eventName: string, args: string[], fromBlock: number, toBlock: number | string): Promise<LogDescription[]>; | ||
nukeThreads(state: ChannelState): Promise<Transaction>; | ||
@@ -30,3 +30,3 @@ startExit(state: ChannelState): Promise<Transaction>; | ||
constructor(wallet: Wallet, address: string, gasMultiple?: number); | ||
getPastEvents(eventName: string, args: string[], fromBlock: number): Promise<any>; | ||
getPastEvents(eventName: string, args: string[], fromBlock: number, toBlock: number | string): Promise<any>; | ||
userAuthorizedUpdate(state: ChannelState, overrides?: any): Promise<any>; | ||
@@ -33,0 +33,0 @@ startExit(state: ChannelState): Promise<any>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1610999
31021
9