"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenesisState = exports.AuthenticatorData = void 0;
//@ts-nocheck
const models_1 = require("./models");
const params_1 = require("./params");
const binary_1 = require("../../../binary");
const registry_1 = require("../../../registry");
function createBaseAuthenticatorData() {
return {
address: "",
authenticators: []
};
}
exports.AuthenticatorData = {
typeUrl: "/osmosis.smartaccount.v1beta1.AuthenticatorData",
aminoType: "osmosis/smartaccount/authenticator-data",
is(o) {
return o && (o.$typeUrl === exports.AuthenticatorData.typeUrl || typeof o.address === "string" && Array.isArray(o.authenticators) && (!o.authenticators.length || models_1.AccountAuthenticator.is(o.authenticators[0])));
},
isSDK(o) {
return o && (o.$typeUrl === exports.AuthenticatorData.typeUrl || typeof o.address === "string" && Array.isArray(o.authenticators) && (!o.authenticators.length || models_1.AccountAuthenticator.isSDK(o.authenticators[0])));
},
isAmino(o) {
return o && (o.$typeUrl === exports.AuthenticatorData.typeUrl || typeof o.address === "string" && Array.isArray(o.authenticators) && (!o.authenticators.length || models_1.AccountAuthenticator.isAmino(o.authenticators[0])));
},
encode(message, writer = binary_1.BinaryWriter.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 binary_1.BinaryReader ? input : new binary_1.BinaryReader(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) {
const message = createBaseAuthenticatorData();
message.address = object.address ?? "";
message.authenticators = object.authenticators?.map(e => models_1.AccountAuthenticator.fromPartial(e)) || [];
return message;
},
fromAmino(object) {
const message = createBaseAuthenticatorData();
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
}
message.authenticators = object.authenticators?.map(e => models_1.AccountAuthenticator.fromAmino(e)) || [];
return message;
},
toAmino(message) {
const obj = {};
obj.address = message.address === "" ? undefined : message.address;
if (message.authenticators) {
obj.authenticators = message.authenticators.map(e => e ? models_1.AccountAuthenticator.toAmino(e) : undefined);
}
else {
obj.authenticators = message.authenticators;
}
return obj;
},
fromAminoMsg(object) {
return exports.AuthenticatorData.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "osmosis/smartaccount/authenticator-data",
value: exports.AuthenticatorData.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.AuthenticatorData.decode(message.value);
},
toProto(message) {
return exports.AuthenticatorData.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/osmosis.smartaccount.v1beta1.AuthenticatorData",
value: exports.AuthenticatorData.encode(message).finish()
};
}
};
registry_1.GlobalDecoderRegistry.register(exports.AuthenticatorData.typeUrl, exports.AuthenticatorData);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.AuthenticatorData.aminoType, exports.AuthenticatorData.typeUrl);
function createBaseGenesisState() {
return {
params: params_1.Params.fromPartial({}),
nextAuthenticatorId: BigInt(0),
authenticatorData: []
};
}
exports.GenesisState = {
typeUrl: "/osmosis.smartaccount.v1beta1.GenesisState",
aminoType: "osmosis/smartaccount/genesis-state",
is(o) {
return o && (o.$typeUrl === exports.GenesisState.typeUrl || params_1.Params.is(o.params) && typeof o.nextAuthenticatorId === "bigint" && Array.isArray(o.authenticatorData) && (!o.authenticatorData.length || exports.AuthenticatorData.is(o.authenticatorData[0])));
},
isSDK(o) {
return o && (o.$typeUrl === exports.GenesisState.typeUrl || params_1.Params.isSDK(o.params) && typeof o.next_authenticator_id === "bigint" && Array.isArray(o.authenticator_data) && (!o.authenticator_data.length || exports.AuthenticatorData.isSDK(o.authenticator_data[0])));
},
isAmino(o) {
return o && (o.$typeUrl === exports.GenesisState.typeUrl || params_1.Params.isAmino(o.params) && typeof o.next_authenticator_id === "bigint" && Array.isArray(o.authenticator_data) && (!o.authenticator_data.length || exports.AuthenticatorData.isAmino(o.authenticator_data[0])));
},
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.params !== undefined) {
params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim();
}
if (message.nextAuthenticatorId !== BigInt(0)) {
writer.uint32(16).uint64(message.nextAuthenticatorId);
}
for (const v of message.authenticatorData) {
exports.AuthenticatorData.encode(v, writer.uint32(26).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.params = params_1.Params.decode(reader, reader.uint32());
break;
case 2:
message.nextAuthenticatorId = reader.uint64();
break;
case 3:
message.authenticatorData.push(exports.AuthenticatorData.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseGenesisState();
message.params = object.params !== undefined && object.params !== null ? params_1.Params.fromPartial(object.params) : undefined;
message.nextAuthenticatorId = object.nextAuthenticatorId !== undefined && object.nextAuthenticatorId !== null ? BigInt(object.nextAuthenticatorId.toString()) : BigInt(0);
message.authenticatorData = object.authenticatorData?.map(e => exports.AuthenticatorData.fromPartial(e)) || [];
return message;
},
fromAmino(object) {
const message = createBaseGenesisState();
if (object.params !== undefined && object.params !== null) {
message.params = params_1.Params.fromAmino(object.params);
}
if (object.next_authenticator_id !== undefined && object.next_authenticator_id !== null) {
message.nextAuthenticatorId = BigInt(object.next_authenticator_id);
}
message.authenticatorData = object.authenticator_data?.map(e => exports.AuthenticatorData.fromAmino(e)) || [];
return message;
},
toAmino(message) {
const obj = {};
obj.params = message.params ? params_1.Params.toAmino(message.params) : undefined;
obj.next_authenticator_id = message.nextAuthenticatorId !== BigInt(0) ? message.nextAuthenticatorId.toString() : undefined;
if (message.authenticatorData) {
obj.authenticator_data = message.authenticatorData.map(e => e ? exports.AuthenticatorData.toAmino(e) : undefined);
}
else {
obj.authenticator_data = message.authenticatorData;
}
return obj;
},
fromAminoMsg(object) {
return exports.GenesisState.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "osmosis/smartaccount/genesis-state",
value: exports.GenesisState.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.GenesisState.decode(message.value);
},
toProto(message) {
return exports.GenesisState.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/osmosis.smartaccount.v1beta1.GenesisState",
value: exports.GenesisState.encode(message).finish()
};
}
};
registry_1.GlobalDecoderRegistry.register(exports.GenesisState.typeUrl, exports.GenesisState);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.GenesisState.aminoType, exports.GenesisState.typeUrl);