"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenesisState = exports.AuthenticatorData = void 0;
const models_1 = require("./models");
const accountplus_1 = require("./accountplus");
const params_1 = require("./params");
const _m0 = __importStar(require("protobufjs/minimal"));
const helpers_1 = require("../../helpers");
function createBaseAuthenticatorData() {
    return {
        address: "",
        authenticators: []
    };
}
exports.AuthenticatorData = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.address !== "") {
            writer.uint32(10).string(message.address);
        }
        for (const v of message.authenticators) {
            models_1.AccountAuthenticator.encode(v, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAuthenticatorData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.address = reader.string();
                    break;
                case 2:
                    message.authenticators.push(models_1.AccountAuthenticator.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a, _b;
        const message = createBaseAuthenticatorData();
        message.address = (_a = object.address) !== null && _a !== void 0 ? _a : "";
        message.authenticators = ((_b = object.authenticators) === null || _b === void 0 ? void 0 : _b.map(e => models_1.AccountAuthenticator.fromPartial(e))) || [];
        return message;
    }
};
function createBaseGenesisState() {
    return {
        accounts: [],
        params: undefined,
        nextAuthenticatorId: helpers_1.Long.UZERO,
        authenticatorData: []
    };
}
exports.GenesisState = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.accounts) {
            accountplus_1.AccountState.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.params !== undefined) {
            params_1.Params.encode(message.params, writer.uint32(18).fork()).ldelim();
        }
        if (!message.nextAuthenticatorId.isZero()) {
            writer.uint32(24).uint64(message.nextAuthenticatorId);
        }
        for (const v of message.authenticatorData) {
            exports.AuthenticatorData.encode(v, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.accounts.push(accountplus_1.AccountState.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.params = params_1.Params.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.nextAuthenticatorId = reader.uint64();
                    break;
                case 4:
                    message.authenticatorData.push(exports.AuthenticatorData.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a, _b;
        const message = createBaseGenesisState();
        message.accounts = ((_a = object.accounts) === null || _a === void 0 ? void 0 : _a.map(e => accountplus_1.AccountState.fromPartial(e))) || [];
        message.params = object.params !== undefined && object.params !== null ? params_1.Params.fromPartial(object.params) : undefined;
        message.nextAuthenticatorId = object.nextAuthenticatorId !== undefined && object.nextAuthenticatorId !== null ? helpers_1.Long.fromValue(object.nextAuthenticatorId) : helpers_1.Long.UZERO;
        message.authenticatorData = ((_b = object.authenticatorData) === null || _b === void 0 ? void 0 : _b.map(e => exports.AuthenticatorData.fromPartial(e))) || [];
        return message;
    }
};
//# sourceMappingURL=data:application/json;base64, 