How to use the grpc-caller.wrap function in grpc-caller

To help you get started, we’ve selected a few grpc-caller 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 sparkswap / broker-cli / broker-daemon-client / index.js View on Github external
let certPathParts = this.certPath.split(path.sep)
      if (certPathParts[0] === '~') {
        certPathParts[0] = os.homedir()
        this.cert = readFileSync(path.join(...certPathParts))
      } else {
        this.cert = readFileSync(this.certPath)
      }

      const channelCredentials = grpc.credentials.createSsl(this.cert)
      const callCredentials = basicAuth.generateBasicAuthCredentials(this.username, this.password)

      this.credentials = grpc.credentials.combineChannelCredentials(channelCredentials, callCredentials)
    }

    const adminServiceClient = new this.proto.broker.rpc.AdminService(this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderServiceClient = new this.proto.broker.rpc.OrderService(this.address, this.credentials)
    this.orderService = caller.wrap(orderServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderBookServiceClient = new this.proto.broker.rpc.OrderBookService(this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const walletServiceClient = new this.proto.broker.rpc.WalletService(this.address, this.credentials)
    this.walletService = caller.wrap(walletServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })
  }
}
github sparkswap / broker-cli / broker-daemon-client / index.js View on Github external
const callCredentials = basicAuth.generateBasicAuthCredentials(this.username, this.password)

      this.credentials = grpc.credentials.combineChannelCredentials(channelCredentials, callCredentials)
    }

    const adminServiceClient = new this.proto.broker.rpc.AdminService(this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderServiceClient = new this.proto.broker.rpc.OrderService(this.address, this.credentials)
    this.orderService = caller.wrap(orderServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderBookServiceClient = new this.proto.broker.rpc.OrderBookService(this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const walletServiceClient = new this.proto.broker.rpc.WalletService(this.address, this.credentials)
    this.walletService = caller.wrap(walletServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })
  }
}
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
if (!PRODUCTION) {
      logger.info('Using local certs for relayer client', { production: PRODUCTION })
      channelCredentials = credentials.createSsl(readFileSync(certPath))
    }

    this.credentials = channelCredentials
    const options = { interceptors: [grpcDeadlineInterceptor] }

    const orderServiceClient = new this.proto.OrderService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderService = caller.wrap(orderServiceClient, {}, options)

    const makerServiceClient = new this.proto.MakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.makerService = caller.wrap(makerServiceClient, {}, options)

    const takerServiceClient = new this.proto.TakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
    this.paymentChannelNetworkService =
      caller.wrap(paymentChannelNetworkServiceClient, {}, options)

    const adminServiceClient = new this.proto.AdminService(
github sparkswap / broker-cli / broker-daemon-client / index.js View on Github external
this.cert = readFileSync(path.join(...certPathParts))
      } else {
        this.cert = readFileSync(this.certPath)
      }

      const channelCredentials = grpc.credentials.createSsl(this.cert)
      const callCredentials = basicAuth.generateBasicAuthCredentials(this.username, this.password)

      this.credentials = grpc.credentials.combineChannelCredentials(channelCredentials, callCredentials)
    }

    const adminServiceClient = new this.proto.broker.rpc.AdminService(this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderServiceClient = new this.proto.broker.rpc.OrderService(this.address, this.credentials)
    this.orderService = caller.wrap(orderServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderBookServiceClient = new this.proto.broker.rpc.OrderBookService(this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const walletServiceClient = new this.proto.broker.rpc.WalletService(this.address, this.credentials)
    this.walletService = caller.wrap(walletServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })
  }
}
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
this.proto = loadProto(path.resolve(RELAYER_PROTO_PATH))
    this.identity = Identity.load(privKeyPath, pubKeyPath)

    let channelCredentials = credentials.createSsl()

    if (!PRODUCTION) {
      logger.info('Using local certs for relayer client', { production: PRODUCTION })
      channelCredentials = credentials.createSsl(readFileSync(certPath))
    }

    this.credentials = channelCredentials
    const options = { interceptors: [grpcDeadlineInterceptor] }

    const orderServiceClient = new this.proto.OrderService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderService = caller.wrap(orderServiceClient, {}, options)

    const makerServiceClient = new this.proto.MakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.makerService = caller.wrap(makerServiceClient, {}, options)

    const takerServiceClient = new this.proto.TakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
}

    this.credentials = channelCredentials
    const options = { interceptors: [grpcDeadlineInterceptor] }

    const orderServiceClient = new this.proto.OrderService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderService = caller.wrap(orderServiceClient, {}, options)

    const makerServiceClient = new this.proto.MakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.makerService = caller.wrap(makerServiceClient, {}, options)

    const takerServiceClient = new this.proto.TakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
    this.paymentChannelNetworkService =
      caller.wrap(paymentChannelNetworkServiceClient, {}, options)

    const adminServiceClient = new this.proto.AdminService(
      this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, options)
  }
github sparkswap / broker-cli / broker-daemon-client / index.js View on Github external
}

      const channelCredentials = grpc.credentials.createSsl(this.cert)
      const callCredentials = basicAuth.generateBasicAuthCredentials(this.username, this.password)

      this.credentials = grpc.credentials.combineChannelCredentials(channelCredentials, callCredentials)
    }

    const adminServiceClient = new this.proto.broker.rpc.AdminService(this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderServiceClient = new this.proto.broker.rpc.OrderService(this.address, this.credentials)
    this.orderService = caller.wrap(orderServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const orderBookServiceClient = new this.proto.broker.rpc.OrderBookService(this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })

    const walletServiceClient = new this.proto.broker.rpc.WalletService(this.address, this.credentials)
    this.walletService = caller.wrap(walletServiceClient, {}, { interceptors: [grpcDeadlineInterceptor] })
  }
}
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.makerService = caller.wrap(makerServiceClient, {}, options)

    const takerServiceClient = new this.proto.TakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
    this.paymentChannelNetworkService =
      caller.wrap(paymentChannelNetworkServiceClient, {}, options)

    const adminServiceClient = new this.proto.AdminService(
      this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, options)
  }
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
const orderServiceClient = new this.proto.OrderService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderService = caller.wrap(orderServiceClient, {}, options)

    const makerServiceClient = new this.proto.MakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.makerService = caller.wrap(makerServiceClient, {}, options)

    const takerServiceClient = new this.proto.TakerService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
    this.paymentChannelNetworkService =
      caller.wrap(paymentChannelNetworkServiceClient, {}, options)

    const adminServiceClient = new this.proto.AdminService(
      this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, options)
  }
github sparkswap / broker / broker-daemon / relayer / relayer-client.js View on Github external
this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.takerService = caller.wrap(takerServiceClient, {}, options)

    const orderBookServiceClient = new this.proto.OrderBookService(
      this.address, this.credentials, GRPC_STREAM_OPTIONS)
    this.orderBookService = caller.wrap(orderBookServiceClient, {}, options)

    const paymentChannelNetworkServiceClient =
      new this.proto.PaymentChannelNetworkService(
        this.address, this.credentials)
    this.paymentChannelNetworkService =
      caller.wrap(paymentChannelNetworkServiceClient, {}, options)

    const adminServiceClient = new this.proto.AdminService(
      this.address, this.credentials)
    this.adminService = caller.wrap(adminServiceClient, {}, options)
  }

grpc-caller

An improved Node.js gRPC client

Apache-2.0
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular grpc-caller functions