PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@babylonlabs-io/babylon-proto-ts/dist/generated/babylon/btcstaking/v1
Просмотр файла: pop.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/pop.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.BIP322Sig = exports.ProofOfPossessionBTC = exports.BTCSigType = exports.protobufPackage = void 0;
exports.bTCSigTypeFromJSON = bTCSigTypeFromJSON;
exports.bTCSigTypeToJSON = bTCSigTypeToJSON;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
exports.protobufPackage = "babylon.btcstaking.v1";
/** BTCSigType indicates the type of btc_sig in a pop */
var BTCSigType;
(function (BTCSigType) {
/** BIP340 - BIP340 means the btc_sig will follow the BIP-340 encoding */
BTCSigType[BTCSigType["BIP340"] = 0] = "BIP340";
/** BIP322 - BIP322 means the btc_sig will follow the BIP-322 encoding */
BTCSigType[BTCSigType["BIP322"] = 1] = "BIP322";
/**
* ECDSA - ECDSA means the btc_sig will follow the ECDSA encoding
* ref: https://github.com/okx/js-wallet-sdk/blob/a57c2acbe6ce917c0aa4e951d96c4e562ad58444/packages/coin-bitcoin/src/BtcWallet.ts#L331
*/
BTCSigType[BTCSigType["ECDSA"] = 2] = "ECDSA";
BTCSigType[BTCSigType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(BTCSigType || (exports.BTCSigType = BTCSigType = {}));
function bTCSigTypeFromJSON(object) {
switch (object) {
case 0:
case "BIP340":
return BTCSigType.BIP340;
case 1:
case "BIP322":
return BTCSigType.BIP322;
case 2:
case "ECDSA":
return BTCSigType.ECDSA;
case -1:
case "UNRECOGNIZED":
default:
return BTCSigType.UNRECOGNIZED;
}
}
function bTCSigTypeToJSON(object) {
switch (object) {
case BTCSigType.BIP340:
return "BIP340";
case BTCSigType.BIP322:
return "BIP322";
case BTCSigType.ECDSA:
return "ECDSA";
case BTCSigType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseProofOfPossessionBTC() {
return { btcSigType: 0, btcSig: new Uint8Array(0) };
}
exports.ProofOfPossessionBTC = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.btcSigType !== 0) {
writer.uint32(8).int32(message.btcSigType);
}
if (message.btcSig.length !== 0) {
writer.uint32(18).bytes(message.btcSig);
}
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 = createBaseProofOfPossessionBTC();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.btcSigType = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.btcSig = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
btcSigType: isSet(object.btcSigType) ? bTCSigTypeFromJSON(object.btcSigType) : 0,
btcSig: isSet(object.btcSig) ? bytesFromBase64(object.btcSig) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.btcSigType !== 0) {
obj.btcSigType = bTCSigTypeToJSON(message.btcSigType);
}
if (message.btcSig.length !== 0) {
obj.btcSig = base64FromBytes(message.btcSig);
}
return obj;
},
create(base) {
return exports.ProofOfPossessionBTC.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseProofOfPossessionBTC();
message.btcSigType = (_a = object.btcSigType) !== null && _a !== void 0 ? _a : 0;
message.btcSig = (_b = object.btcSig) !== null && _b !== void 0 ? _b : new Uint8Array(0);
return message;
},
};
function createBaseBIP322Sig() {
return { address: "", sig: new Uint8Array(0) };
}
exports.BIP322Sig = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.address !== "") {
writer.uint32(10).string(message.address);
}
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 = createBaseBIP322Sig();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.address = reader.string();
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 {
address: isSet(object.address) ? globalThis.String(object.address) : "",
sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array(0),
};
},
toJSON(message) {
const obj = {};
if (message.address !== "") {
obj.address = message.address;
}
if (message.sig.length !== 0) {
obj.sig = base64FromBytes(message.sig);
}
return obj;
},
create(base) {
return exports.BIP322Sig.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseBIP322Sig();
message.address = (_a = object.address) !== null && _a !== void 0 ? _a : "";
message.sig = (_b = object.sig) !== null && _b !== void 0 ? _b : 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 isSet(value) {
return value !== null && value !== undefined;
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!