UNPKG

@archwayhq/arch3-proto

Version:

Protobuf definitions and RPC clients for the Archway Network

141 lines 6.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenesisState = void 0; /* eslint-disable */ const tracking_1 = require("./tracking"); const binary_1 = require("../../../binary"); const helpers_1 = require("../../../helpers"); function createBaseGenesisState() { return { txInfoLastId: BigInt(0), txInfos: [], contractOpInfoLastId: BigInt(0), contractOpInfos: [] }; } exports.GenesisState = { typeUrl: "/archway.tracking.v1.GenesisState", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.txInfoLastId !== BigInt(0)) { writer.uint32(8).uint64(message.txInfoLastId); } for (const v of message.txInfos) { tracking_1.TxInfo.encode(v, writer.uint32(18).fork()).ldelim(); } if (message.contractOpInfoLastId !== BigInt(0)) { writer.uint32(24).uint64(message.contractOpInfoLastId); } for (const v of message.contractOpInfos) { tracking_1.ContractOperationInfo.encode(v, writer.uint32(34).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.txInfoLastId = reader.uint64(); break; case 2: message.txInfos.push(tracking_1.TxInfo.decode(reader, reader.uint32())); break; case 3: message.contractOpInfoLastId = reader.uint64(); break; case 4: message.contractOpInfos.push(tracking_1.ContractOperationInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { txInfoLastId: (0, helpers_1.isSet)(object.txInfoLastId) ? BigInt(object.txInfoLastId.toString()) : BigInt(0), txInfos: Array.isArray(object === null || object === void 0 ? void 0 : object.txInfos) ? object.txInfos.map((e) => tracking_1.TxInfo.fromJSON(e)) : [], contractOpInfoLastId: (0, helpers_1.isSet)(object.contractOpInfoLastId) ? BigInt(object.contractOpInfoLastId.toString()) : BigInt(0), contractOpInfos: Array.isArray(object === null || object === void 0 ? void 0 : object.contractOpInfos) ? object.contractOpInfos.map((e) => tracking_1.ContractOperationInfo.fromJSON(e)) : [] }; }, toJSON(message) { const obj = {}; message.txInfoLastId !== undefined && (obj.txInfoLastId = (message.txInfoLastId || BigInt(0)).toString()); if (message.txInfos) { obj.txInfos = message.txInfos.map(e => e ? tracking_1.TxInfo.toJSON(e) : undefined); } else { obj.txInfos = []; } message.contractOpInfoLastId !== undefined && (obj.contractOpInfoLastId = (message.contractOpInfoLastId || BigInt(0)).toString()); if (message.contractOpInfos) { obj.contractOpInfos = message.contractOpInfos.map(e => e ? tracking_1.ContractOperationInfo.toJSON(e) : undefined); } else { obj.contractOpInfos = []; } return obj; }, fromPartial(object) { var _a, _b; const message = createBaseGenesisState(); message.txInfoLastId = object.txInfoLastId !== undefined && object.txInfoLastId !== null ? BigInt(object.txInfoLastId.toString()) : BigInt(0); message.txInfos = ((_a = object.txInfos) === null || _a === void 0 ? void 0 : _a.map(e => tracking_1.TxInfo.fromPartial(e))) || []; message.contractOpInfoLastId = object.contractOpInfoLastId !== undefined && object.contractOpInfoLastId !== null ? BigInt(object.contractOpInfoLastId.toString()) : BigInt(0); message.contractOpInfos = ((_b = object.contractOpInfos) === null || _b === void 0 ? void 0 : _b.map(e => tracking_1.ContractOperationInfo.fromPartial(e))) || []; return message; }, fromAmino(object) { var _a, _b; const message = createBaseGenesisState(); if (object.tx_info_last_id !== undefined && object.tx_info_last_id !== null) { message.txInfoLastId = BigInt(object.tx_info_last_id); } message.txInfos = ((_a = object.tx_infos) === null || _a === void 0 ? void 0 : _a.map(e => tracking_1.TxInfo.fromAmino(e))) || []; if (object.contract_op_info_last_id !== undefined && object.contract_op_info_last_id !== null) { message.contractOpInfoLastId = BigInt(object.contract_op_info_last_id); } message.contractOpInfos = ((_b = object.contract_op_infos) === null || _b === void 0 ? void 0 : _b.map(e => tracking_1.ContractOperationInfo.fromAmino(e))) || []; return message; }, toAmino(message) { const obj = {}; obj.tx_info_last_id = message.txInfoLastId ? message.txInfoLastId.toString() : undefined; if (message.txInfos) { obj.tx_infos = message.txInfos.map(e => e ? tracking_1.TxInfo.toAmino(e) : undefined); } else { obj.tx_infos = []; } obj.contract_op_info_last_id = message.contractOpInfoLastId ? message.contractOpInfoLastId.toString() : undefined; if (message.contractOpInfos) { obj.contract_op_infos = message.contractOpInfos.map(e => e ? tracking_1.ContractOperationInfo.toAmino(e) : undefined); } else { obj.contract_op_infos = []; } return obj; }, fromAminoMsg(object) { return exports.GenesisState.fromAmino(object.value); }, fromProtoMsg(message) { return exports.GenesisState.decode(message.value); }, toProto(message) { return exports.GenesisState.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/archway.tracking.v1.GenesisState", value: exports.GenesisState.encode(message).finish() }; } }; //# sourceMappingURL=genesis.js.map