@ethersproject/abstract-provider#Listener TypeScript Examples

The following examples show how to use @ethersproject/abstract-provider#Listener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: base-provider.ts    From bodhi.js with Apache License 2.0 6 votes vote down vote up
// Event Emitter (ish)
  addEventListener = (eventName: string, listener: Listener, filter?: any): string => {
    const id = Wallet.createRandom().address;
    const eventCallBack = (data: any): void =>
      listener({
        subscription: id,
        result: data
      });

    this._listeners[eventName] = this._listeners[eventName] || [];
    this._listeners[eventName].push({ cb: eventCallBack, filter, id });

    return id;
  };
Example #2
Source File: base-provider.ts    From bodhi.js with Apache License 2.0 5 votes vote down vote up
on = (eventName: EventType, listener: Listener): Provider => throwNotImplemented('on');
Example #3
Source File: base-provider.ts    From bodhi.js with Apache License 2.0 5 votes vote down vote up
once = (eventName: EventType, listener: Listener): Provider => throwNotImplemented('once');
Example #4
Source File: base-provider.ts    From bodhi.js with Apache License 2.0 5 votes vote down vote up
listeners = (eventName?: EventType): Array<Listener> => throwNotImplemented('listeners');
Example #5
Source File: base-provider.ts    From bodhi.js with Apache License 2.0 5 votes vote down vote up
off = (eventName: EventType, listener?: Listener): Provider => throwNotImplemented('off');
Example #6
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
listeners(eventName?: EventType): Array<Listener> {
    return logger.throwError('Unsupport Event');
  }
Example #7
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
off(eventName: EventType, listener?: Listener): AbstractProvider {
    return logger.throwError('Unsupport Event');
  }
Example #8
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
on(eventName: EventType, listener: Listener): AbstractProvider {
    return logger.throwError('Unsupport Event');
  }
Example #9
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
once(eventName: EventType, listener: Listener): AbstractProvider {
    return logger.throwError('Unsupport Event');
  }
Example #10
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
addListener(eventName: EventType, listener: Listener): AbstractProvider {
    return this.on(eventName, listener);
  }
Example #11
Source File: Provider.ts    From evm-provider.js with Apache License 2.0 5 votes vote down vote up
removeListener(eventName: EventType, listener: Listener): AbstractProvider {
    return this.off(eventName, listener);
  }
Example #12
Source File: contractEventSyncer.ts    From hubble-contracts with MIT License 5 votes vote down vote up
protected eventListener?: Listener;