Skip to content

Commit

Permalink
add optional fromBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Oct 1, 2020
1 parent 4d00c88 commit 386bb89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ocean/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,19 +596,21 @@ export class Assets extends Instantiable {
* get Order History
* @param {Account} account
* @param {string} serviceType Optional, filter by
* @param {number} fromBlock Optional, start at block
* @return {Promise<OrderHistory[]>} transactionHash of the payment
*/
public async getOrderHistory(
account: Account,
serviceType?: string
serviceType?: string,
fromBlock?: number
): Promise<OrderHistory[]> {
const results: OrderHistory[] = []
const address = this.web3.utils.toChecksumAddress(account.getId())
const events = await this.web3.eth.getPastLogs({
topics: [
['0x24c95b9bea47f62df4b9eea32c98c597eccfc5cac47f8477647be875ad925eee', address]
],
fromBlock: 0
fromBlock: fromBlock || 0
})
for (let i = 0; i < events.length; i++) {
const blockDetails = await this.web3.eth.getBlock(events[i].blockNumber)
Expand Down

0 comments on commit 386bb89

Please sign in to comment.