@kingdomchain/wallet-client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -2
- package/dist/index.d.ts +228 -2
- package/dist/index.js +733 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/attestation.ts","../src/generated/google/protobuf/timestamp.ts","../src/generated/isatheword/kingdomchain/citizen/v1/tx.ts","../src/generated/isatheword/kingdomchain/compliance/v1/tx.ts","../src/generated/isatheword/kingdomchain/compliance/v1/compliance.ts","../src/registry.ts","../src/chainConstants.ts","../src/browserSigner.ts","../src/submitApplication.ts"],"names":["BinaryWriter","BinaryReader","toTimestamp","fromTimestamp","ApplicationStatus","RecoveryAttestationStatus"],"mappings":";;;;;;;;AAKO,IAAM,wCAAA,GAA2C;AAGjD,IAAM,yBAAA,GAA4B;AAmBzC,SAAS,UAAU,KAAA,EAA2B;AAC5C,EAAA,OAAO,OAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,KAAK,CAAC,CAAA;AAC/C;AAGA,SAAS,YAAA,CAAa,OAAe,SAAA,EAA2B;AAC9D,EAAA,IAAI,QAAQ,EAAA,EAAI;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,SAAS,CAAA,2BAAA,EAA8B,KAAK,CAAA,CAAE,CAAA;AAAA,EACnE;AACA,EAAA,IAAI,QAAQ,mBAAA,EAAwB;AAClC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,SAAS,CAAA,yBAAA,EAA4B,KAAK,CAAA,CAAE,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,KAAA,CAAM,SAAS,EAAE,CAAA;AAC1B;AAGA,SAAS,YAAY,IAAA,EAAoB;AACvC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,OAAA,KAAY,GAAI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BAAA,CAAiB,mBAAA;AAAA,MACvC,WAAW,gBAAA,CAAiB,QAAA;AAAA,MAC5B,YAAY,gBAAA,CAAiB,SAAA;AAAA,MAC7B;AAAA,KACD;AAAA,GACH;AACF;AAEA,eAAsB,2BACpB,MAAA,EACgE;AAChE,EAAA,MAAM,KAAA,GAAiC;AAAA,IACrC,eAAA,EAAiB,wCAAA;AAAA,IACjB,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,gBAAgB,MAAA,CAAO,eAAA;AAAA,IACvB,QAAQ,MAAA,CAAO,aAAA;AAAA,IACf,eAAe,MAAA,CAAO,aAAA;AAAA,IACtB,OAAO,MAAA,CAAO,KAAA;AAAA,IACd,qBAAqB,MAAA,CAAO,mBAAA;AAAA,IAC5B,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,WAAW,MAAA,CAAO,SAAA;AAAA,IAClB,YAAY,MAAA,CAAO,UAAA;AAAA,IACnB,kBAAA,EAAoB,OAAO,kBAAA,IAAsB;AAAA,GACnD;AACA,EAAA,MAAM,OAAA,GAAU,uBAAuB,KAAK,CAAA;AAC5C,EAAA,MAAM,YAAA,GAAe,mBAAA,CAAoB,MAAA,CAAO,eAAe,CAAA;AAC/D,EAAA,MAAM,SAAA,GAAY,MAAM,sBAAA,CAAuB,YAAA,EAAc,OAAO,CAAA;AACpE,EAAA,OAAO,EAAE,WAAW,KAAA,EAAM;AAC5B","file":"index.js","sourcesContent":["import { fromHex, toHex } from \"@cosmjs/encoding\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport * as ed from \"@noble/ed25519\";\n\n/** Must match x/compliance/types/keys.go AttestationTypeCitizenshipApplication */\nexport const ATTESTATION_TYPE_CITIZENSHIP_APPLICATION = \"citizenship_application\";\n\n/** Must match x/compliance/types/keys.go AttestationTypeRecovery */\nexport const ATTESTATION_TYPE_RECOVERY = \"recovery\";\n\nexport interface AttestationPayloadInput {\n attestationType: string;\n chainId: string;\n intendedWallet: string;\n caseId: string;\n policyVersion: string;\n nonce: string;\n uniquenessReference: string;\n issuedAt: Date;\n expiresAt: Date;\n providerId: string;\n providerKeyVersion: bigint;\n citizenId?: bigint;\n oldWallet?: string;\n newWallet?: string;\n}\n\nfunction hashField(value: string): Uint8Array {\n return sha256(new TextEncoder().encode(value));\n}\n\n/** Format uint64 the same way Go strconv.FormatUint(v, 10) does. Rejects out-of-range values. */\nfunction formatUint64(value: bigint, fieldName: string): string {\n if (value < 0n) {\n throw new Error(`${fieldName} must be non-negative, got ${value}`);\n }\n if (value > 0xffff_ffff_ffff_ffffn) {\n throw new Error(`${fieldName} exceeds uint64 max, got ${value}`);\n }\n return value.toString(10);\n}\n\n/** Unix seconds truncated toward zero — matches Go time.Time.Unix(). */\nfunction unixSeconds(date: Date): number {\n return Math.trunc(date.getTime() / 1000);\n}\n\nfunction combineHashes(hashes: Uint8Array[]): string {\n const totalLen = hashes.reduce((acc, h) => acc + h.length, 0);\n const preimage = new Uint8Array(totalLen);\n let offset = 0;\n for (const h of hashes) {\n preimage.set(h, offset);\n offset += h.length;\n }\n return toHex(sha256(preimage));\n}\n\n/**\n * Canonical attestation payload — must match Go types.AttestationSignPayload bit-for-bit.\n */\nexport function attestationSignPayload(input: AttestationPayloadInput): string {\n const hashes = [\n hashField(input.attestationType),\n hashField(input.chainId),\n hashField(input.intendedWallet),\n hashField(input.caseId),\n hashField(input.policyVersion),\n hashField(input.nonce),\n hashField(input.uniquenessReference),\n hashField(String(unixSeconds(input.issuedAt))),\n hashField(String(unixSeconds(input.expiresAt))),\n hashField(input.providerId),\n hashField(formatUint64(input.providerKeyVersion, \"providerKeyVersion\")),\n ];\n if (input.attestationType === ATTESTATION_TYPE_RECOVERY) {\n hashes.push(\n hashField(formatUint64(input.citizenId ?? 0n, \"citizenId\")),\n hashField(input.oldWallet ?? \"\"),\n hashField(input.newWallet ?? \"\"),\n );\n }\n return combineHashes(hashes);\n}\n\nexport async function signAttestationPayload(privateKeySeed: Uint8Array, payload: string): Promise<string> {\n if (privateKeySeed.length !== 32) {\n throw new Error(\"invalid ed25519 seed size\");\n }\n const sig = await ed.signAsync(new TextEncoder().encode(payload), privateKeySeed);\n return toHex(sig);\n}\n\nexport async function publicKeyFromPrivateSeed(privateKeySeed: Uint8Array): Promise<string> {\n if (privateKeySeed.length !== 32) {\n throw new Error(\"invalid ed25519 seed size\");\n }\n const pub = await ed.getPublicKeyAsync(privateKeySeed);\n return toHex(pub);\n}\n\nexport function providerSeedFromHex(hex: string): Uint8Array {\n const seed = fromHex(hex);\n if (seed.length !== 32) {\n throw new Error(\"provider seed hex must decode to 32 bytes\");\n }\n return new Uint8Array(seed);\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: google/protobuf/timestamp.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\n/**\n * A Timestamp represents a point in time independent of any time zone or local\n * calendar, encoded as a count of seconds and fractions of seconds at\n * nanosecond resolution. The count is relative to an epoch at UTC midnight on\n * January 1, 1970, in the proleptic Gregorian calendar which extends the\n * Gregorian calendar backwards to year one.\n *\n * All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n * second table is needed for interpretation, using a [24-hour linear\n * smear](https://developers.google.com/time/smear).\n *\n * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n * restricting to that range, we ensure that we can convert to and from [RFC\n * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n *\n * # Examples\n *\n * Example 1: Compute Timestamp from POSIX `time()`.\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(time(NULL));\n * timestamp.set_nanos(0);\n *\n * Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n *\n * struct timeval tv;\n * gettimeofday(&tv, NULL);\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(tv.tv_sec);\n * timestamp.set_nanos(tv.tv_usec * 1000);\n *\n * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n *\n * FILETIME ft;\n * GetSystemTimeAsFileTime(&ft);\n * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n *\n * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n * Timestamp timestamp;\n * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n *\n * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n *\n * long millis = System.currentTimeMillis();\n *\n * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n * .setNanos((int) ((millis % 1000) * 1000000)).build();\n *\n * Example 5: Compute Timestamp from Java `Instant.now()`.\n *\n * Instant now = Instant.now();\n *\n * Timestamp timestamp =\n * Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n * .setNanos(now.getNano()).build();\n *\n * Example 6: Compute Timestamp from current time in Python.\n *\n * timestamp = Timestamp()\n * timestamp.GetCurrentTime()\n *\n * # JSON Mapping\n *\n * In JSON format, the Timestamp type is encoded as a string in the\n * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n * format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n * where {year} is always expressed using four digits while {month}, {day},\n * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n * are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n * is required. A proto3 JSON serializer should always use UTC (as indicated by\n * \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n * able to accept both UTC and other timezones (as indicated by an offset).\n *\n * For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n * 01:30 UTC on January 15, 2017.\n *\n * In JavaScript, one can convert a Date object to this format using the\n * standard\n * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n * method. In Python, a standard `datetime.datetime` object can be converted\n * to this format using\n * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n * the Joda Time's [`ISODateTimeFormat.dateTime()`](\n * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()\n * ) to obtain a formatter capable of generating timestamps in this format.\n */\nexport interface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n nanos: number;\n}\n\nfunction createBaseTimestamp(): Timestamp {\n return { seconds: 0n, nanos: 0 };\n}\n\nexport const Timestamp: MessageFns<Timestamp> = {\n encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.seconds !== 0n) {\n if (BigInt.asIntN(64, message.seconds) !== message.seconds) {\n throw new globalThis.Error(\"value provided for field message.seconds of type int64 too large\");\n }\n writer.uint32(8).int64(message.seconds);\n }\n if (message.nanos !== 0) {\n writer.uint32(16).int32(message.nanos);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseTimestamp();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n\n message.seconds = reader.int64() as bigint;\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.nanos = reader.int32();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Timestamp>): Timestamp {\n return Timestamp.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Timestamp>): Timestamp {\n const message = createBaseTimestamp();\n message.seconds = (object.seconds !== undefined && object.seconds !== null) ? BigInt(object.seconds) : 0n;\n message.nanos = object.nanos ?? 0;\n return message;\n },\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/citizen/v1/tx.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport interface MsgIssueKCP {\n authority: string;\n application_id: string;\n wallet_address: string;\n uniqueness_commitment: string;\n decision_id: string;\n}\n\nexport interface MsgIssueKCPResponse {\n citizen_id: bigint;\n}\n\nexport interface MsgSuspendKCP {\n authority: string;\n citizen_id: bigint;\n reason_code: string;\n expires_at?: Date | undefined;\n}\n\nexport interface MsgSuspendKCPResponse {\n}\n\nexport interface MsgReactivateKCP {\n authority: string;\n citizen_id: bigint;\n}\n\nexport interface MsgReactivateKCPResponse {\n}\n\nexport interface MsgRevokeKCP {\n authority: string;\n citizen_id: bigint;\n reason_code: string;\n evidence_ref: string;\n}\n\nexport interface MsgRevokeKCPResponse {\n}\n\nexport interface MsgInitiateRecovery {\n authority: string;\n citizen_id: bigint;\n new_wallet: string;\n recovery_case_id: string;\n cooling_off_ends_at?: Date | undefined;\n}\n\nexport interface MsgInitiateRecoveryResponse {\n}\n\nexport interface MsgApproveRecovery {\n authority: string;\n recovery_case_id: string;\n}\n\nexport interface MsgApproveRecoveryResponse {\n}\n\nexport interface MsgFinalizeRecovery {\n authority: string;\n recovery_case_id: string;\n decision_id: string;\n}\n\nexport interface MsgFinalizeRecoveryResponse {\n}\n\nexport interface MsgCancelRecovery {\n authority: string;\n recovery_case_id: string;\n reason_code: string;\n}\n\nexport interface MsgCancelRecoveryResponse {\n}\n\nfunction createBaseMsgIssueKCP(): MsgIssueKCP {\n return { authority: \"\", application_id: \"\", wallet_address: \"\", uniqueness_commitment: \"\", decision_id: \"\" };\n}\n\nexport const MsgIssueKCP: MessageFns<MsgIssueKCP> = {\n encode(message: MsgIssueKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.wallet_address !== \"\") {\n writer.uint32(26).string(message.wallet_address);\n }\n if (message.uniqueness_commitment !== \"\") {\n writer.uint32(34).string(message.uniqueness_commitment);\n }\n if (message.decision_id !== \"\") {\n writer.uint32(42).string(message.decision_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgIssueKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgIssueKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.wallet_address = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.uniqueness_commitment = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.decision_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgIssueKCP>): MsgIssueKCP {\n return MsgIssueKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgIssueKCP>): MsgIssueKCP {\n const message = createBaseMsgIssueKCP();\n message.authority = object.authority ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.wallet_address = object.wallet_address ?? \"\";\n message.uniqueness_commitment = object.uniqueness_commitment ?? \"\";\n message.decision_id = object.decision_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgIssueKCPResponse(): MsgIssueKCPResponse {\n return { citizen_id: 0n };\n}\n\nexport const MsgIssueKCPResponse: MessageFns<MsgIssueKCPResponse> = {\n encode(message: MsgIssueKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(8).uint64(message.citizen_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgIssueKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgIssueKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgIssueKCPResponse>): MsgIssueKCPResponse {\n return MsgIssueKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgIssueKCPResponse>): MsgIssueKCPResponse {\n const message = createBaseMsgIssueKCPResponse();\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n return message;\n },\n};\n\nfunction createBaseMsgSuspendKCP(): MsgSuspendKCP {\n return { authority: \"\", citizen_id: 0n, reason_code: \"\", expires_at: undefined };\n}\n\nexport const MsgSuspendKCP: MessageFns<MsgSuspendKCP> = {\n encode(message: MsgSuspendKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(34).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendKCP>): MsgSuspendKCP {\n return MsgSuspendKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSuspendKCP>): MsgSuspendKCP {\n const message = createBaseMsgSuspendKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.reason_code = object.reason_code ?? \"\";\n message.expires_at = object.expires_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgSuspendKCPResponse(): MsgSuspendKCPResponse {\n return {};\n}\n\nexport const MsgSuspendKCPResponse: MessageFns<MsgSuspendKCPResponse> = {\n encode(_: MsgSuspendKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendKCPResponse>): MsgSuspendKCPResponse {\n return MsgSuspendKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSuspendKCPResponse>): MsgSuspendKCPResponse {\n const message = createBaseMsgSuspendKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgReactivateKCP(): MsgReactivateKCP {\n return { authority: \"\", citizen_id: 0n };\n}\n\nexport const MsgReactivateKCP: MessageFns<MsgReactivateKCP> = {\n encode(message: MsgReactivateKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgReactivateKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgReactivateKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgReactivateKCP>): MsgReactivateKCP {\n return MsgReactivateKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgReactivateKCP>): MsgReactivateKCP {\n const message = createBaseMsgReactivateKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n return message;\n },\n};\n\nfunction createBaseMsgReactivateKCPResponse(): MsgReactivateKCPResponse {\n return {};\n}\n\nexport const MsgReactivateKCPResponse: MessageFns<MsgReactivateKCPResponse> = {\n encode(_: MsgReactivateKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgReactivateKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgReactivateKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgReactivateKCPResponse>): MsgReactivateKCPResponse {\n return MsgReactivateKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgReactivateKCPResponse>): MsgReactivateKCPResponse {\n const message = createBaseMsgReactivateKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgRevokeKCP(): MsgRevokeKCP {\n return { authority: \"\", citizen_id: 0n, reason_code: \"\", evidence_ref: \"\" };\n}\n\nexport const MsgRevokeKCP: MessageFns<MsgRevokeKCP> = {\n encode(message: MsgRevokeKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n if (message.evidence_ref !== \"\") {\n writer.uint32(34).string(message.evidence_ref);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRevokeKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.evidence_ref = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRevokeKCP>): MsgRevokeKCP {\n return MsgRevokeKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgRevokeKCP>): MsgRevokeKCP {\n const message = createBaseMsgRevokeKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.reason_code = object.reason_code ?? \"\";\n message.evidence_ref = object.evidence_ref ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgRevokeKCPResponse(): MsgRevokeKCPResponse {\n return {};\n}\n\nexport const MsgRevokeKCPResponse: MessageFns<MsgRevokeKCPResponse> = {\n encode(_: MsgRevokeKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRevokeKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRevokeKCPResponse>): MsgRevokeKCPResponse {\n return MsgRevokeKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgRevokeKCPResponse>): MsgRevokeKCPResponse {\n const message = createBaseMsgRevokeKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgInitiateRecovery(): MsgInitiateRecovery {\n return { authority: \"\", citizen_id: 0n, new_wallet: \"\", recovery_case_id: \"\", cooling_off_ends_at: undefined };\n}\n\nexport const MsgInitiateRecovery: MessageFns<MsgInitiateRecovery> = {\n encode(message: MsgInitiateRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(26).string(message.new_wallet);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(34).string(message.recovery_case_id);\n }\n if (message.cooling_off_ends_at !== undefined) {\n Timestamp.encode(toTimestamp(message.cooling_off_ends_at), writer.uint32(42).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgInitiateRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgInitiateRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.cooling_off_ends_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgInitiateRecovery>): MsgInitiateRecovery {\n return MsgInitiateRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgInitiateRecovery>): MsgInitiateRecovery {\n const message = createBaseMsgInitiateRecovery();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.new_wallet = object.new_wallet ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.cooling_off_ends_at = object.cooling_off_ends_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgInitiateRecoveryResponse(): MsgInitiateRecoveryResponse {\n return {};\n}\n\nexport const MsgInitiateRecoveryResponse: MessageFns<MsgInitiateRecoveryResponse> = {\n encode(_: MsgInitiateRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgInitiateRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgInitiateRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgInitiateRecoveryResponse>): MsgInitiateRecoveryResponse {\n return MsgInitiateRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgInitiateRecoveryResponse>): MsgInitiateRecoveryResponse {\n const message = createBaseMsgInitiateRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgApproveRecovery(): MsgApproveRecovery {\n return { authority: \"\", recovery_case_id: \"\" };\n}\n\nexport const MsgApproveRecovery: MessageFns<MsgApproveRecovery> = {\n encode(message: MsgApproveRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgApproveRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgApproveRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgApproveRecovery>): MsgApproveRecovery {\n return MsgApproveRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgApproveRecovery>): MsgApproveRecovery {\n const message = createBaseMsgApproveRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgApproveRecoveryResponse(): MsgApproveRecoveryResponse {\n return {};\n}\n\nexport const MsgApproveRecoveryResponse: MessageFns<MsgApproveRecoveryResponse> = {\n encode(_: MsgApproveRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgApproveRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgApproveRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgApproveRecoveryResponse>): MsgApproveRecoveryResponse {\n return MsgApproveRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgApproveRecoveryResponse>): MsgApproveRecoveryResponse {\n const message = createBaseMsgApproveRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgFinalizeRecovery(): MsgFinalizeRecovery {\n return { authority: \"\", recovery_case_id: \"\", decision_id: \"\" };\n}\n\nexport const MsgFinalizeRecovery: MessageFns<MsgFinalizeRecovery> = {\n encode(message: MsgFinalizeRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.decision_id !== \"\") {\n writer.uint32(26).string(message.decision_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgFinalizeRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgFinalizeRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.decision_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgFinalizeRecovery>): MsgFinalizeRecovery {\n return MsgFinalizeRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgFinalizeRecovery>): MsgFinalizeRecovery {\n const message = createBaseMsgFinalizeRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.decision_id = object.decision_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgFinalizeRecoveryResponse(): MsgFinalizeRecoveryResponse {\n return {};\n}\n\nexport const MsgFinalizeRecoveryResponse: MessageFns<MsgFinalizeRecoveryResponse> = {\n encode(_: MsgFinalizeRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgFinalizeRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgFinalizeRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgFinalizeRecoveryResponse>): MsgFinalizeRecoveryResponse {\n return MsgFinalizeRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgFinalizeRecoveryResponse>): MsgFinalizeRecoveryResponse {\n const message = createBaseMsgFinalizeRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgCancelRecovery(): MsgCancelRecovery {\n return { authority: \"\", recovery_case_id: \"\", reason_code: \"\" };\n}\n\nexport const MsgCancelRecovery: MessageFns<MsgCancelRecovery> = {\n encode(message: MsgCancelRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgCancelRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgCancelRecovery>): MsgCancelRecovery {\n return MsgCancelRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgCancelRecovery>): MsgCancelRecovery {\n const message = createBaseMsgCancelRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgCancelRecoveryResponse(): MsgCancelRecoveryResponse {\n return {};\n}\n\nexport const MsgCancelRecoveryResponse: MessageFns<MsgCancelRecoveryResponse> = {\n encode(_: MsgCancelRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgCancelRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgCancelRecoveryResponse>): MsgCancelRecoveryResponse {\n return MsgCancelRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgCancelRecoveryResponse>): MsgCancelRecoveryResponse {\n const message = createBaseMsgCancelRecoveryResponse();\n return message;\n },\n};\n\nexport type MsgDefinition = typeof MsgDefinition;\nexport const MsgDefinition = {\n name: \"Msg\",\n fullName: \"isatheword.kingdomchain.citizen.v1.Msg\",\n methods: {\n issueKCP: {\n name: \"IssueKCP\",\n requestType: MsgIssueKCP as typeof MsgIssueKCP,\n requestStream: false,\n responseType: MsgIssueKCPResponse as typeof MsgIssueKCPResponse,\n responseStream: false,\n options: {},\n },\n suspendKCP: {\n name: \"SuspendKCP\",\n requestType: MsgSuspendKCP as typeof MsgSuspendKCP,\n requestStream: false,\n responseType: MsgSuspendKCPResponse as typeof MsgSuspendKCPResponse,\n responseStream: false,\n options: {},\n },\n reactivateKCP: {\n name: \"ReactivateKCP\",\n requestType: MsgReactivateKCP as typeof MsgReactivateKCP,\n requestStream: false,\n responseType: MsgReactivateKCPResponse as typeof MsgReactivateKCPResponse,\n responseStream: false,\n options: {},\n },\n revokeKCP: {\n name: \"RevokeKCP\",\n requestType: MsgRevokeKCP as typeof MsgRevokeKCP,\n requestStream: false,\n responseType: MsgRevokeKCPResponse as typeof MsgRevokeKCPResponse,\n responseStream: false,\n options: {},\n },\n initiateRecovery: {\n name: \"InitiateRecovery\",\n requestType: MsgInitiateRecovery as typeof MsgInitiateRecovery,\n requestStream: false,\n responseType: MsgInitiateRecoveryResponse as typeof MsgInitiateRecoveryResponse,\n responseStream: false,\n options: {},\n },\n approveRecovery: {\n name: \"ApproveRecovery\",\n requestType: MsgApproveRecovery as typeof MsgApproveRecovery,\n requestStream: false,\n responseType: MsgApproveRecoveryResponse as typeof MsgApproveRecoveryResponse,\n responseStream: false,\n options: {},\n },\n finalizeRecovery: {\n name: \"FinalizeRecovery\",\n requestType: MsgFinalizeRecovery as typeof MsgFinalizeRecovery,\n requestStream: false,\n responseType: MsgFinalizeRecoveryResponse as typeof MsgFinalizeRecoveryResponse,\n responseStream: false,\n options: {},\n },\n cancelRecovery: {\n name: \"CancelRecovery\",\n requestType: MsgCancelRecovery as typeof MsgCancelRecovery,\n requestStream: false,\n responseType: MsgCancelRecoveryResponse as typeof MsgCancelRecoveryResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/compliance/v1/tx.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport interface MsgRegisterProvider {\n authority: string;\n provider_id: string;\n public_key: string;\n key_version: bigint;\n supported_assurance_levels: string[];\n supported_jurisdictions: string[];\n active_from?: Date | undefined;\n active_until?: Date | undefined;\n}\n\nexport interface MsgRegisterProviderResponse {\n}\n\nexport interface MsgSuspendProvider {\n authority: string;\n provider_id: string;\n reason_code: string;\n}\n\nexport interface MsgSuspendProviderResponse {\n}\n\nexport interface MsgSubmitApplication {\n applicant_wallet: string;\n application_id: string;\n provider_id: string;\n provider_key_version: bigint;\n chain_id: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n signature: string;\n}\n\nexport interface MsgSubmitApplicationResponse {\n}\n\nexport interface MsgSubmitRecoveryAttestation {\n applicant_wallet: string;\n recovery_case_id: string;\n provider_id: string;\n provider_key_version: bigint;\n chain_id: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n signature: string;\n}\n\nexport interface MsgSubmitRecoveryAttestationResponse {\n}\n\nexport interface MsgDecideApplication {\n authority: string;\n application_id: string;\n approved: boolean;\n reason_code: string;\n}\n\nexport interface MsgDecideApplicationResponse {\n}\n\nexport interface MsgDecideRecoveryAttestation {\n authority: string;\n recovery_case_id: string;\n approved: boolean;\n reason_code: string;\n}\n\nexport interface MsgDecideRecoveryAttestationResponse {\n}\n\nfunction createBaseMsgRegisterProvider(): MsgRegisterProvider {\n return {\n authority: \"\",\n provider_id: \"\",\n public_key: \"\",\n key_version: 0n,\n supported_assurance_levels: [],\n supported_jurisdictions: [],\n active_from: undefined,\n active_until: undefined,\n };\n}\n\nexport const MsgRegisterProvider: MessageFns<MsgRegisterProvider> = {\n encode(message: MsgRegisterProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.public_key !== \"\") {\n writer.uint32(26).string(message.public_key);\n }\n if (message.key_version !== 0n) {\n if (BigInt.asUintN(64, message.key_version) !== message.key_version) {\n throw new globalThis.Error(\"value provided for field message.key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.key_version);\n }\n for (const v of message.supported_assurance_levels) {\n writer.uint32(42).string(v!);\n }\n for (const v of message.supported_jurisdictions) {\n writer.uint32(50).string(v!);\n }\n if (message.active_from !== undefined) {\n Timestamp.encode(toTimestamp(message.active_from), writer.uint32(58).fork()).join();\n }\n if (message.active_until !== undefined) {\n Timestamp.encode(toTimestamp(message.active_until), writer.uint32(66).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterProvider {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRegisterProvider();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.public_key = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.supported_assurance_levels.push(reader.string());\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.supported_jurisdictions.push(reader.string());\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.active_from = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.active_until = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRegisterProvider>): MsgRegisterProvider {\n return MsgRegisterProvider.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgRegisterProvider>): MsgRegisterProvider {\n const message = createBaseMsgRegisterProvider();\n message.authority = object.authority ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.public_key = object.public_key ?? \"\";\n message.key_version = (object.key_version !== undefined && object.key_version !== null)\n ? BigInt(object.key_version)\n : 0n;\n message.supported_assurance_levels = object.supported_assurance_levels?.map((e) => e) || [];\n message.supported_jurisdictions = object.supported_jurisdictions?.map((e) => e) || [];\n message.active_from = object.active_from ?? undefined;\n message.active_until = object.active_until ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgRegisterProviderResponse(): MsgRegisterProviderResponse {\n return {};\n}\n\nexport const MsgRegisterProviderResponse: MessageFns<MsgRegisterProviderResponse> = {\n encode(_: MsgRegisterProviderResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterProviderResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRegisterProviderResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRegisterProviderResponse>): MsgRegisterProviderResponse {\n return MsgRegisterProviderResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgRegisterProviderResponse>): MsgRegisterProviderResponse {\n const message = createBaseMsgRegisterProviderResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSuspendProvider(): MsgSuspendProvider {\n return { authority: \"\", provider_id: \"\", reason_code: \"\" };\n}\n\nexport const MsgSuspendProvider: MessageFns<MsgSuspendProvider> = {\n encode(message: MsgSuspendProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendProvider {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendProvider();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendProvider>): MsgSuspendProvider {\n return MsgSuspendProvider.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSuspendProvider>): MsgSuspendProvider {\n const message = createBaseMsgSuspendProvider();\n message.authority = object.authority ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSuspendProviderResponse(): MsgSuspendProviderResponse {\n return {};\n}\n\nexport const MsgSuspendProviderResponse: MessageFns<MsgSuspendProviderResponse> = {\n encode(_: MsgSuspendProviderResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendProviderResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendProviderResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendProviderResponse>): MsgSuspendProviderResponse {\n return MsgSuspendProviderResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSuspendProviderResponse>): MsgSuspendProviderResponse {\n const message = createBaseMsgSuspendProviderResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSubmitApplication(): MsgSubmitApplication {\n return {\n applicant_wallet: \"\",\n application_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n chain_id: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n issued_at: undefined,\n expires_at: undefined,\n signature: \"\",\n };\n}\n\nexport const MsgSubmitApplication: MessageFns<MsgSubmitApplication> = {\n encode(message: MsgSubmitApplication, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.applicant_wallet !== \"\") {\n writer.uint32(10).string(message.applicant_wallet);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(26).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.provider_key_version);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.case_id !== \"\") {\n writer.uint32(50).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(58).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(66).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(74).string(message.uniqueness_reference);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(82).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(90).fork()).join();\n }\n if (message.signature !== \"\") {\n writer.uint32(98).string(message.signature);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitApplication {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitApplication>): MsgSubmitApplication {\n return MsgSubmitApplication.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSubmitApplication>): MsgSubmitApplication {\n const message = createBaseMsgSubmitApplication();\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.chain_id = object.chain_id ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.signature = object.signature ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSubmitApplicationResponse(): MsgSubmitApplicationResponse {\n return {};\n}\n\nexport const MsgSubmitApplicationResponse: MessageFns<MsgSubmitApplicationResponse> = {\n encode(_: MsgSubmitApplicationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitApplicationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitApplicationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitApplicationResponse>): MsgSubmitApplicationResponse {\n return MsgSubmitApplicationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSubmitApplicationResponse>): MsgSubmitApplicationResponse {\n const message = createBaseMsgSubmitApplicationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSubmitRecoveryAttestation(): MsgSubmitRecoveryAttestation {\n return {\n applicant_wallet: \"\",\n recovery_case_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n chain_id: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n issued_at: undefined,\n expires_at: undefined,\n signature: \"\",\n };\n}\n\nexport const MsgSubmitRecoveryAttestation: MessageFns<MsgSubmitRecoveryAttestation> = {\n encode(message: MsgSubmitRecoveryAttestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.applicant_wallet !== \"\") {\n writer.uint32(10).string(message.applicant_wallet);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(26).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.provider_key_version);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.case_id !== \"\") {\n writer.uint32(50).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(58).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(66).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(74).string(message.uniqueness_reference);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(80).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(90).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(98).string(message.new_wallet);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(106).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(114).fork()).join();\n }\n if (message.signature !== \"\") {\n writer.uint32(122).string(message.signature);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitRecoveryAttestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitRecoveryAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 80) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 13: {\n if (tag !== 106) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 14: {\n if (tag !== 114) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 15: {\n if (tag !== 122) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitRecoveryAttestation>): MsgSubmitRecoveryAttestation {\n return MsgSubmitRecoveryAttestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSubmitRecoveryAttestation>): MsgSubmitRecoveryAttestation {\n const message = createBaseMsgSubmitRecoveryAttestation();\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.chain_id = object.chain_id ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.signature = object.signature ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSubmitRecoveryAttestationResponse(): MsgSubmitRecoveryAttestationResponse {\n return {};\n}\n\nexport const MsgSubmitRecoveryAttestationResponse: MessageFns<MsgSubmitRecoveryAttestationResponse> = {\n encode(_: MsgSubmitRecoveryAttestationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitRecoveryAttestationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitRecoveryAttestationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitRecoveryAttestationResponse>): MsgSubmitRecoveryAttestationResponse {\n return MsgSubmitRecoveryAttestationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSubmitRecoveryAttestationResponse>): MsgSubmitRecoveryAttestationResponse {\n const message = createBaseMsgSubmitRecoveryAttestationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgDecideApplication(): MsgDecideApplication {\n return { authority: \"\", application_id: \"\", approved: false, reason_code: \"\" };\n}\n\nexport const MsgDecideApplication: MessageFns<MsgDecideApplication> = {\n encode(message: MsgDecideApplication, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.approved !== false) {\n writer.uint32(24).bool(message.approved);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(34).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideApplication {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.approved = reader.bool();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideApplication>): MsgDecideApplication {\n return MsgDecideApplication.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgDecideApplication>): MsgDecideApplication {\n const message = createBaseMsgDecideApplication();\n message.authority = object.authority ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.approved = object.approved ?? false;\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgDecideApplicationResponse(): MsgDecideApplicationResponse {\n return {};\n}\n\nexport const MsgDecideApplicationResponse: MessageFns<MsgDecideApplicationResponse> = {\n encode(_: MsgDecideApplicationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideApplicationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideApplicationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideApplicationResponse>): MsgDecideApplicationResponse {\n return MsgDecideApplicationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgDecideApplicationResponse>): MsgDecideApplicationResponse {\n const message = createBaseMsgDecideApplicationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgDecideRecoveryAttestation(): MsgDecideRecoveryAttestation {\n return { authority: \"\", recovery_case_id: \"\", approved: false, reason_code: \"\" };\n}\n\nexport const MsgDecideRecoveryAttestation: MessageFns<MsgDecideRecoveryAttestation> = {\n encode(message: MsgDecideRecoveryAttestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.approved !== false) {\n writer.uint32(24).bool(message.approved);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(34).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideRecoveryAttestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideRecoveryAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.approved = reader.bool();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideRecoveryAttestation>): MsgDecideRecoveryAttestation {\n return MsgDecideRecoveryAttestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgDecideRecoveryAttestation>): MsgDecideRecoveryAttestation {\n const message = createBaseMsgDecideRecoveryAttestation();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.approved = object.approved ?? false;\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgDecideRecoveryAttestationResponse(): MsgDecideRecoveryAttestationResponse {\n return {};\n}\n\nexport const MsgDecideRecoveryAttestationResponse: MessageFns<MsgDecideRecoveryAttestationResponse> = {\n encode(_: MsgDecideRecoveryAttestationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideRecoveryAttestationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideRecoveryAttestationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideRecoveryAttestationResponse>): MsgDecideRecoveryAttestationResponse {\n return MsgDecideRecoveryAttestationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgDecideRecoveryAttestationResponse>): MsgDecideRecoveryAttestationResponse {\n const message = createBaseMsgDecideRecoveryAttestationResponse();\n return message;\n },\n};\n\nexport type MsgDefinition = typeof MsgDefinition;\nexport const MsgDefinition = {\n name: \"Msg\",\n fullName: \"isatheword.kingdomchain.compliance.v1.Msg\",\n methods: {\n registerProvider: {\n name: \"RegisterProvider\",\n requestType: MsgRegisterProvider as typeof MsgRegisterProvider,\n requestStream: false,\n responseType: MsgRegisterProviderResponse as typeof MsgRegisterProviderResponse,\n responseStream: false,\n options: {},\n },\n suspendProvider: {\n name: \"SuspendProvider\",\n requestType: MsgSuspendProvider as typeof MsgSuspendProvider,\n requestStream: false,\n responseType: MsgSuspendProviderResponse as typeof MsgSuspendProviderResponse,\n responseStream: false,\n options: {},\n },\n submitApplication: {\n name: \"SubmitApplication\",\n requestType: MsgSubmitApplication as typeof MsgSubmitApplication,\n requestStream: false,\n responseType: MsgSubmitApplicationResponse as typeof MsgSubmitApplicationResponse,\n responseStream: false,\n options: {},\n },\n submitRecoveryAttestation: {\n name: \"SubmitRecoveryAttestation\",\n requestType: MsgSubmitRecoveryAttestation as typeof MsgSubmitRecoveryAttestation,\n requestStream: false,\n responseType: MsgSubmitRecoveryAttestationResponse as typeof MsgSubmitRecoveryAttestationResponse,\n responseStream: false,\n options: {},\n },\n decideApplication: {\n name: \"DecideApplication\",\n requestType: MsgDecideApplication as typeof MsgDecideApplication,\n requestStream: false,\n responseType: MsgDecideApplicationResponse as typeof MsgDecideApplicationResponse,\n responseStream: false,\n options: {},\n },\n decideRecoveryAttestation: {\n name: \"DecideRecoveryAttestation\",\n requestType: MsgDecideRecoveryAttestation as typeof MsgDecideRecoveryAttestation,\n requestStream: false,\n responseType: MsgDecideRecoveryAttestationResponse as typeof MsgDecideRecoveryAttestationResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/compliance/v1/compliance.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport enum ProviderStatus {\n PROVIDER_STATUS_UNSPECIFIED = 0,\n PROVIDER_STATUS_ACTIVE = 1,\n PROVIDER_STATUS_SUSPENDED = 2,\n PROVIDER_STATUS_REVOKED = 3,\n UNRECOGNIZED = -1,\n}\n\nexport enum AttestationType {\n ATTESTATION_TYPE_UNSPECIFIED = 0,\n ATTESTATION_TYPE_CITIZENSHIP_APPLICATION = 1,\n ATTESTATION_TYPE_RECOVERY = 2,\n UNRECOGNIZED = -1,\n}\n\nexport enum ApplicationStatus {\n APPLICATION_STATUS_UNSPECIFIED = 0,\n APPLICATION_STATUS_SUBMITTED = 1,\n APPLICATION_STATUS_PENDING_REVIEW = 2,\n APPLICATION_STATUS_APPROVED = 3,\n APPLICATION_STATUS_REJECTED = 4,\n UNRECOGNIZED = -1,\n}\n\nexport enum RecoveryAttestationStatus {\n RECOVERY_ATTESTATION_STATUS_UNSPECIFIED = 0,\n RECOVERY_ATTESTATION_STATUS_SUBMITTED = 1,\n RECOVERY_ATTESTATION_STATUS_PENDING_REVIEW = 2,\n RECOVERY_ATTESTATION_STATUS_APPROVED = 3,\n RECOVERY_ATTESTATION_STATUS_REJECTED = 4,\n UNRECOGNIZED = -1,\n}\n\nexport interface ProviderRecord {\n provider_id: string;\n public_key: string;\n key_version: bigint;\n supported_assurance_levels: string[];\n supported_jurisdictions: string[];\n active_from?: Date | undefined;\n active_until?: Date | undefined;\n status: ProviderStatus;\n}\n\nexport interface Attestation {\n attestation_id: string;\n provider_id: string;\n provider_key_version: bigint;\n attestation_type: AttestationType;\n chain_id: string;\n intended_wallet: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n consumed: boolean;\n signature: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n}\n\nexport interface Application {\n application_id: string;\n applicant_wallet: string;\n status: ApplicationStatus;\n attestation_id: string;\n uniqueness_commitment: string;\n policy_version: string;\n decision_reason_code: string;\n submitted_at?: Date | undefined;\n decided_at?: Date | undefined;\n}\n\nexport interface RecoveryAttestationCase {\n recovery_case_id: string;\n applicant_wallet: string;\n status: RecoveryAttestationStatus;\n attestation_id: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n policy_version: string;\n decision_reason_code: string;\n submitted_at?: Date | undefined;\n decided_at?: Date | undefined;\n}\n\nfunction createBaseProviderRecord(): ProviderRecord {\n return {\n provider_id: \"\",\n public_key: \"\",\n key_version: 0n,\n supported_assurance_levels: [],\n supported_jurisdictions: [],\n active_from: undefined,\n active_until: undefined,\n status: 0,\n };\n}\n\nexport const ProviderRecord: MessageFns<ProviderRecord> = {\n encode(message: ProviderRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.provider_id !== \"\") {\n writer.uint32(10).string(message.provider_id);\n }\n if (message.public_key !== \"\") {\n writer.uint32(18).string(message.public_key);\n }\n if (message.key_version !== 0n) {\n if (BigInt.asUintN(64, message.key_version) !== message.key_version) {\n throw new globalThis.Error(\"value provided for field message.key_version of type uint64 too large\");\n }\n writer.uint32(24).uint64(message.key_version);\n }\n for (const v of message.supported_assurance_levels) {\n writer.uint32(34).string(v!);\n }\n for (const v of message.supported_jurisdictions) {\n writer.uint32(42).string(v!);\n }\n if (message.active_from !== undefined) {\n Timestamp.encode(toTimestamp(message.active_from), writer.uint32(50).fork()).join();\n }\n if (message.active_until !== undefined) {\n Timestamp.encode(toTimestamp(message.active_until), writer.uint32(58).fork()).join();\n }\n if (message.status !== 0) {\n writer.uint32(64).int32(message.status);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): ProviderRecord {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseProviderRecord();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.public_key = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.key_version = reader.uint64() as bigint;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.supported_assurance_levels.push(reader.string());\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.supported_jurisdictions.push(reader.string());\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.active_from = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.active_until = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 8: {\n if (tag !== 64) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<ProviderRecord>): ProviderRecord {\n return ProviderRecord.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<ProviderRecord>): ProviderRecord {\n const message = createBaseProviderRecord();\n message.provider_id = object.provider_id ?? \"\";\n message.public_key = object.public_key ?? \"\";\n message.key_version = (object.key_version !== undefined && object.key_version !== null)\n ? BigInt(object.key_version)\n : 0n;\n message.supported_assurance_levels = object.supported_assurance_levels?.map((e) => e) || [];\n message.supported_jurisdictions = object.supported_jurisdictions?.map((e) => e) || [];\n message.active_from = object.active_from ?? undefined;\n message.active_until = object.active_until ?? undefined;\n message.status = object.status ?? 0;\n return message;\n },\n};\n\nfunction createBaseAttestation(): Attestation {\n return {\n attestation_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n attestation_type: 0,\n chain_id: \"\",\n intended_wallet: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n issued_at: undefined,\n expires_at: undefined,\n consumed: false,\n signature: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n };\n}\n\nexport const Attestation: MessageFns<Attestation> = {\n encode(message: Attestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.attestation_id !== \"\") {\n writer.uint32(10).string(message.attestation_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(24).uint64(message.provider_key_version);\n }\n if (message.attestation_type !== 0) {\n writer.uint32(32).int32(message.attestation_type);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.intended_wallet !== \"\") {\n writer.uint32(50).string(message.intended_wallet);\n }\n if (message.case_id !== \"\") {\n writer.uint32(58).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(66).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(74).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(82).string(message.uniqueness_reference);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(90).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(98).fork()).join();\n }\n if (message.consumed !== false) {\n writer.uint32(104).bool(message.consumed);\n }\n if (message.signature !== \"\") {\n writer.uint32(114).string(message.signature);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(120).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(130).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(138).string(message.new_wallet);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Attestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.attestation_type = reader.int32() as any;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.intended_wallet = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 13: {\n if (tag !== 104) {\n break;\n }\n\n message.consumed = reader.bool();\n continue;\n }\n case 14: {\n if (tag !== 114) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n case 15: {\n if (tag !== 120) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 16: {\n if (tag !== 130) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 17: {\n if (tag !== 138) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Attestation>): Attestation {\n return Attestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Attestation>): Attestation {\n const message = createBaseAttestation();\n message.attestation_id = object.attestation_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.attestation_type = object.attestation_type ?? 0;\n message.chain_id = object.chain_id ?? \"\";\n message.intended_wallet = object.intended_wallet ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.consumed = object.consumed ?? false;\n message.signature = object.signature ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n return message;\n },\n};\n\nfunction createBaseApplication(): Application {\n return {\n application_id: \"\",\n applicant_wallet: \"\",\n status: 0,\n attestation_id: \"\",\n uniqueness_commitment: \"\",\n policy_version: \"\",\n decision_reason_code: \"\",\n submitted_at: undefined,\n decided_at: undefined,\n };\n}\n\nexport const Application: MessageFns<Application> = {\n encode(message: Application, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.application_id !== \"\") {\n writer.uint32(10).string(message.application_id);\n }\n if (message.applicant_wallet !== \"\") {\n writer.uint32(18).string(message.applicant_wallet);\n }\n if (message.status !== 0) {\n writer.uint32(24).int32(message.status);\n }\n if (message.attestation_id !== \"\") {\n writer.uint32(34).string(message.attestation_id);\n }\n if (message.uniqueness_commitment !== \"\") {\n writer.uint32(42).string(message.uniqueness_commitment);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(50).string(message.policy_version);\n }\n if (message.decision_reason_code !== \"\") {\n writer.uint32(58).string(message.decision_reason_code);\n }\n if (message.submitted_at !== undefined) {\n Timestamp.encode(toTimestamp(message.submitted_at), writer.uint32(66).fork()).join();\n }\n if (message.decided_at !== undefined) {\n Timestamp.encode(toTimestamp(message.decided_at), writer.uint32(74).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Application {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.uniqueness_commitment = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.decision_reason_code = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.submitted_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.decided_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Application>): Application {\n return Application.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Application>): Application {\n const message = createBaseApplication();\n message.application_id = object.application_id ?? \"\";\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.status = object.status ?? 0;\n message.attestation_id = object.attestation_id ?? \"\";\n message.uniqueness_commitment = object.uniqueness_commitment ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.decision_reason_code = object.decision_reason_code ?? \"\";\n message.submitted_at = object.submitted_at ?? undefined;\n message.decided_at = object.decided_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseRecoveryAttestationCase(): RecoveryAttestationCase {\n return {\n recovery_case_id: \"\",\n applicant_wallet: \"\",\n status: 0,\n attestation_id: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n policy_version: \"\",\n decision_reason_code: \"\",\n submitted_at: undefined,\n decided_at: undefined,\n };\n}\n\nexport const RecoveryAttestationCase: MessageFns<RecoveryAttestationCase> = {\n encode(message: RecoveryAttestationCase, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.recovery_case_id !== \"\") {\n writer.uint32(10).string(message.recovery_case_id);\n }\n if (message.applicant_wallet !== \"\") {\n writer.uint32(18).string(message.applicant_wallet);\n }\n if (message.status !== 0) {\n writer.uint32(24).int32(message.status);\n }\n if (message.attestation_id !== \"\") {\n writer.uint32(34).string(message.attestation_id);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(40).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(50).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(58).string(message.new_wallet);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(66).string(message.policy_version);\n }\n if (message.decision_reason_code !== \"\") {\n writer.uint32(74).string(message.decision_reason_code);\n }\n if (message.submitted_at !== undefined) {\n Timestamp.encode(toTimestamp(message.submitted_at), writer.uint32(82).fork()).join();\n }\n if (message.decided_at !== undefined) {\n Timestamp.encode(toTimestamp(message.decided_at), writer.uint32(90).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): RecoveryAttestationCase {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseRecoveryAttestationCase();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 40) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.decision_reason_code = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.submitted_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.decided_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<RecoveryAttestationCase>): RecoveryAttestationCase {\n return RecoveryAttestationCase.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<RecoveryAttestationCase>): RecoveryAttestationCase {\n const message = createBaseRecoveryAttestationCase();\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.status = object.status ?? 0;\n message.attestation_id = object.attestation_id ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.decision_reason_code = object.decision_reason_code ?? \"\";\n message.submitted_at = object.submitted_at ?? undefined;\n message.decided_at = object.decided_at ?? undefined;\n return message;\n },\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","import { GeneratedType, Registry } from \"@cosmjs/proto-signing\";\nimport { defaultRegistryTypes } from \"@cosmjs/stargate\";\nimport { BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\nimport {\n MsgApproveRecovery,\n MsgCancelRecovery,\n MsgFinalizeRecovery,\n MsgInitiateRecovery,\n MsgIssueKCP,\n MsgReactivateKCP,\n MsgRevokeKCP,\n MsgSuspendKCP,\n} from \"./generated/isatheword/kingdomchain/citizen/v1/tx\";\nimport {\n MsgDecideApplication,\n MsgDecideRecoveryAttestation,\n MsgRegisterProvider,\n MsgSubmitApplication,\n MsgSubmitRecoveryAttestation,\n MsgSuspendProvider,\n} from \"./generated/isatheword/kingdomchain/compliance/v1/tx\";\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: Uint8Array): T;\n fromPartial(object: Partial<T>): T;\n}\n\n/** Adapt ts-proto @bufbuild MessageFns to CosmJS Registry (encode().finish()). */\nfunction wrapMsgFns<T>(msgFns: MessageFns<T>): GeneratedType {\n return {\n encode: (message: T) => msgFns.encode(message) as any,\n decode: (input: Uint8Array) => msgFns.decode(input),\n fromPartial: (object: Partial<T>) => msgFns.fromPartial(object),\n };\n}\n\nconst COMPLIANCE_MSG_TYPES: ReadonlyArray<[string, GeneratedType]> = [\n [\"/isatheword.kingdomchain.compliance.v1.MsgRegisterProvider\", wrapMsgFns(MsgRegisterProvider)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSuspendProvider\", wrapMsgFns(MsgSuspendProvider)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSubmitApplication\", wrapMsgFns(MsgSubmitApplication)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSubmitRecoveryAttestation\", wrapMsgFns(MsgSubmitRecoveryAttestation)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgDecideApplication\", wrapMsgFns(MsgDecideApplication)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgDecideRecoveryAttestation\", wrapMsgFns(MsgDecideRecoveryAttestation)],\n];\n\nconst CITIZEN_MSG_TYPES: ReadonlyArray<[string, GeneratedType]> = [\n [\"/isatheword.kingdomchain.citizen.v1.MsgIssueKCP\", wrapMsgFns(MsgIssueKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgSuspendKCP\", wrapMsgFns(MsgSuspendKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgReactivateKCP\", wrapMsgFns(MsgReactivateKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgRevokeKCP\", wrapMsgFns(MsgRevokeKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgInitiateRecovery\", wrapMsgFns(MsgInitiateRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgApproveRecovery\", wrapMsgFns(MsgApproveRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgFinalizeRecovery\", wrapMsgFns(MsgFinalizeRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgCancelRecovery\", wrapMsgFns(MsgCancelRecovery)],\n];\n\n/** CosmJS registry: standard Cosmos SDK types + Kingdom Chain citizen/compliance messages. */\nexport function createKingdomChainRegistry(): Registry {\n return new Registry([...defaultRegistryTypes, ...COMPLIANCE_MSG_TYPES, ...CITIZEN_MSG_TYPES]);\n}\n\nexport { MsgSubmitApplication, MsgSubmitRecoveryAttestation } from \"./generated/isatheword/kingdomchain/compliance/v1/tx\";\nexport { ApplicationStatus, RecoveryAttestationStatus } from \"./generated/isatheword/kingdomchain/compliance/v1/compliance\";\n","/**\n * Kingdom Chain on-chain denom and display metadata.\n *\n * Sources:\n * - x/supply/types/constants.go (UkdrDenom = \"ukdr\")\n * - TOKENOMICS_COSMOS_SPEC.md (1 KDR = 1,000,000 ukdr)\n * - app/app.go + app/config.go (bech32 prefix, coin type)\n */\n\n/** Base (minimal) denom registered in x/supply. */\nexport const UKDR_MINIMAL_DENOM = \"ukdr\";\n\n/** Human-readable display symbol. */\nexport const UKDR_DISPLAY_DENOM = \"KDR\";\n\n/** ukdr is a micro-unit: 10^6 ukdr = 1 KDR. */\nexport const UKDR_DECIMALS = 6;\n\n/** Account / validator bech32 prefix (AccountAddressPrefix in app/app.go). */\nexport const BECH32_PREFIX = \"king\";\n\n/** SLIP-0044 coin type (ChainCoinType in app/app.go). */\nexport const CHAIN_COIN_TYPE = 118;\n\n/** Devnet default chain ID (override via env when a permanent node exists). */\nexport const DEFAULT_CHAIN_ID = \"kingdomchain-e2e\";\n\nexport const DEFAULT_RPC_URL = \"http://127.0.0.1:26657\";\nexport const DEFAULT_REST_URL = \"http://127.0.0.1:1317\";\n","import type { OfflineDirectSigner } from \"@cosmjs/proto-signing\";\nimport { SigningStargateClient } from \"@cosmjs/stargate\";\n\nimport {\n BECH32_PREFIX,\n CHAIN_COIN_TYPE,\n UKDR_DECIMALS,\n UKDR_DISPLAY_DENOM,\n UKDR_MINIMAL_DENOM,\n} from \"./chainConstants\";\nimport { createKingdomChainRegistry } from \"./registry\";\n\n/** Keplr/Leap-compatible currency entry. */\nexport interface ChainCurrency {\n coinDenom: string;\n coinMinimalDenom: string;\n coinDecimals: number;\n gasPriceStep?: { low: number; average: number; high: number };\n}\n\n/** Keplr/Leap-compatible ChainInfo for experimentalSuggestChain. */\nexport interface ChainInfo {\n chainId: string;\n chainName: string;\n rpc: string;\n rest: string;\n bip44: { coinType: number };\n bech32Config: {\n bech32PrefixAccAddr: string;\n bech32PrefixAccPub: string;\n bech32PrefixValAddr: string;\n bech32PrefixValPub: string;\n bech32PrefixConsAddr: string;\n bech32PrefixConsPub: string;\n };\n currencies: ChainCurrency[];\n feeCurrencies: ChainCurrency[];\n stakeCurrency: ChainCurrency;\n}\n\n/** Subset of Keplr/Leap window API used for chain connect. */\nexport interface BrowserWalletApi {\n experimentalSuggestChain(chainInfo: ChainInfo): Promise<void>;\n enable(chainId: string): Promise<void>;\n getOfflineSigner(chainId: string): OfflineDirectSigner;\n}\n\nexport class WalletNotInstalledError extends Error {\n constructor(public readonly walletName: string) {\n super(`${walletName} extension is not installed. Install it and refresh the page.`);\n this.name = \"WalletNotInstalledError\";\n }\n}\n\nexport class WalletConnectionError extends Error {\n constructor(\n public readonly walletName: string,\n public readonly step: \"suggestChain\" | \"enable\" | \"getOfflineSigner\",\n cause?: unknown,\n ) {\n const stepLabel =\n step === \"suggestChain\"\n ? \"chain suggestion\"\n : step === \"enable\"\n ? \"connection request\"\n : \"offline signer retrieval\";\n super(`${walletName} failed during ${stepLabel}.`, { cause });\n this.name = \"WalletConnectionError\";\n }\n}\n\n/** @deprecated Use WalletConnectionError — kept for backward compatibility in tests/demo. */\nexport class WalletConnectionRejectedError extends WalletConnectionError {\n constructor(walletName: string, step: \"suggestChain\" | \"enable\", cause?: unknown) {\n super(walletName, step, cause);\n this.name = \"WalletConnectionRejectedError\";\n }\n}\n\nexport class WalletAccountError extends Error {\n constructor(public readonly walletName: string) {\n super(`${walletName} returned no usable accounts. Reconnect the wallet and try again.`);\n this.name = \"WalletAccountError\";\n }\n}\n\nexport class InvalidChainConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidChainConfigError\";\n }\n}\n\nexport class RpcConnectionError extends Error {\n constructor(\n public readonly rpcUrl: string,\n cause?: unknown,\n ) {\n super(`Failed to connect to RPC endpoint ${rpcUrl}. Is the node running and reachable?`, { cause });\n this.name = \"RpcConnectionError\";\n }\n}\n\ndeclare global {\n interface Window {\n keplr?: BrowserWalletApi;\n leap?: BrowserWalletApi;\n }\n}\n\nconst UKDR_CURRENCY: ChainCurrency = {\n coinDenom: UKDR_DISPLAY_DENOM,\n coinMinimalDenom: UKDR_MINIMAL_DENOM,\n coinDecimals: UKDR_DECIMALS,\n};\n\n/** E2E devnet uses minimum-gas-prices = \"0ukdr\" (scripts/citizen-compliance-e2e/run.sh). */\nconst UKDR_FEE_CURRENCY: ChainCurrency = {\n ...UKDR_CURRENCY,\n gasPriceStep: { low: 0, average: 0, high: 0.025 },\n};\n\nfunction isWalletApiPresent(api: unknown): api is BrowserWalletApi {\n if (api == null || typeof api !== \"object\") {\n return false;\n }\n const candidate = api as BrowserWalletApi;\n return (\n typeof candidate.experimentalSuggestChain === \"function\" &&\n typeof candidate.enable === \"function\" &&\n typeof candidate.getOfflineSigner === \"function\"\n );\n}\n\n/** Validate chain endpoint inputs before passing to Keplr/Leap. */\nexport function validateChainConfig(chainId: string, rpcUrl: string, restUrl: string): void {\n if (!chainId.trim()) {\n throw new InvalidChainConfigError(\"chainId is required\");\n }\n if (!rpcUrl.trim()) {\n throw new InvalidChainConfigError(\"rpcUrl is required\");\n }\n if (!restUrl.trim()) {\n throw new InvalidChainConfigError(\"restUrl is required\");\n }\n}\n\nexport function isKeplrAvailable(): boolean {\n return typeof window !== \"undefined\" && isWalletApiPresent(window.keplr);\n}\n\nexport function isLeapAvailable(): boolean {\n return typeof window !== \"undefined\" && isWalletApiPresent(window.leap);\n}\n\n/** Build ChainInfo for Keplr/Leap experimentalSuggestChain. */\nexport function buildKingdomChainInfo(\n chainId: string,\n rpcUrl: string,\n restUrl: string,\n chainName = \"Kingdom Chain\",\n): ChainInfo {\n validateChainConfig(chainId, rpcUrl, restUrl);\n\n const accPub = `${BECH32_PREFIX}pub`;\n const valAddr = `${BECH32_PREFIX}valoper`;\n const valPub = `${BECH32_PREFIX}valoperpub`;\n const consAddr = `${BECH32_PREFIX}valcons`;\n const consPub = `${BECH32_PREFIX}valconspub`;\n\n return {\n chainId,\n chainName,\n rpc: rpcUrl,\n rest: restUrl,\n bip44: { coinType: CHAIN_COIN_TYPE },\n bech32Config: {\n bech32PrefixAccAddr: BECH32_PREFIX,\n bech32PrefixAccPub: accPub,\n bech32PrefixValAddr: valAddr,\n bech32PrefixValPub: valPub,\n bech32PrefixConsAddr: consAddr,\n bech32PrefixConsPub: consPub,\n },\n currencies: [UKDR_CURRENCY],\n feeCurrencies: [UKDR_FEE_CURRENCY],\n stakeCurrency: UKDR_CURRENCY,\n };\n}\n\nasync function assertSignerHasAccount(signer: OfflineDirectSigner, walletName: string): Promise<void> {\n let accounts;\n try {\n accounts = await signer.getAccounts();\n } catch (err) {\n throw new WalletConnectionError(walletName, \"getOfflineSigner\", err);\n }\n if (accounts.length === 0 || !accounts[0]?.address?.trim()) {\n throw new WalletAccountError(walletName);\n }\n}\n\n/** Suggest chain, request access, return CosmJS OfflineDirectSigner. */\nexport async function suggestAndConnect(\n walletApi: BrowserWalletApi,\n chainInfo: ChainInfo,\n walletName = \"Wallet\",\n): Promise<OfflineDirectSigner> {\n try {\n await walletApi.experimentalSuggestChain(chainInfo);\n } catch (err) {\n throw new WalletConnectionRejectedError(walletName, \"suggestChain\", err);\n }\n\n try {\n await walletApi.enable(chainInfo.chainId);\n } catch (err) {\n throw new WalletConnectionRejectedError(walletName, \"enable\", err);\n }\n\n let signer: OfflineDirectSigner;\n try {\n signer = walletApi.getOfflineSigner(chainInfo.chainId);\n } catch (err) {\n throw new WalletConnectionError(walletName, \"getOfflineSigner\", err);\n }\n\n await assertSignerHasAccount(signer, walletName);\n return signer;\n}\n\nfunction resolveWalletApi(\n getter: () => BrowserWalletApi | undefined,\n walletName: string,\n): BrowserWalletApi {\n if (!isWalletApiPresent(getter())) {\n throw new WalletNotInstalledError(walletName);\n }\n const api = getter();\n if (!isWalletApiPresent(api)) {\n throw new WalletNotInstalledError(walletName);\n }\n return api;\n}\n\nexport async function connectKeplr(chainInfo: ChainInfo): Promise<OfflineDirectSigner> {\n const api = resolveWalletApi(() => window.keplr, \"Keplr\");\n return suggestAndConnect(api, chainInfo, \"Keplr\");\n}\n\nexport async function connectLeap(chainInfo: ChainInfo): Promise<OfflineDirectSigner> {\n const api = resolveWalletApi(() => window.leap, \"Leap\");\n return suggestAndConnect(api, chainInfo, \"Leap\");\n}\n\n/** SigningStargateClient wired with Kingdom Chain custom message registry. */\nexport async function createBrowserSigningClient(\n rpcUrl: string,\n signer: OfflineDirectSigner,\n): Promise<SigningStargateClient> {\n if (!rpcUrl.trim()) {\n throw new InvalidChainConfigError(\"rpcUrl is required\");\n }\n try {\n return await SigningStargateClient.connectWithSigner(rpcUrl, signer, {\n registry: createKingdomChainRegistry(),\n });\n } catch (err) {\n throw new RpcConnectionError(rpcUrl, err);\n }\n}\n","import type { EncodeObject } from \"@cosmjs/proto-signing\";\n\nimport {\n ATTESTATION_TYPE_CITIZENSHIP_APPLICATION,\n attestationSignPayload,\n providerSeedFromHex,\n signAttestationPayload,\n type AttestationPayloadInput,\n} from \"./attestation\";\nimport { MsgSubmitApplication } from \"./registry\";\n\nexport interface SubmitApplicationParams {\n applicantWallet: string;\n applicationId: string;\n chainId: string;\n providerId: string;\n policyVersion: string;\n providerSeedHex: string;\n nonce: string;\n uniquenessReference: string;\n issuedAt: Date;\n expiresAt: Date;\n providerKeyVersion?: bigint;\n}\n\nexport function buildSubmitApplicationMsg(\n applicantWallet: string,\n applicationId: string,\n attestationInput: AttestationPayloadInput,\n signature: string,\n): EncodeObject {\n return {\n typeUrl: \"/isatheword.kingdomchain.compliance.v1.MsgSubmitApplication\",\n value: MsgSubmitApplication.fromPartial({\n applicant_wallet: applicantWallet,\n application_id: applicationId,\n provider_id: attestationInput.providerId,\n provider_key_version: attestationInput.providerKeyVersion,\n chain_id: attestationInput.chainId,\n case_id: attestationInput.caseId,\n policy_version: attestationInput.policyVersion,\n nonce: attestationInput.nonce,\n uniqueness_reference: attestationInput.uniquenessReference,\n issued_at: attestationInput.issuedAt,\n expires_at: attestationInput.expiresAt,\n signature,\n }),\n };\n}\n\nexport async function signCitizenshipAttestation(\n params: SubmitApplicationParams,\n): Promise<{ signature: string; input: AttestationPayloadInput }> {\n const input: AttestationPayloadInput = {\n attestationType: ATTESTATION_TYPE_CITIZENSHIP_APPLICATION,\n chainId: params.chainId,\n intendedWallet: params.applicantWallet,\n caseId: params.applicationId,\n policyVersion: params.policyVersion,\n nonce: params.nonce,\n uniquenessReference: params.uniquenessReference,\n issuedAt: params.issuedAt,\n expiresAt: params.expiresAt,\n providerId: params.providerId,\n providerKeyVersion: params.providerKeyVersion ?? 1n,\n };\n const payload = attestationSignPayload(input);\n const providerSeed = providerSeedFromHex(params.providerSeedHex);\n const signature = await signAttestationPayload(providerSeed, payload);\n return { signature, input };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/attestation.ts","../src/generated/google/protobuf/timestamp.ts","../src/generated/isatheword/kingdomchain/citizen/v1/tx.ts","../src/generated/isatheword/kingdomchain/compliance/v1/tx.ts","../src/generated/isatheword/kingdomchain/compliance/v1/compliance.ts","../src/registry.ts","../src/chainConstants.ts","../src/browserSigner.ts","../src/walletConnectSigner.ts","../src/embeddedWallet/types.ts","../src/embeddedWallet/crypto.ts","../src/embeddedWallet/prf.ts","../src/embeddedWallet/backup.ts","../src/embeddedWallet/webauthn.ts","../src/embeddedWallet/signer.ts","../src/embeddedWallet/storage.ts","../src/embeddedWallet/wallet.ts","../src/submitApplication.ts"],"names":["BinaryWriter","BinaryReader","toTimestamp","fromTimestamp","ApplicationStatus","RecoveryAttestationStatus","toBase64","fromBase64"],"mappings":";;;;;;;;;;AAKO,IAAM,wCAAA,GAA2C;AAGjD,IAAM,yBAAA,GAA4B;AAmBzC,SAAS,UAAU,KAAA,EAA2B;AAC5C,EAAA,OAAO,OAAO,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,KAAK,CAAC,CAAA;AAC/C;AAGA,SAAS,YAAA,CAAa,OAAe,SAAA,EAA2B;AAC9D,EAAA,IAAI,QAAQ,EAAA,EAAI;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,SAAS,CAAA,2BAAA,EAA8B,KAAK,CAAA,CAAE,CAAA;AAAA,EACnE;AACA,EAAA,IAAI,QAAQ,mBAAA,EAAwB;AAClC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,SAAS,CAAA,yBAAA,EAA4B,KAAK,CAAA,CAAE,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,KAAA,CAAM,SAAS,EAAE,CAAA;AAC1B;AAGA,SAAS,YAAY,IAAA,EAAoB;AACvC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,OAAA,KAAY,GAAI,CAAA;AACzC;AAEA,SAAS,cAAc,MAAA,EAA8B;AACnD,EAAA,MAAM,QAAA,GAAW,OAAO,MAAA,CAAO,CAAC,KAA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,CAAO,aAAA;AAAA,IACtB,OAAO,MAAA,CAAO,KAAA;AAAA,IACd,qBAAqB,MAAA,CAAO,mBAAA;AAAA,IAC5B,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,WAAW,MAAA,CAAO,SAAA;AAAA,IAClB,YAAY,MAAA,CAAO,UAAA;AAAA,IACnB,kBAAA,EAAoB,OAAO,kBAAA,IAAsB;AAAA,GACnD;AACA,EAAA,MAAM,OAAA,GAAU,uBAAuB,KAAK,CAAA;AAC5C,EAAA,MAAM,YAAA,GAAe,mBAAA,CAAoB,MAAA,CAAO,eAAe,CAAA;AAC/D,EAAA,MAAM,SAAA,GAAY,MAAM,sBAAA,CAAuB,YAAA,EAAc,OAAO,CAAA;AACpE,EAAA,OAAO,EAAE,WAAW,KAAA,EAAM;AAC5B","file":"index.js","sourcesContent":["import { fromHex, toHex } from \"@cosmjs/encoding\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport * as ed from \"@noble/ed25519\";\n\n/** Must match x/compliance/types/keys.go AttestationTypeCitizenshipApplication */\nexport const ATTESTATION_TYPE_CITIZENSHIP_APPLICATION = \"citizenship_application\";\n\n/** Must match x/compliance/types/keys.go AttestationTypeRecovery */\nexport const ATTESTATION_TYPE_RECOVERY = \"recovery\";\n\nexport interface AttestationPayloadInput {\n attestationType: string;\n chainId: string;\n intendedWallet: string;\n caseId: string;\n policyVersion: string;\n nonce: string;\n uniquenessReference: string;\n issuedAt: Date;\n expiresAt: Date;\n providerId: string;\n providerKeyVersion: bigint;\n citizenId?: bigint;\n oldWallet?: string;\n newWallet?: string;\n}\n\nfunction hashField(value: string): Uint8Array {\n return sha256(new TextEncoder().encode(value));\n}\n\n/** Format uint64 the same way Go strconv.FormatUint(v, 10) does. Rejects out-of-range values. */\nfunction formatUint64(value: bigint, fieldName: string): string {\n if (value < 0n) {\n throw new Error(`${fieldName} must be non-negative, got ${value}`);\n }\n if (value > 0xffff_ffff_ffff_ffffn) {\n throw new Error(`${fieldName} exceeds uint64 max, got ${value}`);\n }\n return value.toString(10);\n}\n\n/** Unix seconds truncated toward zero — matches Go time.Time.Unix(). */\nfunction unixSeconds(date: Date): number {\n return Math.trunc(date.getTime() / 1000);\n}\n\nfunction combineHashes(hashes: Uint8Array[]): string {\n const totalLen = hashes.reduce((acc, h) => acc + h.length, 0);\n const preimage = new Uint8Array(totalLen);\n let offset = 0;\n for (const h of hashes) {\n preimage.set(h, offset);\n offset += h.length;\n }\n return toHex(sha256(preimage));\n}\n\n/**\n * Canonical attestation payload — must match Go types.AttestationSignPayload bit-for-bit.\n */\nexport function attestationSignPayload(input: AttestationPayloadInput): string {\n const hashes = [\n hashField(input.attestationType),\n hashField(input.chainId),\n hashField(input.intendedWallet),\n hashField(input.caseId),\n hashField(input.policyVersion),\n hashField(input.nonce),\n hashField(input.uniquenessReference),\n hashField(String(unixSeconds(input.issuedAt))),\n hashField(String(unixSeconds(input.expiresAt))),\n hashField(input.providerId),\n hashField(formatUint64(input.providerKeyVersion, \"providerKeyVersion\")),\n ];\n if (input.attestationType === ATTESTATION_TYPE_RECOVERY) {\n hashes.push(\n hashField(formatUint64(input.citizenId ?? 0n, \"citizenId\")),\n hashField(input.oldWallet ?? \"\"),\n hashField(input.newWallet ?? \"\"),\n );\n }\n return combineHashes(hashes);\n}\n\nexport async function signAttestationPayload(privateKeySeed: Uint8Array, payload: string): Promise<string> {\n if (privateKeySeed.length !== 32) {\n throw new Error(\"invalid ed25519 seed size\");\n }\n const sig = await ed.signAsync(new TextEncoder().encode(payload), privateKeySeed);\n return toHex(sig);\n}\n\nexport async function publicKeyFromPrivateSeed(privateKeySeed: Uint8Array): Promise<string> {\n if (privateKeySeed.length !== 32) {\n throw new Error(\"invalid ed25519 seed size\");\n }\n const pub = await ed.getPublicKeyAsync(privateKeySeed);\n return toHex(pub);\n}\n\nexport function providerSeedFromHex(hex: string): Uint8Array {\n const seed = fromHex(hex);\n if (seed.length !== 32) {\n throw new Error(\"provider seed hex must decode to 32 bytes\");\n }\n return new Uint8Array(seed);\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: google/protobuf/timestamp.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\n/**\n * A Timestamp represents a point in time independent of any time zone or local\n * calendar, encoded as a count of seconds and fractions of seconds at\n * nanosecond resolution. The count is relative to an epoch at UTC midnight on\n * January 1, 1970, in the proleptic Gregorian calendar which extends the\n * Gregorian calendar backwards to year one.\n *\n * All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n * second table is needed for interpretation, using a [24-hour linear\n * smear](https://developers.google.com/time/smear).\n *\n * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n * restricting to that range, we ensure that we can convert to and from [RFC\n * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n *\n * # Examples\n *\n * Example 1: Compute Timestamp from POSIX `time()`.\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(time(NULL));\n * timestamp.set_nanos(0);\n *\n * Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n *\n * struct timeval tv;\n * gettimeofday(&tv, NULL);\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(tv.tv_sec);\n * timestamp.set_nanos(tv.tv_usec * 1000);\n *\n * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n *\n * FILETIME ft;\n * GetSystemTimeAsFileTime(&ft);\n * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n *\n * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n * Timestamp timestamp;\n * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n *\n * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n *\n * long millis = System.currentTimeMillis();\n *\n * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n * .setNanos((int) ((millis % 1000) * 1000000)).build();\n *\n * Example 5: Compute Timestamp from Java `Instant.now()`.\n *\n * Instant now = Instant.now();\n *\n * Timestamp timestamp =\n * Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n * .setNanos(now.getNano()).build();\n *\n * Example 6: Compute Timestamp from current time in Python.\n *\n * timestamp = Timestamp()\n * timestamp.GetCurrentTime()\n *\n * # JSON Mapping\n *\n * In JSON format, the Timestamp type is encoded as a string in the\n * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n * format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n * where {year} is always expressed using four digits while {month}, {day},\n * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n * are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n * is required. A proto3 JSON serializer should always use UTC (as indicated by\n * \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n * able to accept both UTC and other timezones (as indicated by an offset).\n *\n * For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n * 01:30 UTC on January 15, 2017.\n *\n * In JavaScript, one can convert a Date object to this format using the\n * standard\n * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n * method. In Python, a standard `datetime.datetime` object can be converted\n * to this format using\n * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n * the Joda Time's [`ISODateTimeFormat.dateTime()`](\n * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()\n * ) to obtain a formatter capable of generating timestamps in this format.\n */\nexport interface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n nanos: number;\n}\n\nfunction createBaseTimestamp(): Timestamp {\n return { seconds: 0n, nanos: 0 };\n}\n\nexport const Timestamp: MessageFns<Timestamp> = {\n encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.seconds !== 0n) {\n if (BigInt.asIntN(64, message.seconds) !== message.seconds) {\n throw new globalThis.Error(\"value provided for field message.seconds of type int64 too large\");\n }\n writer.uint32(8).int64(message.seconds);\n }\n if (message.nanos !== 0) {\n writer.uint32(16).int32(message.nanos);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseTimestamp();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n\n message.seconds = reader.int64() as bigint;\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.nanos = reader.int32();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Timestamp>): Timestamp {\n return Timestamp.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Timestamp>): Timestamp {\n const message = createBaseTimestamp();\n message.seconds = (object.seconds !== undefined && object.seconds !== null) ? BigInt(object.seconds) : 0n;\n message.nanos = object.nanos ?? 0;\n return message;\n },\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/citizen/v1/tx.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport interface MsgIssueKCP {\n authority: string;\n application_id: string;\n wallet_address: string;\n uniqueness_commitment: string;\n decision_id: string;\n}\n\nexport interface MsgIssueKCPResponse {\n citizen_id: bigint;\n}\n\nexport interface MsgSuspendKCP {\n authority: string;\n citizen_id: bigint;\n reason_code: string;\n expires_at?: Date | undefined;\n}\n\nexport interface MsgSuspendKCPResponse {\n}\n\nexport interface MsgReactivateKCP {\n authority: string;\n citizen_id: bigint;\n}\n\nexport interface MsgReactivateKCPResponse {\n}\n\nexport interface MsgRevokeKCP {\n authority: string;\n citizen_id: bigint;\n reason_code: string;\n evidence_ref: string;\n}\n\nexport interface MsgRevokeKCPResponse {\n}\n\nexport interface MsgInitiateRecovery {\n authority: string;\n citizen_id: bigint;\n new_wallet: string;\n recovery_case_id: string;\n cooling_off_ends_at?: Date | undefined;\n}\n\nexport interface MsgInitiateRecoveryResponse {\n}\n\nexport interface MsgApproveRecovery {\n authority: string;\n recovery_case_id: string;\n}\n\nexport interface MsgApproveRecoveryResponse {\n}\n\nexport interface MsgFinalizeRecovery {\n authority: string;\n recovery_case_id: string;\n decision_id: string;\n}\n\nexport interface MsgFinalizeRecoveryResponse {\n}\n\nexport interface MsgCancelRecovery {\n authority: string;\n recovery_case_id: string;\n reason_code: string;\n}\n\nexport interface MsgCancelRecoveryResponse {\n}\n\nfunction createBaseMsgIssueKCP(): MsgIssueKCP {\n return { authority: \"\", application_id: \"\", wallet_address: \"\", uniqueness_commitment: \"\", decision_id: \"\" };\n}\n\nexport const MsgIssueKCP: MessageFns<MsgIssueKCP> = {\n encode(message: MsgIssueKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.wallet_address !== \"\") {\n writer.uint32(26).string(message.wallet_address);\n }\n if (message.uniqueness_commitment !== \"\") {\n writer.uint32(34).string(message.uniqueness_commitment);\n }\n if (message.decision_id !== \"\") {\n writer.uint32(42).string(message.decision_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgIssueKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgIssueKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.wallet_address = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.uniqueness_commitment = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.decision_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgIssueKCP>): MsgIssueKCP {\n return MsgIssueKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgIssueKCP>): MsgIssueKCP {\n const message = createBaseMsgIssueKCP();\n message.authority = object.authority ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.wallet_address = object.wallet_address ?? \"\";\n message.uniqueness_commitment = object.uniqueness_commitment ?? \"\";\n message.decision_id = object.decision_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgIssueKCPResponse(): MsgIssueKCPResponse {\n return { citizen_id: 0n };\n}\n\nexport const MsgIssueKCPResponse: MessageFns<MsgIssueKCPResponse> = {\n encode(message: MsgIssueKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(8).uint64(message.citizen_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgIssueKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgIssueKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgIssueKCPResponse>): MsgIssueKCPResponse {\n return MsgIssueKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgIssueKCPResponse>): MsgIssueKCPResponse {\n const message = createBaseMsgIssueKCPResponse();\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n return message;\n },\n};\n\nfunction createBaseMsgSuspendKCP(): MsgSuspendKCP {\n return { authority: \"\", citizen_id: 0n, reason_code: \"\", expires_at: undefined };\n}\n\nexport const MsgSuspendKCP: MessageFns<MsgSuspendKCP> = {\n encode(message: MsgSuspendKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(34).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendKCP>): MsgSuspendKCP {\n return MsgSuspendKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSuspendKCP>): MsgSuspendKCP {\n const message = createBaseMsgSuspendKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.reason_code = object.reason_code ?? \"\";\n message.expires_at = object.expires_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgSuspendKCPResponse(): MsgSuspendKCPResponse {\n return {};\n}\n\nexport const MsgSuspendKCPResponse: MessageFns<MsgSuspendKCPResponse> = {\n encode(_: MsgSuspendKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendKCPResponse>): MsgSuspendKCPResponse {\n return MsgSuspendKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSuspendKCPResponse>): MsgSuspendKCPResponse {\n const message = createBaseMsgSuspendKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgReactivateKCP(): MsgReactivateKCP {\n return { authority: \"\", citizen_id: 0n };\n}\n\nexport const MsgReactivateKCP: MessageFns<MsgReactivateKCP> = {\n encode(message: MsgReactivateKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgReactivateKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgReactivateKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgReactivateKCP>): MsgReactivateKCP {\n return MsgReactivateKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgReactivateKCP>): MsgReactivateKCP {\n const message = createBaseMsgReactivateKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n return message;\n },\n};\n\nfunction createBaseMsgReactivateKCPResponse(): MsgReactivateKCPResponse {\n return {};\n}\n\nexport const MsgReactivateKCPResponse: MessageFns<MsgReactivateKCPResponse> = {\n encode(_: MsgReactivateKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgReactivateKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgReactivateKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgReactivateKCPResponse>): MsgReactivateKCPResponse {\n return MsgReactivateKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgReactivateKCPResponse>): MsgReactivateKCPResponse {\n const message = createBaseMsgReactivateKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgRevokeKCP(): MsgRevokeKCP {\n return { authority: \"\", citizen_id: 0n, reason_code: \"\", evidence_ref: \"\" };\n}\n\nexport const MsgRevokeKCP: MessageFns<MsgRevokeKCP> = {\n encode(message: MsgRevokeKCP, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n if (message.evidence_ref !== \"\") {\n writer.uint32(34).string(message.evidence_ref);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeKCP {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRevokeKCP();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.evidence_ref = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRevokeKCP>): MsgRevokeKCP {\n return MsgRevokeKCP.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgRevokeKCP>): MsgRevokeKCP {\n const message = createBaseMsgRevokeKCP();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.reason_code = object.reason_code ?? \"\";\n message.evidence_ref = object.evidence_ref ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgRevokeKCPResponse(): MsgRevokeKCPResponse {\n return {};\n}\n\nexport const MsgRevokeKCPResponse: MessageFns<MsgRevokeKCPResponse> = {\n encode(_: MsgRevokeKCPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeKCPResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRevokeKCPResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRevokeKCPResponse>): MsgRevokeKCPResponse {\n return MsgRevokeKCPResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgRevokeKCPResponse>): MsgRevokeKCPResponse {\n const message = createBaseMsgRevokeKCPResponse();\n return message;\n },\n};\n\nfunction createBaseMsgInitiateRecovery(): MsgInitiateRecovery {\n return { authority: \"\", citizen_id: 0n, new_wallet: \"\", recovery_case_id: \"\", cooling_off_ends_at: undefined };\n}\n\nexport const MsgInitiateRecovery: MessageFns<MsgInitiateRecovery> = {\n encode(message: MsgInitiateRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(16).uint64(message.citizen_id);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(26).string(message.new_wallet);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(34).string(message.recovery_case_id);\n }\n if (message.cooling_off_ends_at !== undefined) {\n Timestamp.encode(toTimestamp(message.cooling_off_ends_at), writer.uint32(42).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgInitiateRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgInitiateRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 16) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.cooling_off_ends_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgInitiateRecovery>): MsgInitiateRecovery {\n return MsgInitiateRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgInitiateRecovery>): MsgInitiateRecovery {\n const message = createBaseMsgInitiateRecovery();\n message.authority = object.authority ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.new_wallet = object.new_wallet ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.cooling_off_ends_at = object.cooling_off_ends_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgInitiateRecoveryResponse(): MsgInitiateRecoveryResponse {\n return {};\n}\n\nexport const MsgInitiateRecoveryResponse: MessageFns<MsgInitiateRecoveryResponse> = {\n encode(_: MsgInitiateRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgInitiateRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgInitiateRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgInitiateRecoveryResponse>): MsgInitiateRecoveryResponse {\n return MsgInitiateRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgInitiateRecoveryResponse>): MsgInitiateRecoveryResponse {\n const message = createBaseMsgInitiateRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgApproveRecovery(): MsgApproveRecovery {\n return { authority: \"\", recovery_case_id: \"\" };\n}\n\nexport const MsgApproveRecovery: MessageFns<MsgApproveRecovery> = {\n encode(message: MsgApproveRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgApproveRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgApproveRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgApproveRecovery>): MsgApproveRecovery {\n return MsgApproveRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgApproveRecovery>): MsgApproveRecovery {\n const message = createBaseMsgApproveRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgApproveRecoveryResponse(): MsgApproveRecoveryResponse {\n return {};\n}\n\nexport const MsgApproveRecoveryResponse: MessageFns<MsgApproveRecoveryResponse> = {\n encode(_: MsgApproveRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgApproveRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgApproveRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgApproveRecoveryResponse>): MsgApproveRecoveryResponse {\n return MsgApproveRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgApproveRecoveryResponse>): MsgApproveRecoveryResponse {\n const message = createBaseMsgApproveRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgFinalizeRecovery(): MsgFinalizeRecovery {\n return { authority: \"\", recovery_case_id: \"\", decision_id: \"\" };\n}\n\nexport const MsgFinalizeRecovery: MessageFns<MsgFinalizeRecovery> = {\n encode(message: MsgFinalizeRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.decision_id !== \"\") {\n writer.uint32(26).string(message.decision_id);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgFinalizeRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgFinalizeRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.decision_id = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgFinalizeRecovery>): MsgFinalizeRecovery {\n return MsgFinalizeRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgFinalizeRecovery>): MsgFinalizeRecovery {\n const message = createBaseMsgFinalizeRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.decision_id = object.decision_id ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgFinalizeRecoveryResponse(): MsgFinalizeRecoveryResponse {\n return {};\n}\n\nexport const MsgFinalizeRecoveryResponse: MessageFns<MsgFinalizeRecoveryResponse> = {\n encode(_: MsgFinalizeRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgFinalizeRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgFinalizeRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgFinalizeRecoveryResponse>): MsgFinalizeRecoveryResponse {\n return MsgFinalizeRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgFinalizeRecoveryResponse>): MsgFinalizeRecoveryResponse {\n const message = createBaseMsgFinalizeRecoveryResponse();\n return message;\n },\n};\n\nfunction createBaseMsgCancelRecovery(): MsgCancelRecovery {\n return { authority: \"\", recovery_case_id: \"\", reason_code: \"\" };\n}\n\nexport const MsgCancelRecovery: MessageFns<MsgCancelRecovery> = {\n encode(message: MsgCancelRecovery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelRecovery {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgCancelRecovery();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgCancelRecovery>): MsgCancelRecovery {\n return MsgCancelRecovery.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgCancelRecovery>): MsgCancelRecovery {\n const message = createBaseMsgCancelRecovery();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgCancelRecoveryResponse(): MsgCancelRecoveryResponse {\n return {};\n}\n\nexport const MsgCancelRecoveryResponse: MessageFns<MsgCancelRecoveryResponse> = {\n encode(_: MsgCancelRecoveryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelRecoveryResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgCancelRecoveryResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgCancelRecoveryResponse>): MsgCancelRecoveryResponse {\n return MsgCancelRecoveryResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgCancelRecoveryResponse>): MsgCancelRecoveryResponse {\n const message = createBaseMsgCancelRecoveryResponse();\n return message;\n },\n};\n\nexport type MsgDefinition = typeof MsgDefinition;\nexport const MsgDefinition = {\n name: \"Msg\",\n fullName: \"isatheword.kingdomchain.citizen.v1.Msg\",\n methods: {\n issueKCP: {\n name: \"IssueKCP\",\n requestType: MsgIssueKCP as typeof MsgIssueKCP,\n requestStream: false,\n responseType: MsgIssueKCPResponse as typeof MsgIssueKCPResponse,\n responseStream: false,\n options: {},\n },\n suspendKCP: {\n name: \"SuspendKCP\",\n requestType: MsgSuspendKCP as typeof MsgSuspendKCP,\n requestStream: false,\n responseType: MsgSuspendKCPResponse as typeof MsgSuspendKCPResponse,\n responseStream: false,\n options: {},\n },\n reactivateKCP: {\n name: \"ReactivateKCP\",\n requestType: MsgReactivateKCP as typeof MsgReactivateKCP,\n requestStream: false,\n responseType: MsgReactivateKCPResponse as typeof MsgReactivateKCPResponse,\n responseStream: false,\n options: {},\n },\n revokeKCP: {\n name: \"RevokeKCP\",\n requestType: MsgRevokeKCP as typeof MsgRevokeKCP,\n requestStream: false,\n responseType: MsgRevokeKCPResponse as typeof MsgRevokeKCPResponse,\n responseStream: false,\n options: {},\n },\n initiateRecovery: {\n name: \"InitiateRecovery\",\n requestType: MsgInitiateRecovery as typeof MsgInitiateRecovery,\n requestStream: false,\n responseType: MsgInitiateRecoveryResponse as typeof MsgInitiateRecoveryResponse,\n responseStream: false,\n options: {},\n },\n approveRecovery: {\n name: \"ApproveRecovery\",\n requestType: MsgApproveRecovery as typeof MsgApproveRecovery,\n requestStream: false,\n responseType: MsgApproveRecoveryResponse as typeof MsgApproveRecoveryResponse,\n responseStream: false,\n options: {},\n },\n finalizeRecovery: {\n name: \"FinalizeRecovery\",\n requestType: MsgFinalizeRecovery as typeof MsgFinalizeRecovery,\n requestStream: false,\n responseType: MsgFinalizeRecoveryResponse as typeof MsgFinalizeRecoveryResponse,\n responseStream: false,\n options: {},\n },\n cancelRecovery: {\n name: \"CancelRecovery\",\n requestType: MsgCancelRecovery as typeof MsgCancelRecovery,\n requestStream: false,\n responseType: MsgCancelRecoveryResponse as typeof MsgCancelRecoveryResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/compliance/v1/tx.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport interface MsgRegisterProvider {\n authority: string;\n provider_id: string;\n public_key: string;\n key_version: bigint;\n supported_assurance_levels: string[];\n supported_jurisdictions: string[];\n active_from?: Date | undefined;\n active_until?: Date | undefined;\n}\n\nexport interface MsgRegisterProviderResponse {\n}\n\nexport interface MsgSuspendProvider {\n authority: string;\n provider_id: string;\n reason_code: string;\n}\n\nexport interface MsgSuspendProviderResponse {\n}\n\nexport interface MsgSubmitApplication {\n applicant_wallet: string;\n application_id: string;\n provider_id: string;\n provider_key_version: bigint;\n chain_id: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n signature: string;\n}\n\nexport interface MsgSubmitApplicationResponse {\n}\n\nexport interface MsgSubmitRecoveryAttestation {\n applicant_wallet: string;\n recovery_case_id: string;\n provider_id: string;\n provider_key_version: bigint;\n chain_id: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n signature: string;\n}\n\nexport interface MsgSubmitRecoveryAttestationResponse {\n}\n\nexport interface MsgDecideApplication {\n authority: string;\n application_id: string;\n approved: boolean;\n reason_code: string;\n}\n\nexport interface MsgDecideApplicationResponse {\n}\n\nexport interface MsgDecideRecoveryAttestation {\n authority: string;\n recovery_case_id: string;\n approved: boolean;\n reason_code: string;\n}\n\nexport interface MsgDecideRecoveryAttestationResponse {\n}\n\nfunction createBaseMsgRegisterProvider(): MsgRegisterProvider {\n return {\n authority: \"\",\n provider_id: \"\",\n public_key: \"\",\n key_version: 0n,\n supported_assurance_levels: [],\n supported_jurisdictions: [],\n active_from: undefined,\n active_until: undefined,\n };\n}\n\nexport const MsgRegisterProvider: MessageFns<MsgRegisterProvider> = {\n encode(message: MsgRegisterProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.public_key !== \"\") {\n writer.uint32(26).string(message.public_key);\n }\n if (message.key_version !== 0n) {\n if (BigInt.asUintN(64, message.key_version) !== message.key_version) {\n throw new globalThis.Error(\"value provided for field message.key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.key_version);\n }\n for (const v of message.supported_assurance_levels) {\n writer.uint32(42).string(v!);\n }\n for (const v of message.supported_jurisdictions) {\n writer.uint32(50).string(v!);\n }\n if (message.active_from !== undefined) {\n Timestamp.encode(toTimestamp(message.active_from), writer.uint32(58).fork()).join();\n }\n if (message.active_until !== undefined) {\n Timestamp.encode(toTimestamp(message.active_until), writer.uint32(66).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterProvider {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRegisterProvider();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.public_key = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.supported_assurance_levels.push(reader.string());\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.supported_jurisdictions.push(reader.string());\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.active_from = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.active_until = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRegisterProvider>): MsgRegisterProvider {\n return MsgRegisterProvider.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgRegisterProvider>): MsgRegisterProvider {\n const message = createBaseMsgRegisterProvider();\n message.authority = object.authority ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.public_key = object.public_key ?? \"\";\n message.key_version = (object.key_version !== undefined && object.key_version !== null)\n ? BigInt(object.key_version)\n : 0n;\n message.supported_assurance_levels = object.supported_assurance_levels?.map((e) => e) || [];\n message.supported_jurisdictions = object.supported_jurisdictions?.map((e) => e) || [];\n message.active_from = object.active_from ?? undefined;\n message.active_until = object.active_until ?? undefined;\n return message;\n },\n};\n\nfunction createBaseMsgRegisterProviderResponse(): MsgRegisterProviderResponse {\n return {};\n}\n\nexport const MsgRegisterProviderResponse: MessageFns<MsgRegisterProviderResponse> = {\n encode(_: MsgRegisterProviderResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterProviderResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgRegisterProviderResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgRegisterProviderResponse>): MsgRegisterProviderResponse {\n return MsgRegisterProviderResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgRegisterProviderResponse>): MsgRegisterProviderResponse {\n const message = createBaseMsgRegisterProviderResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSuspendProvider(): MsgSuspendProvider {\n return { authority: \"\", provider_id: \"\", reason_code: \"\" };\n}\n\nexport const MsgSuspendProvider: MessageFns<MsgSuspendProvider> = {\n encode(message: MsgSuspendProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(26).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendProvider {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendProvider();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendProvider>): MsgSuspendProvider {\n return MsgSuspendProvider.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSuspendProvider>): MsgSuspendProvider {\n const message = createBaseMsgSuspendProvider();\n message.authority = object.authority ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSuspendProviderResponse(): MsgSuspendProviderResponse {\n return {};\n}\n\nexport const MsgSuspendProviderResponse: MessageFns<MsgSuspendProviderResponse> = {\n encode(_: MsgSuspendProviderResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSuspendProviderResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSuspendProviderResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSuspendProviderResponse>): MsgSuspendProviderResponse {\n return MsgSuspendProviderResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSuspendProviderResponse>): MsgSuspendProviderResponse {\n const message = createBaseMsgSuspendProviderResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSubmitApplication(): MsgSubmitApplication {\n return {\n applicant_wallet: \"\",\n application_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n chain_id: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n issued_at: undefined,\n expires_at: undefined,\n signature: \"\",\n };\n}\n\nexport const MsgSubmitApplication: MessageFns<MsgSubmitApplication> = {\n encode(message: MsgSubmitApplication, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.applicant_wallet !== \"\") {\n writer.uint32(10).string(message.applicant_wallet);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(26).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.provider_key_version);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.case_id !== \"\") {\n writer.uint32(50).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(58).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(66).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(74).string(message.uniqueness_reference);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(82).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(90).fork()).join();\n }\n if (message.signature !== \"\") {\n writer.uint32(98).string(message.signature);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitApplication {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitApplication>): MsgSubmitApplication {\n return MsgSubmitApplication.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSubmitApplication>): MsgSubmitApplication {\n const message = createBaseMsgSubmitApplication();\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.chain_id = object.chain_id ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.signature = object.signature ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSubmitApplicationResponse(): MsgSubmitApplicationResponse {\n return {};\n}\n\nexport const MsgSubmitApplicationResponse: MessageFns<MsgSubmitApplicationResponse> = {\n encode(_: MsgSubmitApplicationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitApplicationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitApplicationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitApplicationResponse>): MsgSubmitApplicationResponse {\n return MsgSubmitApplicationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSubmitApplicationResponse>): MsgSubmitApplicationResponse {\n const message = createBaseMsgSubmitApplicationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgSubmitRecoveryAttestation(): MsgSubmitRecoveryAttestation {\n return {\n applicant_wallet: \"\",\n recovery_case_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n chain_id: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n issued_at: undefined,\n expires_at: undefined,\n signature: \"\",\n };\n}\n\nexport const MsgSubmitRecoveryAttestation: MessageFns<MsgSubmitRecoveryAttestation> = {\n encode(message: MsgSubmitRecoveryAttestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.applicant_wallet !== \"\") {\n writer.uint32(10).string(message.applicant_wallet);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(26).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(32).uint64(message.provider_key_version);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.case_id !== \"\") {\n writer.uint32(50).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(58).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(66).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(74).string(message.uniqueness_reference);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(80).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(90).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(98).string(message.new_wallet);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(106).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(114).fork()).join();\n }\n if (message.signature !== \"\") {\n writer.uint32(122).string(message.signature);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitRecoveryAttestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitRecoveryAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 26) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 80) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 13: {\n if (tag !== 106) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 14: {\n if (tag !== 114) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 15: {\n if (tag !== 122) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitRecoveryAttestation>): MsgSubmitRecoveryAttestation {\n return MsgSubmitRecoveryAttestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgSubmitRecoveryAttestation>): MsgSubmitRecoveryAttestation {\n const message = createBaseMsgSubmitRecoveryAttestation();\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.chain_id = object.chain_id ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.signature = object.signature ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgSubmitRecoveryAttestationResponse(): MsgSubmitRecoveryAttestationResponse {\n return {};\n}\n\nexport const MsgSubmitRecoveryAttestationResponse: MessageFns<MsgSubmitRecoveryAttestationResponse> = {\n encode(_: MsgSubmitRecoveryAttestationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitRecoveryAttestationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgSubmitRecoveryAttestationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgSubmitRecoveryAttestationResponse>): MsgSubmitRecoveryAttestationResponse {\n return MsgSubmitRecoveryAttestationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgSubmitRecoveryAttestationResponse>): MsgSubmitRecoveryAttestationResponse {\n const message = createBaseMsgSubmitRecoveryAttestationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgDecideApplication(): MsgDecideApplication {\n return { authority: \"\", application_id: \"\", approved: false, reason_code: \"\" };\n}\n\nexport const MsgDecideApplication: MessageFns<MsgDecideApplication> = {\n encode(message: MsgDecideApplication, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.application_id !== \"\") {\n writer.uint32(18).string(message.application_id);\n }\n if (message.approved !== false) {\n writer.uint32(24).bool(message.approved);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(34).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideApplication {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.approved = reader.bool();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideApplication>): MsgDecideApplication {\n return MsgDecideApplication.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgDecideApplication>): MsgDecideApplication {\n const message = createBaseMsgDecideApplication();\n message.authority = object.authority ?? \"\";\n message.application_id = object.application_id ?? \"\";\n message.approved = object.approved ?? false;\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgDecideApplicationResponse(): MsgDecideApplicationResponse {\n return {};\n}\n\nexport const MsgDecideApplicationResponse: MessageFns<MsgDecideApplicationResponse> = {\n encode(_: MsgDecideApplicationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideApplicationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideApplicationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideApplicationResponse>): MsgDecideApplicationResponse {\n return MsgDecideApplicationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgDecideApplicationResponse>): MsgDecideApplicationResponse {\n const message = createBaseMsgDecideApplicationResponse();\n return message;\n },\n};\n\nfunction createBaseMsgDecideRecoveryAttestation(): MsgDecideRecoveryAttestation {\n return { authority: \"\", recovery_case_id: \"\", approved: false, reason_code: \"\" };\n}\n\nexport const MsgDecideRecoveryAttestation: MessageFns<MsgDecideRecoveryAttestation> = {\n encode(message: MsgDecideRecoveryAttestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.authority !== \"\") {\n writer.uint32(10).string(message.authority);\n }\n if (message.recovery_case_id !== \"\") {\n writer.uint32(18).string(message.recovery_case_id);\n }\n if (message.approved !== false) {\n writer.uint32(24).bool(message.approved);\n }\n if (message.reason_code !== \"\") {\n writer.uint32(34).string(message.reason_code);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideRecoveryAttestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideRecoveryAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.authority = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.approved = reader.bool();\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.reason_code = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideRecoveryAttestation>): MsgDecideRecoveryAttestation {\n return MsgDecideRecoveryAttestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<MsgDecideRecoveryAttestation>): MsgDecideRecoveryAttestation {\n const message = createBaseMsgDecideRecoveryAttestation();\n message.authority = object.authority ?? \"\";\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.approved = object.approved ?? false;\n message.reason_code = object.reason_code ?? \"\";\n return message;\n },\n};\n\nfunction createBaseMsgDecideRecoveryAttestationResponse(): MsgDecideRecoveryAttestationResponse {\n return {};\n}\n\nexport const MsgDecideRecoveryAttestationResponse: MessageFns<MsgDecideRecoveryAttestationResponse> = {\n encode(_: MsgDecideRecoveryAttestationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): MsgDecideRecoveryAttestationResponse {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMsgDecideRecoveryAttestationResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<MsgDecideRecoveryAttestationResponse>): MsgDecideRecoveryAttestationResponse {\n return MsgDecideRecoveryAttestationResponse.fromPartial(base ?? {});\n },\n fromPartial(_: DeepPartial<MsgDecideRecoveryAttestationResponse>): MsgDecideRecoveryAttestationResponse {\n const message = createBaseMsgDecideRecoveryAttestationResponse();\n return message;\n },\n};\n\nexport type MsgDefinition = typeof MsgDefinition;\nexport const MsgDefinition = {\n name: \"Msg\",\n fullName: \"isatheword.kingdomchain.compliance.v1.Msg\",\n methods: {\n registerProvider: {\n name: \"RegisterProvider\",\n requestType: MsgRegisterProvider as typeof MsgRegisterProvider,\n requestStream: false,\n responseType: MsgRegisterProviderResponse as typeof MsgRegisterProviderResponse,\n responseStream: false,\n options: {},\n },\n suspendProvider: {\n name: \"SuspendProvider\",\n requestType: MsgSuspendProvider as typeof MsgSuspendProvider,\n requestStream: false,\n responseType: MsgSuspendProviderResponse as typeof MsgSuspendProviderResponse,\n responseStream: false,\n options: {},\n },\n submitApplication: {\n name: \"SubmitApplication\",\n requestType: MsgSubmitApplication as typeof MsgSubmitApplication,\n requestStream: false,\n responseType: MsgSubmitApplicationResponse as typeof MsgSubmitApplicationResponse,\n responseStream: false,\n options: {},\n },\n submitRecoveryAttestation: {\n name: \"SubmitRecoveryAttestation\",\n requestType: MsgSubmitRecoveryAttestation as typeof MsgSubmitRecoveryAttestation,\n requestStream: false,\n responseType: MsgSubmitRecoveryAttestationResponse as typeof MsgSubmitRecoveryAttestationResponse,\n responseStream: false,\n options: {},\n },\n decideApplication: {\n name: \"DecideApplication\",\n requestType: MsgDecideApplication as typeof MsgDecideApplication,\n requestStream: false,\n responseType: MsgDecideApplicationResponse as typeof MsgDecideApplicationResponse,\n responseStream: false,\n options: {},\n },\n decideRecoveryAttestation: {\n name: \"DecideRecoveryAttestation\",\n requestType: MsgDecideRecoveryAttestation as typeof MsgDecideRecoveryAttestation,\n requestStream: false,\n responseType: MsgDecideRecoveryAttestationResponse as typeof MsgDecideRecoveryAttestationResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.12.0\n// protoc unknown\n// source: isatheword/kingdomchain/compliance/v1/compliance.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nimport { Timestamp } from \"../../../../google/protobuf/timestamp\";\n\nexport enum ProviderStatus {\n PROVIDER_STATUS_UNSPECIFIED = 0,\n PROVIDER_STATUS_ACTIVE = 1,\n PROVIDER_STATUS_SUSPENDED = 2,\n PROVIDER_STATUS_REVOKED = 3,\n UNRECOGNIZED = -1,\n}\n\nexport enum AttestationType {\n ATTESTATION_TYPE_UNSPECIFIED = 0,\n ATTESTATION_TYPE_CITIZENSHIP_APPLICATION = 1,\n ATTESTATION_TYPE_RECOVERY = 2,\n UNRECOGNIZED = -1,\n}\n\nexport enum ApplicationStatus {\n APPLICATION_STATUS_UNSPECIFIED = 0,\n APPLICATION_STATUS_SUBMITTED = 1,\n APPLICATION_STATUS_PENDING_REVIEW = 2,\n APPLICATION_STATUS_APPROVED = 3,\n APPLICATION_STATUS_REJECTED = 4,\n UNRECOGNIZED = -1,\n}\n\nexport enum RecoveryAttestationStatus {\n RECOVERY_ATTESTATION_STATUS_UNSPECIFIED = 0,\n RECOVERY_ATTESTATION_STATUS_SUBMITTED = 1,\n RECOVERY_ATTESTATION_STATUS_PENDING_REVIEW = 2,\n RECOVERY_ATTESTATION_STATUS_APPROVED = 3,\n RECOVERY_ATTESTATION_STATUS_REJECTED = 4,\n UNRECOGNIZED = -1,\n}\n\nexport interface ProviderRecord {\n provider_id: string;\n public_key: string;\n key_version: bigint;\n supported_assurance_levels: string[];\n supported_jurisdictions: string[];\n active_from?: Date | undefined;\n active_until?: Date | undefined;\n status: ProviderStatus;\n}\n\nexport interface Attestation {\n attestation_id: string;\n provider_id: string;\n provider_key_version: bigint;\n attestation_type: AttestationType;\n chain_id: string;\n intended_wallet: string;\n case_id: string;\n policy_version: string;\n nonce: string;\n uniqueness_reference: string;\n issued_at?: Date | undefined;\n expires_at?: Date | undefined;\n consumed: boolean;\n signature: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n}\n\nexport interface Application {\n application_id: string;\n applicant_wallet: string;\n status: ApplicationStatus;\n attestation_id: string;\n uniqueness_commitment: string;\n policy_version: string;\n decision_reason_code: string;\n submitted_at?: Date | undefined;\n decided_at?: Date | undefined;\n}\n\nexport interface RecoveryAttestationCase {\n recovery_case_id: string;\n applicant_wallet: string;\n status: RecoveryAttestationStatus;\n attestation_id: string;\n citizen_id: bigint;\n old_wallet: string;\n new_wallet: string;\n policy_version: string;\n decision_reason_code: string;\n submitted_at?: Date | undefined;\n decided_at?: Date | undefined;\n}\n\nfunction createBaseProviderRecord(): ProviderRecord {\n return {\n provider_id: \"\",\n public_key: \"\",\n key_version: 0n,\n supported_assurance_levels: [],\n supported_jurisdictions: [],\n active_from: undefined,\n active_until: undefined,\n status: 0,\n };\n}\n\nexport const ProviderRecord: MessageFns<ProviderRecord> = {\n encode(message: ProviderRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.provider_id !== \"\") {\n writer.uint32(10).string(message.provider_id);\n }\n if (message.public_key !== \"\") {\n writer.uint32(18).string(message.public_key);\n }\n if (message.key_version !== 0n) {\n if (BigInt.asUintN(64, message.key_version) !== message.key_version) {\n throw new globalThis.Error(\"value provided for field message.key_version of type uint64 too large\");\n }\n writer.uint32(24).uint64(message.key_version);\n }\n for (const v of message.supported_assurance_levels) {\n writer.uint32(34).string(v!);\n }\n for (const v of message.supported_jurisdictions) {\n writer.uint32(42).string(v!);\n }\n if (message.active_from !== undefined) {\n Timestamp.encode(toTimestamp(message.active_from), writer.uint32(50).fork()).join();\n }\n if (message.active_until !== undefined) {\n Timestamp.encode(toTimestamp(message.active_until), writer.uint32(58).fork()).join();\n }\n if (message.status !== 0) {\n writer.uint32(64).int32(message.status);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): ProviderRecord {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseProviderRecord();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.public_key = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.key_version = reader.uint64() as bigint;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.supported_assurance_levels.push(reader.string());\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.supported_jurisdictions.push(reader.string());\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.active_from = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.active_until = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 8: {\n if (tag !== 64) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<ProviderRecord>): ProviderRecord {\n return ProviderRecord.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<ProviderRecord>): ProviderRecord {\n const message = createBaseProviderRecord();\n message.provider_id = object.provider_id ?? \"\";\n message.public_key = object.public_key ?? \"\";\n message.key_version = (object.key_version !== undefined && object.key_version !== null)\n ? BigInt(object.key_version)\n : 0n;\n message.supported_assurance_levels = object.supported_assurance_levels?.map((e) => e) || [];\n message.supported_jurisdictions = object.supported_jurisdictions?.map((e) => e) || [];\n message.active_from = object.active_from ?? undefined;\n message.active_until = object.active_until ?? undefined;\n message.status = object.status ?? 0;\n return message;\n },\n};\n\nfunction createBaseAttestation(): Attestation {\n return {\n attestation_id: \"\",\n provider_id: \"\",\n provider_key_version: 0n,\n attestation_type: 0,\n chain_id: \"\",\n intended_wallet: \"\",\n case_id: \"\",\n policy_version: \"\",\n nonce: \"\",\n uniqueness_reference: \"\",\n issued_at: undefined,\n expires_at: undefined,\n consumed: false,\n signature: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n };\n}\n\nexport const Attestation: MessageFns<Attestation> = {\n encode(message: Attestation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.attestation_id !== \"\") {\n writer.uint32(10).string(message.attestation_id);\n }\n if (message.provider_id !== \"\") {\n writer.uint32(18).string(message.provider_id);\n }\n if (message.provider_key_version !== 0n) {\n if (BigInt.asUintN(64, message.provider_key_version) !== message.provider_key_version) {\n throw new globalThis.Error(\"value provided for field message.provider_key_version of type uint64 too large\");\n }\n writer.uint32(24).uint64(message.provider_key_version);\n }\n if (message.attestation_type !== 0) {\n writer.uint32(32).int32(message.attestation_type);\n }\n if (message.chain_id !== \"\") {\n writer.uint32(42).string(message.chain_id);\n }\n if (message.intended_wallet !== \"\") {\n writer.uint32(50).string(message.intended_wallet);\n }\n if (message.case_id !== \"\") {\n writer.uint32(58).string(message.case_id);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(66).string(message.policy_version);\n }\n if (message.nonce !== \"\") {\n writer.uint32(74).string(message.nonce);\n }\n if (message.uniqueness_reference !== \"\") {\n writer.uint32(82).string(message.uniqueness_reference);\n }\n if (message.issued_at !== undefined) {\n Timestamp.encode(toTimestamp(message.issued_at), writer.uint32(90).fork()).join();\n }\n if (message.expires_at !== undefined) {\n Timestamp.encode(toTimestamp(message.expires_at), writer.uint32(98).fork()).join();\n }\n if (message.consumed !== false) {\n writer.uint32(104).bool(message.consumed);\n }\n if (message.signature !== \"\") {\n writer.uint32(114).string(message.signature);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(120).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(130).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(138).string(message.new_wallet);\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Attestation {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseAttestation();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.provider_id = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.provider_key_version = reader.uint64() as bigint;\n continue;\n }\n case 4: {\n if (tag !== 32) {\n break;\n }\n\n message.attestation_type = reader.int32() as any;\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.chain_id = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.intended_wallet = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.case_id = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.nonce = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.uniqueness_reference = reader.string();\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.issued_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 12: {\n if (tag !== 98) {\n break;\n }\n\n message.expires_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 13: {\n if (tag !== 104) {\n break;\n }\n\n message.consumed = reader.bool();\n continue;\n }\n case 14: {\n if (tag !== 114) {\n break;\n }\n\n message.signature = reader.string();\n continue;\n }\n case 15: {\n if (tag !== 120) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 16: {\n if (tag !== 130) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 17: {\n if (tag !== 138) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Attestation>): Attestation {\n return Attestation.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Attestation>): Attestation {\n const message = createBaseAttestation();\n message.attestation_id = object.attestation_id ?? \"\";\n message.provider_id = object.provider_id ?? \"\";\n message.provider_key_version = (object.provider_key_version !== undefined && object.provider_key_version !== null)\n ? BigInt(object.provider_key_version)\n : 0n;\n message.attestation_type = object.attestation_type ?? 0;\n message.chain_id = object.chain_id ?? \"\";\n message.intended_wallet = object.intended_wallet ?? \"\";\n message.case_id = object.case_id ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.nonce = object.nonce ?? \"\";\n message.uniqueness_reference = object.uniqueness_reference ?? \"\";\n message.issued_at = object.issued_at ?? undefined;\n message.expires_at = object.expires_at ?? undefined;\n message.consumed = object.consumed ?? false;\n message.signature = object.signature ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n return message;\n },\n};\n\nfunction createBaseApplication(): Application {\n return {\n application_id: \"\",\n applicant_wallet: \"\",\n status: 0,\n attestation_id: \"\",\n uniqueness_commitment: \"\",\n policy_version: \"\",\n decision_reason_code: \"\",\n submitted_at: undefined,\n decided_at: undefined,\n };\n}\n\nexport const Application: MessageFns<Application> = {\n encode(message: Application, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.application_id !== \"\") {\n writer.uint32(10).string(message.application_id);\n }\n if (message.applicant_wallet !== \"\") {\n writer.uint32(18).string(message.applicant_wallet);\n }\n if (message.status !== 0) {\n writer.uint32(24).int32(message.status);\n }\n if (message.attestation_id !== \"\") {\n writer.uint32(34).string(message.attestation_id);\n }\n if (message.uniqueness_commitment !== \"\") {\n writer.uint32(42).string(message.uniqueness_commitment);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(50).string(message.policy_version);\n }\n if (message.decision_reason_code !== \"\") {\n writer.uint32(58).string(message.decision_reason_code);\n }\n if (message.submitted_at !== undefined) {\n Timestamp.encode(toTimestamp(message.submitted_at), writer.uint32(66).fork()).join();\n }\n if (message.decided_at !== undefined) {\n Timestamp.encode(toTimestamp(message.decided_at), writer.uint32(74).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): Application {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseApplication();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.application_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 42) {\n break;\n }\n\n message.uniqueness_commitment = reader.string();\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.decision_reason_code = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.submitted_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.decided_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<Application>): Application {\n return Application.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<Application>): Application {\n const message = createBaseApplication();\n message.application_id = object.application_id ?? \"\";\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.status = object.status ?? 0;\n message.attestation_id = object.attestation_id ?? \"\";\n message.uniqueness_commitment = object.uniqueness_commitment ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.decision_reason_code = object.decision_reason_code ?? \"\";\n message.submitted_at = object.submitted_at ?? undefined;\n message.decided_at = object.decided_at ?? undefined;\n return message;\n },\n};\n\nfunction createBaseRecoveryAttestationCase(): RecoveryAttestationCase {\n return {\n recovery_case_id: \"\",\n applicant_wallet: \"\",\n status: 0,\n attestation_id: \"\",\n citizen_id: 0n,\n old_wallet: \"\",\n new_wallet: \"\",\n policy_version: \"\",\n decision_reason_code: \"\",\n submitted_at: undefined,\n decided_at: undefined,\n };\n}\n\nexport const RecoveryAttestationCase: MessageFns<RecoveryAttestationCase> = {\n encode(message: RecoveryAttestationCase, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.recovery_case_id !== \"\") {\n writer.uint32(10).string(message.recovery_case_id);\n }\n if (message.applicant_wallet !== \"\") {\n writer.uint32(18).string(message.applicant_wallet);\n }\n if (message.status !== 0) {\n writer.uint32(24).int32(message.status);\n }\n if (message.attestation_id !== \"\") {\n writer.uint32(34).string(message.attestation_id);\n }\n if (message.citizen_id !== 0n) {\n if (BigInt.asUintN(64, message.citizen_id) !== message.citizen_id) {\n throw new globalThis.Error(\"value provided for field message.citizen_id of type uint64 too large\");\n }\n writer.uint32(40).uint64(message.citizen_id);\n }\n if (message.old_wallet !== \"\") {\n writer.uint32(50).string(message.old_wallet);\n }\n if (message.new_wallet !== \"\") {\n writer.uint32(58).string(message.new_wallet);\n }\n if (message.policy_version !== \"\") {\n writer.uint32(66).string(message.policy_version);\n }\n if (message.decision_reason_code !== \"\") {\n writer.uint32(74).string(message.decision_reason_code);\n }\n if (message.submitted_at !== undefined) {\n Timestamp.encode(toTimestamp(message.submitted_at), writer.uint32(82).fork()).join();\n }\n if (message.decided_at !== undefined) {\n Timestamp.encode(toTimestamp(message.decided_at), writer.uint32(90).fork()).join();\n }\n return writer;\n },\n\n decode(input: BinaryReader | Uint8Array, length?: number): RecoveryAttestationCase {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n const end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseRecoveryAttestationCase();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 10) {\n break;\n }\n\n message.recovery_case_id = reader.string();\n continue;\n }\n case 2: {\n if (tag !== 18) {\n break;\n }\n\n message.applicant_wallet = reader.string();\n continue;\n }\n case 3: {\n if (tag !== 24) {\n break;\n }\n\n message.status = reader.int32() as any;\n continue;\n }\n case 4: {\n if (tag !== 34) {\n break;\n }\n\n message.attestation_id = reader.string();\n continue;\n }\n case 5: {\n if (tag !== 40) {\n break;\n }\n\n message.citizen_id = reader.uint64() as bigint;\n continue;\n }\n case 6: {\n if (tag !== 50) {\n break;\n }\n\n message.old_wallet = reader.string();\n continue;\n }\n case 7: {\n if (tag !== 58) {\n break;\n }\n\n message.new_wallet = reader.string();\n continue;\n }\n case 8: {\n if (tag !== 66) {\n break;\n }\n\n message.policy_version = reader.string();\n continue;\n }\n case 9: {\n if (tag !== 74) {\n break;\n }\n\n message.decision_reason_code = reader.string();\n continue;\n }\n case 10: {\n if (tag !== 82) {\n break;\n }\n\n message.submitted_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n case 11: {\n if (tag !== 90) {\n break;\n }\n\n message.decided_at = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n\n create(base?: DeepPartial<RecoveryAttestationCase>): RecoveryAttestationCase {\n return RecoveryAttestationCase.fromPartial(base ?? {});\n },\n fromPartial(object: DeepPartial<RecoveryAttestationCase>): RecoveryAttestationCase {\n const message = createBaseRecoveryAttestationCase();\n message.recovery_case_id = object.recovery_case_id ?? \"\";\n message.applicant_wallet = object.applicant_wallet ?? \"\";\n message.status = object.status ?? 0;\n message.attestation_id = object.attestation_id ?? \"\";\n message.citizen_id = (object.citizen_id !== undefined && object.citizen_id !== null)\n ? BigInt(object.citizen_id)\n : 0n;\n message.old_wallet = object.old_wallet ?? \"\";\n message.new_wallet = object.new_wallet ?? \"\";\n message.policy_version = object.policy_version ?? \"\";\n message.decision_reason_code = object.decision_reason_code ?? \"\";\n message.submitted_at = object.submitted_at ?? undefined;\n message.decided_at = object.decided_at ?? undefined;\n return message;\n },\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\ntype DeepPartial<T> = T extends bigint ? string | number | bigint\n : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = BigInt(Math.trunc(date.getTime() / 1_000));\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;\n millis += (t.nanos || 0) / 1_000_000;\n return new globalThis.Date(millis);\n}\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create(base?: DeepPartial<T>): T;\n fromPartial(object: DeepPartial<T>): T;\n}\n","import { GeneratedType, Registry } from \"@cosmjs/proto-signing\";\nimport { defaultRegistryTypes } from \"@cosmjs/stargate\";\nimport { BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\nimport {\n MsgApproveRecovery,\n MsgCancelRecovery,\n MsgFinalizeRecovery,\n MsgInitiateRecovery,\n MsgIssueKCP,\n MsgReactivateKCP,\n MsgRevokeKCP,\n MsgSuspendKCP,\n} from \"./generated/isatheword/kingdomchain/citizen/v1/tx\";\nimport {\n MsgDecideApplication,\n MsgDecideRecoveryAttestation,\n MsgRegisterProvider,\n MsgSubmitApplication,\n MsgSubmitRecoveryAttestation,\n MsgSuspendProvider,\n} from \"./generated/isatheword/kingdomchain/compliance/v1/tx\";\n\ninterface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: Uint8Array): T;\n fromPartial(object: Partial<T>): T;\n}\n\n/** Adapt ts-proto @bufbuild MessageFns to CosmJS Registry (encode().finish()). */\nfunction wrapMsgFns<T>(msgFns: MessageFns<T>): GeneratedType {\n return {\n encode: (message: T) => msgFns.encode(message) as any,\n decode: (input: Uint8Array) => msgFns.decode(input),\n fromPartial: (object: Partial<T>) => msgFns.fromPartial(object),\n };\n}\n\nconst COMPLIANCE_MSG_TYPES: ReadonlyArray<[string, GeneratedType]> = [\n [\"/isatheword.kingdomchain.compliance.v1.MsgRegisterProvider\", wrapMsgFns(MsgRegisterProvider)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSuspendProvider\", wrapMsgFns(MsgSuspendProvider)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSubmitApplication\", wrapMsgFns(MsgSubmitApplication)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgSubmitRecoveryAttestation\", wrapMsgFns(MsgSubmitRecoveryAttestation)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgDecideApplication\", wrapMsgFns(MsgDecideApplication)],\n [\"/isatheword.kingdomchain.compliance.v1.MsgDecideRecoveryAttestation\", wrapMsgFns(MsgDecideRecoveryAttestation)],\n];\n\nconst CITIZEN_MSG_TYPES: ReadonlyArray<[string, GeneratedType]> = [\n [\"/isatheword.kingdomchain.citizen.v1.MsgIssueKCP\", wrapMsgFns(MsgIssueKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgSuspendKCP\", wrapMsgFns(MsgSuspendKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgReactivateKCP\", wrapMsgFns(MsgReactivateKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgRevokeKCP\", wrapMsgFns(MsgRevokeKCP)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgInitiateRecovery\", wrapMsgFns(MsgInitiateRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgApproveRecovery\", wrapMsgFns(MsgApproveRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgFinalizeRecovery\", wrapMsgFns(MsgFinalizeRecovery)],\n [\"/isatheword.kingdomchain.citizen.v1.MsgCancelRecovery\", wrapMsgFns(MsgCancelRecovery)],\n];\n\n/** CosmJS registry: standard Cosmos SDK types + Kingdom Chain citizen/compliance messages. */\nexport function createKingdomChainRegistry(): Registry {\n return new Registry([...defaultRegistryTypes, ...COMPLIANCE_MSG_TYPES, ...CITIZEN_MSG_TYPES]);\n}\n\nexport { MsgSubmitApplication, MsgSubmitRecoveryAttestation } from \"./generated/isatheword/kingdomchain/compliance/v1/tx\";\nexport { ApplicationStatus, RecoveryAttestationStatus } from \"./generated/isatheword/kingdomchain/compliance/v1/compliance\";\n","/**\n * Kingdom Chain on-chain denom and display metadata.\n *\n * Sources:\n * - x/supply/types/constants.go (UkdrDenom = \"ukdr\")\n * - TOKENOMICS_COSMOS_SPEC.md (1 KDR = 1,000,000 ukdr)\n * - app/app.go + app/config.go (bech32 prefix, coin type)\n */\n\n/** Base (minimal) denom registered in x/supply. */\nexport const UKDR_MINIMAL_DENOM = \"ukdr\";\n\n/** Human-readable display symbol. */\nexport const UKDR_DISPLAY_DENOM = \"KDR\";\n\n/** ukdr is a micro-unit: 10^6 ukdr = 1 KDR. */\nexport const UKDR_DECIMALS = 6;\n\n/** Account / validator bech32 prefix (AccountAddressPrefix in app/app.go). */\nexport const BECH32_PREFIX = \"king\";\n\n/** SLIP-0044 coin type (ChainCoinType in app/app.go). */\nexport const CHAIN_COIN_TYPE = 118;\n\n/** Devnet default chain ID (override via env when a permanent node exists). */\nexport const DEFAULT_CHAIN_ID = \"kingdomchain-e2e\";\n\nexport const DEFAULT_RPC_URL = \"http://127.0.0.1:26657\";\nexport const DEFAULT_REST_URL = \"http://127.0.0.1:1317\";\n","import type { OfflineDirectSigner } from \"@cosmjs/proto-signing\";\nimport { SigningStargateClient } from \"@cosmjs/stargate\";\n\nimport {\n BECH32_PREFIX,\n CHAIN_COIN_TYPE,\n UKDR_DECIMALS,\n UKDR_DISPLAY_DENOM,\n UKDR_MINIMAL_DENOM,\n} from \"./chainConstants\";\nimport { createKingdomChainRegistry } from \"./registry\";\n\n/** Keplr/Leap-compatible currency entry. */\nexport interface ChainCurrency {\n coinDenom: string;\n coinMinimalDenom: string;\n coinDecimals: number;\n gasPriceStep?: { low: number; average: number; high: number };\n}\n\n/** Keplr/Leap-compatible ChainInfo for experimentalSuggestChain. */\nexport interface ChainInfo {\n chainId: string;\n chainName: string;\n rpc: string;\n rest: string;\n bip44: { coinType: number };\n bech32Config: {\n bech32PrefixAccAddr: string;\n bech32PrefixAccPub: string;\n bech32PrefixValAddr: string;\n bech32PrefixValPub: string;\n bech32PrefixConsAddr: string;\n bech32PrefixConsPub: string;\n };\n currencies: ChainCurrency[];\n feeCurrencies: ChainCurrency[];\n stakeCurrency: ChainCurrency;\n}\n\n/** Subset of Keplr/Leap window API used for chain connect. */\nexport interface BrowserWalletApi {\n experimentalSuggestChain(chainInfo: ChainInfo): Promise<void>;\n enable(chainId: string): Promise<void>;\n getOfflineSigner(chainId: string): OfflineDirectSigner;\n}\n\nexport class WalletNotInstalledError extends Error {\n constructor(public readonly walletName: string) {\n super(`${walletName} extension is not installed. Install it and refresh the page.`);\n this.name = \"WalletNotInstalledError\";\n }\n}\n\nexport class WalletConnectionError extends Error {\n constructor(\n public readonly walletName: string,\n public readonly step: \"suggestChain\" | \"enable\" | \"getOfflineSigner\",\n cause?: unknown,\n ) {\n const stepLabel =\n step === \"suggestChain\"\n ? \"chain suggestion\"\n : step === \"enable\"\n ? \"connection request\"\n : \"offline signer retrieval\";\n super(`${walletName} failed during ${stepLabel}.`, { cause });\n this.name = \"WalletConnectionError\";\n }\n}\n\n/** @deprecated Use WalletConnectionError — kept for backward compatibility in tests/demo. */\nexport class WalletConnectionRejectedError extends WalletConnectionError {\n constructor(walletName: string, step: \"suggestChain\" | \"enable\", cause?: unknown) {\n super(walletName, step, cause);\n this.name = \"WalletConnectionRejectedError\";\n }\n}\n\nexport class WalletAccountError extends Error {\n constructor(public readonly walletName: string) {\n super(`${walletName} returned no usable accounts. Reconnect the wallet and try again.`);\n this.name = \"WalletAccountError\";\n }\n}\n\nexport class InvalidChainConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidChainConfigError\";\n }\n}\n\nexport class RpcConnectionError extends Error {\n constructor(\n public readonly rpcUrl: string,\n cause?: unknown,\n ) {\n super(`Failed to connect to RPC endpoint ${rpcUrl}. Is the node running and reachable?`, { cause });\n this.name = \"RpcConnectionError\";\n }\n}\n\n/** Cosmostation exposes a Keplr-compatible provider at providers.keplr. */\nexport interface CosmostationWindowApi {\n providers?: {\n keplr?: BrowserWalletApi;\n };\n}\n\ndeclare global {\n interface Window {\n keplr?: BrowserWalletApi;\n leap?: BrowserWalletApi;\n cosmostation?: CosmostationWindowApi;\n }\n}\n\nconst UKDR_CURRENCY: ChainCurrency = {\n coinDenom: UKDR_DISPLAY_DENOM,\n coinMinimalDenom: UKDR_MINIMAL_DENOM,\n coinDecimals: UKDR_DECIMALS,\n};\n\n/** E2E devnet uses minimum-gas-prices = \"0ukdr\" (scripts/citizen-compliance-e2e/run.sh). */\nconst UKDR_FEE_CURRENCY: ChainCurrency = {\n ...UKDR_CURRENCY,\n gasPriceStep: { low: 0, average: 0, high: 0.025 },\n};\n\nfunction isWalletApiPresent(api: unknown): api is BrowserWalletApi {\n if (api == null || typeof api !== \"object\") {\n return false;\n }\n const candidate = api as BrowserWalletApi;\n return (\n typeof candidate.experimentalSuggestChain === \"function\" &&\n typeof candidate.enable === \"function\" &&\n typeof candidate.getOfflineSigner === \"function\"\n );\n}\n\n/** Validate chain endpoint inputs before passing to Keplr/Leap. */\nexport function validateChainConfig(chainId: string, rpcUrl: string, restUrl: string): void {\n if (!chainId.trim()) {\n throw new InvalidChainConfigError(\"chainId is required\");\n }\n if (!rpcUrl.trim()) {\n throw new InvalidChainConfigError(\"rpcUrl is required\");\n }\n if (!restUrl.trim()) {\n throw new InvalidChainConfigError(\"restUrl is required\");\n }\n}\n\nexport function isKeplrAvailable(): boolean {\n return typeof window !== \"undefined\" && isWalletApiPresent(window.keplr);\n}\n\nexport function isLeapAvailable(): boolean {\n return typeof window !== \"undefined\" && isWalletApiPresent(window.leap);\n}\n\n/** Keplr-compatible API injected by the Cosmostation extension. */\nexport function getCosmostationKeplrApi(): BrowserWalletApi | undefined {\n if (typeof window === \"undefined\") {\n return undefined;\n }\n const api = window.cosmostation?.providers?.keplr;\n return isWalletApiPresent(api) ? api : undefined;\n}\n\nexport function isCosmostationAvailable(): boolean {\n return getCosmostationKeplrApi() != null;\n}\n\n/** Build ChainInfo for Keplr/Leap experimentalSuggestChain. */\nexport function buildKingdomChainInfo(\n chainId: string,\n rpcUrl: string,\n restUrl: string,\n chainName = \"Kingdom Chain\",\n): ChainInfo {\n validateChainConfig(chainId, rpcUrl, restUrl);\n\n const accPub = `${BECH32_PREFIX}pub`;\n const valAddr = `${BECH32_PREFIX}valoper`;\n const valPub = `${BECH32_PREFIX}valoperpub`;\n const consAddr = `${BECH32_PREFIX}valcons`;\n const consPub = `${BECH32_PREFIX}valconspub`;\n\n return {\n chainId,\n chainName,\n rpc: rpcUrl,\n rest: restUrl,\n bip44: { coinType: CHAIN_COIN_TYPE },\n bech32Config: {\n bech32PrefixAccAddr: BECH32_PREFIX,\n bech32PrefixAccPub: accPub,\n bech32PrefixValAddr: valAddr,\n bech32PrefixValPub: valPub,\n bech32PrefixConsAddr: consAddr,\n bech32PrefixConsPub: consPub,\n },\n currencies: [UKDR_CURRENCY],\n feeCurrencies: [UKDR_FEE_CURRENCY],\n stakeCurrency: UKDR_CURRENCY,\n };\n}\n\nasync function assertSignerHasAccount(signer: OfflineDirectSigner, walletName: string): Promise<void> {\n let accounts;\n try {\n accounts = await signer.getAccounts();\n } catch (err) {\n throw new WalletConnectionError(walletName, \"getOfflineSigner\", err);\n }\n if (accounts.length === 0 || !accounts[0]?.address?.trim()) {\n throw new WalletAccountError(walletName);\n }\n}\n\n/** Suggest chain, request access, return CosmJS OfflineDirectSigner. */\nexport async function suggestAndConnect(\n walletApi: BrowserWalletApi,\n chainInfo: ChainInfo,\n walletName = \"Wallet\",\n): Promise<OfflineDirectSigner> {\n try {\n await walletApi.experimentalSuggestChain(chainInfo);\n } catch (err) {\n throw new WalletConnectionRejectedError(walletName, \"suggestChain\", err);\n }\n\n try {\n await walletApi.enable(chainInfo.chainId);\n } catch (err) {\n throw new WalletConnectionRejectedError(walletName, \"enable\", err);\n }\n\n let signer: OfflineDirectSigner;\n try {\n signer = walletApi.getOfflineSigner(chainInfo.chainId);\n } catch (err) {\n throw new WalletConnectionError(walletName, \"getOfflineSigner\", err);\n }\n\n await assertSignerHasAccount(signer, walletName);\n return signer;\n}\n\nfunction resolveWalletApi(\n getter: () => BrowserWalletApi | undefined,\n walletName: string,\n): BrowserWalletApi {\n if (!isWalletApiPresent(getter())) {\n throw new WalletNotInstalledError(walletName);\n }\n const api = getter();\n if (!isWalletApiPresent(api)) {\n throw new WalletNotInstalledError(walletName);\n }\n return api;\n}\n\nexport async function connectKeplr(chainInfo: ChainInfo): Promise<OfflineDirectSigner> {\n const api = resolveWalletApi(() => window.keplr, \"Keplr\");\n return suggestAndConnect(api, chainInfo, \"Keplr\");\n}\n\nexport async function connectLeap(chainInfo: ChainInfo): Promise<OfflineDirectSigner> {\n const api = resolveWalletApi(() => window.leap, \"Leap\");\n return suggestAndConnect(api, chainInfo, \"Leap\");\n}\n\nexport async function connectCosmostation(chainInfo: ChainInfo): Promise<OfflineDirectSigner> {\n const api = resolveWalletApi(getCosmostationKeplrApi, \"Cosmostation\");\n return suggestAndConnect(api, chainInfo, \"Cosmostation\");\n}\n\n/** SigningStargateClient wired with Kingdom Chain custom message registry. */\nexport async function createBrowserSigningClient(\n rpcUrl: string,\n signer: OfflineDirectSigner,\n): Promise<SigningStargateClient> {\n if (!rpcUrl.trim()) {\n throw new InvalidChainConfigError(\"rpcUrl is required\");\n }\n try {\n return await SigningStargateClient.connectWithSigner(rpcUrl, signer, {\n registry: createKingdomChainRegistry(),\n });\n } catch (err) {\n throw new RpcConnectionError(rpcUrl, err);\n }\n}\n","import SignClient from \"@walletconnect/sign-client\";\nimport type { ProposalTypes, SessionTypes } from \"@walletconnect/types\";\nimport type { OfflineDirectSigner } from \"@cosmjs/proto-signing\";\nimport type { AccountData, DirectSignResponse } from \"@cosmjs/proto-signing\";\nimport type { SignDoc } from \"cosmjs-types/cosmos/tx/v1beta1/tx\";\nimport { fromBase64, toBase64 } from \"@cosmjs/encoding\";\n\nexport const WALLETCONNECT_COSMOS_NAMESPACE = \"cosmos\";\n\nexport const WALLETCONNECT_COSMOS_METHODS = [\n \"cosmos_getAccounts\",\n \"cosmos_signDirect\",\n \"cosmos_signAmino\",\n] as const;\n\nexport interface WalletConnectMetadata {\n name: string;\n description: string;\n url: string;\n icons: string[];\n}\n\nexport interface WalletConnectChainConfig {\n chainId: string;\n projectId: string;\n metadata: WalletConnectMetadata;\n relayUrl?: string;\n}\n\nexport interface WalletConnectConnectResult {\n uri: string;\n session: SessionTypes.Struct;\n signer: OfflineDirectSigner;\n}\n\nexport class WalletConnectNotInitializedError extends Error {\n constructor() {\n super(\"WalletConnect Sign Client is not initialized.\");\n this.name = \"WalletConnectNotInitializedError\";\n }\n}\n\nexport class WalletConnectSessionError extends Error {\n constructor(message: string, cause?: unknown) {\n super(message, { cause });\n this.name = \"WalletConnectSessionError\";\n }\n}\n\nexport class WalletConnectSigningError extends Error {\n constructor(message: string, cause?: unknown) {\n super(message, { cause });\n this.name = \"WalletConnectSigningError\";\n }\n}\n\n/** WalletConnect chain id: `cosmos:{chainId}`. */\nexport function toWalletConnectCosmosChainId(chainId: string): string {\n return `${WALLETCONNECT_COSMOS_NAMESPACE}:${chainId}`;\n}\n\nexport function parseWalletConnectAccount(\n account: string,\n): { namespace: string; chainId: string; address: string } {\n const parts = account.split(\":\");\n if (parts.length !== 3) {\n throw new WalletConnectSessionError(`Invalid WalletConnect account id: ${account}`);\n }\n const [namespace, chainId, address] = parts;\n return { namespace, chainId, address };\n}\n\nexport function buildRequiredCosmosNamespaces(chainId: string): ProposalTypes.RequiredNamespaces {\n const wcChainId = toWalletConnectCosmosChainId(chainId);\n return {\n [WALLETCONNECT_COSMOS_NAMESPACE]: {\n methods: [...WALLETCONNECT_COSMOS_METHODS],\n chains: [wcChainId],\n events: [],\n },\n };\n}\n\nexport async function initWalletConnectClient(\n config: WalletConnectChainConfig,\n): Promise<SignClient> {\n if (!config.projectId.trim()) {\n throw new WalletConnectSessionError(\"WalletConnect projectId is required\");\n }\n if (!config.chainId.trim()) {\n throw new WalletConnectSessionError(\"chainId is required\");\n }\n\n return SignClient.init({\n projectId: config.projectId,\n metadata: config.metadata,\n relayUrl: config.relayUrl,\n });\n}\n\nexport function createWalletConnectOfflineSigner(\n client: SignClient,\n session: SessionTypes.Struct,\n chainId: string,\n): OfflineDirectSigner {\n const wcChainId = toWalletConnectCosmosChainId(chainId);\n const accounts = session.namespaces[WALLETCONNECT_COSMOS_NAMESPACE]?.accounts ?? [];\n const chainAccounts = accounts\n .map(parseWalletConnectAccount)\n .filter((entry) => entry.chainId === chainId);\n\n if (chainAccounts.length === 0) {\n throw new WalletConnectSessionError(\n `WalletConnect session has no accounts for chain ${chainId}`,\n );\n }\n\n const primaryAddress = chainAccounts[0].address;\n\n return {\n getAccounts: async (): Promise<AccountData[]> => {\n try {\n const response = (await client.request({\n topic: session.topic,\n chainId: wcChainId,\n request: {\n method: \"cosmos_getAccounts\",\n params: {},\n },\n })) as { address: string; algo: string; pubkey: string }[];\n\n if (Array.isArray(response) && response.length > 0) {\n return response.map((account) => ({\n address: account.address,\n algo: account.algo as AccountData[\"algo\"],\n pubkey: fromBase64(account.pubkey),\n }));\n }\n } catch {\n // Some wallets omit cosmos_getAccounts; fall back to session account list.\n }\n\n return chainAccounts.map((account) => ({\n address: account.address,\n algo: \"secp256k1\",\n pubkey: new Uint8Array(0),\n }));\n },\n\n signDirect: async (signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse> => {\n if (signerAddress !== primaryAddress) {\n throw new WalletConnectSigningError(\n `WalletConnect signer address mismatch: expected ${primaryAddress}, got ${signerAddress}`,\n );\n }\n\n try {\n const result = (await client.request({\n topic: session.topic,\n chainId: wcChainId,\n request: {\n method: \"cosmos_signDirect\",\n params: {\n signerAddress,\n signDoc: {\n chainId: signDoc.chainId,\n accountNumber: signDoc.accountNumber.toString(),\n authInfoBytes: toBase64(signDoc.authInfoBytes),\n bodyBytes: toBase64(signDoc.bodyBytes),\n },\n },\n },\n })) as {\n signature: { pub_key: { type: string; value: string }; signature: string };\n signed?: {\n chainId: string;\n accountNumber: string;\n authInfoBytes: string;\n bodyBytes: string;\n };\n };\n\n return {\n signed: {\n chainId: result.signed?.chainId ?? signDoc.chainId,\n accountNumber: BigInt(result.signed?.accountNumber ?? signDoc.accountNumber),\n authInfoBytes: result.signed?.authInfoBytes\n ? fromBase64(result.signed.authInfoBytes)\n : signDoc.authInfoBytes,\n bodyBytes: result.signed?.bodyBytes\n ? fromBase64(result.signed.bodyBytes)\n : signDoc.bodyBytes,\n },\n signature: {\n pub_key: {\n type: result.signature.pub_key.type,\n value: result.signature.pub_key.value,\n },\n signature: result.signature.signature,\n },\n };\n } catch (err) {\n throw new WalletConnectSigningError(\"WalletConnect cosmos_signDirect failed.\", err);\n }\n },\n };\n}\n\n/** Pair with a mobile wallet; returns WC URI (for QR) and approval promise. */\nexport async function connectWalletConnect(\n client: SignClient,\n chainId: string,\n options?: { pairingTopic?: string },\n): Promise<WalletConnectConnectResult> {\n const { uri, approval } = await client.connect({\n pairingTopic: options?.pairingTopic,\n requiredNamespaces: buildRequiredCosmosNamespaces(chainId),\n });\n\n if (!uri) {\n throw new WalletConnectSessionError(\"WalletConnect did not return a pairing URI\");\n }\n\n const session = await approval();\n const signer = createWalletConnectOfflineSigner(client, session, chainId);\n const accounts = await signer.getAccounts();\n if (accounts.length === 0 || !accounts[0]?.address?.trim()) {\n throw new WalletConnectSessionError(\"WalletConnect session returned no usable accounts\");\n }\n\n return { uri, session, signer };\n}\n\nexport async function disconnectWalletConnect(\n client: SignClient,\n session: SessionTypes.Struct,\n reason = \"User disconnected\",\n): Promise<void> {\n await client.disconnect({\n topic: session.topic,\n reason: { code: 6000, message: reason },\n });\n}\n\nexport async function restoreWalletConnectSession(\n client: SignClient,\n chainId: string,\n): Promise<{ session: SessionTypes.Struct; signer: OfflineDirectSigner } | null> {\n const sessions = client.session.getAll();\n const wcChainId = toWalletConnectCosmosChainId(chainId);\n const active = sessions.find((session) => {\n const chains = session.namespaces[WALLETCONNECT_COSMOS_NAMESPACE]?.chains ?? [];\n return chains.includes(wcChainId);\n });\n\n if (!active) {\n return null;\n }\n\n const signer = createWalletConnectOfflineSigner(client, active, chainId);\n return { session: active, signer };\n}\n","/** Embedded wallet vault format version. */\nexport const EMBEDDED_WALLET_VAULT_VERSION = 1;\n\nexport const EMBEDDED_WALLET_KDF_PRF = \"webauthn-prf\" as const;\nexport const EMBEDDED_WALLET_KDF_PBKDF2 = \"pbkdf2-passkey\" as const;\n\nexport type EmbeddedWalletKdf = typeof EMBEDDED_WALLET_KDF_PRF | typeof EMBEDDED_WALLET_KDF_PBKDF2;\n\n/** Plaintext wallet payload — never persisted unencrypted. */\nexport interface EmbeddedWalletPlaintext {\n privateKey: Uint8Array;\n hdPath: string;\n createdAt: string;\n}\n\n/** Encrypted vault stored in IndexedDB and exported backup files. */\nexport interface EmbeddedWalletVaultV1 {\n version: typeof EMBEDDED_WALLET_VAULT_VERSION;\n kdf: EmbeddedWalletKdf;\n credentialId: string;\n publicAddress: string;\n iv: string;\n ciphertext: string;\n /** PBKDF2 salt (base64). Empty when kdf=webauthn-prf. */\n kdfSalt: string;\n /** PBKDF2 iterations. Zero when kdf=webauthn-prf. */\n kdfIterations: number;\n /** PRF eval salt (base64). Empty when kdf=pbkdf2-passkey. */\n prfSalt: string;\n /** Hard gate: must be true before any transaction is permitted. */\n backupAcknowledged: boolean;\n backupAcknowledgedAt?: string;\n createdAt: string;\n}\n\nexport interface EmbeddedWalletBackupFileV1 {\n format: \"kingdom-os-embedded-wallet-backup\";\n version: typeof EMBEDDED_WALLET_VAULT_VERSION;\n vault: EmbeddedWalletVaultV1;\n exportedAt: string;\n}\n\nexport class EmbeddedWalletBackupRequiredError extends Error {\n constructor() {\n super(\n \"Encrypted backup must be downloaded and acknowledged before the first transaction.\",\n );\n this.name = \"EmbeddedWalletBackupRequiredError\";\n }\n}\n\nexport class EmbeddedWalletVaultError extends Error {\n constructor(message: string, cause?: unknown) {\n super(message, { cause });\n this.name = \"EmbeddedWalletVaultError\";\n }\n}\n","import { toBase64, fromBase64 } from \"@cosmjs/encoding\";\n\nimport {\n EMBEDDED_WALLET_KDF_PBKDF2,\n EMBEDDED_WALLET_KDF_PRF,\n EMBEDDED_WALLET_VAULT_VERSION,\n EmbeddedWalletBackupRequiredError,\n type EmbeddedWalletKdf,\n type EmbeddedWalletPlaintext,\n type EmbeddedWalletVaultV1,\n EmbeddedWalletVaultError,\n} from \"./types\";\n\nconst PBKDF2_ITERATIONS = 310_000;\nconst AES_GCM_IV_BYTES = 12;\n\nexport interface EncryptWalletOptions {\n kdf: EmbeddedWalletKdf;\n credentialId: Uint8Array;\n publicAddress: string;\n kek: Uint8Array;\n /** Required when kdf=pbkdf2-passkey */\n kdfSalt?: Uint8Array;\n /** Required when kdf=webauthn-prf */\n prfSalt?: Uint8Array;\n backupAcknowledged?: boolean;\n}\n\nfunction assertKekLength(kek: Uint8Array): void {\n if (kek.length !== 32) {\n throw new EmbeddedWalletVaultError(`KEK must be 32 bytes, got ${kek.length}`);\n }\n}\n\nfunction serializePlaintext(payload: EmbeddedWalletPlaintext): Uint8Array {\n const json = JSON.stringify({\n privateKey: toBase64(payload.privateKey),\n hdPath: payload.hdPath,\n createdAt: payload.createdAt,\n });\n return new TextEncoder().encode(json);\n}\n\nfunction deserializePlaintext(bytes: Uint8Array): EmbeddedWalletPlaintext {\n let parsed: unknown;\n try {\n parsed = JSON.parse(new TextDecoder().decode(bytes));\n } catch (err) {\n throw new EmbeddedWalletVaultError(\"Failed to parse decrypted wallet payload\", err);\n }\n\n if (\n typeof parsed !== \"object\" ||\n parsed == null ||\n typeof (parsed as EmbeddedWalletPlaintext).hdPath !== \"string\" ||\n typeof (parsed as EmbeddedWalletPlaintext).createdAt !== \"string\" ||\n typeof (parsed as { privateKey?: unknown }).privateKey !== \"string\"\n ) {\n throw new EmbeddedWalletVaultError(\"Decrypted wallet payload has invalid shape\");\n }\n\n return {\n privateKey: fromBase64((parsed as { privateKey: string }).privateKey),\n hdPath: (parsed as EmbeddedWalletPlaintext).hdPath,\n createdAt: (parsed as EmbeddedWalletPlaintext).createdAt,\n };\n}\n\nexport async function deriveKekFromPrf(prfOutput: Uint8Array): Promise<Uint8Array> {\n if (prfOutput.length < 32) {\n throw new EmbeddedWalletVaultError(`PRF output must be at least 32 bytes, got ${prfOutput.length}`);\n }\n return prfOutput.slice(0, 32);\n}\n\n/** PBKDF2-SHA256 fallback when WebAuthn PRF is unavailable (Safari cross-device QR, etc.). */\nexport async function deriveKekFromPbkdf2(\n passkeyMaterial: Uint8Array,\n salt: Uint8Array,\n iterations = PBKDF2_ITERATIONS,\n): Promise<Uint8Array> {\n if (salt.length < 16) {\n throw new EmbeddedWalletVaultError(\"PBKDF2 salt must be at least 16 bytes\");\n }\n\n const keyMaterial = await crypto.subtle.importKey(\n \"raw\",\n new Uint8Array(passkeyMaterial),\n \"PBKDF2\",\n false,\n [\"deriveBits\"],\n );\n const derived = await crypto.subtle.deriveBits(\n { name: \"PBKDF2\", salt: new Uint8Array(salt), iterations, hash: \"SHA-256\" },\n keyMaterial,\n 256,\n );\n return new Uint8Array(derived);\n}\n\nexport function createPbkdf2Salt(): Uint8Array {\n const salt = new Uint8Array(32);\n crypto.getRandomValues(salt);\n return salt;\n}\n\nexport function createPasskeyMaterialFromAssertion(\n authenticatorData: Uint8Array,\n clientDataJSON: Uint8Array,\n): Uint8Array {\n const combined = new Uint8Array(authenticatorData.length + clientDataJSON.length);\n combined.set(authenticatorData, 0);\n combined.set(clientDataJSON, authenticatorData.length);\n return combined;\n}\n\nasync function importAesKey(kek: Uint8Array): Promise<CryptoKey> {\n assertKekLength(kek);\n const raw = new Uint8Array(kek);\n return crypto.subtle.importKey(\"raw\", raw, \"AES-GCM\", false, [\"encrypt\", \"decrypt\"]);\n}\n\nexport async function encryptWalletPayload(\n payload: EmbeddedWalletPlaintext,\n options: EncryptWalletOptions,\n): Promise<EmbeddedWalletVaultV1> {\n const iv = crypto.getRandomValues(new Uint8Array(AES_GCM_IV_BYTES));\n const aesKey = await importAesKey(options.kek);\n const plaintext = serializePlaintext(payload);\n const ciphertext = await crypto.subtle.encrypt(\n { name: \"AES-GCM\", iv },\n aesKey,\n new Uint8Array(plaintext),\n );\n\n if (options.kdf === EMBEDDED_WALLET_KDF_PBKDF2 && !options.kdfSalt) {\n throw new EmbeddedWalletVaultError(\"PBKDF2 encryption requires kdfSalt\");\n }\n\n return {\n version: EMBEDDED_WALLET_VAULT_VERSION,\n kdf: options.kdf,\n credentialId: toBase64(options.credentialId),\n publicAddress: options.publicAddress,\n iv: toBase64(iv),\n ciphertext: toBase64(new Uint8Array(ciphertext)),\n kdfSalt: options.kdfSalt ? toBase64(options.kdfSalt) : \"\",\n kdfIterations: options.kdf === EMBEDDED_WALLET_KDF_PBKDF2 ? PBKDF2_ITERATIONS : 0,\n prfSalt: options.prfSalt ? toBase64(options.prfSalt) : \"\",\n backupAcknowledged: options.backupAcknowledged ?? false,\n backupAcknowledgedAt: options.backupAcknowledged ? new Date().toISOString() : undefined,\n createdAt: payload.createdAt,\n };\n}\n\nexport async function decryptWalletPayload(\n vault: EmbeddedWalletVaultV1,\n kek: Uint8Array,\n): Promise<EmbeddedWalletPlaintext> {\n if (vault.version !== EMBEDDED_WALLET_VAULT_VERSION) {\n throw new EmbeddedWalletVaultError(`Unsupported vault version: ${vault.version}`);\n }\n\n const aesKey = await importAesKey(kek);\n const iv = fromBase64(vault.iv);\n const ciphertext = fromBase64(vault.ciphertext);\n\n let plaintextBytes: ArrayBuffer;\n try {\n plaintextBytes = await crypto.subtle.decrypt(\n { name: \"AES-GCM\", iv: new Uint8Array(iv) },\n aesKey,\n new Uint8Array(ciphertext),\n );\n } catch (err) {\n throw new EmbeddedWalletVaultError(\"Failed to decrypt wallet vault (wrong key or corrupted data)\", err);\n }\n\n return deserializePlaintext(new Uint8Array(plaintextBytes));\n}\n\nexport function markVaultBackupAcknowledged(vault: EmbeddedWalletVaultV1): EmbeddedWalletVaultV1 {\n const now = new Date().toISOString();\n return {\n ...vault,\n backupAcknowledged: true,\n backupAcknowledgedAt: now,\n };\n}\n\nexport function assertVaultPermitsTransaction(vault: EmbeddedWalletVaultV1): void {\n if (!vault.backupAcknowledged) {\n throw new EmbeddedWalletBackupRequiredError();\n }\n}\n","/**\n * WebAuthn PRF capability detection for embedded wallet KEK derivation.\n *\n * Safari does not expose PRF during cross-device QR-code WebAuthn flows — only\n * direct iCloud-synced passkeys. Callers must fall back to PBKDF2 in that case.\n */\n\nexport interface WebAuthnPrfCapabilities {\n /** Browser exposes PublicKeyCredential. */\n webAuthnAvailable: boolean;\n /** PRF extension likely usable on this device/browser combo. */\n prfLikelySupported: boolean;\n /** Human-readable reason when prfLikelySupported is false. */\n prfFallbackReason?: string;\n}\n\n/** Best-effort PRF support probe — PBKDF2 fallback remains mandatory. */\nexport function detectWebAuthnPrfCapabilities(): WebAuthnPrfCapabilities {\n if (typeof globalThis.PublicKeyCredential === \"undefined\") {\n return {\n webAuthnAvailable: false,\n prfLikelySupported: false,\n prfFallbackReason: \"WebAuthn is not available in this environment\",\n };\n }\n\n const ua = typeof navigator !== \"undefined\" ? navigator.userAgent : \"\";\n const isSafari = /Safari/i.test(ua) && !/Chrome|Chromium|CriOS|FxiOS/i.test(ua);\n\n // Safari cross-device QR WebAuthn cannot use PRF today — PBKDF2 is load-bearing.\n if (isSafari) {\n return {\n webAuthnAvailable: true,\n prfLikelySupported: false,\n prfFallbackReason:\n \"Safari does not support WebAuthn PRF for cross-device QR flows; use PBKDF2 fallback\",\n };\n }\n\n const getCaps = (\n PublicKeyCredential as unknown as {\n getClientCapabilities?: () => Promise<Record<string, boolean>>;\n }\n ).getClientCapabilities;\n\n if (typeof getCaps !== \"function\") {\n return {\n webAuthnAvailable: true,\n prfLikelySupported: true,\n };\n }\n\n return {\n webAuthnAvailable: true,\n prfLikelySupported: true,\n prfFallbackReason: undefined,\n };\n}\n\n/** Extract 32-byte PRF output from assertion clientExtensionResults. */\nexport function readPrfOutput(\n clientExtensionResults: AuthenticationExtensionsClientOutputs | undefined,\n): Uint8Array | null {\n const prf = clientExtensionResults?.prf as\n | { results?: Record<string, ArrayBuffer> }\n | undefined;\n const first = prf?.results?.first ?? (prf?.results ? Object.values(prf.results)[0] : undefined);\n if (!first || first.byteLength < 32) {\n return null;\n }\n return new Uint8Array(first).slice(0, 32);\n}\n\nexport function selectEmbeddedWalletKdf(\n caps: WebAuthnPrfCapabilities,\n prfOutput: Uint8Array | null,\n): \"webauthn-prf\" | \"pbkdf2-passkey\" {\n if (caps.prfLikelySupported && prfOutput && prfOutput.length >= 32) {\n return \"webauthn-prf\";\n }\n return \"pbkdf2-passkey\";\n}\n","import type { EmbeddedWalletBackupFileV1, EmbeddedWalletVaultV1 } from \"./types\";\nimport { EMBEDDED_WALLET_VAULT_VERSION } from \"./types\";\n\nexport function exportEncryptedBackup(vault: EmbeddedWalletVaultV1): EmbeddedWalletBackupFileV1 {\n return {\n format: \"kingdom-os-embedded-wallet-backup\",\n version: EMBEDDED_WALLET_VAULT_VERSION,\n vault: structuredClone(vault),\n exportedAt: new Date().toISOString(),\n };\n}\n\nexport function parseEncryptedBackup(json: string): EmbeddedWalletBackupFileV1 {\n let parsed: unknown;\n try {\n parsed = JSON.parse(json);\n } catch (err) {\n throw new Error(\"Backup file is not valid JSON\", { cause: err });\n }\n\n if (\n typeof parsed !== \"object\" ||\n parsed == null ||\n (parsed as EmbeddedWalletBackupFileV1).format !== \"kingdom-os-embedded-wallet-backup\" ||\n (parsed as EmbeddedWalletBackupFileV1).version !== EMBEDDED_WALLET_VAULT_VERSION ||\n typeof (parsed as EmbeddedWalletBackupFileV1).vault !== \"object\"\n ) {\n throw new Error(\"Unrecognized embedded wallet backup format\");\n }\n\n return parsed as EmbeddedWalletBackupFileV1;\n}\n\nexport function serializeBackupFile(backup: EmbeddedWalletBackupFileV1): string {\n return JSON.stringify(backup, null, 2);\n}\n","import { fromBase64, toBase64 } from \"@cosmjs/encoding\";\n\nimport { EmbeddedWalletVaultError } from \"./types\";\n\nexport const WEBAUTHN_RP_NAME = \"Kingdom OS\";\n\nexport interface PasskeyRegistrationResult {\n credentialId: Uint8Array;\n authenticatorData: Uint8Array;\n clientDataJSON: Uint8Array;\n prfOutput: Uint8Array | null;\n prfSalt: Uint8Array;\n}\n\nexport interface PasskeyAssertionResult {\n credentialId: Uint8Array;\n authenticatorData: Uint8Array;\n clientDataJSON: Uint8Array;\n prfOutput: Uint8Array | null;\n}\n\nexport class WebAuthnUnavailableError extends Error {\n constructor(message = \"WebAuthn is not available in this browser\") {\n super(message);\n this.name = \"WebAuthnUnavailableError\";\n }\n}\n\nexport class WebAuthnUserCancelledError extends Error {\n constructor(message = \"Passkey request was cancelled\") {\n super(message);\n this.name = \"WebAuthnUserCancelledError\";\n }\n}\n\nfunction randomChallenge(): BufferSource {\n return toBufferSource(crypto.getRandomValues(new Uint8Array(32)));\n}\n\n/** Copy bytes into a plain ArrayBuffer-backed Uint8Array for WebAuthn BufferSource typing. */\nfunction toBufferSource(bytes: Uint8Array): BufferSource {\n return Uint8Array.from(bytes);\n}\n\nfunction resolveRpId(explicit?: string): string {\n if (explicit?.trim()) {\n return explicit.trim();\n }\n if (typeof window !== \"undefined\" && window.location.hostname) {\n return window.location.hostname;\n }\n throw new EmbeddedWalletVaultError(\"rpId is required when window.location is unavailable\");\n}\n\nfunction mapWebAuthnError(err: unknown): Error {\n if (err instanceof DOMException) {\n if (err.name === \"NotAllowedError\") {\n return new WebAuthnUserCancelledError();\n }\n return new EmbeddedWalletVaultError(`WebAuthn failed: ${err.name}`, err);\n }\n return err instanceof Error ? err : new EmbeddedWalletVaultError(String(err));\n}\n\n/** Register a platform passkey; attempts PRF extension when supported. */\nexport async function registerPasskey(options: {\n userId: Uint8Array;\n userName: string;\n displayName: string;\n rpId?: string;\n prfSalt?: Uint8Array;\n}): Promise<PasskeyRegistrationResult> {\n if (typeof navigator === \"undefined\" || !navigator.credentials?.create) {\n throw new WebAuthnUnavailableError();\n }\n\n const rpId = resolveRpId(options.rpId);\n const prfSalt = options.prfSalt ?? crypto.getRandomValues(new Uint8Array(32));\n\n try {\n const credential = (await navigator.credentials.create({\n publicKey: {\n challenge: randomChallenge(),\n rp: { name: WEBAUTHN_RP_NAME, id: rpId },\n user: {\n id: toBufferSource(options.userId),\n name: options.userName,\n displayName: options.displayName,\n },\n pubKeyCredParams: [{ alg: -7, type: \"public-key\" }],\n authenticatorSelection: {\n residentKey: \"preferred\",\n userVerification: \"required\",\n },\n extensions: {\n prf: { eval: { first: toBufferSource(prfSalt) } },\n } as AuthenticationExtensionsClientInputs,\n },\n })) as PublicKeyCredential | null;\n\n if (!credential || !(credential.response instanceof AuthenticatorAttestationResponse)) {\n throw new EmbeddedWalletVaultError(\"Passkey registration returned no credential\");\n }\n\n const prfOutput = readPrfFromExtensions(credential.getClientExtensionResults());\n\n return {\n credentialId: new Uint8Array(credential.rawId),\n authenticatorData: new Uint8Array(credential.response.getAuthenticatorData()),\n clientDataJSON: new Uint8Array(credential.response.clientDataJSON),\n prfOutput,\n prfSalt,\n };\n } catch (err) {\n throw mapWebAuthnError(err);\n }\n}\n\n/** Assert an existing passkey; re-derives PRF output when extension succeeds. */\nexport async function assertPasskey(options: {\n credentialId: Uint8Array;\n rpId?: string;\n prfSalt?: Uint8Array;\n}): Promise<PasskeyAssertionResult> {\n if (typeof navigator === \"undefined\" || !navigator.credentials?.get) {\n throw new WebAuthnUnavailableError();\n }\n\n const rpId = resolveRpId(options.rpId);\n const extensions: AuthenticationExtensionsClientInputs = {};\n if (options.prfSalt) {\n extensions.prf = { eval: { first: toBufferSource(options.prfSalt) } };\n }\n\n try {\n const assertion = (await navigator.credentials.get({\n publicKey: {\n challenge: randomChallenge(),\n rpId,\n allowCredentials: [{ id: toBufferSource(options.credentialId), type: \"public-key\" }],\n userVerification: \"required\",\n extensions,\n },\n })) as PublicKeyCredential | null;\n\n if (!assertion || !(assertion.response instanceof AuthenticatorAssertionResponse)) {\n throw new EmbeddedWalletVaultError(\"Passkey assertion returned no credential\");\n }\n\n return {\n credentialId: new Uint8Array(assertion.rawId),\n authenticatorData: new Uint8Array(assertion.response.authenticatorData),\n clientDataJSON: new Uint8Array(assertion.response.clientDataJSON),\n prfOutput: readPrfFromExtensions(assertion.getClientExtensionResults()),\n };\n } catch (err) {\n throw mapWebAuthnError(err);\n }\n}\n\nfunction readPrfFromExtensions(\n results: AuthenticationExtensionsClientOutputs,\n): Uint8Array | null {\n const prf = results?.prf as { results?: { first?: ArrayBuffer } } | undefined;\n const first = prf?.results?.first;\n if (!first || first.byteLength < 32) {\n return null;\n }\n return new Uint8Array(first).slice(0, 32);\n}\n\nexport function encodeCredentialId(id: Uint8Array): string {\n return toBase64(id);\n}\n\nexport function decodeCredentialId(encoded: string): Uint8Array {\n return fromBase64(encoded);\n}\n","import { DirectSecp256k1Wallet } from \"@cosmjs/proto-signing\";\n\nimport { BECH32_PREFIX } from \"../chainConstants\";\nimport type { EmbeddedWalletPlaintext } from \"./types\";\nimport { EmbeddedWalletVaultError } from \"./types\";\n\nconst DEFAULT_HD_PATH = \"m/44'/118'/0'/0/0\";\n\n/** Build a CosmJS offline signer from decrypted vault plaintext. */\nexport async function embeddedPlaintextToSigner(\n plaintext: EmbeddedWalletPlaintext,\n prefix = BECH32_PREFIX,\n): Promise<DirectSecp256k1Wallet> {\n if (plaintext.privateKey.length !== 32) {\n throw new EmbeddedWalletVaultError(\n `Invalid secp256k1 private key length: ${plaintext.privateKey.length}`,\n );\n }\n return DirectSecp256k1Wallet.fromKey(plaintext.privateKey, prefix);\n}\n\nexport function defaultEmbeddedHdPath(): string {\n return DEFAULT_HD_PATH;\n}\n","import type { EmbeddedWalletVaultV1 } from \"./types\";\n\nconst DB_NAME = \"kingdom-os-wallet\";\nconst DB_VERSION = 1;\nconst STORE_NAME = \"vault\";\nconst PRIMARY_KEY = \"primary\";\n\nfunction openDb(): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(DB_NAME, DB_VERSION);\n request.onerror = () => reject(request.error ?? new Error(\"IndexedDB open failed\"));\n request.onupgradeneeded = () => {\n const db = request.result;\n if (!db.objectStoreNames.contains(STORE_NAME)) {\n db.createObjectStore(STORE_NAME);\n }\n };\n request.onsuccess = () => resolve(request.result);\n });\n}\n\nexport async function saveVaultToIndexedDb(vault: EmbeddedWalletVaultV1): Promise<void> {\n const db = await openDb();\n await new Promise<void>((resolve, reject) => {\n const tx = db.transaction(STORE_NAME, \"readwrite\");\n tx.objectStore(STORE_NAME).put(vault, PRIMARY_KEY);\n tx.oncomplete = () => resolve();\n tx.onerror = () => reject(tx.error ?? new Error(\"IndexedDB write failed\"));\n });\n db.close();\n}\n\nexport async function loadVaultFromIndexedDb(): Promise<EmbeddedWalletVaultV1 | null> {\n const db = await openDb();\n const vault = await new Promise<EmbeddedWalletVaultV1 | null>((resolve, reject) => {\n const tx = db.transaction(STORE_NAME, \"readonly\");\n const request = tx.objectStore(STORE_NAME).get(PRIMARY_KEY);\n request.onsuccess = () => resolve((request.result as EmbeddedWalletVaultV1 | undefined) ?? null);\n request.onerror = () => reject(request.error ?? new Error(\"IndexedDB read failed\"));\n });\n db.close();\n return vault;\n}\n\nexport async function clearVaultFromIndexedDb(): Promise<void> {\n const db = await openDb();\n await new Promise<void>((resolve, reject) => {\n const tx = db.transaction(STORE_NAME, \"readwrite\");\n tx.objectStore(STORE_NAME).delete(PRIMARY_KEY);\n tx.oncomplete = () => resolve();\n tx.onerror = () => reject(tx.error ?? new Error(\"IndexedDB delete failed\"));\n });\n db.close();\n}\n","import { Random } from \"@cosmjs/crypto\";\nimport type { OfflineDirectSigner } from \"@cosmjs/proto-signing\";\n\nimport { exportEncryptedBackup, parseEncryptedBackup, serializeBackupFile } from \"./backup\";\nimport {\n assertVaultPermitsTransaction,\n createPasskeyMaterialFromAssertion,\n createPbkdf2Salt,\n decryptWalletPayload,\n deriveKekFromPbkdf2,\n deriveKekFromPrf,\n encryptWalletPayload,\n markVaultBackupAcknowledged,\n} from \"./crypto\";\nimport { detectWebAuthnPrfCapabilities, selectEmbeddedWalletKdf } from \"./prf\";\nimport { defaultEmbeddedHdPath, embeddedPlaintextToSigner } from \"./signer\";\nimport { clearVaultFromIndexedDb, loadVaultFromIndexedDb, saveVaultToIndexedDb } from \"./storage\";\nimport {\n EMBEDDED_WALLET_KDF_PBKDF2,\n EMBEDDED_WALLET_KDF_PRF,\n type EmbeddedWalletBackupFileV1,\n type EmbeddedWalletPlaintext,\n type EmbeddedWalletVaultV1,\n EmbeddedWalletVaultError,\n} from \"./types\";\nimport { assertPasskey, decodeCredentialId, registerPasskey } from \"./webauthn\";\n\nexport interface CreateEmbeddedWalletOptions {\n userId: Uint8Array;\n userName: string;\n displayName: string;\n rpId?: string;\n}\n\nexport interface EmbeddedWalletSession {\n address: string;\n vault: EmbeddedWalletVaultV1;\n signer: OfflineDirectSigner;\n}\n\nlet activeSession: EmbeddedWalletSession | null = null;\n\nasync function deriveKekFromPasskeyMaterial(\n vault: EmbeddedWalletVaultV1,\n prfOutput: Uint8Array | null,\n authenticatorData: Uint8Array,\n clientDataJSON: Uint8Array,\n): Promise<Uint8Array> {\n const caps = detectWebAuthnPrfCapabilities();\n const kdf = selectEmbeddedWalletKdf(caps, prfOutput);\n\n if (kdf === EMBEDDED_WALLET_KDF_PRF && prfOutput) {\n return deriveKekFromPrf(prfOutput);\n }\n\n if (vault.kdf !== EMBEDDED_WALLET_KDF_PBKDF2 || !vault.kdfSalt) {\n throw new EmbeddedWalletVaultError(\"Vault expects PBKDF2 but passkey material unavailable\");\n }\n\n const salt = decodeCredentialId(vault.kdfSalt);\n const material = createPasskeyMaterialFromAssertion(authenticatorData, clientDataJSON);\n return deriveKekFromPbkdf2(material, salt, vault.kdfIterations || undefined);\n}\n\nasync function unlockVaultToSession(vault: EmbeddedWalletVaultV1): Promise<EmbeddedWalletSession> {\n const credentialId = decodeCredentialId(vault.credentialId);\n const prfSalt = vault.prfSalt ? decodeCredentialId(vault.prfSalt) : undefined;\n const assertion = await assertPasskey({ credentialId, rpId: undefined, prfSalt });\n const kek = await deriveKekFromPasskeyMaterial(\n vault,\n assertion.prfOutput,\n assertion.authenticatorData,\n assertion.clientDataJSON,\n );\n const plaintext = await decryptWalletPayload(vault, kek);\n const signer = await embeddedPlaintextToSigner(plaintext);\n const [account] = await signer.getAccounts();\n const session: EmbeddedWalletSession = { address: account.address, vault, signer };\n activeSession = session;\n return session;\n}\n\n/** Returns true if an encrypted vault exists in IndexedDB. */\nexport async function hasEmbeddedWallet(): Promise<boolean> {\n const vault = await loadVaultFromIndexedDb();\n return vault != null;\n}\n\n/** Create passkey + encrypted vault; does not unlock signer until backup is acknowledged. */\nexport async function createEmbeddedWallet(\n options: CreateEmbeddedWalletOptions,\n): Promise<{ address: string; vault: EmbeddedWalletVaultV1 }> {\n const registration = await registerPasskey({\n userId: options.userId,\n userName: options.userName,\n displayName: options.displayName,\n rpId: options.rpId,\n });\n\n const privateKey = Random.getBytes(32);\n const createdAt = new Date().toISOString();\n const plaintext: EmbeddedWalletPlaintext = {\n privateKey,\n hdPath: defaultEmbeddedHdPath(),\n createdAt,\n };\n\n const previewSigner = await embeddedPlaintextToSigner(plaintext);\n const [account] = await previewSigner.getAccounts();\n\n const caps = detectWebAuthnPrfCapabilities();\n const kdf = selectEmbeddedWalletKdf(caps, registration.prfOutput);\n let kek: Uint8Array;\n let kdfSalt: Uint8Array | undefined;\n let prfSalt: Uint8Array | undefined;\n\n if (kdf === EMBEDDED_WALLET_KDF_PRF && registration.prfOutput) {\n kek = await deriveKekFromPrf(registration.prfOutput);\n prfSalt = registration.prfSalt;\n } else {\n kdfSalt = createPbkdf2Salt();\n const material = createPasskeyMaterialFromAssertion(\n registration.authenticatorData,\n registration.clientDataJSON,\n );\n kek = await deriveKekFromPbkdf2(material, kdfSalt);\n }\n\n const vault = await encryptWalletPayload(plaintext, {\n kdf,\n credentialId: registration.credentialId,\n publicAddress: account.address,\n kek,\n kdfSalt,\n prfSalt,\n backupAcknowledged: false,\n });\n\n await saveVaultToIndexedDb(vault);\n lockEmbeddedWallet();\n return { address: account.address, vault };\n}\n\n/** Unlock existing vault with passkey; requires backup acknowledged for signing. */\nexport async function unlockEmbeddedWallet(): Promise<EmbeddedWalletSession> {\n const vault = await loadVaultFromIndexedDb();\n if (!vault) {\n throw new EmbeddedWalletVaultError(\"No embedded wallet found on this device\");\n }\n return unlockVaultToSession(vault);\n}\n\n/** Clear in-memory signer. */\nexport function lockEmbeddedWallet(): void {\n activeSession = null;\n}\n\nexport function getEmbeddedWalletSession(): EmbeddedWalletSession | null {\n return activeSession;\n}\n\n/** Offline signer for CosmJS; enforces backup gate before signing. */\nexport function getEmbeddedOfflineSigner(): OfflineDirectSigner {\n if (!activeSession) {\n throw new EmbeddedWalletVaultError(\"Embedded wallet is locked\");\n }\n assertVaultPermitsTransaction(activeSession.vault);\n\n const inner = activeSession.signer;\n return {\n getAccounts: () => inner.getAccounts(),\n signDirect: (signerAddress, signDoc) => inner.signDirect(signerAddress, signDoc),\n };\n}\n\n/** Mark backup downloaded/acknowledged and persist. Returns backup file payload. */\nexport async function acknowledgeEmbeddedBackup(): Promise<EmbeddedWalletBackupFileV1> {\n const vault = await loadVaultFromIndexedDb();\n if (!vault) {\n throw new EmbeddedWalletVaultError(\"No embedded wallet found on this device\");\n }\n const updated = markVaultBackupAcknowledged(vault);\n await saveVaultToIndexedDb(updated);\n if (activeSession) {\n activeSession = { ...activeSession, vault: updated };\n }\n return exportEncryptedBackup(updated);\n}\n\nexport function downloadEmbeddedBackupFile(backup: EmbeddedWalletBackupFileV1, filename?: string): void {\n const blob = new Blob([serializeBackupFile(backup)], { type: \"application/json\" });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.href = url;\n anchor.download = filename ?? `kingdom-os-wallet-backup-${backup.vault.publicAddress}.json`;\n anchor.click();\n URL.revokeObjectURL(url);\n}\n\n/** Restore vault from user-held backup file (still requires passkey to decrypt). */\nexport async function importEmbeddedBackup(json: string): Promise<EmbeddedWalletVaultV1> {\n const backup = parseEncryptedBackup(json);\n await saveVaultToIndexedDb(backup.vault);\n lockEmbeddedWallet();\n return backup.vault;\n}\n\nexport async function clearEmbeddedWallet(): Promise<void> {\n lockEmbeddedWallet();\n await clearVaultFromIndexedDb();\n}\n","import type { EncodeObject } from \"@cosmjs/proto-signing\";\n\nimport {\n ATTESTATION_TYPE_CITIZENSHIP_APPLICATION,\n attestationSignPayload,\n providerSeedFromHex,\n signAttestationPayload,\n type AttestationPayloadInput,\n} from \"./attestation\";\nimport { MsgSubmitApplication } from \"./registry\";\n\nexport interface SubmitApplicationParams {\n applicantWallet: string;\n applicationId: string;\n chainId: string;\n providerId: string;\n policyVersion: string;\n providerSeedHex: string;\n nonce: string;\n uniquenessReference: string;\n issuedAt: Date;\n expiresAt: Date;\n providerKeyVersion?: bigint;\n}\n\nexport function buildSubmitApplicationMsg(\n applicantWallet: string,\n applicationId: string,\n attestationInput: AttestationPayloadInput,\n signature: string,\n): EncodeObject {\n return {\n typeUrl: \"/isatheword.kingdomchain.compliance.v1.MsgSubmitApplication\",\n value: MsgSubmitApplication.fromPartial({\n applicant_wallet: applicantWallet,\n application_id: applicationId,\n provider_id: attestationInput.providerId,\n provider_key_version: attestationInput.providerKeyVersion,\n chain_id: attestationInput.chainId,\n case_id: attestationInput.caseId,\n policy_version: attestationInput.policyVersion,\n nonce: attestationInput.nonce,\n uniqueness_reference: attestationInput.uniquenessReference,\n issued_at: attestationInput.issuedAt,\n expires_at: attestationInput.expiresAt,\n signature,\n }),\n };\n}\n\nexport async function signCitizenshipAttestation(\n params: SubmitApplicationParams,\n): Promise<{ signature: string; input: AttestationPayloadInput }> {\n const input: AttestationPayloadInput = {\n attestationType: ATTESTATION_TYPE_CITIZENSHIP_APPLICATION,\n chainId: params.chainId,\n intendedWallet: params.applicantWallet,\n caseId: params.applicationId,\n policyVersion: params.policyVersion,\n nonce: params.nonce,\n uniquenessReference: params.uniquenessReference,\n issuedAt: params.issuedAt,\n expiresAt: params.expiresAt,\n providerId: params.providerId,\n providerKeyVersion: params.providerKeyVersion ?? 1n,\n };\n const payload = attestationSignPayload(input);\n const providerSeed = providerSeedFromHex(params.providerSeedHex);\n const signature = await signAttestationPayload(providerSeed, payload);\n return { signature, input };\n}\n"]}
|