PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@babylonlabs-io/babylon-proto-ts/dist/generated/babylon/btcstaking/v1
Просмотр файла: btcstaking.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/btcstaking.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.InclusionProof = exports.SelectiveSlashingEvidence = exports.CovenantAdaptorSignatures = exports.SignatureInfo = exports.BTCDelegatorDelegationIndex = exports.BTCDelegatorDelegations = exports.BTCUndelegation = exports.DelegatorUnbondingInfo = exports.BTCDelegation = exports.FinalityProviderWithMeta = exports.FinalityProvider = exports.BTCDelegationStatus = exports.protobufPackage = void 0;
exports.bTCDelegationStatusFromJSON = bTCDelegationStatusFromJSON;
exports.bTCDelegationStatusToJSON = bTCDelegationStatusToJSON;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const staking_1 = require("../../../cosmos/staking/v1beta1/staking");
const btccheckpoint_1 = require("../../btccheckpoint/v1/btccheckpoint");
const pop_1 = require("./pop");
exports.protobufPackage = "babylon.btcstaking.v1";
/**
* BTCDelegationStatus is the status of a delegation.
* There are two possible valid state transition paths for a BTC delegation:
* - PENDING -> VERIFIED -> ACTIVE -> UNBONDED -> EXPIRED
* - PENDING -> VERIFIED -> ACTIVE -> UNBONDED/EXPIRED
* and one invalid state transition path:
* - PENDING -> VERIFIED -> UNBONDED i.e the staker unbonded before
* activating delegation on Babylon chain.
* In valid transition paths, the delegation becomes UNBONDED when:
* - either the staking transaction timelock expires
* - or the staker requests early undelegation through MsgBTCUndelegate message.
*/
var BTCDelegationStatus;
(function (BTCDelegationStatus) {
/** PENDING - PENDING defines a delegation that is waiting for covenant signatures. */
BTCDelegationStatus[BTCDelegationStatus["PENDING"] = 0] = "PENDING";
/**
* VERIFIED - VERIFIED defines a delegation that has covenant signatures but is not yet
* included in the BTC chain.
*/
BTCDelegationStatus[BTCDelegationStatus["VERIFIED"] = 1] = "VERIFIED";
/** ACTIVE - ACTIVE defines a delegation that has voting power */
BTCDelegationStatus[BTCDelegationStatus["ACTIVE"] = 2] = "ACTIVE";
/**
* UNBONDED - UNBONDED defines a delegation no longer has voting power
* by receiving unbonding tx with signatures from staker and covenant committee
*/
BTCDelegationStatus[BTCDelegationStatus["UNBONDED"] = 3] = "UNBONDED";
/**
* EXPIRED - EXPIRED defines a delegation no longer has voting power
* for reaching the end of staking transaction timelock
*/
BTCDelegationStatus[BTCDelegationStatus["EXPIRED"] = 4] = "EXPIRED";
/** ANY - ANY is any of the above status */
BTCDelegationStatus[BTCDelegationStatus["ANY"] = 5] = "ANY";
BTCDelegationStatus[BTCDelegationStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(BTCDelegationStatus || (exports.BTCDelegationStatus = BTCDelegationStatus = {}));
function bTCDelegationStatusFromJSON(object) {
switch (object) {
case 0:
case "PENDING":
return BTCDelegationStatus.PENDING;
case 1:
case "VERIFIED":
return BTCDelegationStatus.VERIFIED;
case 2:
case "ACTIVE":
return BTCDelegationStatus.ACTIVE;
case 3:
case "UNBONDED":
return BTCDelegationStatus.UNBONDED;
case 4:
case "EXPIRED":
return BTCDelegationStatus.EXPIRED;
case 5:
case "ANY":
return BTCDelegationStatus.ANY;
case -1:
case "UNRECOGNIZED":
default:
return BTCDelegationStatus.UNRECOGNIZED;
}
}
function bTCDelegationStatusToJSON(object) {
switch (object) {
case BTCDelegationStatus.PENDING:
return "PENDING";
case BTCDelegationStatus.VERIFIED:
return "VERIFIED";
case BTCDelegationStatus.ACTIVE:
return "ACTIVE";
case BTCDelegationStatus.UNBONDED:
return "UNBONDED";
case BTCDelegationStatus.EXPIRED:
return "EXPIRED";
case BTCDelegationStatus.ANY:
return "ANY";
case BTCDelegationStatus.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseFinalityProvider() {
return {
addr: "",
description: undefined,
commission: "",
btcPk: new Uint8Array(0),
pop: undefined,
slashedBabylonHeight: 0,
slashedBtcHeight: 0,
jailed: false,
highestVotedHeight: 0,
};
}
exports.FinalityProvider = {
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();
}
if (message.slashedBabylonHeight !== 0) {
writer.uint32(48).uint64(message.slashedBabylonHeight);
}
if (message.slashedBtcHeight !== 0) {
writer.uint32(56).uint32(message.slashedBtcHeight);
}
if (message.jailed !== false) {
writer.uint32(64).bool(message.jailed);
}
if (message.highestVotedHeight !== 0) {
writer.uint32(72).uint32(message.highestVotedHeight);
}
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 = createBaseFinalityProvider();
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;
}
case 6: {
if (tag !== 48) {
break;
}
message.slashedBabylonHeight = longToNumber(reader.uint64());
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.slashedBtcHeight = reader.uint32();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.jailed = reader.bool();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.highestVotedHeight = 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,
slashedBabylonHeight: isSet(object.slashedBabylonHeight) ? globalThis.Number(object.slashedBabylonHeight) : 0,
slashedBtcHeight: isSet(object.slashedBtcHeight) ? globalThis.Number(object.slashedBtcHeight) : 0,
jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false,
highestVotedHeight: isSet(object.highestVotedHeight) ? globalThis.Number(object.highestVotedHeight) : 0,
};
},
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);
}
if (message.slashedBabylonHeight !== 0) {
obj.slashedBabylonHeight = Math.round(message.slashedBabylonHeight);
}
if (message.slashedBtcHeight !== 0) {
obj.slashedBtcHeight = Math.round(message.slashedBtcHeight);
}
if (message.jailed !== false) {
obj.jailed = message.jailed;
}
if (message.highestVotedHeight !== 0) {
obj.highestVotedHeight = Math.round(message.highestVotedHeight);
}
return obj;
},
create(base) {
return exports.FinalityProvider.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = createBaseFinalityProvider();
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;
message.slashedBabylonHeight = (_d = object.slashedBabylonHeight) !== null && _d !== void 0 ? _d : 0;
message.slashedBtcHeight = (_e = object.slashedBtcHeight) !== null && _e !== void 0 ? _e : 0;
message.jailed = (_f = object.jailed) !== null && _f !== void 0 ? _f : false;
message.highestVotedHeight = (_g = object.highestVotedHeight) !== null && _g !== void 0 ? _g : 0;
return message;
},
};
function createBaseFinalityProviderWithMeta() {
return {
btcPk: new Uint8Array(0),
height: 0,
votingPower: 0,
slashedBabylonHeight: 0,
slashedBtcHeight: 0,
jailed: false,
highestVotedHeight: 0,
};
}
exports.FinalityProviderWithMeta = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.btcPk.length !== 0) {
writer.uint32(10).bytes(message.btcPk);
}
if (message.height !== 0) {
writer.uint32(16).uint64(message.height);
}
if (message.votingPower !== 0) {
writer.uint32(24).uint64(message.votingPower);
}
if (message.slashedBabylonHeight !== 0) {
writer.uint32(32).uint64(message.slashedBabylonHeight);
}
if (message.slashedBtcHeight !== 0) {
writer.uint32(40).uint32(message.slashedBtcHeight);
}
if (message.jailed !== false) {
writer.uint32(48).bool(message.jailed);
}
if (message.highestVotedHeight !== 0) {
writer.uint32(56).uint32(message.highestVotedHeight);
}
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 = createBaseFinalityProviderWithMeta();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.btcPk = reader.bytes();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.height = longToNumber(reader.uint64());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.votingPower = longToNumber(reader.uint64());
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.slashedBabylonHeight = longToNumber(reader.uint64());
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.slashedBtcHeight = reader.uint32();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.jailed = reader.bool();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.highestVotedHeight = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
btcPk: isSet(object.btcPk) ? bytesFromBase64(object.btcPk) : new Uint8Array(0),
height: isSet(object.height) ? globalThis.Number(object.height) : 0,
votingPower: isSet(object.votingPower) ? globalThis.Number(object.votingPower) : 0,
slashedBabylonHeight: isSet(object.slashedBabylonHeight) ? globalThis.Number(object.slashedBabylonHeight) : 0,
slashedBtcHeight: isSet(object.slashedBtcHeight) ? globalThis.Number(object.slashedBtcHeight) : 0,
jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false,
highestVotedHeight: isSet(object.highestVotedHeight) ? globalThis.Number(object.highestVotedHeight) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.btcPk.length !== 0) {
obj.btcPk = base64FromBytes(message.btcPk);
}
if (message.height !== 0) {
obj.height = Math.round(message.height);
}
if (message.votingPower !== 0) {
obj.votingPower = Math.round(message.votingPower);
}
if (message.slashedBabylonHeight !== 0) {
obj.slashedBabylonHeight = Math.round(message.slashedBabylonHeight);
}
if (message.slashedBtcHeight !== 0) {
obj.slashedBtcHeight = Math.round(message.slashedBtcHeight);
}
if (message.jailed !== false) {
obj.jailed = message.jailed;
}
if (message.highestVotedHeight !== 0) {
obj.highestVotedHeight = Math.round(message.highestVotedHeight);
}
return obj;
},
create(base) {
return exports.FinalityProviderWithMeta.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = createBaseFinalityProviderWithMeta();
message.btcPk = (_a = object.btcPk) !== null && _a !== void 0 ? _a : new Uint8Array(0);
message.height = (_b = object.height) !== null && _b !== void 0 ? _b : 0;
message.votingPower = (_c = object.votingPower) !== null && _c !== void 0 ? _c : 0;
message.slashedBabylonHeight = (_d = object.slashedBabylonHeight) !== null && _d !== void 0 ? _d : 0;
message.slashedBtcHeight = (_e = object.slashedBtcHeight) !== null && _e !== void 0 ? _e : 0;
message.jailed = (_f = object.jailed) !== null && _f !== void 0 ? _f : false;
message.highestVotedHeight = (_g = object.highestVotedHeight) !== null && _g !== void 0 ? _g : 0;
return message;
},
};
function createBaseBTCDelegation() {
return {
stakerAddr: "",
btcPk: new Uint8Array(0),
pop: undefined,
fpBtcPkList: [],
stakingTime: 0,
startHeight: 0,
endHeight: 0,
totalSat: 0,
stakingTx: new Uint8Array(0),
stakingOutputIdx: 0,
slashingTx: new Uint8Array(0),
delegatorSig: new Uint8Array(0),
covenantSigs: [],
unbondingTime: 0,
btcUndelegation: undefined,
paramsVersion: 0,
btcTipHeight: 0,
};
}
exports.BTCDelegation = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.stakerAddr !== "") {
writer.uint32(10).string(message.stakerAddr);
}
if (message.btcPk.length !== 0) {
writer.uint32(18).bytes(message.btcPk);
}
if (message.pop !== undefined) {
pop_1.ProofOfPossessionBTC.encode(message.pop, writer.uint32(26).fork()).join();
}
for (const v of message.fpBtcPkList) {
writer.uint32(34).bytes(v);
}
if (message.stakingTime !== 0) {
writer.uint32(40).uint32(message.stakingTime);
}
if (message.startHeight !== 0) {
writer.uint32(48).uint32(message.startHeight);
}
if (message.endHeight !== 0) {
writer.uint32(56).uint32(message.endHeight);
}
if (message.totalSat !== 0) {
writer.uint32(64).uint64(message.totalSat);
}
if (message.stakingTx.length !== 0) {
writer.uint32(74).bytes(message.stakingTx);
}
if (message.stakingOutputIdx !== 0) {
writer.uint32(80).uint32(message.stakingOutputIdx);
}
if (message.slashingTx.length !== 0) {
writer.uint32(90).bytes(message.slashingTx);
}
if (message.delegatorSig.length !== 0) {
writer.uint32(98).bytes(message.delegatorSig);
}
for (const v of message.covenantSigs) {
exports.CovenantAdaptorSignatures.encode(v, writer.uint32(106).fork()).join();
}
if (message.unbondingTime !== 0) {
writer.uint32(112).uint32(message.unbondingTime);
}
if (message.btcUndelegation !== undefined) {
exports.BTCUndelegation.encode(message.btcUndelegation, writer.uint32(122).fork()).join();
}
if (message.paramsVersion !== 0) {
writer.uint32(128).uint32(message.paramsVersion);
}
if (message.btcTipHeight !== 0) {
writer.uint32(136).uint32(message.btcTipHeight);
}
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 = createBaseBTCDelegation();
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.btcPk = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.pop = pop_1.ProofOfPossessionBTC.decode(reader, reader.uint32());
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.startHeight = reader.uint32();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.endHeight = reader.uint32();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.totalSat = longToNumber(reader.uint64());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.stakingTx = reader.bytes();
continue;
}
case 10: {
if (tag !== 80) {
break;
}
message.stakingOutputIdx = reader.uint32();
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.slashingTx = reader.bytes();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.delegatorSig = reader.bytes();
continue;
}
case 13: {
if (tag !== 106) {
break;
}
message.covenantSigs.push(exports.CovenantAdaptorSignatures.decode(reader, reader.uint32()));
continue;
}
case 14: {
if (tag !== 112) {
break;
}
message.unbondingTime = reader.uint32();
continue;
}
case 15: {
if (tag !== 122) {
break;
}
message.btcUndelegation = exports.BTCUndelegation.decode(reader, reader.uint32());
continue;
}
case 16: {
if (tag !== 128) {
break;
}
message.paramsVersion = reader.uint32();
continue;
}
case 17: {
if (tag !== 136) {
break;
}
message.btcTipHeight = reader.uint32();
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) : "",
btcPk: isSet(object.btcPk) ? bytesFromBase64(object.btcPk) : new Uint8Array(0),
pop: isSet(object.pop) ? pop_1.ProofOfPossessionBTC.fromJSON(object.pop) : undefined,
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,
startHeight: isSet(object.startHeight) ? globalThis.Number(object.startHeight) : 0,
endHeight: isSet(object.endHeight) ? globalThis.Number(object.endHeight) : 0,
totalSat: isSet(object.totalSat) ? globalThis.Number(object.totalSat) : 0,
stakingTx: isSet(object.stakingTx) ? bytesFromBase64(object.stakingTx) : new Uint8Array(0),
stakingOutputIdx: isSet(object.stakingOutputIdx) ? globalThis.Number(object.stakingOutputIdx) : 0,
slashingTx: isSet(object.slashingTx) ? bytesFromBase64(object.slashingTx) : new Uint8Array(0),
delegatorSig: isSet(object.delegatorSig) ? bytesFromBase64(object.delegatorSig) : new Uint8Array(0),
covenantSigs: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.covenantSigs)
? object.covenantSigs.map((e) => exports.CovenantAdaptorSignatures.fromJSON(e))
: [],
unbondingTime: isSet(object.unbondingTime) ? globalThis.Number(object.unbondingTime) : 0,
btcUndelegation: isSet(object.btcUndelegation) ? exports.BTCUndelegation.fromJSON(object.btcUndelegation) : undefined,
paramsVersion: isSet(object.paramsVersion) ? globalThis.Number(object.paramsVersion) : 0,
btcTipHeight: isSet(object.btcTipHeight) ? globalThis.Number(object.btcTipHeight) : 0,
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.stakerAddr !== "") {
obj.stakerAddr = message.stakerAddr;
}
if (message.btcPk.length !== 0) {
obj.btcPk = base64FromBytes(message.btcPk);
}
if (message.pop !== undefined) {
obj.pop = pop_1.ProofOfPossessionBTC.toJSON(message.pop);
}
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.startHeight !== 0) {
obj.startHeight = Math.round(message.startHeight);
}
if (message.endHeight !== 0) {
obj.endHeight = Math.round(message.endHeight);
}
if (message.totalSat !== 0) {
obj.totalSat = Math.round(message.totalSat);
}
if (message.stakingTx.length !== 0) {
obj.stakingTx = base64FromBytes(message.stakingTx);
}
if (message.stakingOutputIdx !== 0) {
obj.stakingOutputIdx = Math.round(message.stakingOutputIdx);
}
if (message.slashingTx.length !== 0) {
obj.slashingTx = base64FromBytes(message.slashingTx);
}
if (message.delegatorSig.length !== 0) {
obj.delegatorSig = base64FromBytes(message.delegatorSig);
}
if ((_b = message.covenantSigs) === null || _b === void 0 ? void 0 : _b.length) {
obj.covenantSigs = message.covenantSigs.map((e) => exports.CovenantAdaptorSignatures.toJSON(e));
}
if (message.unbondingTime !== 0) {
obj.unbondingTime = Math.round(message.unbondingTime);
}
if (message.btcUndelegation !== undefined) {
obj.btcUndelegation = exports.BTCUndelegation.toJSON(message.btcUndelegation);
}
if (message.paramsVersion !== 0) {
obj.paramsVersion = Math.round(message.paramsVersion);
}
if (message.btcTipHeight !== 0) {
obj.btcTipHeight = Math.round(message.btcTipHeight);
}
return obj;
},
create(base) {
return exports.BTCDelegation.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
const message = createBaseBTCDelegation();
message.stakerAddr = (_a = object.stakerAddr) !== null && _a !== void 0 ? _a : "";
message.btcPk = (_b = object.btcPk) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.pop = (object.pop !== undefined && object.pop !== null)
? pop_1.ProofOfPossessionBTC.fromPartial(object.pop)
: undefined;
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.startHeight = (_e = object.startHeight) !== null && _e !== void 0 ? _e : 0;
message.endHeight = (_f = object.endHeight) !== null && _f !== void 0 ? _f : 0;
message.totalSat = (_g = object.totalSat) !== null && _g !== void 0 ? _g : 0;
message.stakingTx = (_h = object.stakingTx) !== null && _h !== void 0 ? _h : new Uint8Array(0);
message.stakingOutputIdx = (_j = object.stakingOutputIdx) !== null && _j !== void 0 ? _j : 0;
message.slashingTx = (_k = object.slashingTx) !== null && _k !== void 0 ? _k : new Uint8Array(0);
message.delegatorSig = (_l = object.delegatorSig) !== null && _l !== void 0 ? _l : new Uint8Array(0);
message.covenantSigs = ((_m = object.covenantSigs) === null || _m === void 0 ? void 0 : _m.map((e) => exports.CovenantAdaptorSignatures.fromPartial(e))) || [];
message.unbondingTime = (_o = object.unbondingTime) !== null && _o !== void 0 ? _o : 0;
message.btcUndelegation = (object.btcUndelegation !== undefined && object.btcUndelegation !== null)
? exports.BTCUndelegation.fromPartial(object.btcUndelegation)
: undefined;
message.paramsVersion = (_p = object.paramsVersion) !== null && _p !== void 0 ? _p : 0;
message.btcTipHeight = (_q = object.btcTipHeight) !== null && _q !== void 0 ? _q : 0;
return message;
},
};
function createBaseDelegatorUnbondingInfo() {
return { spendStakeTx: new Uint8Array(0) };
}
exports.DelegatorUnbondingInfo = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.spendStakeTx.length !== 0) {
writer.uint32(10).bytes(message.spendStakeTx);
}
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 = createBaseDelegatorUnbondingInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.spendStakeTx = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { spendStakeTx: isSet(object.spendStakeTx) ? bytesFromBase64(object.spendStakeTx) : new Uint8Array(0) };
},
toJSON(message) {
const obj = {};
if (message.spendStakeTx.length !== 0) {
obj.spendStakeTx = base64FromBytes(message.spendStakeTx);
}
return obj;
},
create(base) {
return exports.DelegatorUnbondingInfo.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseDelegatorUnbondingInfo();
message.spendStakeTx = (_a = object.spendStakeTx) !== null && _a !== void 0 ? _a : new Uint8Array(0);
return message;
},
};
function createBaseBTCUndelegation() {
return {
unbondingTx: new Uint8Array(0),
slashingTx: new Uint8Array(0),
delegatorSlashingSig: new Uint8Array(0),
covenantSlashingSigs: [],
covenantUnbondingSigList: [],
delegatorUnbondingInfo: undefined,
};
}
exports.BTCUndelegation = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.unbondingTx.length !== 0) {
writer.uint32(10).bytes(message.unbondingTx);
}
if (message.slashingTx.length !== 0) {
writer.uint32(18).bytes(message.slashingTx);
}
if (message.delegatorSlashingSig.length !== 0) {
writer.uint32(26).bytes(message.delegatorSlashingSig);
}
for (const v of message.covenantSlashingSigs) {
exports.CovenantAdaptorSignatures.encode(v, writer.uint32(34).fork()).join();
}
for (const v of message.covenantUnbondingSigList) {
exports.SignatureInfo.encode(v, writer.uint32(42).fork()).join();
}
if (message.delegatorUnbondingInfo !== undefined) {
exports.DelegatorUnbondingInfo.encode(message.delegatorUnbondingInfo, writer.uint32(50).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 = createBaseBTCUndelegation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.unbondingTx = reader.bytes();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.slashingTx = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.delegatorSlashingSig = reader.bytes();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.covenantSlashingSigs.push(exports.CovenantAdaptorSignatures.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.covenantUnbondingSigList.push(exports.SignatureInfo.decode(reader, reader.uint32()));
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.delegatorUnbondingInfo = exports.DelegatorUnbondingInfo.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
unbondingTx: isSet(object.unbondingTx) ? bytesFromBase64(object.unbondingTx) : new Uint8Array(0),
slashingTx: isSet(object.slashingTx) ? bytesFromBase64(object.slashingTx) : new Uint8Array(0),
delegatorSlashingSig: isSet(object.delegatorSlashingSig)
? bytesFromBase64(object.delegatorSlashingSig)
: new Uint8Array(0),
covenantSlashingSigs: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.covenantSlashingSigs)
? object.covenantSlashingSigs.map((e) => exports.CovenantAdaptorSignatures.fromJSON(e))
: [],
covenantUnbondingSigList: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.covenantUnbondingSigList)
? object.covenantUnbondingSigList.map((e) => exports.SignatureInfo.fromJSON(e))
: [],
delegatorUnbondingInfo: isSet(object.delegatorUnbondingInfo)
? exports.DelegatorUnbondingInfo.fromJSON(object.delegatorUnbondingInfo)
: undefined,
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.unbondingTx.length !== 0) {
obj.unbondingTx = base64FromBytes(message.unbondingTx);
}
if (message.slashingTx.length !== 0) {
obj.slashingTx = base64FromBytes(message.slashingTx);
}
if (message.delegatorSlashingSig.length !== 0) {
obj.delegatorSlashingSig = base64FromBytes(message.delegatorSlashingSig);
}
if ((_a = message.covenantSlashingSigs) === null || _a === void 0 ? void 0 : _a.length) {
obj.covenantSlashingSigs = message.covenantSlashingSigs.map((e) => exports.CovenantAdaptorSignatures.toJSON(e));
}
if ((_b = message.covenantUnbondingSigList) === null || _b === void 0 ? void 0 : _b.length) {
obj.covenantUnbondingSigList = message.covenantUnbondingSigList.map((e) => exports.SignatureInfo.toJSON(e));
}
if (message.delegatorUnbondingInfo !== undefined) {
obj.delegatorUnbondingInfo = exports.DelegatorUnbondingInfo.toJSON(message.delegatorUnbondingInfo);
}
return obj;
},
create(base) {
return exports.BTCUndelegation.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseBTCUndelegation();
message.unbondingTx = (_a = object.unbondingTx) !== null && _a !== void 0 ? _a : new Uint8Array(0);
message.slashingTx = (_b = object.slashingTx) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.delegatorSlashingSig = (_c = object.delegatorSlashingSig) !== null && _c !== void 0 ? _c : new Uint8Array(0);
message.covenantSlashingSigs = ((_d = object.covenantSlashingSigs) === null || _d === void 0 ? void 0 : _d.map((e) => exports.CovenantAdaptorSignatures.fromPartial(e))) ||
[];
message.covenantUnbondingSigList = ((_e = object.covenantUnbondingSigList) === null || _e === void 0 ? void 0 : _e.map((e) => exports.SignatureInfo.fromPartial(e))) || [];
message.delegatorUnbondingInfo =
(object.delegatorUnbondingInfo !== undefined && object.delegatorUnbondingInfo !== null)
? exports.DelegatorUnbondingInfo.fromPartial(object.delegatorUnbondingInfo)
: undefined;
return message;
},
};
function createBaseBTCDelegatorDelegations() {
return { dels: [] };
}
exports.BTCDelegatorDelegations = {
encode(message, writer = new wire_1.BinaryWriter()) {
for (const v of message.dels) {
exports.BTCDelegation.encode(v, 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 = createBaseBTCDelegatorDelegations();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.dels.push(exports.BTCDelegation.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
dels: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.dels) ? object.dels.map((e) => exports.BTCDelegation.fromJSON(e)) : [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.dels) === null || _a === void 0 ? void 0 : _a.length) {
obj.dels = message.dels.map((e) => exports.BTCDelegation.toJSON(e));
}
return obj;
},
create(base) {
return exports.BTCDelegatorDelegations.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseBTCDelegatorDelegations();
message.dels = ((_a = object.dels) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BTCDelegation.fromPartial(e))) || [];
return message;
},
};
function createBaseBTCDelegatorDelegationIndex() {
return { stakingTxHashList: [] };
}
exports.BTCDelegatorDelegationIndex = {
encode(message, writer = new wire_1.BinaryWriter()) {
for (const v of message.stakingTxHashList) {
writer.uint32(10).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 = createBaseBTCDelegatorDelegationIndex();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.stakingTxHashList.push(reader.bytes());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
stakingTxHashList: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.stakingTxHashList)
? object.stakingTxHashList.map((e) => bytesFromBase64(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.stakingTxHashList) === null || _a === void 0 ? void 0 : _a.length) {
obj.stakingTxHashList = message.stakingTxHashList.map((e) => base64FromBytes(e));
}
return obj;
},
create(base) {
return exports.BTCDelegatorDelegationIndex.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseBTCDelegatorDelegationIndex();
message.stakingTxHashList = ((_a = object.stakingTxHashList) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function createBaseSignatureInfo() {
return { pk: new Uint8Array(0), sig: new Uint8Array(0) };
}
exports.SignatureInfo = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.pk.length !== 0) {
writer.uint32(10).bytes(message.pk);
}
if (message.sig.length !== 0) {
writer.uint32(18).bytes(message.sig);
}
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 = createBaseSignatureInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pk = reader.bytes();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.sig = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
pk: isSet(object.pk) ? bytesFromBase64(object.pk) : new Uint8Array(0),
sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.pk.length !== 0) {
obj.pk = base64FromBytes(message.pk);
}
if (message.sig.length !== 0) {
obj.sig = base64FromBytes(message.sig);
}
return obj;
},
create(base) {
return exports.SignatureInfo.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseSignatureInfo();
message.pk = (_a = object.pk) !== null && _a !== void 0 ? _a : new Uint8Array(0);
message.sig = (_b = object.sig) !== null && _b !== void 0 ? _b : new Uint8Array(0);
return message;
},
};
function createBaseCovenantAdaptorSignatures() {
return { covPk: new Uint8Array(0), adaptorSigs: [] };
}
exports.CovenantAdaptorSignatures = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.covPk.length !== 0) {
writer.uint32(10).bytes(message.covPk);
}
for (const v of message.adaptorSigs) {
writer.uint32(18).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 = createBaseCovenantAdaptorSignatures();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.covPk = reader.bytes();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.adaptorSigs.push(reader.bytes());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
covPk: isSet(object.covPk) ? bytesFromBase64(object.covPk) : new Uint8Array(0),
adaptorSigs: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.adaptorSigs)
? object.adaptorSigs.map((e) => bytesFromBase64(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.covPk.length !== 0) {
obj.covPk = base64FromBytes(message.covPk);
}
if ((_a = message.adaptorSigs) === null || _a === void 0 ? void 0 : _a.length) {
obj.adaptorSigs = message.adaptorSigs.map((e) => base64FromBytes(e));
}
return obj;
},
create(base) {
return exports.CovenantAdaptorSignatures.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseCovenantAdaptorSignatures();
message.covPk = (_a = object.covPk) !== null && _a !== void 0 ? _a : new Uint8Array(0);
message.adaptorSigs = ((_b = object.adaptorSigs) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
return message;
},
};
function createBaseSelectiveSlashingEvidence() {
return { stakingTxHash: "", fpBtcPk: new Uint8Array(0), recoveredFpBtcSk: new Uint8Array(0) };
}
exports.SelectiveSlashingEvidence = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.stakingTxHash !== "") {
writer.uint32(10).string(message.stakingTxHash);
}
if (message.fpBtcPk.length !== 0) {
writer.uint32(18).bytes(message.fpBtcPk);
}
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 = createBaseSelectiveSlashingEvidence();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.stakingTxHash = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.fpBtcPk = reader.bytes();
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 {
stakingTxHash: isSet(object.stakingTxHash) ? globalThis.String(object.stakingTxHash) : "",
fpBtcPk: isSet(object.fpBtcPk) ? bytesFromBase64(object.fpBtcPk) : new Uint8Array(0),
recoveredFpBtcSk: isSet(object.recoveredFpBtcSk) ? bytesFromBase64(object.recoveredFpBtcSk) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.stakingTxHash !== "") {
obj.stakingTxHash = message.stakingTxHash;
}
if (message.fpBtcPk.length !== 0) {
obj.fpBtcPk = base64FromBytes(message.fpBtcPk);
}
if (message.recoveredFpBtcSk.length !== 0) {
obj.recoveredFpBtcSk = base64FromBytes(message.recoveredFpBtcSk);
}
return obj;
},
create(base) {
return exports.SelectiveSlashingEvidence.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseSelectiveSlashingEvidence();
message.stakingTxHash = (_a = object.stakingTxHash) !== null && _a !== void 0 ? _a : "";
message.fpBtcPk = (_b = object.fpBtcPk) !== null && _b !== void 0 ? _b : new Uint8Array(0);
message.recoveredFpBtcSk = (_c = object.recoveredFpBtcSk) !== null && _c !== void 0 ? _c : new Uint8Array(0);
return message;
},
};
function createBaseInclusionProof() {
return { key: undefined, proof: new Uint8Array(0) };
}
exports.InclusionProof = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.key !== undefined) {
btccheckpoint_1.TransactionKey.encode(message.key, writer.uint32(10).fork()).join();
}
if (message.proof.length !== 0) {
writer.uint32(18).bytes(message.proof);
}
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 = createBaseInclusionProof();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = btccheckpoint_1.TransactionKey.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.proof = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
key: isSet(object.key) ? btccheckpoint_1.TransactionKey.fromJSON(object.key) : undefined,
proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.key !== undefined) {
obj.key = btccheckpoint_1.TransactionKey.toJSON(message.key);
}
if (message.proof.length !== 0) {
obj.proof = base64FromBytes(message.proof);
}
return obj;
},
create(base) {
return exports.InclusionProof.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseInclusionProof();
message.key = (object.key !== undefined && object.key !== null)
? btccheckpoint_1.TransactionKey.fromPartial(object.key)
: undefined;
message.proof = (_a = object.proof) !== null && _a !== void 0 ? _a : new Uint8Array(0);
return message;
},
};
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;
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!