UNPKG

@routerprotocol/chain-api

Version:

Router Chain API Query client with generated gRPC bindings.

102 lines (91 loc) 3.86 kB
// package: types // file: types/tx_service.proto import * as types_tx_service_pb from "../types/tx_service_pb"; import {grpc} from "@improbable-eng/grpc-web"; type RouterTxRpcGetTx = { readonly methodName: string; readonly service: typeof RouterTxRpc; readonly requestStream: false; readonly responseStream: false; readonly requestType: typeof types_tx_service_pb.GetTxRequest; readonly responseType: typeof types_tx_service_pb.GetTxResponse; }; type RouterTxRpcPrepareTx = { readonly methodName: string; readonly service: typeof RouterTxRpc; readonly requestStream: false; readonly responseStream: false; readonly requestType: typeof types_tx_service_pb.PrepareTxRequest; readonly responseType: typeof types_tx_service_pb.PrepareTxResponse; }; type RouterTxRpcBroadcastTx = { readonly methodName: string; readonly service: typeof RouterTxRpc; readonly requestStream: false; readonly responseStream: false; readonly requestType: typeof types_tx_service_pb.BroadcastTxRequest; readonly responseType: typeof types_tx_service_pb.BroadcastTxResponse; }; export class RouterTxRpc { static readonly serviceName: string; static readonly GetTx: RouterTxRpcGetTx; static readonly PrepareTx: RouterTxRpcPrepareTx; static readonly BroadcastTx: RouterTxRpcBroadcastTx; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } export type Status = { details: string, code: number; metadata: grpc.Metadata } interface UnaryResponse { cancel(): void; } interface ResponseStream<T> { cancel(): void; on(type: 'data', handler: (message: T) => void): ResponseStream<T>; on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>; on(type: 'status', handler: (status: Status) => void): ResponseStream<T>; } interface RequestStream<T> { write(message: T): RequestStream<T>; end(): void; cancel(): void; on(type: 'end', handler: (status?: Status) => void): RequestStream<T>; on(type: 'status', handler: (status: Status) => void): RequestStream<T>; } interface BidirectionalStream<ReqT, ResT> { write(message: ReqT): BidirectionalStream<ReqT, ResT>; end(): void; cancel(): void; on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>; on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>; on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>; } export class RouterTxRpcClient { readonly serviceHost: string; constructor(serviceHost: string, options?: grpc.RpcOptions); getTx( requestMessage: types_tx_service_pb.GetTxRequest, metadata: grpc.Metadata, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.GetTxResponse|null) => void ): UnaryResponse; getTx( requestMessage: types_tx_service_pb.GetTxRequest, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.GetTxResponse|null) => void ): UnaryResponse; prepareTx( requestMessage: types_tx_service_pb.PrepareTxRequest, metadata: grpc.Metadata, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.PrepareTxResponse|null) => void ): UnaryResponse; prepareTx( requestMessage: types_tx_service_pb.PrepareTxRequest, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.PrepareTxResponse|null) => void ): UnaryResponse; broadcastTx( requestMessage: types_tx_service_pb.BroadcastTxRequest, metadata: grpc.Metadata, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.BroadcastTxResponse|null) => void ): UnaryResponse; broadcastTx( requestMessage: types_tx_service_pb.BroadcastTxRequest, callback: (error: ServiceError|null, responseMessage: types_tx_service_pb.BroadcastTxResponse|null) => void ): UnaryResponse; }