PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@babylonlabs-io/babylon-proto-ts/dist/generated/babylon/btcstaking/v1
Просмотр файла: tx.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/btcstaking/v1/tx.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.MsgClientImpl = exports.MsgServiceName = exports.MsgUpdateParamsResponse = exports.MsgUpdateParams = exports.MsgSelectiveSlashingEvidenceResponse = exports.MsgSelectiveSlashingEvidence = exports.MsgBTCUndelegateResponse = exports.MsgBTCUndelegate = exports.MsgAddCovenantSigsResponse = exports.MsgAddCovenantSigs = exports.MsgAddBTCDelegationInclusionProofResponse = exports.MsgAddBTCDelegationInclusionProof = exports.MsgCreateBTCDelegationResponse = exports.MsgCreateBTCDelegation = exports.MsgEditFinalityProviderResponse = exports.MsgEditFinalityProvider = exports.MsgCreateFinalityProviderResponse = exports.MsgCreateFinalityProvider = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const staking_1 = require("../../../cosmos/staking/v1beta1/staking");
const btcstaking_1 = require("./btcstaking");
const params_1 = require("./params");
const pop_1 = require("./pop");
exports.protobufPackage = "babylon.btcstaking.v1";
function createBaseMsgCreateFinalityProvider() {
return { addr: "", description: undefined, commission: "", btcPk: new Uint8Array(0), pop: undefined };
}
exports.MsgCreateFinalityProvider = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.addr !== "") {
writer.uint32(10).string(message.addr);
}
if (message.description !== undefined) {
staking_1.Description.encode(message.description, writer.uint32(18).fork()).join();
}
if (message.commission !== "") {
writer.uint32(26).string(message.commission);
}
if (message.btcPk.length !== 0) {
writer.uint32(34).bytes(message.btcPk);
}
if (message.pop !== undefined) {
pop_1.ProofOfPossessionBTC.encode(message.pop, writer.uint32(42).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 = createBaseMsgCreateFinalityProvider();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.addr = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = staking_1.Description.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.commission = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.btcPk = reader.bytes();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.pop = pop_1.ProofOfPossessionBTC.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
addr: isSet(object.addr) ? globalThis.String(object.addr) : "",
description: isSet(object.description) ? staking_1.Description.fromJSON(object.description) : undefined,
commission: isSet(object.commission) ? globalThis.String(object.commission) : "",
btcPk: isSet(object.btcPk) ? bytesFromBase64(object.btcPk) : new Uint8Array(0),
pop: isSet(object.pop) ? pop_1.ProofOfPossessionBTC.fromJSON(object.pop) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.addr !== "") {
obj.addr = message.addr;
}
if (message.description !== undefined) {
obj.description = staking_1.Description.toJSON(message.description);
}
if (message.commission !== "") {
obj.commission = message.commission;
}
if (message.btcPk.length !== 0) {
obj.btcPk = base64FromBytes(message.btcPk);
}
if (message.pop !== undefined) {
obj.pop = pop_1.ProofOfPossessionBTC.toJSON(message.pop);
}
return obj;
},
create(base) {
return exports.MsgCreateFinalityProvider.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseMsgCreateFinalityProvider();
message.addr = (_a = object.addr) !== null && _a !== void 0 ? _a : "";
message.description = (object.description !== undefined && object.description !== null)
? staking_1.Description.fromPartial(object.description)
: undefined;
message.commission = (_b = object.commission) !== null && _b !== void 0 ? _b : "";
message.btcPk = (_c = object.btcPk) !== null && _c !== void 0 ? _c : new Uint8Array(0);
message.pop = (object.pop !== undefined && object.pop !== null)
? pop_1.ProofOfPossessionBTC.fromPartial(object.pop)
: undefined;
return message;
},
};
function createBaseMsgCreateFinalityProviderResponse() {
return {};
}
exports.MsgCreateFinalityProviderResponse = {
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 = createBaseMsgCreateFinalityProviderResponse();
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.MsgCreateFinalityProviderResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgCreateFinalityProviderResponse();
return message;
},
};
function createBaseMsgEditFinalityProvider() {
return { addr: "", btcPk: new Uint8Array(0), description: undefined, commission: "" };
}
exports.MsgEditFinalityProvider = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.addr !== "") {
writer.uint32(10).string(message.addr);
}
if (message.btcPk.length !== 0) {
writer.uint32(18).bytes(message.btcPk);
}
if (message.description !== undefined) {
staking_1.Description.encode(message.description, writer.uint32(26).fork()).join();
}
if (message.commission !== "") {
writer.uint32(34).string(message.commission);
}
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 = createBaseMsgEditFinalityProvider();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.addr = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.btcPk = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.description = staking_1.Description.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.commission = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
addr: isSet(object.addr) ? globalThis.String(object.addr) : "",
btcPk: isSet(object.btcPk) ? bytesFromBase64(object.btcPk) : new Uint8Array(0),
description: isSet(object.description) ? staking_1.Description.fromJSON(object.description) : undefined,
commission: isSet(object.commission) ? globalThis.String(object.commission) : "",
};
},
toJSON(message) {
const obj = {};
if (message.addr !== "") {
obj.addr = message.addr;
}
if (message.btcPk.length !== 0) {
obj.btcPk = base64FromBytes(message.btcPk);
}
if (message.description !== undefined) {
obj.description = staking_1.Description.toJSON(message.description);
}
if (message.commission !== "") {
obj.commission = message.commission;
}
return obj;
},
create(base) {
return exports.MsgEditFinalityProvider.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseMsgEditFinalityProvider();
message.addr = (_a = object.addr) !== null && _a !== void 0 ? _a : "";
message.btcPk = (_b = object.btcPk) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.description = (object.description !== undefined && object.description !== null)
? staking_1.Description.fromPartial(object.description)
: undefined;
message.commission = (_c = object.commission) !== null && _c !== void 0 ? _c : "";
return message;
},
};
function createBaseMsgEditFinalityProviderResponse() {
return {};
}
exports.MsgEditFinalityProviderResponse = {
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 = createBaseMsgEditFinalityProviderResponse();
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.MsgEditFinalityProviderResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgEditFinalityProviderResponse();
return message;
},
};
function createBaseMsgCreateBTCDelegation() {
return {
stakerAddr: "",
pop: undefined,
btcPk: new Uint8Array(0),
fpBtcPkList: [],
stakingTime: 0,
stakingValue: 0,
stakingTx: new Uint8Array(0),
stakingTxInclusionProof: undefined,
slashingTx: new Uint8Array(0),
delegatorSlashingSig: new Uint8Array(0),
unbondingTime: 0,
unbondingTx: new Uint8Array(0),
unbondingValue: 0,
unbondingSlashingTx: new Uint8Array(0),
delegatorUnbondingSlashingSig: new Uint8Array(0),
};
}
exports.MsgCreateBTCDelegation = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.stakerAddr !== "") {
writer.uint32(10).string(message.stakerAddr);
}
if (message.pop !== undefined) {
pop_1.ProofOfPossessionBTC.encode(message.pop, writer.uint32(18).fork()).join();
}
if (message.btcPk.length !== 0) {
writer.uint32(26).bytes(message.btcPk);
}
for (const v of message.fpBtcPkList) {
writer.uint32(34).bytes(v);
}
if (message.stakingTime !== 0) {
writer.uint32(40).uint32(message.stakingTime);
}
if (message.stakingValue !== 0) {
writer.uint32(48).int64(message.stakingValue);
}
if (message.stakingTx.length !== 0) {
writer.uint32(58).bytes(message.stakingTx);
}
if (message.stakingTxInclusionProof !== undefined) {
btcstaking_1.InclusionProof.encode(message.stakingTxInclusionProof, writer.uint32(66).fork()).join();
}
if (message.slashingTx.length !== 0) {
writer.uint32(74).bytes(message.slashingTx);
}
if (message.delegatorSlashingSig.length !== 0) {
writer.uint32(82).bytes(message.delegatorSlashingSig);
}
if (message.unbondingTime !== 0) {
writer.uint32(88).uint32(message.unbondingTime);
}
if (message.unbondingTx.length !== 0) {
writer.uint32(98).bytes(message.unbondingTx);
}
if (message.unbondingValue !== 0) {
writer.uint32(104).int64(message.unbondingValue);
}
if (message.unbondingSlashingTx.length !== 0) {
writer.uint32(114).bytes(message.unbondingSlashingTx);
}
if (message.delegatorUnbondingSlashingSig.length !== 0) {
writer.uint32(122).bytes(message.delegatorUnbondingSlashingSig);
}
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 = createBaseMsgCreateBTCDelegation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.stakerAddr = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pop = pop_1.ProofOfPossessionBTC.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.btcPk = reader.bytes();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.fpBtcPkList.push(reader.bytes());
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.stakingTime = reader.uint32();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.stakingValue = longToNumber(reader.int64());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.stakingTx = reader.bytes();
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.stakingTxInclusionProof = btcstaking_1.InclusionProof.decode(reader, reader.uint32());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.slashingTx = reader.bytes();
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.delegatorSlashingSig = reader.bytes();
continue;
}
case 11: {
if (tag !== 88) {
break;
}
message.unbondingTime = reader.uint32();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.unbondingTx = reader.bytes();
continue;
}
case 13: {
if (tag !== 104) {
break;
}
message.unbondingValue = longToNumber(reader.int64());
continue;
}
case 14: {
if (tag !== 114) {
break;
}
message.unbondingSlashingTx = reader.bytes();
continue;
}
case 15: {
if (tag !== 122) {
break;
}
message.delegatorUnbondingSlashingSig = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
stakerAddr: isSet(object.stakerAddr) ? globalThis.String(object.stakerAddr) : "",
pop: isSet(object.pop) ? pop_1.ProofOfPossessionBTC.fromJSON(object.pop) : undefined,
btcPk: isSet(object.btcPk) ? bytesFromBase64(object.btcPk) : new Uint8Array(0),
fpBtcPkList: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.fpBtcPkList)
? object.fpBtcPkList.map((e) => bytesFromBase64(e))
: [],
stakingTime: isSet(object.stakingTime) ? globalThis.Number(object.stakingTime) : 0,
stakingValue: isSet(object.stakingValue) ? globalThis.Number(object.stakingValue) : 0,
stakingTx: isSet(object.stakingTx) ? bytesFromBase64(object.stakingTx) : new Uint8Array(0),
stakingTxInclusionProof: isSet(object.stakingTxInclusionProof)
? btcstaking_1.InclusionProof.fromJSON(object.stakingTxInclusionProof)
: undefined,
slashingTx: isSet(object.slashingTx) ? bytesFromBase64(object.slashingTx) : new Uint8Array(0),
delegatorSlashingSig: isSet(object.delegatorSlashingSig)
? bytesFromBase64(object.delegatorSlashingSig)
: new Uint8Array(0),
unbondingTime: isSet(object.unbondingTime) ? globalThis.Number(object.unbondingTime) : 0,
unbondingTx: isSet(object.unbondingTx) ? bytesFromBase64(object.unbondingTx) : new Uint8Array(0),
unbondingValue: isSet(object.unbondingValue) ? globalThis.Number(object.unbondingValue) : 0,
unbondingSlashingTx: isSet(object.unbondingSlashingTx)
? bytesFromBase64(object.unbondingSlashingTx)
: new Uint8Array(0),
delegatorUnbondingSlashingSig: isSet(object.delegatorUnbondingSlashingSig)
? bytesFromBase64(object.delegatorUnbondingSlashingSig)
: new Uint8Array(0),
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.stakerAddr !== "") {
obj.stakerAddr = message.stakerAddr;
}
if (message.pop !== undefined) {
obj.pop = pop_1.ProofOfPossessionBTC.toJSON(message.pop);
}
if (message.btcPk.length !== 0) {
obj.btcPk = base64FromBytes(message.btcPk);
}
if ((_a = message.fpBtcPkList) === null || _a === void 0 ? void 0 : _a.length) {
obj.fpBtcPkList = message.fpBtcPkList.map((e) => base64FromBytes(e));
}
if (message.stakingTime !== 0) {
obj.stakingTime = Math.round(message.stakingTime);
}
if (message.stakingValue !== 0) {
obj.stakingValue = Math.round(message.stakingValue);
}
if (message.stakingTx.length !== 0) {
obj.stakingTx = base64FromBytes(message.stakingTx);
}
if (message.stakingTxInclusionProof !== undefined) {
obj.stakingTxInclusionProof = btcstaking_1.InclusionProof.toJSON(message.stakingTxInclusionProof);
}
if (message.slashingTx.length !== 0) {
obj.slashingTx = base64FromBytes(message.slashingTx);
}
if (message.delegatorSlashingSig.length !== 0) {
obj.delegatorSlashingSig = base64FromBytes(message.delegatorSlashingSig);
}
if (message.unbondingTime !== 0) {
obj.unbondingTime = Math.round(message.unbondingTime);
}
if (message.unbondingTx.length !== 0) {
obj.unbondingTx = base64FromBytes(message.unbondingTx);
}
if (message.unbondingValue !== 0) {
obj.unbondingValue = Math.round(message.unbondingValue);
}
if (message.unbondingSlashingTx.length !== 0) {
obj.unbondingSlashingTx = base64FromBytes(message.unbondingSlashingTx);
}
if (message.delegatorUnbondingSlashingSig.length !== 0) {
obj.delegatorUnbondingSlashingSig = base64FromBytes(message.delegatorUnbondingSlashingSig);
}
return obj;
},
create(base) {
return exports.MsgCreateBTCDelegation.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
const message = createBaseMsgCreateBTCDelegation();
message.stakerAddr = (_a = object.stakerAddr) !== null && _a !== void 0 ? _a : "";
message.pop = (object.pop !== undefined && object.pop !== null)
? pop_1.ProofOfPossessionBTC.fromPartial(object.pop)
: undefined;
message.btcPk = (_b = object.btcPk) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.fpBtcPkList = ((_c = object.fpBtcPkList) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
message.stakingTime = (_d = object.stakingTime) !== null && _d !== void 0 ? _d : 0;
message.stakingValue = (_e = object.stakingValue) !== null && _e !== void 0 ? _e : 0;
message.stakingTx = (_f = object.stakingTx) !== null && _f !== void 0 ? _f : new Uint8Array(0);
message.stakingTxInclusionProof =
(object.stakingTxInclusionProof !== undefined && object.stakingTxInclusionProof !== null)
? btcstaking_1.InclusionProof.fromPartial(object.stakingTxInclusionProof)
: undefined;
message.slashingTx = (_g = object.slashingTx) !== null && _g !== void 0 ? _g : new Uint8Array(0);
message.delegatorSlashingSig = (_h = object.delegatorSlashingSig) !== null && _h !== void 0 ? _h : new Uint8Array(0);
message.unbondingTime = (_j = object.unbondingTime) !== null && _j !== void 0 ? _j : 0;
message.unbondingTx = (_k = object.unbondingTx) !== null && _k !== void 0 ? _k : new Uint8Array(0);
message.unbondingValue = (_l = object.unbondingValue) !== null && _l !== void 0 ? _l : 0;
message.unbondingSlashingTx = (_m = object.unbondingSlashingTx) !== null && _m !== void 0 ? _m : new Uint8Array(0);
message.delegatorUnbondingSlashingSig = (_o = object.delegatorUnbondingSlashingSig) !== null && _o !== void 0 ? _o : new Uint8Array(0);
return message;
},
};
function createBaseMsgCreateBTCDelegationResponse() {
return {};
}
exports.MsgCreateBTCDelegationResponse = {
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 = createBaseMsgCreateBTCDelegationResponse();
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.MsgCreateBTCDelegationResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgCreateBTCDelegationResponse();
return message;
},
};
function createBaseMsgAddBTCDelegationInclusionProof() {
return { signer: "", stakingTxHash: "", stakingTxInclusionProof: undefined };
}
exports.MsgAddBTCDelegationInclusionProof = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.stakingTxHash !== "") {
writer.uint32(18).string(message.stakingTxHash);
}
if (message.stakingTxInclusionProof !== undefined) {
btcstaking_1.InclusionProof.encode(message.stakingTxInclusionProof, writer.uint32(26).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 = createBaseMsgAddBTCDelegationInclusionProof();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.signer = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.stakingTxHash = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.stakingTxInclusionProof = btcstaking_1.InclusionProof.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
signer: isSet(object.signer) ? globalThis.String(object.signer) : "",
stakingTxHash: isSet(object.stakingTxHash) ? globalThis.String(object.stakingTxHash) : "",
stakingTxInclusionProof: isSet(object.stakingTxInclusionProof)
? btcstaking_1.InclusionProof.fromJSON(object.stakingTxInclusionProof)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.signer !== "") {
obj.signer = message.signer;
}
if (message.stakingTxHash !== "") {
obj.stakingTxHash = message.stakingTxHash;
}
if (message.stakingTxInclusionProof !== undefined) {
obj.stakingTxInclusionProof = btcstaking_1.InclusionProof.toJSON(message.stakingTxInclusionProof);
}
return obj;
},
create(base) {
return exports.MsgAddBTCDelegationInclusionProof.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseMsgAddBTCDelegationInclusionProof();
message.signer = (_a = object.signer) !== null && _a !== void 0 ? _a : "";
message.stakingTxHash = (_b = object.stakingTxHash) !== null && _b !== void 0 ? _b : "";
message.stakingTxInclusionProof =
(object.stakingTxInclusionProof !== undefined && object.stakingTxInclusionProof !== null)
? btcstaking_1.InclusionProof.fromPartial(object.stakingTxInclusionProof)
: undefined;
return message;
},
};
function createBaseMsgAddBTCDelegationInclusionProofResponse() {
return {};
}
exports.MsgAddBTCDelegationInclusionProofResponse = {
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 = createBaseMsgAddBTCDelegationInclusionProofResponse();
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.MsgAddBTCDelegationInclusionProofResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgAddBTCDelegationInclusionProofResponse();
return message;
},
};
function createBaseMsgAddCovenantSigs() {
return {
signer: "",
pk: new Uint8Array(0),
stakingTxHash: "",
slashingTxSigs: [],
unbondingTxSig: new Uint8Array(0),
slashingUnbondingTxSigs: [],
};
}
exports.MsgAddCovenantSigs = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.pk.length !== 0) {
writer.uint32(18).bytes(message.pk);
}
if (message.stakingTxHash !== "") {
writer.uint32(26).string(message.stakingTxHash);
}
for (const v of message.slashingTxSigs) {
writer.uint32(34).bytes(v);
}
if (message.unbondingTxSig.length !== 0) {
writer.uint32(42).bytes(message.unbondingTxSig);
}
for (const v of message.slashingUnbondingTxSigs) {
writer.uint32(50).bytes(v);
}
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 = createBaseMsgAddCovenantSigs();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.signer = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pk = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.stakingTxHash = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.slashingTxSigs.push(reader.bytes());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.unbondingTxSig = reader.bytes();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.slashingUnbondingTxSigs.push(reader.bytes());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
signer: isSet(object.signer) ? globalThis.String(object.signer) : "",
pk: isSet(object.pk) ? bytesFromBase64(object.pk) : new Uint8Array(0),
stakingTxHash: isSet(object.stakingTxHash) ? globalThis.String(object.stakingTxHash) : "",
slashingTxSigs: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.slashingTxSigs)
? object.slashingTxSigs.map((e) => bytesFromBase64(e))
: [],
unbondingTxSig: isSet(object.unbondingTxSig) ? bytesFromBase64(object.unbondingTxSig) : new Uint8Array(0),
slashingUnbondingTxSigs: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.slashingUnbondingTxSigs)
? object.slashingUnbondingTxSigs.map((e) => bytesFromBase64(e))
: [],
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.signer !== "") {
obj.signer = message.signer;
}
if (message.pk.length !== 0) {
obj.pk = base64FromBytes(message.pk);
}
if (message.stakingTxHash !== "") {
obj.stakingTxHash = message.stakingTxHash;
}
if ((_a = message.slashingTxSigs) === null || _a === void 0 ? void 0 : _a.length) {
obj.slashingTxSigs = message.slashingTxSigs.map((e) => base64FromBytes(e));
}
if (message.unbondingTxSig.length !== 0) {
obj.unbondingTxSig = base64FromBytes(message.unbondingTxSig);
}
if ((_b = message.slashingUnbondingTxSigs) === null || _b === void 0 ? void 0 : _b.length) {
obj.slashingUnbondingTxSigs = message.slashingUnbondingTxSigs.map((e) => base64FromBytes(e));
}
return obj;
},
create(base) {
return exports.MsgAddCovenantSigs.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f;
const message = createBaseMsgAddCovenantSigs();
message.signer = (_a = object.signer) !== null && _a !== void 0 ? _a : "";
message.pk = (_b = object.pk) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.stakingTxHash = (_c = object.stakingTxHash) !== null && _c !== void 0 ? _c : "";
message.slashingTxSigs = ((_d = object.slashingTxSigs) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
message.unbondingTxSig = (_e = object.unbondingTxSig) !== null && _e !== void 0 ? _e : new Uint8Array(0);
message.slashingUnbondingTxSigs = ((_f = object.slashingUnbondingTxSigs) === null || _f === void 0 ? void 0 : _f.map((e) => e)) || [];
return message;
},
};
function createBaseMsgAddCovenantSigsResponse() {
return {};
}
exports.MsgAddCovenantSigsResponse = {
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 = createBaseMsgAddCovenantSigsResponse();
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.MsgAddCovenantSigsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgAddCovenantSigsResponse();
return message;
},
};
function createBaseMsgBTCUndelegate() {
return {
signer: "",
stakingTxHash: "",
stakeSpendingTx: new Uint8Array(0),
stakeSpendingTxInclusionProof: undefined,
};
}
exports.MsgBTCUndelegate = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.stakingTxHash !== "") {
writer.uint32(18).string(message.stakingTxHash);
}
if (message.stakeSpendingTx.length !== 0) {
writer.uint32(26).bytes(message.stakeSpendingTx);
}
if (message.stakeSpendingTxInclusionProof !== undefined) {
btcstaking_1.InclusionProof.encode(message.stakeSpendingTxInclusionProof, writer.uint32(34).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 = createBaseMsgBTCUndelegate();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.signer = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.stakingTxHash = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.stakeSpendingTx = reader.bytes();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.stakeSpendingTxInclusionProof = btcstaking_1.InclusionProof.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
signer: isSet(object.signer) ? globalThis.String(object.signer) : "",
stakingTxHash: isSet(object.stakingTxHash) ? globalThis.String(object.stakingTxHash) : "",
stakeSpendingTx: isSet(object.stakeSpendingTx) ? bytesFromBase64(object.stakeSpendingTx) : new Uint8Array(0),
stakeSpendingTxInclusionProof: isSet(object.stakeSpendingTxInclusionProof)
? btcstaking_1.InclusionProof.fromJSON(object.stakeSpendingTxInclusionProof)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.signer !== "") {
obj.signer = message.signer;
}
if (message.stakingTxHash !== "") {
obj.stakingTxHash = message.stakingTxHash;
}
if (message.stakeSpendingTx.length !== 0) {
obj.stakeSpendingTx = base64FromBytes(message.stakeSpendingTx);
}
if (message.stakeSpendingTxInclusionProof !== undefined) {
obj.stakeSpendingTxInclusionProof = btcstaking_1.InclusionProof.toJSON(message.stakeSpendingTxInclusionProof);
}
return obj;
},
create(base) {
return exports.MsgBTCUndelegate.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseMsgBTCUndelegate();
message.signer = (_a = object.signer) !== null && _a !== void 0 ? _a : "";
message.stakingTxHash = (_b = object.stakingTxHash) !== null && _b !== void 0 ? _b : "";
message.stakeSpendingTx = (_c = object.stakeSpendingTx) !== null && _c !== void 0 ? _c : new Uint8Array(0);
message.stakeSpendingTxInclusionProof =
(object.stakeSpendingTxInclusionProof !== undefined && object.stakeSpendingTxInclusionProof !== null)
? btcstaking_1.InclusionProof.fromPartial(object.stakeSpendingTxInclusionProof)
: undefined;
return message;
},
};
function createBaseMsgBTCUndelegateResponse() {
return {};
}
exports.MsgBTCUndelegateResponse = {
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 = createBaseMsgBTCUndelegateResponse();
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.MsgBTCUndelegateResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgBTCUndelegateResponse();
return message;
},
};
function createBaseMsgSelectiveSlashingEvidence() {
return { signer: "", stakingTxHash: "", recoveredFpBtcSk: new Uint8Array(0) };
}
exports.MsgSelectiveSlashingEvidence = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.stakingTxHash !== "") {
writer.uint32(18).string(message.stakingTxHash);
}
if (message.recoveredFpBtcSk.length !== 0) {
writer.uint32(26).bytes(message.recoveredFpBtcSk);
}
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 = createBaseMsgSelectiveSlashingEvidence();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.signer = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.stakingTxHash = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.recoveredFpBtcSk = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
signer: isSet(object.signer) ? globalThis.String(object.signer) : "",
stakingTxHash: isSet(object.stakingTxHash) ? globalThis.String(object.stakingTxHash) : "",
recoveredFpBtcSk: isSet(object.recoveredFpBtcSk) ? bytesFromBase64(object.recoveredFpBtcSk) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.signer !== "") {
obj.signer = message.signer;
}
if (message.stakingTxHash !== "") {
obj.stakingTxHash = message.stakingTxHash;
}
if (message.recoveredFpBtcSk.length !== 0) {
obj.recoveredFpBtcSk = base64FromBytes(message.recoveredFpBtcSk);
}
return obj;
},
create(base) {
return exports.MsgSelectiveSlashingEvidence.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseMsgSelectiveSlashingEvidence();
message.signer = (_a = object.signer) !== null && _a !== void 0 ? _a : "";
message.stakingTxHash = (_b = object.stakingTxHash) !== null && _b !== void 0 ? _b : "";
message.recoveredFpBtcSk = (_c = object.recoveredFpBtcSk) !== null && _c !== void 0 ? _c : new Uint8Array(0);
return message;
},
};
function createBaseMsgSelectiveSlashingEvidenceResponse() {
return {};
}
exports.MsgSelectiveSlashingEvidenceResponse = {
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 = createBaseMsgSelectiveSlashingEvidenceResponse();
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.MsgSelectiveSlashingEvidenceResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgSelectiveSlashingEvidenceResponse();
return message;
},
};
function createBaseMsgUpdateParams() {
return { authority: "", params: undefined };
}
exports.MsgUpdateParams = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.authority !== "") {
writer.uint32(10).string(message.authority);
}
if (message.params !== undefined) {
params_1.Params.encode(message.params, 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 = createBaseMsgUpdateParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.authority = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
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 {
authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.authority !== "") {
obj.authority = message.authority;
}
if (message.params !== undefined) {
obj.params = params_1.Params.toJSON(message.params);
}
return obj;
},
create(base) {
return exports.MsgUpdateParams.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseMsgUpdateParams();
message.authority = (_a = object.authority) !== null && _a !== void 0 ? _a : "";
message.params = (object.params !== undefined && object.params !== null)
? params_1.Params.fromPartial(object.params)
: undefined;
return message;
},
};
function createBaseMsgUpdateParamsResponse() {
return {};
}
exports.MsgUpdateParamsResponse = {
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 = createBaseMsgUpdateParamsResponse();
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.MsgUpdateParamsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBaseMsgUpdateParamsResponse();
return message;
},
};
exports.MsgServiceName = "babylon.btcstaking.v1.Msg";
class MsgClientImpl {
constructor(rpc, opts) {
this.service = (opts === null || opts === void 0 ? void 0 : opts.service) || exports.MsgServiceName;
this.rpc = rpc;
this.CreateFinalityProvider = this.CreateFinalityProvider.bind(this);
this.EditFinalityProvider = this.EditFinalityProvider.bind(this);
this.CreateBTCDelegation = this.CreateBTCDelegation.bind(this);
this.AddBTCDelegationInclusionProof = this.AddBTCDelegationInclusionProof.bind(this);
this.AddCovenantSigs = this.AddCovenantSigs.bind(this);
this.BTCUndelegate = this.BTCUndelegate.bind(this);
this.SelectiveSlashingEvidence = this.SelectiveSlashingEvidence.bind(this);
this.UpdateParams = this.UpdateParams.bind(this);
}
CreateFinalityProvider(request) {
const data = exports.MsgCreateFinalityProvider.encode(request).finish();
const promise = this.rpc.request(this.service, "CreateFinalityProvider", data);
return promise.then((data) => exports.MsgCreateFinalityProviderResponse.decode(new wire_1.BinaryReader(data)));
}
EditFinalityProvider(request) {
const data = exports.MsgEditFinalityProvider.encode(request).finish();
const promise = this.rpc.request(this.service, "EditFinalityProvider", data);
return promise.then((data) => exports.MsgEditFinalityProviderResponse.decode(new wire_1.BinaryReader(data)));
}
CreateBTCDelegation(request) {
const data = exports.MsgCreateBTCDelegation.encode(request).finish();
const promise = this.rpc.request(this.service, "CreateBTCDelegation", data);
return promise.then((data) => exports.MsgCreateBTCDelegationResponse.decode(new wire_1.BinaryReader(data)));
}
AddBTCDelegationInclusionProof(request) {
const data = exports.MsgAddBTCDelegationInclusionProof.encode(request).finish();
const promise = this.rpc.request(this.service, "AddBTCDelegationInclusionProof", data);
return promise.then((data) => exports.MsgAddBTCDelegationInclusionProofResponse.decode(new wire_1.BinaryReader(data)));
}
AddCovenantSigs(request) {
const data = exports.MsgAddCovenantSigs.encode(request).finish();
const promise = this.rpc.request(this.service, "AddCovenantSigs", data);
return promise.then((data) => exports.MsgAddCovenantSigsResponse.decode(new wire_1.BinaryReader(data)));
}
BTCUndelegate(request) {
const data = exports.MsgBTCUndelegate.encode(request).finish();
const promise = this.rpc.request(this.service, "BTCUndelegate", data);
return promise.then((data) => exports.MsgBTCUndelegateResponse.decode(new wire_1.BinaryReader(data)));
}
SelectiveSlashingEvidence(request) {
const data = exports.MsgSelectiveSlashingEvidence.encode(request).finish();
const promise = this.rpc.request(this.service, "SelectiveSlashingEvidence", data);
return promise.then((data) => exports.MsgSelectiveSlashingEvidenceResponse.decode(new wire_1.BinaryReader(data)));
}
UpdateParams(request) {
const data = exports.MsgUpdateParams.encode(request).finish();
const promise = this.rpc.request(this.service, "UpdateParams", data);
return promise.then((data) => exports.MsgUpdateParamsResponse.decode(new wire_1.BinaryReader(data)));
}
}
exports.MsgClientImpl = MsgClientImpl;
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 longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
function isSet(value) {
return value !== null && value !== undefined;
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!