UNPKG

@routerprotocol/chain-api

Version:

Router Chain API Query client with generated gRPC bindings.

142 lines (129 loc) 3.99 kB
// package: routerprotocol.routerchain.attestation // file: routerprotocol/routerchain/attestation/tx.proto var routerprotocol_routerchain_attestation_tx_pb = require("../../../routerprotocol/routerchain/attestation/tx_pb"); var grpc = require("@improbable-eng/grpc-web").grpc; var Msg = (function () { function Msg() {} Msg.serviceName = "routerprotocol.routerchain.attestation.Msg"; return Msg; }()); Msg.SetOrchestratorAddress = { methodName: "SetOrchestratorAddress", service: Msg, requestStream: false, responseStream: false, requestType: routerprotocol_routerchain_attestation_tx_pb.MsgSetOrchestratorAddress, responseType: routerprotocol_routerchain_attestation_tx_pb.MsgSetOrchestratorAddressResponse }; Msg.ValsetConfirm = { methodName: "ValsetConfirm", service: Msg, requestStream: false, responseStream: false, requestType: routerprotocol_routerchain_attestation_tx_pb.MsgValsetConfirm, responseType: routerprotocol_routerchain_attestation_tx_pb.MsgValsetConfirmResponse }; Msg.ValsetUpdatedClaim = { methodName: "ValsetUpdatedClaim", service: Msg, requestStream: false, responseStream: false, requestType: routerprotocol_routerchain_attestation_tx_pb.MsgValsetUpdatedClaim, responseType: routerprotocol_routerchain_attestation_tx_pb.MsgValsetUpdatedClaimResponse }; exports.Msg = Msg; function MsgClient(serviceHost, options) { this.serviceHost = serviceHost; this.options = options || {}; } MsgClient.prototype.setOrchestratorAddress = function setOrchestratorAddress(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } var client = grpc.unary(Msg.SetOrchestratorAddress, { request: requestMessage, host: this.serviceHost, metadata: metadata, transport: this.options.transport, debug: this.options.debug, onEnd: function (response) { if (callback) { if (response.status !== grpc.Code.OK) { var err = new Error(response.statusMessage); err.code = response.status; err.metadata = response.trailers; callback(err, null); } else { callback(null, response.message); } } } }); return { cancel: function () { callback = null; client.close(); } }; }; MsgClient.prototype.valsetConfirm = function valsetConfirm(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } var client = grpc.unary(Msg.ValsetConfirm, { request: requestMessage, host: this.serviceHost, metadata: metadata, transport: this.options.transport, debug: this.options.debug, onEnd: function (response) { if (callback) { if (response.status !== grpc.Code.OK) { var err = new Error(response.statusMessage); err.code = response.status; err.metadata = response.trailers; callback(err, null); } else { callback(null, response.message); } } } }); return { cancel: function () { callback = null; client.close(); } }; }; MsgClient.prototype.valsetUpdatedClaim = function valsetUpdatedClaim(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; } var client = grpc.unary(Msg.ValsetUpdatedClaim, { request: requestMessage, host: this.serviceHost, metadata: metadata, transport: this.options.transport, debug: this.options.debug, onEnd: function (response) { if (callback) { if (response.status !== grpc.Code.OK) { var err = new Error(response.statusMessage); err.code = response.status; err.metadata = response.trailers; callback(err, null); } else { callback(null, response.message); } } } }); return { cancel: function () { callback = null; client.close(); } }; }; exports.MsgClient = MsgClient;