async Events({toBlock, fromBlock, includeTransaction=false}) {
    // Pull logs in batches of 100
    let logs = [];
    for(let i = fromBlock; i < toBlock; i += 101) {
      const newLogs = await this.MakeProviderCall({
        methodName: "getLogs",
        args: [{
          fromBlock: i,
          toBlock: Math.min(toBlock, i + 100)
        }]
      });

      logs = logs.concat(newLogs || []);
    }

    // Group logs by blocknumber
    let blocks = {};
    logs.forEach(log => {
      blocks[log.blockNumber] = [this.ParseUnknownLog({log})].concat((blocks[log.blockNumber] || []));
    });

    let output = [];
    await [...Array(toBlock - fromBlock + 1).keys()].limitedMap(
      3,
      async i => {
        const blockNumber = toBlock - i;
        let blockInfo = blocks[blockNumber];

        if(!blockInfo) {
          blockInfo = await this.MakeProviderCall({methodName: "getBlock", args: [blockNumber]});
          blockInfo = blockInfo.transactions.map(transactionHash => {
            return {
              blockNumber: blockInfo.number,
              blockHash: blockInfo.hash,
              ...blockInfo,
              transactionHash
            };
          });

          blocks[blockNumber] = blockInfo;
        }

        if(includeTransaction) {
          let transactionInfo = {};

          blocks[blockNumber] = await Promise.all(
            blockInfo.map(async block => {
              if(!transactionInfo[block.transactionHash]) {
                transactionInfo[block.transactionHash] = {
                  ...(await this.MakeProviderCall({methodName: "getTransaction", args: [block.transactionHash]})),
                  ...(await this.MakeProviderCall({methodName: "getTransactionReceipt", args: [block.transactionHash]})),
                };
              }
              return {
                ...block,
                ...transactionInfo[block.transactionHash]
              };
            })
          );
        }

        output.push(blocks[blockNumber]);
      }
    );

    return output;
  }
// Returns a list, sorted in descending block order, with each entry containing all logs or transactions in that block
Returns a list, sorted in descending block order, with each entry containing all logs or transactions in that block
Returns a list sorted in descending block order with each entry containing all logs or transactions in that block
async Events({toBlock, fromBlock, includeTransaction=false}) {
    let logs = [];
    for(let i = fromBlock; i < toBlock; i += 101) {
      const newLogs = await this.MakeProviderCall({
        methodName: "getLogs",
        args: [{
          fromBlock: i,
          toBlock: Math.min(toBlock, i + 100)
        }]
      });
      logs = logs.concat(newLogs || []);
    }
    let blocks = {};
    logs.forEach(log => {
      blocks[log.blockNumber] = [this.ParseUnknownLog({log})].concat((blocks[log.blockNumber] || []));
    });
    let output = [];
    await [...Array(toBlock - fromBlock + 1).keys()].limitedMap(
      3,
      async i => {
        const blockNumber = toBlock - i;
        let blockInfo = blocks[blockNumber];
        if(!blockInfo) {
          blockInfo = await this.MakeProviderCall({methodName: "getBlock", args: [blockNumber]});
          blockInfo = blockInfo.transactions.map(transactionHash => {
            return {
              blockNumber: blockInfo.number,
              blockHash: blockInfo.hash,
              ...blockInfo,
              transactionHash
            };
          });
          blocks[blockNumber] = blockInfo;
        }
        if(includeTransaction) {
          let transactionInfo = {};
          blocks[blockNumber] = await Promise.all(
            blockInfo.map(async block => {
              if(!transactionInfo[block.transactionHash]) {
                transactionInfo[block.transactionHash] = {
                  ...(await this.MakeProviderCall({methodName: "getTransaction", args: [block.transactionHash]})),
                  ...(await this.MakeProviderCall({methodName: "getTransactionReceipt", args: [block.transactionHash]})),
                };
              }
              return {
                ...block,
                ...transactionInfo[block.transactionHash]
              };
            })
          );
        }
        output.push(blocks[blockNumber]);
      }
    );
    return output;
  }
async Events ( { toBlock , fromBlock , includeTransaction = false } ) { let logs = [ ] ; for ( let i = fromBlock ; i < toBlock ; i += 101 ) { const newLogs = await this . MakeProviderCall ( { methodName : "getLogs" , args : [ { fromBlock : i , toBlock : Math . min ( toBlock , i + 100 ) } ] } ) ; logs = logs . concat ( newLogs || [ ] ) ; } let blocks = { } ; logs . forEach ( log => { blocks [ log . blockNumber ] = [ this . ParseUnknownLog ( { log } ) ] . concat ( ( blocks [ log . blockNumber ] || [ ] ) ) ; } ) ; let output = [ ] ; await [ ... Array ( toBlock - fromBlock + 1 ) . keys ( ) ] . limitedMap ( 3 , async i => { const blockNumber = toBlock - i ; let blockInfo = blocks [ blockNumber ] ; if ( ! blockInfo ) { blockInfo = await this . MakeProviderCall ( { methodName : "getBlock" , args : [ blockNumber ] } ) ; blockInfo = blockInfo . transactions . map ( transactionHash => { return { blockNumber : blockInfo . number , blockHash : blockInfo . hash , ... blockInfo , transactionHash } ; } ) ; blocks [ blockNumber ] = blockInfo ; } if ( includeTransaction ) { let transactionInfo = { } ; blocks [ blockNumber ] = await Promise . all ( blockInfo . map ( async block => { if ( ! transactionInfo [ block . transactionHash ] ) { transactionInfo [ block . transactionHash ] = { ... ( await this . MakeProviderCall ( { methodName : "getTransaction" , args : [ block . transactionHash ] } ) ) , ... ( await this . MakeProviderCall ( { methodName : "getTransactionReceipt" , args : [ block . transactionHash ] } ) ) , } ; } return { ... block , ... transactionInfo [ block . transactionHash ] } ; } ) ) ; } output . push ( blocks [ blockNumber ] ) ; } ) ; return output ; }
Returns a list, sorted in descending block order, with each entry containing all logs or transactions in that block
Returns a list sorted in descending block order with each entry containing all logs or transactions in that block
// Pull logs in batches of 100 // Group logs by blocknumber