PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@babylonlabs-io/babylon-proto-ts/dist/generated/babylon/btclightclient/v1
Просмотр файла: query.js
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
// source: babylon/btclightclient/v1/query.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryClientImpl = exports.QueryServiceName = exports.BTCHeaderInfoResponse = exports.QueryHeaderDepthResponse = exports.QueryHeaderDepthRequest = exports.QueryBaseHeaderResponse = exports.QueryBaseHeaderRequest = exports.QueryTipResponse = exports.QueryTipRequest = exports.QueryMainChainResponse = exports.QueryMainChainRequest = exports.QueryContainsBytesResponse = exports.QueryContainsBytesRequest = exports.QueryContainsResponse = exports.QueryContainsRequest = exports.QueryHashesResponse = exports.QueryHashesRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const pagination_1 = require("../../../cosmos/base/query/v1beta1/pagination");
const params_1 = require("./params");
exports.protobufPackage = "babylon.btclightclient.v1";
function createBaseQueryParamsRequest() {
return {};
}
exports.QueryParamsRequest = {
encode(_, writer = new wire_1.BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryParamsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return exports.QueryParamsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseQueryParamsRequest();
return message;
},
};
function createBaseQueryParamsResponse() {
return { params: undefined };
}
exports.QueryParamsResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.params !== undefined) {
params_1.Params.encode(message.params, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryParamsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.params = params_1.Params.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined };
},
toJSON(message) {
const obj = {};
if (message.params !== undefined) {
obj.params = params_1.Params.toJSON(message.params);
}
return obj;
},
create(base) {
return exports.QueryParamsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseQueryParamsResponse();
message.params = (object.params !== undefined && object.params !== null)
? params_1.Params.fromPartial(object.params)
: undefined;
return message;
},
};
function createBaseQueryHashesRequest() {
return { pagination: undefined };
}
exports.QueryHashesRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.pagination !== undefined) {
pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryHashesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { pagination: isSet(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined };
},
toJSON(message) {
const obj = {};
if (message.pagination !== undefined) {
obj.pagination = pagination_1.PageRequest.toJSON(message.pagination);
}
return obj;
},
create(base) {
return exports.QueryHashesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseQueryHashesRequest();
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? pagination_1.PageRequest.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryHashesResponse() {
return { hashes: [], pagination: undefined };
}
exports.QueryHashesResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
for (const v of message.hashes) {
writer.uint32(10).bytes(v);
}
if (message.pagination !== undefined) {
pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryHashesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.hashes.push(reader.bytes());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
hashes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.hashes) ? object.hashes.map((e) => bytesFromBase64(e)) : [],
pagination: isSet(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.hashes) === null || _a === void 0 ? void 0 : _a.length) {
obj.hashes = message.hashes.map((e) => base64FromBytes(e));
}
if (message.pagination !== undefined) {
obj.pagination = pagination_1.PageResponse.toJSON(message.pagination);
}
return obj;
},
create(base) {
return exports.QueryHashesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryHashesResponse();
message.hashes = ((_a = object.hashes) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? pagination_1.PageResponse.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryContainsRequest() {
return { hash: new Uint8Array(0) };
}
exports.QueryContainsRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.hash.length !== 0) {
writer.uint32(10).bytes(message.hash);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryContainsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.hash = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) };
},
toJSON(message) {
const obj = {};
if (message.hash.length !== 0) {
obj.hash = base64FromBytes(message.hash);
}
return obj;
},
create(base) {
return exports.QueryContainsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryContainsRequest();
message.hash = (_a = object.hash) !== null && _a !== void 0 ? _a : new Uint8Array(0);
return message;
},
};
function createBaseQueryContainsResponse() {
return { contains: false };
}
exports.QueryContainsResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.contains !== false) {
writer.uint32(8).bool(message.contains);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryContainsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.contains = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { contains: isSet(object.contains) ? globalThis.Boolean(object.contains) : false };
},
toJSON(message) {
const obj = {};
if (message.contains !== false) {
obj.contains = message.contains;
}
return obj;
},
create(base) {
return exports.QueryContainsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryContainsResponse();
message.contains = (_a = object.contains) !== null && _a !== void 0 ? _a : false;
return message;
},
};
function createBaseQueryContainsBytesRequest() {
return { hash: new Uint8Array(0) };
}
exports.QueryContainsBytesRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.hash.length !== 0) {
writer.uint32(10).bytes(message.hash);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryContainsBytesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.hash = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) };
},
toJSON(message) {
const obj = {};
if (message.hash.length !== 0) {
obj.hash = base64FromBytes(message.hash);
}
return obj;
},
create(base) {
return exports.QueryContainsBytesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryContainsBytesRequest();
message.hash = (_a = object.hash) !== null && _a !== void 0 ? _a : new Uint8Array(0);
return message;
},
};
function createBaseQueryContainsBytesResponse() {
return { contains: false };
}
exports.QueryContainsBytesResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.contains !== false) {
writer.uint32(8).bool(message.contains);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryContainsBytesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.contains = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { contains: isSet(object.contains) ? globalThis.Boolean(object.contains) : false };
},
toJSON(message) {
const obj = {};
if (message.contains !== false) {
obj.contains = message.contains;
}
return obj;
},
create(base) {
return exports.QueryContainsBytesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryContainsBytesResponse();
message.contains = (_a = object.contains) !== null && _a !== void 0 ? _a : false;
return message;
},
};
function createBaseQueryMainChainRequest() {
return { pagination: undefined };
}
exports.QueryMainChainRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.pagination !== undefined) {
pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryMainChainRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { pagination: isSet(object.pagination) ? pagination_1.PageRequest.fromJSON(object.pagination) : undefined };
},
toJSON(message) {
const obj = {};
if (message.pagination !== undefined) {
obj.pagination = pagination_1.PageRequest.toJSON(message.pagination);
}
return obj;
},
create(base) {
return exports.QueryMainChainRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseQueryMainChainRequest();
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? pagination_1.PageRequest.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryMainChainResponse() {
return { headers: [], pagination: undefined };
}
exports.QueryMainChainResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
for (const v of message.headers) {
exports.BTCHeaderInfoResponse.encode(v, writer.uint32(10).fork()).join();
}
if (message.pagination !== undefined) {
pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryMainChainResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.headers.push(exports.BTCHeaderInfoResponse.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
headers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.headers)
? object.headers.map((e) => exports.BTCHeaderInfoResponse.fromJSON(e))
: [],
pagination: isSet(object.pagination) ? pagination_1.PageResponse.fromJSON(object.pagination) : undefined,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.headers) === null || _a === void 0 ? void 0 : _a.length) {
obj.headers = message.headers.map((e) => exports.BTCHeaderInfoResponse.toJSON(e));
}
if (message.pagination !== undefined) {
obj.pagination = pagination_1.PageResponse.toJSON(message.pagination);
}
return obj;
},
create(base) {
return exports.QueryMainChainResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryMainChainResponse();
message.headers = ((_a = object.headers) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BTCHeaderInfoResponse.fromPartial(e))) || [];
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? pagination_1.PageResponse.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryTipRequest() {
return {};
}
exports.QueryTipRequest = {
encode(_, writer = new wire_1.BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryTipRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return exports.QueryTipRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseQueryTipRequest();
return message;
},
};
function createBaseQueryTipResponse() {
return { header: undefined };
}
exports.QueryTipResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.header !== undefined) {
exports.BTCHeaderInfoResponse.encode(message.header, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryTipResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.header = exports.BTCHeaderInfoResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { header: isSet(object.header) ? exports.BTCHeaderInfoResponse.fromJSON(object.header) : undefined };
},
toJSON(message) {
const obj = {};
if (message.header !== undefined) {
obj.header = exports.BTCHeaderInfoResponse.toJSON(message.header);
}
return obj;
},
create(base) {
return exports.QueryTipResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseQueryTipResponse();
message.header = (object.header !== undefined && object.header !== null)
? exports.BTCHeaderInfoResponse.fromPartial(object.header)
: undefined;
return message;
},
};
function createBaseQueryBaseHeaderRequest() {
return {};
}
exports.QueryBaseHeaderRequest = {
encode(_, writer = new wire_1.BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryBaseHeaderRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return exports.QueryBaseHeaderRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseQueryBaseHeaderRequest();
return message;
},
};
function createBaseQueryBaseHeaderResponse() {
return { header: undefined };
}
exports.QueryBaseHeaderResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.header !== undefined) {
exports.BTCHeaderInfoResponse.encode(message.header, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryBaseHeaderResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.header = exports.BTCHeaderInfoResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { header: isSet(object.header) ? exports.BTCHeaderInfoResponse.fromJSON(object.header) : undefined };
},
toJSON(message) {
const obj = {};
if (message.header !== undefined) {
obj.header = exports.BTCHeaderInfoResponse.toJSON(message.header);
}
return obj;
},
create(base) {
return exports.QueryBaseHeaderResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseQueryBaseHeaderResponse();
message.header = (object.header !== undefined && object.header !== null)
? exports.BTCHeaderInfoResponse.fromPartial(object.header)
: undefined;
return message;
},
};
function createBaseQueryHeaderDepthRequest() {
return { hash: "" };
}
exports.QueryHeaderDepthRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.hash !== "") {
writer.uint32(10).string(message.hash);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryHeaderDepthRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.hash = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" };
},
toJSON(message) {
const obj = {};
if (message.hash !== "") {
obj.hash = message.hash;
}
return obj;
},
create(base) {
return exports.QueryHeaderDepthRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryHeaderDepthRequest();
message.hash = (_a = object.hash) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseQueryHeaderDepthResponse() {
return { depth: 0 };
}
exports.QueryHeaderDepthResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.depth !== 0) {
writer.uint32(8).uint32(message.depth);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryHeaderDepthResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.depth = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { depth: isSet(object.depth) ? globalThis.Number(object.depth) : 0 };
},
toJSON(message) {
const obj = {};
if (message.depth !== 0) {
obj.depth = Math.round(message.depth);
}
return obj;
},
create(base) {
return exports.QueryHeaderDepthResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseQueryHeaderDepthResponse();
message.depth = (_a = object.depth) !== null && _a !== void 0 ? _a : 0;
return message;
},
};
function createBaseBTCHeaderInfoResponse() {
return { headerHex: "", hashHex: "", height: 0, work: "" };
}
exports.BTCHeaderInfoResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.headerHex !== "") {
writer.uint32(10).string(message.headerHex);
}
if (message.hashHex !== "") {
writer.uint32(18).string(message.hashHex);
}
if (message.height !== 0) {
writer.uint32(24).uint32(message.height);
}
if (message.work !== "") {
writer.uint32(34).string(message.work);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBTCHeaderInfoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.headerHex = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.hashHex = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.height = reader.uint32();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.work = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
headerHex: isSet(object.headerHex) ? globalThis.String(object.headerHex) : "",
hashHex: isSet(object.hashHex) ? globalThis.String(object.hashHex) : "",
height: isSet(object.height) ? globalThis.Number(object.height) : 0,
work: isSet(object.work) ? globalThis.String(object.work) : "",
};
},
toJSON(message) {
const obj = {};
if (message.headerHex !== "") {
obj.headerHex = message.headerHex;
}
if (message.hashHex !== "") {
obj.hashHex = message.hashHex;
}
if (message.height !== 0) {
obj.height = Math.round(message.height);
}
if (message.work !== "") {
obj.work = message.work;
}
return obj;
},
create(base) {
return exports.BTCHeaderInfoResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseBTCHeaderInfoResponse();
message.headerHex = (_a = object.headerHex) !== null && _a !== void 0 ? _a : "";
message.hashHex = (_b = object.hashHex) !== null && _b !== void 0 ? _b : "";
message.height = (_c = object.height) !== null && _c !== void 0 ? _c : 0;
message.work = (_d = object.work) !== null && _d !== void 0 ? _d : "";
return message;
},
};
exports.QueryServiceName = "babylon.btclightclient.v1.Query";
class QueryClientImpl {
constructor(rpc, opts) {
this.service = (opts === null || opts === void 0 ? void 0 : opts.service) || exports.QueryServiceName;
this.rpc = rpc;
this.Params = this.Params.bind(this);
this.Hashes = this.Hashes.bind(this);
this.Contains = this.Contains.bind(this);
this.ContainsBytes = this.ContainsBytes.bind(this);
this.MainChain = this.MainChain.bind(this);
this.Tip = this.Tip.bind(this);
this.BaseHeader = this.BaseHeader.bind(this);
this.HeaderDepth = this.HeaderDepth.bind(this);
}
Params(request) {
const data = exports.QueryParamsRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Params", data);
return promise.then((data) => exports.QueryParamsResponse.decode(new wire_1.BinaryReader(data)));
}
Hashes(request) {
const data = exports.QueryHashesRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Hashes", data);
return promise.then((data) => exports.QueryHashesResponse.decode(new wire_1.BinaryReader(data)));
}
Contains(request) {
const data = exports.QueryContainsRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Contains", data);
return promise.then((data) => exports.QueryContainsResponse.decode(new wire_1.BinaryReader(data)));
}
ContainsBytes(request) {
const data = exports.QueryContainsBytesRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "ContainsBytes", data);
return promise.then((data) => exports.QueryContainsBytesResponse.decode(new wire_1.BinaryReader(data)));
}
MainChain(request) {
const data = exports.QueryMainChainRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "MainChain", data);
return promise.then((data) => exports.QueryMainChainResponse.decode(new wire_1.BinaryReader(data)));
}
Tip(request) {
const data = exports.QueryTipRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Tip", data);
return promise.then((data) => exports.QueryTipResponse.decode(new wire_1.BinaryReader(data)));
}
BaseHeader(request) {
const data = exports.QueryBaseHeaderRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "BaseHeader", data);
return promise.then((data) => exports.QueryBaseHeaderResponse.decode(new wire_1.BinaryReader(data)));
}
HeaderDepth(request) {
const data = exports.QueryHeaderDepthRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "HeaderDepth", data);
return promise.then((data) => exports.QueryHeaderDepthResponse.decode(new wire_1.BinaryReader(data)));
}
}
exports.QueryClientImpl = QueryClientImpl;
function bytesFromBase64(b64) {
if (globalThis.Buffer) {
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
}
else {
const bin = globalThis.atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
}
function base64FromBytes(arr) {
if (globalThis.Buffer) {
return globalThis.Buffer.from(arr).toString("base64");
}
else {
const bin = [];
arr.forEach((byte) => {
bin.push(globalThis.String.fromCharCode(byte));
});
return globalThis.btoa(bin.join(""));
}
}
function isSet(value) {
return value !== null && value !== undefined;
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!