How to use the @cityofzion/neon-core.rpc.RPCClient function in @cityofzion/neon-core

To help you get started, we’ve selected a few @cityofzion/neon-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CityOfZion / neon-js / packages / neon-api / src / provider / neoscan / class.ts View on Github external
public async getRPCEndpoint(): Promise {
    if (this.rpc && this.cacheExpiry && this.cacheExpiry < new Date()) {
      const ping = await this.rpc.ping();
      if (ping <= 1000) {
        return this.rpc.net;
      }
    }
    const rpcAddress = await getRPCEndpoint(this.url);
    this.rpc = new rpc.RPCClient(rpcAddress);
    this.cacheExpiry = new Date(new Date().getTime() + 5 * 60000);
    return this.rpc.net;
  }
github CityOfZion / neon-js / packages / neon-api / src / provider / common.ts View on Github external
  const clients = rpcs.map(r => new rpc.RPCClient(r.url));
  return await raceToSuccess(clients.map(c => c.ping().then(_ => c.net)));
github CityOfZion / neon-js / packages / neon-api / src / provider / neoCli / class.ts View on Github external
public constructor(url: string) {
    this.url = url;
    this.rpc = new rpc.RPCClient(url);
    log.info(`Created NeoCli Provider: ${this.url}`);
  }
  public getRPCEndpoint(noCache?: boolean | undefined): Promise {
github CityOfZion / neon-js / packages / neon-api / src / provider / neonDB / class.ts View on Github external
public async getRPCEndpoint(noCache = false): Promise {
    if (
      !noCache &&
      this.rpc &&
      this.cacheExpiry &&
      this.cacheExpiry < new Date()
    ) {
      const ping = await this.rpc.ping();
      if (ping <= 1000) {
        return this.rpc.net;
      }
    }
    const rpcAddress = await getRPCEndpoint(this.url);
    this.rpc = new rpc.RPCClient(rpcAddress);
    this.cacheExpiry = new Date(new Date().getTime() + 5 * 60000);
    return this.rpc.net;
  }