//@ts-nocheck
import { BinaryReader, BinaryWriter } from "../../../binary";
import { bytesFromBase64, base64FromBytes } from "../../../helpers";
import { GlobalDecoderRegistry } from "../../../registry";
function createBaseAccountAuthenticator() {
return {
id: BigInt(0),
type: "",
data: new Uint8Array()
};
}
export const AccountAuthenticator = {
typeUrl: "/osmosis.smartaccount.v1beta1.AccountAuthenticator",
aminoType: "osmosis/smartaccount/account-authenticator",
is(o) {
return o && (o.$typeUrl === AccountAuthenticator.typeUrl || typeof o.id === "bigint" && typeof o.type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string"));
},
isSDK(o) {
return o && (o.$typeUrl === AccountAuthenticator.typeUrl || typeof o.id === "bigint" && typeof o.type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string"));
},
isAmino(o) {
return o && (o.$typeUrl === AccountAuthenticator.typeUrl || typeof o.id === "bigint" && typeof o.type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string"));
},
encode(message, writer = BinaryWriter.create()) {
if (message.id !== BigInt(0)) {
writer.uint32(8).uint64(message.id);
}
if (message.type !== "") {
writer.uint32(18).string(message.type);
}
if (message.data.length !== 0) {
writer.uint32(26).bytes(message.data);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAccountAuthenticator();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.uint64();
break;
case 2:
message.type = reader.string();
break;
case 3:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseAccountAuthenticator();
message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
message.type = object.type ?? "";
message.data = object.data ?? new Uint8Array();
return message;
},
fromAmino(object) {
const message = createBaseAccountAuthenticator();
if (object.id !== undefined && object.id !== null) {
message.id = BigInt(object.id);
}
if (object.type !== undefined && object.type !== null) {
message.type = object.type;
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
toAmino(message) {
const obj = {};
obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
obj.type = message.type === "" ? undefined : message.type;
obj.data = message.data ? base64FromBytes(message.data) : undefined;
return obj;
},
fromAminoMsg(object) {
return AccountAuthenticator.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "osmosis/smartaccount/account-authenticator",
value: AccountAuthenticator.toAmino(message)
};
},
fromProtoMsg(message) {
return AccountAuthenticator.decode(message.value);
},
toProto(message) {
return AccountAuthenticator.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/osmosis.smartaccount.v1beta1.AccountAuthenticator",
value: AccountAuthenticator.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(AccountAuthenticator.typeUrl, AccountAuthenticator);
GlobalDecoderRegistry.registerAminoProtoMapping(AccountAuthenticator.aminoType, AccountAuthenticator.typeUrl);