@keetanetwork/anchor 0.0.64 → 0.0.65

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.
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGnE,MAAM,CAAC,MAAM,MAAM,GAA2C,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwD,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEpK,SAAS,QAAQ,CAAC,GAAkC;IACnD,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,+DAA+D;QAC/D,yEAAyE;QACzE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAuB,CAAC;IACtF,CAAC;IAED,qBAAqB;IACrB,gDAAgD;IAChD,yEAAyE;IACzE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAuB,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC3D,OAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAyC;IAChF,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,yEAAyE;IACzE,OAAM,CAAC,QAAQ,CAAC,MAAqB,CAAC,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nexport type Buffer = InstanceType<typeof KeetaNetLib.Utils.Buffer.Buffer>;\nexport const Buffer: typeof KeetaNetLib.Utils.Buffer.Buffer = KeetaNetLib.Utils.Buffer.Buffer;\n\n/*\n * Because our public interfaces are ArrayBuffers we often need to convert\n * Buffers to ArrayBuffers -- an alias to the Node function to do that\n */\nexport const bufferToArrayBuffer: typeof KeetaNetLib.Utils.Helper.bufferToArrayBuffer = KeetaNetLib.Utils.Helper.bufferToArrayBuffer.bind(KeetaNetLib.Utils.Helper);\n\nfunction toBuffer(src: ArrayBufferView | ArrayBuffer): Buffer {\n\tif (ArrayBuffer.isView(src)) {\n\t\t// Zero-copy: Buffer will reference the same ArrayBuffer range.\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(Buffer.from(src.buffer, src.byteOffset, src.byteLength) as unknown as Buffer);\n\t}\n\n\t// src is ArrayBuffer\n\t// Zero-copy: shares memory with the ArrayBuffer\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(Buffer.from(src) as unknown as Buffer);\n}\n\n/*\n * Helper to convert ArrayBuffer back to Buffer\n */\nexport function arrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer {\n\treturn(toBuffer(arrayBuffer));\n}\n\n/*\n * Converts a Buffer backed by ArrayBufferLike storage into one backed by an ArrayBuffer.\n */\nexport function arrayBufferLikeToBuffer(buffer: ArrayBufferLike | ArrayBufferView): Buffer {\n\tif (ArrayBuffer.isView(buffer)) {\n\t\treturn(toBuffer(buffer));\n\t}\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(toBuffer(buffer as ArrayBuffer));\n}\n"]}
1
+ {"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BA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,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAM,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAED,OAAM,CAAC,OAAO,CAAC,CAAC;AACjB,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nexport type Buffer = InstanceType<typeof KeetaNetLib.Utils.Buffer.Buffer>;\nexport const Buffer: typeof KeetaNetLib.Utils.Buffer.Buffer = KeetaNetLib.Utils.Buffer.Buffer;\n\n/*\n * Because our public interfaces are ArrayBuffers we often need to convert\n * Buffers to ArrayBuffers -- an alias to the Node function to do that\n */\nexport const bufferToArrayBuffer: typeof KeetaNetLib.Utils.Helper.bufferToArrayBuffer = KeetaNetLib.Utils.Helper.bufferToArrayBuffer.bind(KeetaNetLib.Utils.Helper);\n\nfunction toBuffer(src: ArrayBufferView | ArrayBuffer): Buffer {\n\tif (ArrayBuffer.isView(src)) {\n\t\t// Zero-copy: Buffer will reference the same ArrayBuffer range.\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(Buffer.from(src.buffer, src.byteOffset, src.byteLength) as unknown as Buffer);\n\t}\n\n\t// src is ArrayBuffer\n\t// Zero-copy: shares memory with the ArrayBuffer\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(Buffer.from(src) as unknown as Buffer);\n}\n\n/*\n * Helper to convert ArrayBuffer back to Buffer\n */\nexport function arrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer {\n\treturn(toBuffer(arrayBuffer));\n}\n\n/*\n * Converts a Buffer backed by ArrayBufferLike storage into one backed by an ArrayBuffer.\n */\nexport function arrayBufferLikeToBuffer(buffer: ArrayBufferLike | ArrayBufferView): Buffer {\n\tif (ArrayBuffer.isView(buffer)) {\n\t\treturn(toBuffer(buffer));\n\t}\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(toBuffer(buffer as ArrayBuffer));\n}\n\n/**\n * Regular expression to match base64 input.\n */\nconst BASE64_INPUT_REGEX = /^[-_A-Za-z0-9+/=\\s]*$/;\n\n/**\n * Decode a base64 string into a {@link Buffer}.\n */\nexport function decodeBase64Strict(input: string): Buffer | undefined {\n\tif (!BASE64_INPUT_REGEX.test(input)) {\n\t\treturn(undefined);\n\t}\n\n\tconst decoded = Buffer.from(input, 'base64');\n\tif (decoded.length === 0) {\n\t\treturn(undefined);\n\t}\n\n\treturn(decoded);\n}\n"]}
@@ -9,6 +9,11 @@ export type Signable = (string | number | bigint | InstanceType<typeof KeetaNetL
9
9
  export type SignableInput = {
10
10
  [key: string | number | symbol]: unknown;
11
11
  } | SignableInput[] | Signable[number] | undefined | null | boolean;
12
+ /**
13
+ * Serialize a JSON-shaped value following JCS
14
+ * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785}).
15
+ */
16
+ export declare function canonicalizeJson(value: unknown): string;
12
17
  /**
13
18
  * Canonicalize a tree into a {@link Signable} via {@link canonicalizeJson}.
14
19
  * {@link KeetaNetLib.Account} instances are replaced by their `publicKeyAndTypeString`.
@@ -1 +1 @@
1
- {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,MAAM,EAAgD,MAAM,2BAA2B,CAAC;AAKjG,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;AACpG,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AACzE,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC,O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QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;CAAE,CAAC,CAS1I;AAED,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
@@ -15,7 +15,7 @@ const LONE_SURROGATE_PATTERN = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\
15
15
  * Serialize a JSON-shaped value following JCS
16
16
  * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785}).
17
17
  */
18
- function canonicalizeJson(value) {
18
+ export function canonicalizeJson(value) {
19
19
  /**
20
20
  * Literal serialization (Section 3.2.2.1).
21
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../src/lib/utils/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiB/C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,4BAA4B,GAAG,KAAK,CAAC;AAE3C;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,wEAAwE,CAAC;AAExG;;;GAGG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACvC;;OAEG;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,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC;IACzC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5C;;;;;;;OAOG;IACH,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,eAAe,EAAE,CAAC;QACjD,OAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IACtD,MAAM,aAAa,GAAG,OAAO,EAAE,aAAa,IAAI,IAAI,IAAI,EAAE,CAAC;IAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC;QACzE,wDAAwD;QACxD,OAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,mGAAmG;IACnG,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;IAE/E,OAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AACvJ,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport type {\n\tValidateASN1 as KeetaNetASN1Validation,\n\tASN1AnyJS as KeetaNetASN1AnyJS\n} from '@keetanetwork/keetanet-client/lib/utils/asn1.js';\n\nimport { Buffer, bufferToArrayBuffer, arrayBufferLikeToBuffer } from '../../lib/utils/buffer.js';\nimport crypto from '../../lib/utils/crypto.js';\nimport { assertNever } from '../../lib/utils/never.js';\nimport { KeetaAnchorError } from '../error.js';\n\nexport type SignableAccount = ReturnType<InstanceType<typeof KeetaNetLib.Account>['assertAccount']>;\nexport type VerifiableAccount = InstanceType<typeof KeetaNetLib.Account>;\nexport type Signable = (string | number | bigint | InstanceType<typeof KeetaNetLib.Account>)[];\n\n/**\n * Structural input to {@link objectToSignable}.\n */\nexport type SignableInput =\n\t{ [key: string | number | symbol]: unknown } |\n\tSignableInput[] |\n\tSignable[number] |\n\tundefined |\n\tnull |\n\tboolean;\n\nconst TO_SIGNABLE_MAX_NODES = 1000;\nconst TO_SIGNABLE_MAX_OUTPUT_BYTES = 65536;\n\n/**\n * Detects unpaired UTF-16 surrogate code units. JCS\n * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785} Section 3.2.2.2)\n * requires implementations to reject such strings.\n */\nconst LONE_SURROGATE_PATTERN = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Serialize a JSON-shaped value following JCS\n * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785}).\n */\nfunction canonicalizeJson(value: unknown): string {\n\t/**\n\t * Literal serialization (Section 3.2.2.1).\n\t */\n\tif (value === null || typeof value === 'boolean') {\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * String serialization (Section 3.2.2.2). Lone UTF-16 surrogates MUST cause termination.\n\t */\n\tif (typeof value === 'string') {\n\t\tif (LONE_SURROGATE_PATTERN.test(value)) {\n\t\t\tthrow(new KeetaAnchorError('Lone UTF-16 surrogate in canonicalizeJson'));\n\t\t}\n\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * Number serialization (Section 3.2.2.3). NaN and Infinity MUST cause termination.\n\t */\n\tif (typeof value === 'number') {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow(new KeetaAnchorError('non-finite number in canonicalizeJson'));\n\t\t}\n\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * Big integer serialization (Appendix D); I-JSON safe-integer range required.\n\t */\n\tif (typeof value === 'bigint') {\n\t\tif (value > BigInt(Number.MAX_SAFE_INTEGER) || value < BigInt(Number.MIN_SAFE_INTEGER)) {\n\t\t\tthrow(new KeetaAnchorError('bigint out of safe integer range in canonicalizeJson'));\n\t\t}\n\n\t\treturn(value.toString());\n\t}\n\n\t/**\n\t * Array element order MUST NOT be changed (Section 3.2.3); sparse holes serialize as JSON `null`.\n\t */\n\tif (Array.isArray(value)) {\n\t\tconst parts: string[] = [];\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tparts.push(i in value ? canonicalizeJson(value[i]) : 'null');\n\t\t}\n\n\t\treturn(`[${parts.join(',')}]`);\n\t}\n\n\t/**\n\t * Object property sorting by UTF-16 code unit (Section 3.2.3); recursion required.\n\t * Only plain objects are permitted; class instances (Date, Map, etc.) are rejected.\n\t */\n\tif (typeof value === 'object') {\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {\n\t\t\tthrow(new KeetaAnchorError('Non-plain object in canonicalizeJson'));\n\t\t}\n\n\t\tconst entries = Object.entries(value);\n\t\tfor (const [ key ] of entries) {\n\t\t\tif (LONE_SURROGATE_PATTERN.test(key)) {\n\t\t\t\tthrow(new KeetaAnchorError('Lone UTF-16 surrogate in object key'));\n\t\t\t}\n\t\t}\n\n\t\tentries.sort(([ a ], [ b ]) => {\n\t\t\tif (a < b) {\n\t\t\t\treturn(-1);\n\t\t\t}\n\t\t\tif (a > b) {\n\t\t\t\treturn(1);\n\t\t\t}\n\n\t\t\treturn(0);\n\t\t});\n\n\t\tconst parts: string[] = [];\n\t\tfor (const [ key, child ] of entries) {\n\t\t\tparts.push(`${JSON.stringify(key)}:${canonicalizeJson(child)}`);\n\t\t}\n\n\t\treturn(`{${parts.join(',')}}`);\n\t}\n\n\tthrow(new KeetaAnchorError('Unsupported value type in canonicalizeJson'));\n}\n\n/**\n * Canonicalize a tree into a {@link Signable} via {@link canonicalizeJson}.\n * {@link KeetaNetLib.Account} instances are replaced by their `publicKeyAndTypeString`.\n * {@link Date} instances are replaced by their ISO 8601 string.\n */\nexport function objectToSignable(item: SignableInput): Signable {\n\tlet nodeCount = 0;\n\tfunction visit(value: unknown): unknown {\n\t\tnodeCount++;\n\t\tif (nodeCount > TO_SIGNABLE_MAX_NODES) {\n\t\t\tthrow(new KeetaAnchorError('Too much data to sign in objectToSignable'));\n\t\t}\n\n\t\tif (value === undefined || value === null) {\n\t\t\treturn(null);\n\t\t}\n\t\tif (value instanceof Date) {\n\t\t\tif (Number.isNaN(value.valueOf())) {\n\t\t\t\tthrow(new KeetaAnchorError('Invalid Date in objectToSignable'));\n\t\t\t}\n\n\t\t\treturn(value.toISOString());\n\t\t}\n\t\tif (KeetaNetLib.Account.isInstance(value)) {\n\t\t\treturn(value.publicKeyAndTypeString);\n\t\t}\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length > TO_SIGNABLE_MAX_NODES - nodeCount) {\n\t\t\t\tthrow(new KeetaAnchorError('Too much data to sign in objectToSignable'));\n\t\t\t}\n\n\t\t\tconst result: unknown[] = [];\n\t\t\tfor (const child of value) {\n\t\t\t\tresult.push(visit(child));\n\t\t\t}\n\n\t\t\treturn(result);\n\t\t}\n\t\tif (typeof value === 'object') {\n\t\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {\n\t\t\t\tthrow(new KeetaAnchorError('Non-plain object in objectToSignable'));\n\t\t\t}\n\n\t\t\tconst result: { [key: string]: unknown } = {};\n\t\t\tfor (const [ key, child ] of Object.entries(value)) {\n\t\t\t\tif (child === undefined) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tresult[key] = visit(child);\n\t\t\t}\n\n\t\t\treturn(result);\n\t\t}\n\n\t\treturn(value);\n\t}\n\n\tconst canonical = canonicalizeJson(visit(item));\n\tif (Buffer.byteLength(canonical, 'utf8') > TO_SIGNABLE_MAX_OUTPUT_BYTES) {\n\t\tthrow(new KeetaAnchorError('Canonical output exceeds size limit in objectToSignable'));\n\t}\n\n\treturn([ canonical ]);\n}\n\n/**\n * Options for signature verification\n */\nexport interface VerifyOptions {\n\t/** Maximum allowed time difference in milliseconds (default: 5 * 60 * 1000 = 5 minutes) */\n\tmaxSkewMs?: number;\n\t/** Reference time for skew calculation (default: new Date()) */\n\treferenceTime?: Date;\n}\n\nexport function FormatData(account: VerifiableAccount, data: Signable, nonce?: string, timestamp?: string | Date): { nonce: string; timestamp: string; verificationData: Buffer; } {\n\tnonce ??= crypto.randomUUID();\n\ttimestamp ??= new Date();\n\n\tlet timestampString: string;\n\tif (typeof timestamp === 'string') {\n\t\ttimestampString = timestamp;\n\t} else {\n\t\ttimestampString = timestamp.toISOString();\n\t}\n\n\tconst input: KeetaNetASN1AnyJS[] = [\n\t\tnonce,\n\t\ttimestampString,\n\t\taccount.publicKeyAndType\n\t];\n\n\tconst schema: KeetaNetASN1Validation.Schema[] = [\n\t\t{ type: 'string', kind: 'utf8' },\n\t\t{ type: 'string', kind: 'utf8' },\n\t\tKeetaNetLib.Utils.ASN1.ValidateASN1.IsOctetString\n\t];\n\n\tfor (const item of data) {\n\t\tif (typeof item === 'string') {\n\t\t\tinput.push(item);\n\t\t\tschema.push({ type: 'string', kind: 'utf8' });\n\t\t} else if (typeof item === 'number' || typeof item === 'bigint') {\n\t\t\tinput.push(item);\n\t\t\tschema.push(KeetaNetLib.Utils.ASN1.ValidateASN1.IsInteger);\n\t\t} else if (KeetaNetLib.Account.isInstance(item)) {\n\t\t\tinput.push(item.publicKeyAndType);\n\t\t\tschema.push(KeetaNetLib.Utils.ASN1.ValidateASN1.IsOctetString);\n\t\t} else {\n\t\t\tassertNever(item);\n\t\t}\n\t}\n\n\t/*\n\t * Verify that the generated ASN.1 data matches the expected schema before returning it.\n\t */\n\t// @ts-ignore\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\tconst inputCanonical = KeetaNetLib.Utils.ASN1.ValidateASN1.againstSchema(input, schema);\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\tconst verificationData = KeetaNetLib.Utils.ASN1.JStoASN1(inputCanonical);\n\n\treturn({\n\t\tnonce: nonce,\n\t\ttimestamp: timestampString,\n\t\tverificationData: arrayBufferLikeToBuffer(verificationData.toBER())\n\t});\n}\n\nexport async function SignData(account: SignableAccount, data: Signable): Promise<{ nonce: string; timestamp: string; signature: string; }> {\n\tconst { nonce, timestamp, verificationData } = FormatData(account, data);\n\tconst signature = await account.sign(bufferToArrayBuffer(verificationData));\n\n\treturn({\n\t\tnonce: nonce,\n\t\ttimestamp: timestamp,\n\t\tsignature: signature.getBuffer().toString('base64')\n\t});\n}\n\nexport async function VerifySignedData(\n\taccount: VerifiableAccount,\n\tdata: Signable,\n\tsigned: Awaited<ReturnType<typeof SignData>>,\n\toptions?: VerifyOptions\n): Promise<boolean> {\n\tconst nonce = signed.nonce;\n\tconst timestampString = signed.timestamp;\n\tconst signatureBuffer = Buffer.from(signed.signature, 'base64');\n\n\tconst timestamp = new Date(timestampString);\n\t/*\n\t * Enforce that the timestamp string is in valid ISO 8601 format,\n\t * not just a date that can be parsed\n\t *\n\t * XXX:TODO: This is not a perfect check since ISO 8601 does not require millisecond-level\n\t * precision and technically allows other timezones (though we will not support\n\t * those). This will be changed in the future to be more robust.\n\t */\n\tif (timestamp.toISOString() !== timestampString) {\n\t\treturn(false);\n\t}\n\n\tconst maxSkewMs = options?.maxSkewMs ?? 5 * 60 * 1000;\n\tconst referenceTime = options?.referenceTime ?? new Date();\n\tif (Math.abs(timestamp.valueOf() - referenceTime.valueOf()) > maxSkewMs) {\n\t\t/* Timestamp exceeds allowed skew from reference time */\n\t\treturn(false);\n\t}\n\n\t/* XXX:TODO: Verify that the timestamp is a valid ISO 8601 date string within a reasonable range */\n\tconst { verificationData } = FormatData(account, data, nonce, timestampString);\n\n\treturn(account.verify(KeetaNetLib.Utils.Helper.bufferToArrayBuffer(verificationData), KeetaNetLib.Utils.Helper.bufferToArrayBuffer(signatureBuffer)));\n}\n"]}
1
+ {"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../src/lib/utils/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiB/C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,4BAA4B,GAAG,KAAK,CAAC;AAE3C;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,wEAAwE,CAAC;AAExG;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC9C;;OAEG;IACH,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAClD,OAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,MAAK,CAAC,IAAI,gBAAgB,CAAC,2CAA2C,CAAC,CAAC,CAAC;QAC1E,CAAC;QAED,OAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK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GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC;QACzE,wDAAwD;QACxD,OAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,mGAAmG;IACnG,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;IAE/E,OAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AACvJ,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport type {\n\tValidateASN1 as KeetaNetASN1Validation,\n\tASN1AnyJS as KeetaNetASN1AnyJS\n} from '@keetanetwork/keetanet-client/lib/utils/asn1.js';\n\nimport { Buffer, bufferToArrayBuffer, arrayBufferLikeToBuffer } from '../../lib/utils/buffer.js';\nimport crypto from '../../lib/utils/crypto.js';\nimport { assertNever } from '../../lib/utils/never.js';\nimport { KeetaAnchorError } from '../error.js';\n\nexport type SignableAccount = ReturnType<InstanceType<typeof KeetaNetLib.Account>['assertAccount']>;\nexport type VerifiableAccount = InstanceType<typeof KeetaNetLib.Account>;\nexport type Signable = (string | number | bigint | InstanceType<typeof KeetaNetLib.Account>)[];\n\n/**\n * Structural input to {@link objectToSignable}.\n */\nexport type SignableInput =\n\t{ [key: string | number | symbol]: unknown } |\n\tSignableInput[] |\n\tSignable[number] |\n\tundefined |\n\tnull |\n\tboolean;\n\nconst TO_SIGNABLE_MAX_NODES = 1000;\nconst TO_SIGNABLE_MAX_OUTPUT_BYTES = 65536;\n\n/**\n * Detects unpaired UTF-16 surrogate code units. JCS\n * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785} Section 3.2.2.2)\n * requires implementations to reject such strings.\n */\nconst LONE_SURROGATE_PATTERN = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Serialize a JSON-shaped value following JCS\n * ({@link https://www.rfc-editor.org/rfc/rfc8785 RFC 8785}).\n */\nexport function canonicalizeJson(value: unknown): string {\n\t/**\n\t * Literal serialization (Section 3.2.2.1).\n\t */\n\tif (value === null || typeof value === 'boolean') {\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * String serialization (Section 3.2.2.2). Lone UTF-16 surrogates MUST cause termination.\n\t */\n\tif (typeof value === 'string') {\n\t\tif (LONE_SURROGATE_PATTERN.test(value)) {\n\t\t\tthrow(new KeetaAnchorError('Lone UTF-16 surrogate in canonicalizeJson'));\n\t\t}\n\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * Number serialization (Section 3.2.2.3). NaN and Infinity MUST cause termination.\n\t */\n\tif (typeof value === 'number') {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow(new KeetaAnchorError('non-finite number in canonicalizeJson'));\n\t\t}\n\n\t\treturn(JSON.stringify(value));\n\t}\n\n\t/**\n\t * Big integer serialization (Appendix D); I-JSON safe-integer range required.\n\t */\n\tif (typeof value === 'bigint') {\n\t\tif (value > BigInt(Number.MAX_SAFE_INTEGER) || value < BigInt(Number.MIN_SAFE_INTEGER)) {\n\t\t\tthrow(new KeetaAnchorError('bigint out of safe integer range in canonicalizeJson'));\n\t\t}\n\n\t\treturn(value.toString());\n\t}\n\n\t/**\n\t * Array element order MUST NOT be changed (Section 3.2.3); sparse holes serialize as JSON `null`.\n\t */\n\tif (Array.isArray(value)) {\n\t\tconst parts: string[] = [];\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tparts.push(i in value ? canonicalizeJson(value[i]) : 'null');\n\t\t}\n\n\t\treturn(`[${parts.join(',')}]`);\n\t}\n\n\t/**\n\t * Object property sorting by UTF-16 code unit (Section 3.2.3); recursion required.\n\t * Only plain objects are permitted; class instances (Date, Map, etc.) are rejected.\n\t */\n\tif (typeof value === 'object') {\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {\n\t\t\tthrow(new KeetaAnchorError('Non-plain object in canonicalizeJson'));\n\t\t}\n\n\t\tconst entries = Object.entries(value);\n\t\tfor (const [ key ] of entries) {\n\t\t\tif (LONE_SURROGATE_PATTERN.test(key)) {\n\t\t\t\tthrow(new KeetaAnchorError('Lone UTF-16 surrogate in object key'));\n\t\t\t}\n\t\t}\n\n\t\tentries.sort(([ a ], [ b ]) => {\n\t\t\tif (a < b) {\n\t\t\t\treturn(-1);\n\t\t\t}\n\t\t\tif (a > b) {\n\t\t\t\treturn(1);\n\t\t\t}\n\n\t\t\treturn(0);\n\t\t});\n\n\t\tconst parts: string[] = [];\n\t\tfor (const [ key, child ] of entries) {\n\t\t\tparts.push(`${JSON.stringify(key)}:${canonicalizeJson(child)}`);\n\t\t}\n\n\t\treturn(`{${parts.join(',')}}`);\n\t}\n\n\tthrow(new KeetaAnchorError('Unsupported value type in canonicalizeJson'));\n}\n\n/**\n * Canonicalize a tree into a {@link Signable} via {@link canonicalizeJson}.\n * {@link KeetaNetLib.Account} instances are replaced by their `publicKeyAndTypeString`.\n * {@link Date} instances are replaced by their ISO 8601 string.\n */\nexport function objectToSignable(item: SignableInput): Signable {\n\tlet nodeCount = 0;\n\tfunction visit(value: unknown): unknown {\n\t\tnodeCount++;\n\t\tif (nodeCount > TO_SIGNABLE_MAX_NODES) {\n\t\t\tthrow(new KeetaAnchorError('Too much data to sign in objectToSignable'));\n\t\t}\n\n\t\tif (value === undefined || value === null) {\n\t\t\treturn(null);\n\t\t}\n\t\tif (value instanceof Date) {\n\t\t\tif (Number.isNaN(value.valueOf())) {\n\t\t\t\tthrow(new KeetaAnchorError('Invalid Date in objectToSignable'));\n\t\t\t}\n\n\t\t\treturn(value.toISOString());\n\t\t}\n\t\tif (KeetaNetLib.Account.isInstance(value)) {\n\t\t\treturn(value.publicKeyAndTypeString);\n\t\t}\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length > TO_SIGNABLE_MAX_NODES - nodeCount) {\n\t\t\t\tthrow(new KeetaAnchorError('Too much data to sign in objectToSignable'));\n\t\t\t}\n\n\t\t\tconst result: unknown[] = [];\n\t\t\tfor (const child of value) {\n\t\t\t\tresult.push(visit(child));\n\t\t\t}\n\n\t\t\treturn(result);\n\t\t}\n\t\tif (typeof value === 'object') {\n\t\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {\n\t\t\t\tthrow(new KeetaAnchorError('Non-plain object in objectToSignable'));\n\t\t\t}\n\n\t\t\tconst result: { [key: string]: unknown } = {};\n\t\t\tfor (const [ key, child ] of Object.entries(value)) {\n\t\t\t\tif (child === undefined) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tresult[key] = visit(child);\n\t\t\t}\n\n\t\t\treturn(result);\n\t\t}\n\n\t\treturn(value);\n\t}\n\n\tconst canonical = canonicalizeJson(visit(item));\n\tif (Buffer.byteLength(canonical, 'utf8') > TO_SIGNABLE_MAX_OUTPUT_BYTES) {\n\t\tthrow(new KeetaAnchorError('Canonical output exceeds size limit in objectToSignable'));\n\t}\n\n\treturn([ canonical ]);\n}\n\n/**\n * Options for signature verification\n */\nexport interface VerifyOptions {\n\t/** Maximum allowed time difference in milliseconds (default: 5 * 60 * 1000 = 5 minutes) */\n\tmaxSkewMs?: number;\n\t/** Reference time for skew calculation (default: new Date()) */\n\treferenceTime?: Date;\n}\n\nexport function FormatData(account: VerifiableAccount, data: Signable, nonce?: string, timestamp?: string | Date): { nonce: string; timestamp: string; verificationData: Buffer; } {\n\tnonce ??= crypto.randomUUID();\n\ttimestamp ??= new Date();\n\n\tlet timestampString: string;\n\tif (typeof timestamp === 'string') {\n\t\ttimestampString = timestamp;\n\t} else {\n\t\ttimestampString = timestamp.toISOString();\n\t}\n\n\tconst input: KeetaNetASN1AnyJS[] = [\n\t\tnonce,\n\t\ttimestampString,\n\t\taccount.publicKeyAndType\n\t];\n\n\tconst schema: KeetaNetASN1Validation.Schema[] = [\n\t\t{ type: 'string', kind: 'utf8' },\n\t\t{ type: 'string', kind: 'utf8' },\n\t\tKeetaNetLib.Utils.ASN1.ValidateASN1.IsOctetString\n\t];\n\n\tfor (const item of data) {\n\t\tif (typeof item === 'string') {\n\t\t\tinput.push(item);\n\t\t\tschema.push({ type: 'string', kind: 'utf8' });\n\t\t} else if (typeof item === 'number' || typeof item === 'bigint') {\n\t\t\tinput.push(item);\n\t\t\tschema.push(KeetaNetLib.Utils.ASN1.ValidateASN1.IsInteger);\n\t\t} else if (KeetaNetLib.Account.isInstance(item)) {\n\t\t\tinput.push(item.publicKeyAndType);\n\t\t\tschema.push(KeetaNetLib.Utils.ASN1.ValidateASN1.IsOctetString);\n\t\t} else {\n\t\t\tassertNever(item);\n\t\t}\n\t}\n\n\t/*\n\t * Verify that the generated ASN.1 data matches the expected schema before returning it.\n\t */\n\t// @ts-ignore\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\tconst inputCanonical = KeetaNetLib.Utils.ASN1.ValidateASN1.againstSchema(input, schema);\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\tconst verificationData = KeetaNetLib.Utils.ASN1.JStoASN1(inputCanonical);\n\n\treturn({\n\t\tnonce: nonce,\n\t\ttimestamp: timestampString,\n\t\tverificationData: arrayBufferLikeToBuffer(verificationData.toBER())\n\t});\n}\n\nexport async function SignData(account: SignableAccount, data: Signable): Promise<{ nonce: string; timestamp: string; signature: string; }> {\n\tconst { nonce, timestamp, verificationData } = FormatData(account, data);\n\tconst signature = await account.sign(bufferToArrayBuffer(verificationData));\n\n\treturn({\n\t\tnonce: nonce,\n\t\ttimestamp: timestamp,\n\t\tsignature: signature.getBuffer().toString('base64')\n\t});\n}\n\nexport async function VerifySignedData(\n\taccount: VerifiableAccount,\n\tdata: Signable,\n\tsigned: Awaited<ReturnType<typeof SignData>>,\n\toptions?: VerifyOptions\n): Promise<boolean> {\n\tconst nonce = signed.nonce;\n\tconst timestampString = signed.timestamp;\n\tconst signatureBuffer = Buffer.from(signed.signature, 'base64');\n\n\tconst timestamp = new Date(timestampString);\n\t/*\n\t * Enforce that the timestamp string is in valid ISO 8601 format,\n\t * not just a date that can be parsed\n\t *\n\t * XXX:TODO: This is not a perfect check since ISO 8601 does not require millisecond-level\n\t * precision and technically allows other timezones (though we will not support\n\t * those). This will be changed in the future to be more robust.\n\t */\n\tif (timestamp.toISOString() !== timestampString) {\n\t\treturn(false);\n\t}\n\n\tconst maxSkewMs = options?.maxSkewMs ?? 5 * 60 * 1000;\n\tconst referenceTime = options?.referenceTime ?? new Date();\n\tif (Math.abs(timestamp.valueOf() - referenceTime.valueOf()) > maxSkewMs) {\n\t\t/* Timestamp exceeds allowed skew from reference time */\n\t\treturn(false);\n\t}\n\n\t/* XXX:TODO: Verify that the timestamp is a valid ISO 8601 date string within a reasonable range */\n\tconst { verificationData } = FormatData(account, data, nonce, timestampString);\n\n\treturn(account.verify(KeetaNetLib.Utils.Helper.bufferToArrayBuffer(verificationData), KeetaNetLib.Utils.Helper.bufferToArrayBuffer(signatureBuffer)));\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@keetanetwork/anchor",
9
- "version": "0.0.64",
9
+ "version": "0.0.65",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@keetanetwork/currency-info": "1.2.5",
@@ -1687,8 +1687,8 @@
1687
1687
  }
1688
1688
  },
1689
1689
  "node_modules/protobufjs": {
1690
- "version": "7.5.9",
1691
- "integrity": "sha512-Od4muIm3HW1AouyHF5lONOf1FWo3hY1NbFDoy191X9GzhpgW1clCoaFjfVs2rKJNFYpTNJbje4cbAIDBZJ63ZA==",
1690
+ "version": "7.6.0",
1691
+ "integrity": "sha512-LtESOsMPTZgyYtwxhvdgdjGL0HmXEaRA/hVD6sol4zA60hVXXXP/SGmxnqDbgGE8gy7pYex7cym+5vYPcmaXBQ==",
1692
1692
  "hasInstallScript": true,
1693
1693
  "license": "BSD-3-Clause",
1694
1694
  "optional": true,
@@ -1704,7 +1704,7 @@
1704
1704
  "@protobufjs/pool": "^1.1.0",
1705
1705
  "@protobufjs/utf8": "^1.1.1",
1706
1706
  "@types/node": ">=13.7.0",
1707
- "long": "^5.0.0"
1707
+ "long": "^5.3.2"
1708
1708
  },
1709
1709
  "engines": {
1710
1710
  "node": ">=12.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "description": "KeetaNetwork Network Anchor",
5
5
  "main": "client/index.js",
6
6
  "scripts": {
@@ -348,7 +348,7 @@ class KeetaAssetMovementAnchorUserActionNeededError extends KeetaAnchorUserError
348
348
  message = JSON.stringify({
349
349
  ok: false,
350
350
  name: this.name,
351
- code: 'KEETA_ANCHOR_ASSET_MOVEMENT_OPERATION_NOT_SUPPORTED',
351
+ code: 'KEETA_ANCHOR_ASSET_MOVEMENT_USER_ACTION_NEEDED',
352
352
  data: { actionsNeeded },
353
353
  error: this.message
354
354
  });
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/asset-movement/common.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAC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iB,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAE;yBACvI;qBACD,CAAC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACP,MAAK,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACF,CAAC,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAEpE,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;YACxB,MAAK,CAAC,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,MAAM,GAAG,iEAAiE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7F,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEjG,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAM,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;;AAGF,MAAM,CAAC,MAAM,MAAM,GAKf;IACH;;OAEG;IACH,cAAc,EAAE,2CAA2C;IAE3D;;OAEG;IACH,mBAAmB,EAAE,gDAAgD;IAErE;;OAEG;IACH,qBAAqB,EAAE,kDAAkD;IAEzE;;OAEG;IACH,gBAAgB,EAAE,6CAA6C;CAC/D,CAAC","sourcesContent":["import type { ServiceMetadata } from '../../lib/resolver.ts';\nimport type * as CurrencyInfo from '@keetanetwork/currency-info';\nimport type { AccountKeyAlgorithm, GenericAccount, IdentifierKeyAlgorithm, TokenPublicKeyString } from '@keetanetwork/keetanet-client/lib/account.js';\nimport type { JSONSerializable, ToJSONSerializable } from '@keetanetwork/keetanet-client/lib/utils/conversion.js';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type { Signable } from '../../lib/utils/signing.js';\nimport type { SharableCertificateAttributes } from '../../lib/certificates.js';\nimport * as KeetaNet from '@keetanetwork/keetanet-client';\nimport { KeetaAnchorUserError } from '../../lib/error.js';\nimport type { AssetLocationLike, AssetLocationString, AssetLocationInput, AssetLocationCanonical, ChainLocationString } from './lib/location.js';\nimport { convertAssetLocationInputToCanonical } from './lib/location.js';\nimport type { BankAccountAddressObfuscated, BankAccountAddressResolved, MobileWalletAddressObfuscated, MobileWalletAddressResolved } from './lib/data/addresses/types.generated.js';\nimport type { HexString, KeetaNetAccount, MovableAsset, MovableAssetSearchCanonical, CurrencySearchCanonical, ExternalChainLocationType, ExternalChainAsset } from '../../lib/asset.js';\nimport { convertAssetSearchInputToCanonical } from '../../lib/asset.js';\nimport { assertKeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties, assertKeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties, assertKeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties, assertKeetaAssetMovementAnchorUserActionNeededErrorJSONProperties } from './common.generated.js';\nimport type { ClientRenderableContent } from '../../lib/metadata.types.js';\nimport type { TokenMetadata } from '../../lib/token-metadata.js';\nimport type { DistributiveOmit } from '@keetanetwork/keetanet-client/lib/utils/helper.js';\nimport type { ACLRow } from '@keetanetwork/keetanet-client/lib/ledger/types.js';\nimport type { Certificate } from '@keetanetwork/keetanet-client/lib/utils/certificate.js';\nimport type { UserClientBuilder } from '@keetanetwork/keetanet-client/client/builder.js';\nimport { objectToSignable } from '../../lib/utils/signing.js';\n\nexport * from './lib/data/addresses/types.generated.js';\n\nexport * from './lib/location.js';\n\nexport * from './common.generated.js';\n\nexport type {\n\tHexString,\n\tKeetaNetAccount,\n\tKeetaNetTokenPublicKeyString,\n\tEVMAsset,\n\tTronAsset,\n\tSolanaAsset,\n\tChainAssetString,\n\tMovableAssetSearchInput,\n\tMovableAssetSearchCanonical,\n\tMovableAsset,\n\tCurrencySearchCanonical,\n\tCurrencySearchInput,\n\tTokenSearchInput,\n\tTokenSearchCanonical\n} from '../../lib/asset.js';\n\nexport {\n\ttoEVMAsset,\n\tparseEVMAsset,\n\tisEVMAsset,\n\ttoTronAsset,\n\tparseTronAsset,\n\tisTronAsset,\n\ttoSolanaAsset,\n\tparseSolanaAsset,\n\tisSolanaAsset,\n\tconvertAssetSearchInputToCanonical,\n\tisExternalChainAsset\n} from '../../lib/asset.js';\n\nexport type ISOCountryCode = CurrencyInfo.ISOCountryCode;\n\ntype RailOrRails = Rail | Rail[];\n\n/**\n * Search criteria for filtering asset movement rails when searching for supported rails for a given transfer.\n * This can be either a single rail or an array of rails, and can be specified for inbound, outbound or common rails.\n *\n * If a single rail or array of rails is provided, it will be applied to both inbound and outbound rails.\n * If separate inbound and outbound rails are provided, they will be applied to their respective directions.\n *\n * For both methods, this will look for providers that support at least one of the specified rails in the respective direction(s).\n * For example, if { inbound: ['ACH', 'WIRE'] } is provided, it will match providers that support either ACH or WIRE inbound rails.\n */\nexport type AssetMovementRailSearchInput = RailOrRails | ({ inbound: RailOrRails; outbound?: RailOrRails } | { inbound?: RailOrRails; outbound: RailOrRails });\n\nexport type ProviderSearchInput = {\n\tasset?: MovableAsset | AssetPair;\n\tfrom?: AssetLocationInput;\n\tto?: AssetLocationInput;\n\trail?: AssetMovementRailSearchInput;\n}\n\n// A given asset should have a location and ID for the contract or public key for that asset\nexport interface Asset {\n\tlocation?: AssetLocationString;\n\t/**\n\t * Keeta token public key string, external chain asset, ticker, or a currency code\n\t */\n\tid: AssetMetadataTargetValue;\n}\n\nexport type FiatPullRails = 'ACH_DEBIT' | 'CARD_PULL';\nexport type FiatPushRails = 'ACH' | 'WIRE' | 'PIX_PUSH' | 'SPEI_PUSH' | 'WIRE_INTL_PUSH' | 'SEPA_PUSH' | 'MOBILE_WALLET' | 'INTERAC_PUSH' | 'FPS_PUSH' | 'CARD_PUSH' | 'HK_FPS_PUSH' | 'BCR_PAY_PUSH' | 'DUIT_NOW_PUSH' | 'PAY_NOW_PUSH' | 'UPI_PUSH' | 'CA_PUSH' | 'AE_PUSH';\nexport type FiatRails = FiatPullRails | FiatPushRails;\nexport type CryptoRails = 'KEETA_SEND' | 'EVM_SEND' | 'EVM_CALL' | 'SOLANA_SEND' | 'BITCOIN_SEND' | 'TRON_SEND';\nexport type Rail = FiatRails | CryptoRails;\n\n// Rails can be inbound, outbound or common (inbound and outbound)\nexport interface AssetWithRails extends Asset {\n\trails: (({\n\t\tinbound: RailOrRailWithExtendedDetails[];\n\t\toutbound?: RailOrRailWithExtendedDetails[];\n\t} | {\n\t\tinbound?: RailOrRailWithExtendedDetails[];\n\t\toutbound: RailOrRailWithExtendedDetails[];\n\t} | {\n\t\tinbound?: never;\n\t\toutbound?: never;\n\t}) & {\n\t\tcommon?: RailOrRailWithExtendedDetails[];\n\t});\n};\n\n// A given asset path should consist of exactly one tuple of locations\nexport interface AssetPath {\n\t/**\n\t * The asset or asset pair for this path, with from and to locations supporting the assets in the pair\n\t */\n\tpair: [ AssetWithRails, AssetWithRails ];\n\n\t/**\n\t * KYC providers which this Asset Movement Provider\n\t * supports (DN) -- if not specified,\n\t * then it does not require KYC.\n\t */\n\tkycProviders?: string[];\n};\n\nexport interface AnchorTokenLocationMetadata extends TokenMetadata {\n\tdisplayName?: string;\n\tticker?: `$${string}`;\n}\n\nexport type PerChainLocationMetadata<Chain extends ExternalChainLocationType = ExternalChainLocationType> = {\n\tassets?: {\n\t\t[AssetId in ExternalChainAsset<Chain>]?: AnchorTokenLocationMetadata | undefined;\n\t}\n};\n\ntype ExtractLocationTypeFromString<I extends ChainLocationString> = I extends ChainLocationString<infer R extends ExternalChainLocationType> ? R : never;\n\nexport type AnchorCustomLocationMetadata = {\n\t[Location in ChainLocationString<ExternalChainLocationType>]?: PerChainLocationMetadata<ExtractLocationTypeFromString<Location>> | undefined;\n};\n\nexport type AssetMetadataTargetValue = TokenPublicKeyString | CurrencySearchCanonical | `$${string}` | ExternalChainAsset;\nexport interface SupportedAssetsMetadata {\n\tasset: AssetMetadataTargetValue | [ AssetMetadataTargetValue, AssetMetadataTargetValue ];\n\tpaths: AssetPath[];\n}\n\n\nexport interface RailWithExtendedDetails {\n\trail: Rail;\n\n\t/**\n\t * An estimate of the time it will take for a transfer using this rail to complete, in milliseconds. This can be a single number or a tuple representing an estimated range [min, max].\n\t */\n\testimatedTransferTimeMs?: number | [ minEstimateMs: number, maxEstimateMs: number ];\n\n\t/**\n\t * Minimum/Maximum transfer value details for this rail, if applicable.\n\t */\n\testimatedTransferValueRange?: {\n\t\t/**\n\t\t * Min/max transfer value range, as a string in the asset's smallest unit (e.g. cents for USD, or 1/(10**6) for USDC).\n\t\t */\n\t\tvalue: [ string | undefined, string | undefined ];\n\n\t\t/**\n\t\t * The asset in which the min transfer value is denominated. If omitted, it is assumed to be the same as the source asset being transferred.\n\t\t */\n\t\tasset?: MovableAssetSearchCanonical;\n\t}\n\n\t/**\n\t * Fee estimate details for this rail, if applicable.\n\t */\n\testimatedFee?: {\n\t\tfixedFee?: {\n\t\t\t/**\n\t\t\t * Transfer fixed fee, as a string in the asset's smallest unit (e.g. cents for USD, or 1/(10**6) for USDC).\n\t\t\t */\n\t\t\tvalue: string;\n\n\t\t\t/**\n\t\t\t * The asset in which the fixed fee is denominated. If omitted, it is assumed to be the same as the source asset being transferred.\n\t\t\t */\n\t\t\tasset?: MovableAssetSearchCanonical;\n\t\t}\n\n\t\t/**\n\t\t * Estimated transfer variable fee in basis points (bps). 1 bps = 0.01%\n\t\t */\n\t\tvariableFeeBps?: number;\n\t}\n\n\t/**\n\t * Supported operations for this rail\n\t */\n\tsupportedOperations?: {\n\t\t/**\n\t\t * Whether this rail supports creating persistent forwarding addresses for (unmanaged) transfers\n\t\t */\n\t\tcreatePersistentForwarding?: boolean;\n\n\t\t/**\n\t\t * Whether this rail supports initiating (managed) transfers\n\t\t */\n\t\tinitiateTransfer?: boolean;\n\t}\n}\n\nexport type RailOrRailWithExtendedDetails = Rail | RailWithExtendedDetails;\n\n\nexport function commonJSONStringify(input: unknown): string {\n\treturn(JSON.stringify(input, function(_, value: unknown) {\n\t\tif (typeof value === 'bigint') {\n\t\t\treturn(String(value));\n\t\t} else if (KeetaNet.lib.Account.isInstance(value)) {\n\t\t\treturn(value.publicKeyString.get());\n\t\t}\n\n\t\treturn(value);\n\t}));\n}\n\nexport type AssetPair<From extends MovableAsset = MovableAsset, To extends MovableAsset = MovableAsset> = { from: From; to: To; };\nexport type AssetOrPair = MovableAsset | AssetPair;\n\nexport type AssetPairCanonical<From extends MovableAssetSearchCanonical = MovableAssetSearchCanonical, To extends MovableAssetSearchCanonical = MovableAssetSearchCanonical> = { from: From; to: To; };\nexport type AssetOrPairCanonical = MovableAssetSearchCanonical | AssetPairCanonical;\n\nfunction isAssetPairLike(input: unknown): input is AssetPair {\n\treturn(typeof input === 'object' && input !== null && 'from' in input && 'to' in input);\n}\n\nexport function toAssetPair(input: AssetOrPair): AssetPair {\n\tif (isAssetPairLike(input)) {\n\t\treturn(input);\n\t}\n\n\treturn({ from: input, to: input });\n}\n\n\nexport function convertAssetOrPairSearchInputToCanonical(input: MovableAsset): MovableAssetSearchCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetPair): AssetPairCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetOrPair): AssetOrPairCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetOrPair): AssetOrPairCanonical {\n\tif (isAssetPairLike(input)) {\n\t\treturn({\n\t\t\tfrom: convertAssetSearchInputToCanonical(input.from),\n\t\t\tto: convertAssetSearchInputToCanonical(input.to)\n\t\t});\n\t} else {\n\t\treturn(convertAssetSearchInputToCanonical(input));\n\t}\n}\n\n\nexport type Operations = NonNullable<ServiceMetadata['services']['assetMovement']>[string]['operations'];\nexport type OperationNames = keyof Operations;\n\nexport type PersistentAddressReference = { type: 'persistent-address'; persistentAddressId: string; };\nexport type PersistentAddressTemplateReference = { type: 'persistent-address-template'; persistentAddressTemplateId: string; };\nexport type PersistentAddressOrTemplateReference = PersistentAddressReference | PersistentAddressTemplateReference;\nexport type RecipientResolved = AddressResolved | PersistentAddressOrTemplateReference;\n\n/**\n * Optional deposit message to include with the transfer, ex: for wire this is a reference note.\n */\ntype AddressDepositMessage = string;\n\ntype ConvertToExternalRequest<\n\tInternal extends object,\n\tOverrides,\n\tSigned = { signed?: HTTPSignedField | undefined }\n> =\n\tToJSONSerializable<Omit<Internal, keyof Overrides>> &\n\tOverrides &\n\tSigned;\n\n/**\n * The client-side request type for initiating an asset transfer via the Keeta Asset Movement Anchor service\n */\nexport type KeetaAssetMovementAnchorInitiateTransferClientRequest = {\n\t/**\n\t * Optional KeetaNet account to use for signing the request\n\t */\n\taccount?: KeetaNetAccount | undefined;\n\n\t/**\n\t * The asset or asset pair to transfer, if a pair is given the from and to locations must support both assets in the pair\n\t */\n\tasset: AssetOrPair;\n\n\t/**\n\t * The source location for the asset transfer\n\t */\n\tfrom: {\n\t\tlocation: AssetLocationLike;\n\n\t\t/**\n\t\t * If sending from a persistent address (ex ACH pull), this would be the account the user wants to debit from\n\t\t */\n\t\tsource?: PersistentAddressOrTemplateReference;\n\t};\n\n\t/**\n\t * The destination location and recipient for the asset transfer\n\t */\n\tto: {\n\t\tlocation: AssetLocationLike;\n\t\trecipient: RecipientResolved;\n\t\tdepositMessage?: AddressDepositMessage;\n\t};\n\n\t/**\n\t * The amount of the asset to transfer, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\tvalue: string | bigint;\n\n\t/**\n\t * Optional list of allowed rails for the transfer, the service should throw an error if none of the allowed rails are available\n\t */\n\tallowedRails?: Rail[];\n}\n\nexport type KeetaAssetMovementAnchorSimulateTransferClientRequest = KeetaAssetMovementAnchorInitiateTransferClientRequest;\n\n/**\n * The serialized HTTP Body for the {@link KeetaAssetMovementAnchorInitiateTransferClientRequest} request\n */\nexport type KeetaAssetMovementAnchorInitiateTransferRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorInitiateTransferClientRequest, {\n\tasset: AssetOrPairCanonical;\n\tfrom: { location: AssetLocationCanonical; source?: PersistentAddressOrTemplateReference; };\n\tto: { location: AssetLocationCanonical; recipient: RecipientResolved; depositMessage?: AddressDepositMessage; };\n}>;\n\nexport type KeetaAssetMovementAnchorSimulateTransferRequest = KeetaAssetMovementAnchorInitiateTransferRequest;\n\nexport function getKeetaAssetMovementAnchorInitiateTransferRequestSigningData(input: KeetaAssetMovementAnchorInitiateTransferClientRequest | KeetaAssetMovementAnchorInitiateTransferRequest): Signable {\n\treturn(objectToSignable({\n\t\tasset: convertAssetOrPairSearchInputToCanonical(input.asset),\n\t\tfrom: { location: convertAssetLocationInputToCanonical(input.from.location) },\n\t\tto: { location: convertAssetLocationInputToCanonical(input.to.location), recipient: input.to.recipient },\n\t\tvalue: String(input.value)\n\t}));\n}\n\nexport function getKeetaAssetMovementAnchorSimulateTransferRequestSigningData(input: KeetaAssetMovementAnchorSimulateTransferClientRequest | KeetaAssetMovementAnchorSimulateTransferRequest): Signable {\n\treturn(getKeetaAssetMovementAnchorInitiateTransferRequestSigningData(input));\n}\n\n\n/**\n * Fee line item type in an asset transfer fee breakdown, showing the purpose of each fee line item.\n */\nexport type AssetFeeLineItemType = 'RAIL' | 'NETWORK' | 'PROVIDER' | 'VALUE_VARIABLE' | 'OTHER';\n\n/**\n * Breakdown of fees for an asset transfer, including line items and total amounts.\n */\nexport type AssetFeeBreakdown = {\n\tlineItems: {\n\t\t/**\n\t\t * The amount of the fee line item, as a string in the asset's smallest unit (e.g. cents for USD).\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * The purpose of the fee line item. @see AssetFeeLineItemType\n\t\t */\n\t\tpurpose: AssetFeeLineItemType;\n\n\t\t/**\n\t\t * The asset in which the fee line item is denominated. If omitted, it is assumed to be the same as the asset being transferred.\n\t\t */\n\t\tasset?: MovableAssetSearchCanonical;\n\t}[];\n\t/**\n\t * The total fee amount priced in a canonical asset. If omitted, the total is assumed to be in the asset being transferred.\n\t */\n\ttotalPricedIn?: MovableAssetSearchCanonical;\n\n\t/**\n\t * The total fee amount, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\ttotal: string;\n};\n\n/**\n * An instruction on how to complete a transfer, ex: where to send tokens, or where to wire USD.\n */\nexport type AssetTransferInstructions = ({\n\ttype: 'KEETA_SEND';\n\n\t/**\n\t * The location from which to send the asset for this instruction, this will only be a keeta chain location.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * The keeta wallet address to send to\n\t */\n\tsendToAddress: ReturnType<GenericAccount['publicKeyString']['get']>;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit.\n\t */\n\tvalue: string;\n\n\t/**\n\t * The token address to send.\n\t */\n\ttokenAddress: TokenPublicKeyString;\n\n\t/**\n\t * If provided, the value to put in the external field of the send operation.\n\t */\n\texternal?: string;\n} | {\n\ttype: 'EVM_SEND';\n\t/**\n\t * The EVM location from which to send the asset for this instruction.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * EVM address to send to\n\t */\n\tsendToAddress: HexString;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit.\n\t */\n\tvalue: string;\n\n\t/**\n\t * The EVM token contract address to send.\n\t */\n\ttokenAddress: HexString;\n} | {\n\t/**\n\t * An EVM contract call instruction, used for assets that require contract interaction to transfer (ex: ERC20 contract deposit() method).\n\t */\n\ttype: 'EVM_CALL';\n\n\t/**\n\t * The EVM location on which the contract call should be made.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * The EVM contract address to call.\n\t */\n\tcontractAddress: HexString;\n\n\t/**\n\t * The method name to call on the contract. Should be either the full method signature (ex: deposit(uint256 value)), or the hashed method ID.\n\t */\n\tcontractMethodName: string;\n\n\t/**\n\t * The arguments to pass to the contract method, as an array of strings.\n\t */\n\tcontractMethodArgs: string[];\n} | {\n\ttype: FiatPushRails;\n\n\t/**\n\t * The resolved bank account address details to send funds to\n\t */\n\taccount: BankAccountAddressResolved;\n\n\tdepositMessage?: AddressDepositMessage;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\tvalue: string;\n} |\n/**\n * Instructions when pulling funds from a persistent address.\n * If the user wants to execute this instruction, they will need to call the executeInstruction endpoint with the transfer id\n */\n{\n\ttype: FiatPullRails;\n\n\t/**\n\t * The previously created persistent address template or persistent address to pull funds from\n\t */\n\tpullFrom: PersistentAddressOrTemplateReference;\n} | {\n\ttype: 'TRON_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Tron address to send to\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit (e.g. SUN for TRX).\n\t */\n\tvalue: string;\n\n\t/**\n\t * TRC20 token contract address if non-TRX.\n\t * Omitting will indicate native TRX.\n\t */\n\ttokenAddress?: string;\n} | {\n\ttype: 'BITCOIN_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Bitcoin address to send to\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount in sats to send, as a string\n\t */\n\tvalue: string;\n} | {\n\ttype: 'SOLANA_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Solana recipient address (base58 pubkey).\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount to send, as a string (e.g. in lamports or\n\t * normalized units, depending on your convention).\n\t */\n\tvalue: string;\n\n\t/**\n\t * SPL token mint address if non-native SOL.\n\t * Omitting will indicate native SOL.\n\t */\n\ttokenMintAddress?: string;\n}) & ({\n\t/**\n\t * assetFee is an advisory fee estimate for the fee that will be incurred when the instruction is executed.\n\t * This can be a total value or a breakdown of line items for the executed transfer.\n\t */\n\tassetFee: string | AssetFeeBreakdown;\n\n\t/**\n\t * If provided, this is the total amount the recipient should expect to receive after fees are deducted, formatted in the destination asset's smallest unit.\n\t */\n\ttotalReceiveAmount?: string;\n\n\t/**\n\t * If provided, this is the ID of a persistent address created/used for this transfer instruction.\n\t */\n\tpersistentAddressId?: string;\n});\n\nexport type SimulatedAssetTransferInstructions = DistributiveOmit<AssetTransferInstructions, 'sendToAddress'>;\n\nexport type KeetaAssetMovementAnchorSimulateTransferResponse = {\n\tok: true;\n\tinstructionChoices: SimulatedAssetTransferInstructions[];\n} | {\n\tok: false;\n\terror: string;\n}\n\nexport type KeetaAssetMovementAnchorInitiateTransferResponse = {\n\tok: true;\n\tid: string;\n\tinstructionChoices: AssetTransferInstructions[];\n} | ({\n\tok: false;\n\terror: string;\n})\n\nexport interface KeetaAssetMovementAnchorExecuteTransferClientRequest {\n\taccount?: KeetaNetAccount;\n\t/**\n\t * The ID of the transfer to execute the instruction for, which was returned in the initiate transfer response\n\t */\n\tid: string;\n\n\t/**\n\t * The instruction to execute\n\t */\n\tinstruction: Pick<Extract<AssetTransferInstructions, { type: FiatPullRails; }>, 'pullFrom' | 'type'>;\n}\n\nexport type KeetaAssetMovementAnchorExecuteTransferRequest = ConvertToExternalRequest<Omit<KeetaAssetMovementAnchorExecuteTransferClientRequest, 'id'>, unknown>;\n\nexport function getKeetaAssetMovementAnchorExecuteTransferRequestSigningData(input: (KeetaAssetMovementAnchorExecuteTransferRequest | KeetaAssetMovementAnchorExecuteTransferClientRequest) & { id: string; }): Signable {\n\treturn(objectToSignable({\n\t\tid: input.id,\n\t\tinstruction: input.instruction\n\t}));\n}\n\nexport type KeetaAssetMovementAnchorExecuteTransferResponse = KeetaAssetMovementAnchorGetTransferStatusResponse;\n\nexport interface KeetaAssetMovementAnchorGetTransferStatusClientRequest {\n\taccount?: KeetaNetAccount;\n\tid: string;\n}\n\nexport interface KeetaAssetMovementAnchorGetTransferStatusRequest {\n\tid: string;\n}\n\nexport function getKeetaAssetMovementAnchorGetTransferStatusRequestSigningData(input: KeetaAssetMovementAnchorGetTransferStatusRequest): Signable {\n\treturn([ 'get-transaction', input.id ]);\n}\n\ntype TransactionStatus = string;\n\nexport type TransactionId = {\n\tid: string;\n\tnonce: string;\n};\n\ntype TransactionIds<T extends string> = {\n\t[type in T]: TransactionId | null;\n};\n\nexport type TransactionSourceObfuscated = AddressObfuscated | PersistentAddressOrTemplateReference;\n\n/**\n * Representation of an asset movement transaction in the Asset Movement Anchor's system.\n */\nexport type KeetaAssetMovementTransaction = {\n\t/**\n\t * The unique (per anchor) identifier for the asset movement transaction.\n\t *\n\t * This ID is opaque and has no meaning outside of a specific anchor's system.\n\t */\n\tid: string;\n\n\t/**\n\t * The current status of the asset movement transaction.\n\t */\n\tstatus: TransactionStatus;\n\n\t/**\n\t * The asset being moved in the transaction.\n\t */\n\tasset: AssetOrPair;\n\n\t/**\n\t * Information about the source of the asset movement.\n\t */\n\tfrom: {\n\t\t/**\n\t\t * The location of the source of the movement.\n\t\t */\n\t\tlocation: AssetLocationString;\n\n\t\t/**\n\t\t * The value that was sent/to be sent on the source.\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * A list of transaction IDs related to the source chain.\n\t\t */\n\t\ttransactions: TransactionIds<'persistentForwarding' | 'deposit' | 'finalization'>;\n\n\t\t/**\n\t\t * A reference to the sender of the transaction, this can be a reference to a persistent address, or general recipient information\n\t\t */\n\t\tsource?: TransactionSourceObfuscated;\n\t};\n\n\t/**\n\t * Information about the destination of the asset movement.\n\t */\n\tto: {\n\t\t/**\n\t\t * The location of the destination of the movement.\n\t\t */\n\t\tlocation: AssetLocationString;\n\n\t\t/**\n\t\t * The value that was received/to be received on the destination.\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * A list of transaction IDs related to the destination chain.\n\t\t */\n\t\ttransactions: TransactionIds<'withdraw'>;\n\t};\n\n\t/**\n\t * Information related to the fee charged for the asset movement.\n\t */\n\tfee: {\n\t\tasset: MovableAsset;\n\t\tvalue: string;\n\t} | null;\n\n\t/**\n\t * Additional details about this rail that (optionally) can be rendered in the client application.\n\t *\n\t * Ex: If there is a proprietary block explorer for a chain involved in the transfer, this field could contain a URL to view the transaction on that explorer.\n\t */\n\tadditionalTransferDetails?: ClientRenderableContent;\n\n\t/**\n\t * Timestamp for when the transaction was created\n\t */\n\tcreatedAt: string;\n\n\t/**\n\t * Timestamp for when the transaction was last updated\n\t */\n\tupdatedAt: string;\n}\n\nexport type KeetaAssetMovementAnchorGetTransferStatusResponse = ({\n\tok: true;\n\ttransaction: KeetaAssetMovementTransaction;\n} | {\n\tok: false;\n\terror: string;\n});\n\ntype CryptoAddress = string;\ntype AddressResolved = BankAccountAddressResolved | MobileWalletAddressResolved | CryptoAddress;\ntype AddressObfuscated = BankAccountAddressObfuscated | MobileWalletAddressObfuscated | CryptoAddress;\n\nexport type PersistentAddressTemplateData = {\n\tid: string;\n\tlocation: AssetLocationLike;\n\tasset: MovableAsset;\n\taddress: AddressObfuscated;\n}\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset: MovableAsset;\n\tlocation: AssetLocationLike;\n}\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest, {\n\tasset: AssetOrPairCanonical;\n\tlocation: AssetLocationCanonical;\n}>;\n\nexport function getKeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequestSigningData(input: KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequest): Signable {\n\tconst pair = toAssetPair(input.asset);\n\treturn(objectToSignable({\n\t\tasset: { from: convertAssetSearchInputToCanonical(pair.from), to: convertAssetSearchInputToCanonical(pair.to) },\n\t\tlocation: convertAssetLocationInputToCanonical(input.location)\n\t}));\n}\n\nexport type PersistentForwardingTemplateSessionData = {\n\ttype: 'plaid';\n\tplaidLinkToken: string;\n} | {\n\ttype: 'other';\n\t[key: string]: JSONSerializable;\n};\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateResponse = ({\n\tok: true;\n\tid: string;\n\texpiresAt: string;\n\tdata: PersistentForwardingTemplateSessionData;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type PersistentForwardingTemplateCompletionData = {\n\ttype: 'plaid';\n\tplaidPublicToken: string;\n\tplaidAccountId: string;\n} | {\n\ttype: 'other';\n\t[key: string]: JSONSerializable;\n};\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset: MovableAsset;\n\tlocation: AssetLocationLike;\n\taddress: AddressResolved;\n} | {\n\taccount?: KeetaNetAccount;\n\tid?: string;\n\tdata: PersistentForwardingTemplateCompletionData;\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequest =\n\tConvertToExternalRequest<{ account?: KeetaNetAccount; asset: MovableAsset; location: AssetLocationLike; address: AddressResolved; }, {\n\t\tasset: AssetOrPairCanonical;\n\t\tlocation: AssetLocationCanonical;\n\t\taddress: AddressResolved;\n\t}> |\n\tConvertToExternalRequest<{ account?: KeetaNetAccount; id?: string; data: PersistentForwardingTemplateCompletionData; }, unknown>;\n\nexport function getKeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequestSigningData(input: KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequest): Signable {\n\tif ('data' in input) {\n\t\treturn(objectToSignable({\n\t\t\tid: input.id,\n\t\t\tdata: input.data\n\t\t}));\n\t}\n\tconst pair = toAssetPair(input.asset);\n\treturn(objectToSignable({\n\t\tasset: { from: convertAssetSearchInputToCanonical(pair.from), to: convertAssetSearchInputToCanonical(pair.to) },\n\t\tlocation: convertAssetLocationInputToCanonical(input.location),\n\t\taddress: input.address\n\t}));\n}\n\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateResponse = (({\n\tok: true;\n} & PersistentAddressTemplateData) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset?: MovableAsset[];\n\tlocation?: AssetLocationLike[];\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateRequest = ToJSONSerializable<Pick<KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest, 'account' | 'pagination'>> & {\n\tasset?: MovableAssetSearchCanonical[] | undefined;\n\tlocation?: AssetLocationCanonical[] | undefined;\n\tsigned?: HTTPSignedField;\n}\n\nexport function getKeetaAssetMovementAnchorListForwardingAddressTemplateRequestSigningData(_ignore_input: KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorListForwardingAddressTemplateRequest): Signable {\n\treturn([ 'list-templates' ]);\n}\n\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateResponse = (({\n\tok: true;\n\ttemplates: PersistentAddressTemplateData[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\n\nexport type KeetaPersistentForwardingAddressDetails = {\n\tid?: string;\n\taddress: AddressObfuscated | AddressResolved;\n\tdepositMessage?: AddressDepositMessage;\n\tasset?: AssetOrPair;\n\tsourceLocation?: AssetLocationLike;\n\tdestinationLocation?: AssetLocationLike;\n\tdestinationAddress?: AddressResolved | AddressObfuscated;\n\toutgoingRail?: Rail;\n\tincomingRail?: Rail[];\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest = {\n\taccount?: KeetaNetAccount;\n\tsourceLocation: AssetLocationLike;\n\tasset: AssetOrPair;\n\toutgoingRail?: Rail;\n} & ({\n\tdestinationLocation: AssetLocationLike;\n\tdestinationAddress: AddressResolved;\n} | {\n\tpersistentAddressTemplateId: string;\n});\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField;\n\tsourceLocation: AssetLocationCanonical;\n\tasset: AssetOrPairCanonical;\n\toutgoingRail?: Rail | undefined;\n} & ({\n\tdestinationLocation: AssetLocationCanonical;\n\tdestinationAddress: AddressResolved;\n} | {\n\tpersistentAddressTemplateId: string;\n});\n\nexport function getKeetaAssetMovementAnchorCreatePersistentForwardingRequestSigningData(input: KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest | KeetaAssetMovementAnchorCreatePersistentForwardingRequest): Signable {\n\treturn(objectToSignable({\n\t\tsourceLocation: convertAssetLocationInputToCanonical(input.sourceLocation),\n\t\tasset: convertAssetOrPairSearchInputToCanonical(input.asset),\n\t\toutgoingRail: input.outgoingRail,\n\t\t...('destinationLocation' in input ? {\n\t\t\tdestinationLocation: convertAssetLocationInputToCanonical(input.destinationLocation),\n\t\t\tdestinationAddress: input.destinationAddress\n\t\t} : {\n\t\t\tpersistentAddressTemplateId: input.persistentAddressTemplateId\n\t\t})\n\t}))\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingResponse = (({\n\tok: true;\n} & KeetaPersistentForwardingAddressDetails) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingClientRequest = {\n\taccount?: KeetaNetAccount;\n\tsigned?: HTTPSignedField | undefined;\n\tsearch?: {\n\t\tsourceLocation?: AssetLocationLike;\n\t\tdestinationLocation?: AssetLocationLike;\n\t\tasset?: MovableAsset;\n\t\tdestinationAddress?: string;\n\t\tpersistentAddressTemplateId?: string;\n\t}[];\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField | undefined;\n\tsearch?: {\n\t\tsourceLocation?: AssetLocationCanonical | undefined;\n\t\tdestinationLocation?: AssetLocationCanonical | undefined;\n\t\tasset?: MovableAssetSearchCanonical | undefined;\n\t\tdestinationAddress?: string | undefined;\n\t\tpersistentAddressTemplateId?: string | undefined;\n\t}[] | undefined;\n\tpagination?: PaginationQuery | undefined;\n}\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingResponse = (({\n\tok: true;\n\taddresses: KeetaPersistentForwardingAddressDetails[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\nexport function getKeetaAssetMovementAnchorListPersistentForwardingRequestSigningData(_ignore_input: KeetaAssetMovementAnchorListPersistentForwardingClientRequest | KeetaAssetMovementAnchorListPersistentForwardingRequest): Signable {\n\treturn([ 'list-persistent-forwarding-addresses' ]);\n}\n\ntype PaginationQuery = {\n\tlimit?: number;\n\toffset?: number;\n}\n\ntype PaginationResponseInformation = {\n\ttotal: string;\n}\n\nexport type KeetaAssetMovementAnchorlistTransactionsClientRequest = {\n\taccount?: KeetaNetAccount;\n\tpersistentAddresses?: ({ location: AssetLocationLike; } & ({ persistentAddress?: string; persistentAddressTemplate: string; } | { persistentAddress: string; persistentAddressTemplate?: string; }))[];\n\tfrom?: { location: AssetLocationLike; userAddress?: string; asset?: MovableAsset; };\n\tto?: { location: AssetLocationLike; userAddress?: string; asset?: MovableAsset; };\n\ttransactions?: { location: AssetLocationLike; transaction: Partial<TransactionId>; }[] | undefined;\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorlistTransactionsRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField | undefined;\n\tpersistentAddresses?: ({ location: AssetLocationCanonical; } & ({ persistentAddress?: string | undefined; persistentAddressTemplate: string; } | { persistentAddress: string; persistentAddressTemplate?: string | undefined; }))[] | undefined;\n\tfrom?: { location: AssetLocationCanonical; userAddress?: string | undefined; asset?: MovableAsset | undefined; } | undefined;\n\tto?: { location: AssetLocationCanonical; userAddress?: string | undefined; asset?: MovableAsset | undefined; } | undefined;\n\ttransactions?: { location: AssetLocationCanonical; transaction: Partial<TransactionId>; }[] | undefined;\n\tpagination?: PaginationQuery | undefined;\n}\n\nexport function getKeetaAssetMovementAnchorlistTransactionsRequestSigningData(_ignore_input: KeetaAssetMovementAnchorlistTransactionsClientRequest | KeetaAssetMovementAnchorlistTransactionsRequest): Signable {\n\treturn([ 'list-transactions' ]);\n}\n\nexport type KeetaAssetMovementAnchorlistPersistentForwardingTransactionsResponse = (({\n\tok: true;\n\ttransactions: KeetaAssetMovementTransaction[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorShareKYCClientRequest = {\n\taccount: KeetaNetAccount;\n\tattributes: string | SharableCertificateAttributes;\n\ttosAgreement?: { id: string; };\n}\n\nexport type KeetaAssetMovementAnchorShareKYCRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorShareKYCClientRequest, {\n\tattributes: string;\n}, { signed: HTTPSignedField }>;\n\nexport function getKeetaAssetMovementAnchorShareKYCRequestSigningData(_ignore_input: KeetaAssetMovementAnchorShareKYCClientRequest | KeetaAssetMovementAnchorShareKYCRequest): Signable {\n\treturn([ 'share-kyc' ]);\n}\n\nexport type KeetaAssetMovementAnchorShareKYCResponse = (({\n\tok: true;\n} & ({\n\tisPending?: false;\n} | {\n\tisPending: true;\n\tpromiseURL?: string;\n})) | {\n\tok: false;\n\terror: string;\n});\n\ntype Account = InstanceType<typeof KeetaNet.lib.Account<Exclude<AccountKeyAlgorithm, IdentifierKeyAlgorithm>>>;\n\ntype KeetaAssetMovementAnchorKYCExternalURLFlow = {\n\ttype: 'url-flow';\n\turl: string;\n}\n\nexport interface KeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties {\n\ttosFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\tneededAttributes: string[] | undefined;\n\tshareWithPrincipals: ReturnType<Account['publicKeyString']['get']>[];\n\tacceptedIssuers: { name: string; value: string; }[][];\n}\n\n\ntype KeetaAssetMovementAnchorKYCShareNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorKYCShareNeededError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorKYCShareNeededError';\n\tprivate readonly KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID = '3f4d6acd-8915-40de-94fa-4c6c48c01623';\n\n\treadonly shareWithPrincipals: Account[];\n\treadonly neededAttributes: string[] | undefined;\n\treadonly tosFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\treadonly acceptedIssuers: { name: string; value: string; }[][];\n\n\tconstructor(args: {\n\t\tneededAttributes?: string[] | undefined;\n\t\tshareWithPrincipals: Account[];\n\t\ttosFlow?: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\t\tacceptedIssuers: { name: string; value: string; }[][];\n\t}, message?: string) {\n\t\tsuper(message ?? 'User Not Onboarded to Asset Movement Service');\n\t\tthis.statusCode = 403;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorKYCShareNeededError.KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.neededAttributes = args.neededAttributes;\n\t\tthis.tosFlow = args.tosFlow;\n\t\tthis.shareWithPrincipals = args.shareWithPrincipals;\n\t\tthis.acceptedIssuers = args.acceptedIssuers;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorKYCShareNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID', KeetaAssetMovementAnchorKYCShareNeededError.KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID));\n\t}\n\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { tosFlow, neededAttributes, shareWithPrincipals, acceptedIssuers } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_KYC_SHARE_NEEDED',\n\t\t\t\tdata: { tosFlow, neededAttributes, shareWithPrincipals, acceptedIssuers },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorKYCShareNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\ttosFlow: this.tosFlow,\n\t\t\tneededAttributes: this.neededAttributes,\n\t\t\tshareWithPrincipals: this.shareWithPrincipals.map(function(account) {\n\t\t\t\treturn(account.publicKeyString.get());\n\t\t\t}),\n\t\t\tacceptedIssuers: this.acceptedIssuers\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorKYCShareNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorKYCShareNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\tshareWithPrincipals: parsed.shareWithPrincipals.map(function(pubKeyString) {\n\t\t\t\t\treturn(KeetaNet.lib.Account.fromPublicKeyString(pubKeyString).assertAccount());\n\t\t\t\t}),\n\t\t\t\tneededAttributes: parsed.neededAttributes,\n\t\t\t\ttosFlow: parsed.tosFlow,\n\t\t\t\tacceptedIssuers: parsed.acceptedIssuers\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport interface KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties {\n\ttoCompleteFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n}\n\n\ntype KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorAdditionalKYCNeededError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorAdditionalKYCNeededError';\n\tprivate readonly KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID = '3f4d6acd-8915-40de-94fa-4c6c48c01623';\n\n\treadonly toCompleteFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\n\tconstructor(args: KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties, message?: string) {\n\t\tsuper(message ?? 'User requires additional KYC to proceed with asset movement');\n\t\tthis.statusCode = 403;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorAdditionalKYCNeededError.KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.toCompleteFlow = args.toCompleteFlow;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorAdditionalKYCNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID', KeetaAssetMovementAnchorAdditionalKYCNeededError.KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID));\n\t}\n\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { toCompleteFlow } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_ADDITIONAL_KYC_NEEDED',\n\t\t\t\tdata: { toCompleteFlow },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\ttoCompleteFlow: this.toCompleteFlow\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorAdditionalKYCNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorAdditionalKYCNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\ttoCompleteFlow: parsed.toCompleteFlow\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\n\nexport interface KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties {\n\tforAsset?: AssetOrPair | undefined;\n\tforRail?: Rail | undefined;\n}\n\n\ntype KeetaAssetMovementAnchorOperationNotSupportedErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorOperationNotSupportedError extends KeetaAnchorUserError implements KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorOperationNotSupportedError';\n\tprivate readonly KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID = 'b613cd80-57ac-4be5-ad4a-bb8644d50de6';\n\n\treadonly forAsset: AssetOrPair | undefined;\n\treadonly forRail: Rail | undefined;\n\n\tconstructor(args: KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties, message?: string) {\n\t\tsuper(message ?? `Operation not supported`);\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorOperationNotSupportedError.KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.forAsset = args.forAsset;\n\t\tthis.forRail = args.forRail;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorOperationNotSupportedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID', KeetaAssetMovementAnchorOperationNotSupportedError.KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID));\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { forAsset, forRail } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_OPERATION_NOT_SUPPORTED',\n\t\t\t\tdata: { forAsset, forRail },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorOperationNotSupportedErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\tforRail: this.forRail,\n\t\t\tforAsset: this.forAsset ? convertAssetOrPairSearchInputToCanonical(this.forAsset) : undefined\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorOperationNotSupportedError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorOperationNotSupportedError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\tforAsset: parsed.forAsset,\n\t\t\t\tforRail: parsed.forRail\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport type KeetaAssetMovementAnchorUserAction = ({\n\ttype: 'add-certificate';\n\n\taccount?: GenericAccount;\n\tcertificate: Certificate;\n\tintermediates?: Certificate[];\n} | {\n\ttype: 'grant-permission';\n\tpermissionToGrant: Omit<ACLRow, 'target' | 'entity'> & Partial<Pick<ACLRow, 'target' | 'entity'>>;\n}) & {\n\tdetails?: ClientRenderableContent;\n}\n\nexport type KeetaAssetMovementAnchorUserActionJSON =\n\tToJSONSerializable<Exclude<KeetaAssetMovementAnchorUserAction, { type: 'add-certificate'; }> |\n\t(Omit<Extract<KeetaAssetMovementAnchorUserAction, { type: 'add-certificate'; }>, 'certificate' | 'intermediates'> & {\n\t\tcertificate: string;\n\t\tintermediates?: string[];\n\t})>;\n\nexport interface KeetaAssetMovementAnchorUserActionNeededErrorProperties {\n\tactionsNeeded: KeetaAssetMovementAnchorUserAction[];\n}\n\nexport interface KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties extends Omit<KeetaAssetMovementAnchorUserActionNeededErrorProperties, 'actionsNeeded'> {\n\tactionsNeeded: KeetaAssetMovementAnchorUserActionJSON[];\n}\n\n\ntype KeetaAssetMovementAnchorUserActionNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorUserActionNeededError extends KeetaAnchorUserError implements KeetaAssetMovementAnchorUserActionNeededErrorProperties {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorUserActionNeededError';\n\tprivate readonly KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID = 'f2160fd8-a1d3-4a6d-ae22-da0dd642c44e';\n\n\treadonly actionsNeeded: KeetaAssetMovementAnchorUserAction[];\n\n\tconstructor(args: KeetaAssetMovementAnchorUserActionNeededErrorProperties, message?: string) {\n\t\tsuper(message ?? `Actions are needed to perform operation`);\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorUserActionNeededError.KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.actionsNeeded = args.actionsNeeded;\n\t}\n\n\tstatic #parseJSONActions(actions: KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties['actionsNeeded']): KeetaAssetMovementAnchorUserActionNeededErrorProperties['actionsNeeded'] {\n\t\treturn(actions.map(function(action): KeetaAssetMovementAnchorUserAction {\n\t\t\tconst shared = {\n\t\t\t\t...(action.details ? { details: action.details } : {})\n\t\t\t} as const;\n\n\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\treturn({\n\t\t\t\t\t...shared,\n\t\t\t\t\ttype: action.type,\n\t\t\t\t\t...(action.account ? { account: KeetaNet.lib.Account.fromPublicKeyString(action.account).assertAccount() } : {}),\n\t\t\t\t\tcertificate: new KeetaNet.lib.Utils.Certificate.Certificate(action.certificate),\n\t\t\t\t\t...(action.intermediates ? {\n\t\t\t\t\t\tintermediates: action.intermediates.map(function(cert) {\n\t\t\t\t\t\t\treturn(new KeetaNet.lib.Utils.Certificate.Certificate(cert));\n\t\t\t\t\t\t})\n\t\t\t\t\t} : {})\n\t\t\t\t});\n\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\treturn({\n\t\t\t\t\t...shared,\n\t\t\t\t\ttype: action.type,\n\t\t\t\t\tpermissionToGrant: {\n\t\t\t\t\t\tprincipal: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.principal),\n\t\t\t\t\t\t...(action.permissionToGrant.entity ? { entity: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.entity) } : {}),\n\t\t\t\t\t\t...(action.permissionToGrant.target ? { target: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.target) } : {}),\n\t\t\t\t\t\tpermissions: new KeetaNet.lib.Permissions(BigInt(action.permissionToGrant.permissions[0]), BigInt(action.permissionToGrant.permissions[1]))\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow(new Error('Unsupported action type'));\n\t\t\t}\n\t\t}));\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorUserActionNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID', KeetaAssetMovementAnchorUserActionNeededError.KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID));\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { actionsNeeded } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_OPERATION_NOT_SUPPORTED',\n\t\t\t\tdata: { actionsNeeded },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\tstatic addOperationsToBuilder(actions: KeetaAssetMovementAnchorUserAction[], builder: UserClientBuilder): void {\n\t\tfor (const action of actions) {\n\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\tlet intermediates;\n\t\t\t\tif (action.intermediates) {\n\t\t\t\t\tintermediates = new KeetaNet.lib.Utils.Certificate.CertificateBundle(action.intermediates);\n\t\t\t\t}\n\t\t\t\tbuilder.modifyCertificate(KeetaNet.lib.Block.AdjustMethod.ADD, action.certificate, intermediates, action.account ? { account: action.account } : undefined);\n\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\tbuilder.updatePermissions(action.permissionToGrant.principal, action.permissionToGrant.permissions, action.permissionToGrant.target, KeetaNet.lib.Block.AdjustMethod.ADD, action.permissionToGrant.entity ? { account: action.permissionToGrant.entity } : {})\n\t\t\t}\n\t\t}\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorUserActionNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\tactionsNeeded: this.actionsNeeded.map(function(action): KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties['actionsNeeded'][number] {\n\t\t\t\tconst shared = {\n\t\t\t\t\t...(action.details ? { details: action.details } : {})\n\t\t\t\t} as const;\n\n\t\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\t\treturn({\n\t\t\t\t\t\t...shared,\n\t\t\t\t\t\ttype: action.type,\n\t\t\t\t\t\t...(action.account ? { account: action.account.publicKeyString.get() } : {}),\n\t\t\t\t\t\tcertificate: action.certificate.toPEM(),\n\t\t\t\t\t\t...(action.intermediates ? { intermediates: action.intermediates.map(function(cert) {\n\t\t\t\t\t\t\treturn(cert.toPEM());\n\t\t\t\t\t\t}) } : {})\n\t\t\t\t\t});\n\t\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\t\treturn({\n\t\t\t\t\t\t...shared,\n\t\t\t\t\t\ttype: action.type,\n\t\t\t\t\t\tpermissionToGrant: {\n\t\t\t\t\t\t\tprincipal: action.permissionToGrant.principal.publicKeyString.get(),\n\t\t\t\t\t\t\t...(action.permissionToGrant.entity ? { entity: action.permissionToGrant.entity.publicKeyString.get() } : {}),\n\t\t\t\t\t\t\t...(action.permissionToGrant.target ? { target: action.permissionToGrant.target.publicKeyString.get() } : {}),\n\t\t\t\t\t\t\tpermissions: [ String(action.permissionToGrant.permissions.base.bigint), String(action.permissionToGrant.permissions.external.bigint) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthrow(new Error('Unsupported action type'));\n\t\t\t\t}\n\t\t\t})\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorUserActionNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorUserActionNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorUserActionNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this({ actionsNeeded: this.#parseJSONActions(parsed.actionsNeeded) }, message);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport const Errors: {\n\tKYCShareNeeded: typeof KeetaAssetMovementAnchorKYCShareNeededError;\n\tAdditionalKYCNeeded: typeof KeetaAssetMovementAnchorAdditionalKYCNeededError;\n\tOperationNotSupported: typeof KeetaAssetMovementAnchorOperationNotSupportedError;\n\tUserActionNeeded: typeof KeetaAssetMovementAnchorUserActionNeededError;\n} = {\n\t/**\n\t * The user is required to share KYC details\n\t */\n\tKYCShareNeeded: KeetaAssetMovementAnchorKYCShareNeededError,\n\n\t/**\n\t * The user is required to complete additional KYC steps\n\t */\n\tAdditionalKYCNeeded: KeetaAssetMovementAnchorAdditionalKYCNeededError,\n\n\t/**\n\t * The requested operation is not supported\n\t */\n\tOperationNotSupported: KeetaAssetMovementAnchorOperationNotSupportedError,\n\n\t/**\n\t * An action is required by the user to complete the requested operation\n\t */\n\tUserActionNeeded: KeetaAssetMovementAnchorUserActionNeededError\n};\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/asset-movement/common.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,oEAAoE,EAAE,+DAA+D,EAAE,sEAAsE,EAAE,iEAAiE,EAAE,MAAM,uBAAuB,CAAC;AAOzT,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,cAAc,yCAAyC,CAAC;AAExD,cAAc,mBAAmB,CAAC;AAElC,cAAc,uBAAuB,CAAC;AAmBtC,OAAO,EACN,UAAU,EACV,aAAa,EACb,UAAU,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,kCAAkC,EAClC,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAsD3B,CAAC;AAeD,CAAC;AA0FF,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,OAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,UAAS,CAAC,EAAE,KAAc;QACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,OAAM,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,OAAM,C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CAAC,MAAM,MAAM,GAKf;IACH;;OAEG;IACH,cAAc,EAAE,2CAA2C;IAE3D;;OAEG;IACH,mBAAmB,EAAE,gDAAgD;IAErE;;OAEG;IACH,qBAAqB,EAAE,kDAAkD;IAEzE;;OAEG;IACH,gBAAgB,EAAE,6CAA6C;CAC/D,CAAC","sourcesContent":["import type { ServiceMetadata } from '../../lib/resolver.ts';\nimport type * as CurrencyInfo from '@keetanetwork/currency-info';\nimport type { AccountKeyAlgorithm, GenericAccount, IdentifierKeyAlgorithm, TokenPublicKeyString } from '@keetanetwork/keetanet-client/lib/account.js';\nimport type { JSONSerializable, ToJSONSerializable } from '@keetanetwork/keetanet-client/lib/utils/conversion.js';\nimport type { HTTPSignedField } from '../../lib/http-server/common.js';\nimport type { Signable } from '../../lib/utils/signing.js';\nimport type { SharableCertificateAttributes } from '../../lib/certificates.js';\nimport * as KeetaNet from '@keetanetwork/keetanet-client';\nimport { KeetaAnchorUserError } from '../../lib/error.js';\nimport type { AssetLocationLike, AssetLocationString, AssetLocationInput, AssetLocationCanonical, ChainLocationString } from './lib/location.js';\nimport { convertAssetLocationInputToCanonical } from './lib/location.js';\nimport type { BankAccountAddressObfuscated, BankAccountAddressResolved, MobileWalletAddressObfuscated, MobileWalletAddressResolved } from './lib/data/addresses/types.generated.js';\nimport type { HexString, KeetaNetAccount, MovableAsset, MovableAssetSearchCanonical, CurrencySearchCanonical, ExternalChainLocationType, ExternalChainAsset } from '../../lib/asset.js';\nimport { convertAssetSearchInputToCanonical } from '../../lib/asset.js';\nimport { assertKeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties, assertKeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties, assertKeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties, assertKeetaAssetMovementAnchorUserActionNeededErrorJSONProperties } from './common.generated.js';\nimport type { ClientRenderableContent } from '../../lib/metadata.types.js';\nimport type { TokenMetadata } from '../../lib/token-metadata.js';\nimport type { DistributiveOmit } from '@keetanetwork/keetanet-client/lib/utils/helper.js';\nimport type { ACLRow } from '@keetanetwork/keetanet-client/lib/ledger/types.js';\nimport type { Certificate } from '@keetanetwork/keetanet-client/lib/utils/certificate.js';\nimport type { UserClientBuilder } from '@keetanetwork/keetanet-client/client/builder.js';\nimport { objectToSignable } from '../../lib/utils/signing.js';\n\nexport * from './lib/data/addresses/types.generated.js';\n\nexport * from './lib/location.js';\n\nexport * from './common.generated.js';\n\nexport type {\n\tHexString,\n\tKeetaNetAccount,\n\tKeetaNetTokenPublicKeyString,\n\tEVMAsset,\n\tTronAsset,\n\tSolanaAsset,\n\tChainAssetString,\n\tMovableAssetSearchInput,\n\tMovableAssetSearchCanonical,\n\tMovableAsset,\n\tCurrencySearchCanonical,\n\tCurrencySearchInput,\n\tTokenSearchInput,\n\tTokenSearchCanonical\n} from '../../lib/asset.js';\n\nexport {\n\ttoEVMAsset,\n\tparseEVMAsset,\n\tisEVMAsset,\n\ttoTronAsset,\n\tparseTronAsset,\n\tisTronAsset,\n\ttoSolanaAsset,\n\tparseSolanaAsset,\n\tisSolanaAsset,\n\tconvertAssetSearchInputToCanonical,\n\tisExternalChainAsset\n} from '../../lib/asset.js';\n\nexport type ISOCountryCode = CurrencyInfo.ISOCountryCode;\n\ntype RailOrRails = Rail | Rail[];\n\n/**\n * Search criteria for filtering asset movement rails when searching for supported rails for a given transfer.\n * This can be either a single rail or an array of rails, and can be specified for inbound, outbound or common rails.\n *\n * If a single rail or array of rails is provided, it will be applied to both inbound and outbound rails.\n * If separate inbound and outbound rails are provided, they will be applied to their respective directions.\n *\n * For both methods, this will look for providers that support at least one of the specified rails in the respective direction(s).\n * For example, if { inbound: ['ACH', 'WIRE'] } is provided, it will match providers that support either ACH or WIRE inbound rails.\n */\nexport type AssetMovementRailSearchInput = RailOrRails | ({ inbound: RailOrRails; outbound?: RailOrRails } | { inbound?: RailOrRails; outbound: RailOrRails });\n\nexport type ProviderSearchInput = {\n\tasset?: MovableAsset | AssetPair;\n\tfrom?: AssetLocationInput;\n\tto?: AssetLocationInput;\n\trail?: AssetMovementRailSearchInput;\n}\n\n// A given asset should have a location and ID for the contract or public key for that asset\nexport interface Asset {\n\tlocation?: AssetLocationString;\n\t/**\n\t * Keeta token public key string, external chain asset, ticker, or a currency code\n\t */\n\tid: AssetMetadataTargetValue;\n}\n\nexport type FiatPullRails = 'ACH_DEBIT' | 'CARD_PULL';\nexport type FiatPushRails = 'ACH' | 'WIRE' | 'PIX_PUSH' | 'SPEI_PUSH' | 'WIRE_INTL_PUSH' | 'SEPA_PUSH' | 'MOBILE_WALLET' | 'INTERAC_PUSH' | 'FPS_PUSH' | 'CARD_PUSH' | 'HK_FPS_PUSH' | 'BCR_PAY_PUSH' | 'DUIT_NOW_PUSH' | 'PAY_NOW_PUSH' | 'UPI_PUSH' | 'CA_PUSH' | 'AE_PUSH';\nexport type FiatRails = FiatPullRails | FiatPushRails;\nexport type CryptoRails = 'KEETA_SEND' | 'EVM_SEND' | 'EVM_CALL' | 'SOLANA_SEND' | 'BITCOIN_SEND' | 'TRON_SEND';\nexport type Rail = FiatRails | CryptoRails;\n\n// Rails can be inbound, outbound or common (inbound and outbound)\nexport interface AssetWithRails extends Asset {\n\trails: (({\n\t\tinbound: RailOrRailWithExtendedDetails[];\n\t\toutbound?: RailOrRailWithExtendedDetails[];\n\t} | {\n\t\tinbound?: RailOrRailWithExtendedDetails[];\n\t\toutbound: RailOrRailWithExtendedDetails[];\n\t} | {\n\t\tinbound?: never;\n\t\toutbound?: never;\n\t}) & {\n\t\tcommon?: RailOrRailWithExtendedDetails[];\n\t});\n};\n\n// A given asset path should consist of exactly one tuple of locations\nexport interface AssetPath {\n\t/**\n\t * The asset or asset pair for this path, with from and to locations supporting the assets in the pair\n\t */\n\tpair: [ AssetWithRails, AssetWithRails ];\n\n\t/**\n\t * KYC providers which this Asset Movement Provider\n\t * supports (DN) -- if not specified,\n\t * then it does not require KYC.\n\t */\n\tkycProviders?: string[];\n};\n\nexport interface AnchorTokenLocationMetadata extends TokenMetadata {\n\tdisplayName?: string;\n\tticker?: `$${string}`;\n}\n\nexport type PerChainLocationMetadata<Chain extends ExternalChainLocationType = ExternalChainLocationType> = {\n\tassets?: {\n\t\t[AssetId in ExternalChainAsset<Chain>]?: AnchorTokenLocationMetadata | undefined;\n\t}\n};\n\ntype ExtractLocationTypeFromString<I extends ChainLocationString> = I extends ChainLocationString<infer R extends ExternalChainLocationType> ? R : never;\n\nexport type AnchorCustomLocationMetadata = {\n\t[Location in ChainLocationString<ExternalChainLocationType>]?: PerChainLocationMetadata<ExtractLocationTypeFromString<Location>> | undefined;\n};\n\nexport type AssetMetadataTargetValue = TokenPublicKeyString | CurrencySearchCanonical | `$${string}` | ExternalChainAsset;\nexport interface SupportedAssetsMetadata {\n\tasset: AssetMetadataTargetValue | [ AssetMetadataTargetValue, AssetMetadataTargetValue ];\n\tpaths: AssetPath[];\n}\n\n\nexport interface RailWithExtendedDetails {\n\trail: Rail;\n\n\t/**\n\t * An estimate of the time it will take for a transfer using this rail to complete, in milliseconds. This can be a single number or a tuple representing an estimated range [min, max].\n\t */\n\testimatedTransferTimeMs?: number | [ minEstimateMs: number, maxEstimateMs: number ];\n\n\t/**\n\t * Minimum/Maximum transfer value details for this rail, if applicable.\n\t */\n\testimatedTransferValueRange?: {\n\t\t/**\n\t\t * Min/max transfer value range, as a string in the asset's smallest unit (e.g. cents for USD, or 1/(10**6) for USDC).\n\t\t */\n\t\tvalue: [ string | undefined, string | undefined ];\n\n\t\t/**\n\t\t * The asset in which the min transfer value is denominated. If omitted, it is assumed to be the same as the source asset being transferred.\n\t\t */\n\t\tasset?: MovableAssetSearchCanonical;\n\t}\n\n\t/**\n\t * Fee estimate details for this rail, if applicable.\n\t */\n\testimatedFee?: {\n\t\tfixedFee?: {\n\t\t\t/**\n\t\t\t * Transfer fixed fee, as a string in the asset's smallest unit (e.g. cents for USD, or 1/(10**6) for USDC).\n\t\t\t */\n\t\t\tvalue: string;\n\n\t\t\t/**\n\t\t\t * The asset in which the fixed fee is denominated. If omitted, it is assumed to be the same as the source asset being transferred.\n\t\t\t */\n\t\t\tasset?: MovableAssetSearchCanonical;\n\t\t}\n\n\t\t/**\n\t\t * Estimated transfer variable fee in basis points (bps). 1 bps = 0.01%\n\t\t */\n\t\tvariableFeeBps?: number;\n\t}\n\n\t/**\n\t * Supported operations for this rail\n\t */\n\tsupportedOperations?: {\n\t\t/**\n\t\t * Whether this rail supports creating persistent forwarding addresses for (unmanaged) transfers\n\t\t */\n\t\tcreatePersistentForwarding?: boolean;\n\n\t\t/**\n\t\t * Whether this rail supports initiating (managed) transfers\n\t\t */\n\t\tinitiateTransfer?: boolean;\n\t}\n}\n\nexport type RailOrRailWithExtendedDetails = Rail | RailWithExtendedDetails;\n\n\nexport function commonJSONStringify(input: unknown): string {\n\treturn(JSON.stringify(input, function(_, value: unknown) {\n\t\tif (typeof value === 'bigint') {\n\t\t\treturn(String(value));\n\t\t} else if (KeetaNet.lib.Account.isInstance(value)) {\n\t\t\treturn(value.publicKeyString.get());\n\t\t}\n\n\t\treturn(value);\n\t}));\n}\n\nexport type AssetPair<From extends MovableAsset = MovableAsset, To extends MovableAsset = MovableAsset> = { from: From; to: To; };\nexport type AssetOrPair = MovableAsset | AssetPair;\n\nexport type AssetPairCanonical<From extends MovableAssetSearchCanonical = MovableAssetSearchCanonical, To extends MovableAssetSearchCanonical = MovableAssetSearchCanonical> = { from: From; to: To; };\nexport type AssetOrPairCanonical = MovableAssetSearchCanonical | AssetPairCanonical;\n\nfunction isAssetPairLike(input: unknown): input is AssetPair {\n\treturn(typeof input === 'object' && input !== null && 'from' in input && 'to' in input);\n}\n\nexport function toAssetPair(input: AssetOrPair): AssetPair {\n\tif (isAssetPairLike(input)) {\n\t\treturn(input);\n\t}\n\n\treturn({ from: input, to: input });\n}\n\n\nexport function convertAssetOrPairSearchInputToCanonical(input: MovableAsset): MovableAssetSearchCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetPair): AssetPairCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetOrPair): AssetOrPairCanonical;\nexport function convertAssetOrPairSearchInputToCanonical(input: AssetOrPair): AssetOrPairCanonical {\n\tif (isAssetPairLike(input)) {\n\t\treturn({\n\t\t\tfrom: convertAssetSearchInputToCanonical(input.from),\n\t\t\tto: convertAssetSearchInputToCanonical(input.to)\n\t\t});\n\t} else {\n\t\treturn(convertAssetSearchInputToCanonical(input));\n\t}\n}\n\n\nexport type Operations = NonNullable<ServiceMetadata['services']['assetMovement']>[string]['operations'];\nexport type OperationNames = keyof Operations;\n\nexport type PersistentAddressReference = { type: 'persistent-address'; persistentAddressId: string; };\nexport type PersistentAddressTemplateReference = { type: 'persistent-address-template'; persistentAddressTemplateId: string; };\nexport type PersistentAddressOrTemplateReference = PersistentAddressReference | PersistentAddressTemplateReference;\nexport type RecipientResolved = AddressResolved | PersistentAddressOrTemplateReference;\n\n/**\n * Optional deposit message to include with the transfer, ex: for wire this is a reference note.\n */\ntype AddressDepositMessage = string;\n\ntype ConvertToExternalRequest<\n\tInternal extends object,\n\tOverrides,\n\tSigned = { signed?: HTTPSignedField | undefined }\n> =\n\tToJSONSerializable<Omit<Internal, keyof Overrides>> &\n\tOverrides &\n\tSigned;\n\n/**\n * The client-side request type for initiating an asset transfer via the Keeta Asset Movement Anchor service\n */\nexport type KeetaAssetMovementAnchorInitiateTransferClientRequest = {\n\t/**\n\t * Optional KeetaNet account to use for signing the request\n\t */\n\taccount?: KeetaNetAccount | undefined;\n\n\t/**\n\t * The asset or asset pair to transfer, if a pair is given the from and to locations must support both assets in the pair\n\t */\n\tasset: AssetOrPair;\n\n\t/**\n\t * The source location for the asset transfer\n\t */\n\tfrom: {\n\t\tlocation: AssetLocationLike;\n\n\t\t/**\n\t\t * If sending from a persistent address (ex ACH pull), this would be the account the user wants to debit from\n\t\t */\n\t\tsource?: PersistentAddressOrTemplateReference;\n\t};\n\n\t/**\n\t * The destination location and recipient for the asset transfer\n\t */\n\tto: {\n\t\tlocation: AssetLocationLike;\n\t\trecipient: RecipientResolved;\n\t\tdepositMessage?: AddressDepositMessage;\n\t};\n\n\t/**\n\t * The amount of the asset to transfer, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\tvalue: string | bigint;\n\n\t/**\n\t * Optional list of allowed rails for the transfer, the service should throw an error if none of the allowed rails are available\n\t */\n\tallowedRails?: Rail[];\n}\n\nexport type KeetaAssetMovementAnchorSimulateTransferClientRequest = KeetaAssetMovementAnchorInitiateTransferClientRequest;\n\n/**\n * The serialized HTTP Body for the {@link KeetaAssetMovementAnchorInitiateTransferClientRequest} request\n */\nexport type KeetaAssetMovementAnchorInitiateTransferRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorInitiateTransferClientRequest, {\n\tasset: AssetOrPairCanonical;\n\tfrom: { location: AssetLocationCanonical; source?: PersistentAddressOrTemplateReference; };\n\tto: { location: AssetLocationCanonical; recipient: RecipientResolved; depositMessage?: AddressDepositMessage; };\n}>;\n\nexport type KeetaAssetMovementAnchorSimulateTransferRequest = KeetaAssetMovementAnchorInitiateTransferRequest;\n\nexport function getKeetaAssetMovementAnchorInitiateTransferRequestSigningData(input: KeetaAssetMovementAnchorInitiateTransferClientRequest | KeetaAssetMovementAnchorInitiateTransferRequest): Signable {\n\treturn(objectToSignable({\n\t\tasset: convertAssetOrPairSearchInputToCanonical(input.asset),\n\t\tfrom: { location: convertAssetLocationInputToCanonical(input.from.location) },\n\t\tto: { location: convertAssetLocationInputToCanonical(input.to.location), recipient: input.to.recipient },\n\t\tvalue: String(input.value)\n\t}));\n}\n\nexport function getKeetaAssetMovementAnchorSimulateTransferRequestSigningData(input: KeetaAssetMovementAnchorSimulateTransferClientRequest | KeetaAssetMovementAnchorSimulateTransferRequest): Signable {\n\treturn(getKeetaAssetMovementAnchorInitiateTransferRequestSigningData(input));\n}\n\n\n/**\n * Fee line item type in an asset transfer fee breakdown, showing the purpose of each fee line item.\n */\nexport type AssetFeeLineItemType = 'RAIL' | 'NETWORK' | 'PROVIDER' | 'VALUE_VARIABLE' | 'OTHER';\n\n/**\n * Breakdown of fees for an asset transfer, including line items and total amounts.\n */\nexport type AssetFeeBreakdown = {\n\tlineItems: {\n\t\t/**\n\t\t * The amount of the fee line item, as a string in the asset's smallest unit (e.g. cents for USD).\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * The purpose of the fee line item. @see AssetFeeLineItemType\n\t\t */\n\t\tpurpose: AssetFeeLineItemType;\n\n\t\t/**\n\t\t * The asset in which the fee line item is denominated. If omitted, it is assumed to be the same as the asset being transferred.\n\t\t */\n\t\tasset?: MovableAssetSearchCanonical;\n\t}[];\n\t/**\n\t * The total fee amount priced in a canonical asset. If omitted, the total is assumed to be in the asset being transferred.\n\t */\n\ttotalPricedIn?: MovableAssetSearchCanonical;\n\n\t/**\n\t * The total fee amount, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\ttotal: string;\n};\n\n/**\n * An instruction on how to complete a transfer, ex: where to send tokens, or where to wire USD.\n */\nexport type AssetTransferInstructions = ({\n\ttype: 'KEETA_SEND';\n\n\t/**\n\t * The location from which to send the asset for this instruction, this will only be a keeta chain location.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * The keeta wallet address to send to\n\t */\n\tsendToAddress: ReturnType<GenericAccount['publicKeyString']['get']>;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit.\n\t */\n\tvalue: string;\n\n\t/**\n\t * The token address to send.\n\t */\n\ttokenAddress: TokenPublicKeyString;\n\n\t/**\n\t * If provided, the value to put in the external field of the send operation.\n\t */\n\texternal?: string;\n} | {\n\ttype: 'EVM_SEND';\n\t/**\n\t * The EVM location from which to send the asset for this instruction.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * EVM address to send to\n\t */\n\tsendToAddress: HexString;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit.\n\t */\n\tvalue: string;\n\n\t/**\n\t * The EVM token contract address to send.\n\t */\n\ttokenAddress: HexString;\n} | {\n\t/**\n\t * An EVM contract call instruction, used for assets that require contract interaction to transfer (ex: ERC20 contract deposit() method).\n\t */\n\ttype: 'EVM_CALL';\n\n\t/**\n\t * The EVM location on which the contract call should be made.\n\t */\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * The EVM contract address to call.\n\t */\n\tcontractAddress: HexString;\n\n\t/**\n\t * The method name to call on the contract. Should be either the full method signature (ex: deposit(uint256 value)), or the hashed method ID.\n\t */\n\tcontractMethodName: string;\n\n\t/**\n\t * The arguments to pass to the contract method, as an array of strings.\n\t */\n\tcontractMethodArgs: string[];\n} | {\n\ttype: FiatPushRails;\n\n\t/**\n\t * The resolved bank account address details to send funds to\n\t */\n\taccount: BankAccountAddressResolved;\n\n\tdepositMessage?: AddressDepositMessage;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit (e.g. cents for USD).\n\t */\n\tvalue: string;\n} |\n/**\n * Instructions when pulling funds from a persistent address.\n * If the user wants to execute this instruction, they will need to call the executeInstruction endpoint with the transfer id\n */\n{\n\ttype: FiatPullRails;\n\n\t/**\n\t * The previously created persistent address template or persistent address to pull funds from\n\t */\n\tpullFrom: PersistentAddressOrTemplateReference;\n} | {\n\ttype: 'TRON_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Tron address to send to\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount to send, as a string in the asset's smallest unit (e.g. SUN for TRX).\n\t */\n\tvalue: string;\n\n\t/**\n\t * TRC20 token contract address if non-TRX.\n\t * Omitting will indicate native TRX.\n\t */\n\ttokenAddress?: string;\n} | {\n\ttype: 'BITCOIN_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Bitcoin address to send to\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount in sats to send, as a string\n\t */\n\tvalue: string;\n} | {\n\ttype: 'SOLANA_SEND';\n\tlocation: AssetLocationLike;\n\n\t/**\n\t * Solana recipient address (base58 pubkey).\n\t */\n\tsendToAddress: string;\n\n\t/**\n\t * Amount to send, as a string (e.g. in lamports or\n\t * normalized units, depending on your convention).\n\t */\n\tvalue: string;\n\n\t/**\n\t * SPL token mint address if non-native SOL.\n\t * Omitting will indicate native SOL.\n\t */\n\ttokenMintAddress?: string;\n}) & ({\n\t/**\n\t * assetFee is an advisory fee estimate for the fee that will be incurred when the instruction is executed.\n\t * This can be a total value or a breakdown of line items for the executed transfer.\n\t */\n\tassetFee: string | AssetFeeBreakdown;\n\n\t/**\n\t * If provided, this is the total amount the recipient should expect to receive after fees are deducted, formatted in the destination asset's smallest unit.\n\t */\n\ttotalReceiveAmount?: string;\n\n\t/**\n\t * If provided, this is the ID of a persistent address created/used for this transfer instruction.\n\t */\n\tpersistentAddressId?: string;\n});\n\nexport type SimulatedAssetTransferInstructions = DistributiveOmit<AssetTransferInstructions, 'sendToAddress'>;\n\nexport type KeetaAssetMovementAnchorSimulateTransferResponse = {\n\tok: true;\n\tinstructionChoices: SimulatedAssetTransferInstructions[];\n} | {\n\tok: false;\n\terror: string;\n}\n\nexport type KeetaAssetMovementAnchorInitiateTransferResponse = {\n\tok: true;\n\tid: string;\n\tinstructionChoices: AssetTransferInstructions[];\n} | ({\n\tok: false;\n\terror: string;\n})\n\nexport interface KeetaAssetMovementAnchorExecuteTransferClientRequest {\n\taccount?: KeetaNetAccount;\n\t/**\n\t * The ID of the transfer to execute the instruction for, which was returned in the initiate transfer response\n\t */\n\tid: string;\n\n\t/**\n\t * The instruction to execute\n\t */\n\tinstruction: Pick<Extract<AssetTransferInstructions, { type: FiatPullRails; }>, 'pullFrom' | 'type'>;\n}\n\nexport type KeetaAssetMovementAnchorExecuteTransferRequest = ConvertToExternalRequest<Omit<KeetaAssetMovementAnchorExecuteTransferClientRequest, 'id'>, unknown>;\n\nexport function getKeetaAssetMovementAnchorExecuteTransferRequestSigningData(input: (KeetaAssetMovementAnchorExecuteTransferRequest | KeetaAssetMovementAnchorExecuteTransferClientRequest) & { id: string; }): Signable {\n\treturn(objectToSignable({\n\t\tid: input.id,\n\t\tinstruction: input.instruction\n\t}));\n}\n\nexport type KeetaAssetMovementAnchorExecuteTransferResponse = KeetaAssetMovementAnchorGetTransferStatusResponse;\n\nexport interface KeetaAssetMovementAnchorGetTransferStatusClientRequest {\n\taccount?: KeetaNetAccount;\n\tid: string;\n}\n\nexport interface KeetaAssetMovementAnchorGetTransferStatusRequest {\n\tid: string;\n}\n\nexport function getKeetaAssetMovementAnchorGetTransferStatusRequestSigningData(input: KeetaAssetMovementAnchorGetTransferStatusRequest): Signable {\n\treturn([ 'get-transaction', input.id ]);\n}\n\ntype TransactionStatus = string;\n\nexport type TransactionId = {\n\tid: string;\n\tnonce: string;\n};\n\ntype TransactionIds<T extends string> = {\n\t[type in T]: TransactionId | null;\n};\n\nexport type TransactionSourceObfuscated = AddressObfuscated | PersistentAddressOrTemplateReference;\n\n/**\n * Representation of an asset movement transaction in the Asset Movement Anchor's system.\n */\nexport type KeetaAssetMovementTransaction = {\n\t/**\n\t * The unique (per anchor) identifier for the asset movement transaction.\n\t *\n\t * This ID is opaque and has no meaning outside of a specific anchor's system.\n\t */\n\tid: string;\n\n\t/**\n\t * The current status of the asset movement transaction.\n\t */\n\tstatus: TransactionStatus;\n\n\t/**\n\t * The asset being moved in the transaction.\n\t */\n\tasset: AssetOrPair;\n\n\t/**\n\t * Information about the source of the asset movement.\n\t */\n\tfrom: {\n\t\t/**\n\t\t * The location of the source of the movement.\n\t\t */\n\t\tlocation: AssetLocationString;\n\n\t\t/**\n\t\t * The value that was sent/to be sent on the source.\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * A list of transaction IDs related to the source chain.\n\t\t */\n\t\ttransactions: TransactionIds<'persistentForwarding' | 'deposit' | 'finalization'>;\n\n\t\t/**\n\t\t * A reference to the sender of the transaction, this can be a reference to a persistent address, or general recipient information\n\t\t */\n\t\tsource?: TransactionSourceObfuscated;\n\t};\n\n\t/**\n\t * Information about the destination of the asset movement.\n\t */\n\tto: {\n\t\t/**\n\t\t * The location of the destination of the movement.\n\t\t */\n\t\tlocation: AssetLocationString;\n\n\t\t/**\n\t\t * The value that was received/to be received on the destination.\n\t\t */\n\t\tvalue: string;\n\n\t\t/**\n\t\t * A list of transaction IDs related to the destination chain.\n\t\t */\n\t\ttransactions: TransactionIds<'withdraw'>;\n\t};\n\n\t/**\n\t * Information related to the fee charged for the asset movement.\n\t */\n\tfee: {\n\t\tasset: MovableAsset;\n\t\tvalue: string;\n\t} | null;\n\n\t/**\n\t * Additional details about this rail that (optionally) can be rendered in the client application.\n\t *\n\t * Ex: If there is a proprietary block explorer for a chain involved in the transfer, this field could contain a URL to view the transaction on that explorer.\n\t */\n\tadditionalTransferDetails?: ClientRenderableContent;\n\n\t/**\n\t * Timestamp for when the transaction was created\n\t */\n\tcreatedAt: string;\n\n\t/**\n\t * Timestamp for when the transaction was last updated\n\t */\n\tupdatedAt: string;\n}\n\nexport type KeetaAssetMovementAnchorGetTransferStatusResponse = ({\n\tok: true;\n\ttransaction: KeetaAssetMovementTransaction;\n} | {\n\tok: false;\n\terror: string;\n});\n\ntype CryptoAddress = string;\ntype AddressResolved = BankAccountAddressResolved | MobileWalletAddressResolved | CryptoAddress;\ntype AddressObfuscated = BankAccountAddressObfuscated | MobileWalletAddressObfuscated | CryptoAddress;\n\nexport type PersistentAddressTemplateData = {\n\tid: string;\n\tlocation: AssetLocationLike;\n\tasset: MovableAsset;\n\taddress: AddressObfuscated;\n}\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset: MovableAsset;\n\tlocation: AssetLocationLike;\n}\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest, {\n\tasset: AssetOrPairCanonical;\n\tlocation: AssetLocationCanonical;\n}>;\n\nexport function getKeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequestSigningData(input: KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateRequest): Signable {\n\tconst pair = toAssetPair(input.asset);\n\treturn(objectToSignable({\n\t\tasset: { from: convertAssetSearchInputToCanonical(pair.from), to: convertAssetSearchInputToCanonical(pair.to) },\n\t\tlocation: convertAssetLocationInputToCanonical(input.location)\n\t}));\n}\n\nexport type PersistentForwardingTemplateSessionData = {\n\ttype: 'plaid';\n\tplaidLinkToken: string;\n} | {\n\ttype: 'other';\n\t[key: string]: JSONSerializable;\n};\n\nexport type KeetaAssetMovementAnchorInitiatePersistentForwardingAddressTemplateResponse = ({\n\tok: true;\n\tid: string;\n\texpiresAt: string;\n\tdata: PersistentForwardingTemplateSessionData;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type PersistentForwardingTemplateCompletionData = {\n\ttype: 'plaid';\n\tplaidPublicToken: string;\n\tplaidAccountId: string;\n} | {\n\ttype: 'other';\n\t[key: string]: JSONSerializable;\n};\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset: MovableAsset;\n\tlocation: AssetLocationLike;\n\taddress: AddressResolved;\n} | {\n\taccount?: KeetaNetAccount;\n\tid?: string;\n\tdata: PersistentForwardingTemplateCompletionData;\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequest =\n\tConvertToExternalRequest<{ account?: KeetaNetAccount; asset: MovableAsset; location: AssetLocationLike; address: AddressResolved; }, {\n\t\tasset: AssetOrPairCanonical;\n\t\tlocation: AssetLocationCanonical;\n\t\taddress: AddressResolved;\n\t}> |\n\tConvertToExternalRequest<{ account?: KeetaNetAccount; id?: string; data: PersistentForwardingTemplateCompletionData; }, unknown>;\n\nexport function getKeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequestSigningData(input: KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateRequest): Signable {\n\tif ('data' in input) {\n\t\treturn(objectToSignable({\n\t\t\tid: input.id,\n\t\t\tdata: input.data\n\t\t}));\n\t}\n\tconst pair = toAssetPair(input.asset);\n\treturn(objectToSignable({\n\t\tasset: { from: convertAssetSearchInputToCanonical(pair.from), to: convertAssetSearchInputToCanonical(pair.to) },\n\t\tlocation: convertAssetLocationInputToCanonical(input.location),\n\t\taddress: input.address\n\t}));\n}\n\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateResponse = (({\n\tok: true;\n} & PersistentAddressTemplateData) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest = {\n\taccount?: KeetaNetAccount;\n\tasset?: MovableAsset[];\n\tlocation?: AssetLocationLike[];\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateRequest = ToJSONSerializable<Pick<KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest, 'account' | 'pagination'>> & {\n\tasset?: MovableAssetSearchCanonical[] | undefined;\n\tlocation?: AssetLocationCanonical[] | undefined;\n\tsigned?: HTTPSignedField;\n}\n\nexport function getKeetaAssetMovementAnchorListForwardingAddressTemplateRequestSigningData(_ignore_input: KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest | KeetaAssetMovementAnchorListForwardingAddressTemplateRequest): Signable {\n\treturn([ 'list-templates' ]);\n}\n\n\nexport type KeetaAssetMovementAnchorListForwardingAddressTemplateResponse = (({\n\tok: true;\n\ttemplates: PersistentAddressTemplateData[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\n\nexport type KeetaPersistentForwardingAddressDetails = {\n\tid?: string;\n\taddress: AddressObfuscated | AddressResolved;\n\tdepositMessage?: AddressDepositMessage;\n\tasset?: AssetOrPair;\n\tsourceLocation?: AssetLocationLike;\n\tdestinationLocation?: AssetLocationLike;\n\tdestinationAddress?: AddressResolved | AddressObfuscated;\n\toutgoingRail?: Rail;\n\tincomingRail?: Rail[];\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest = {\n\taccount?: KeetaNetAccount;\n\tsourceLocation: AssetLocationLike;\n\tasset: AssetOrPair;\n\toutgoingRail?: Rail;\n} & ({\n\tdestinationLocation: AssetLocationLike;\n\tdestinationAddress: AddressResolved;\n} | {\n\tpersistentAddressTemplateId: string;\n});\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField;\n\tsourceLocation: AssetLocationCanonical;\n\tasset: AssetOrPairCanonical;\n\toutgoingRail?: Rail | undefined;\n} & ({\n\tdestinationLocation: AssetLocationCanonical;\n\tdestinationAddress: AddressResolved;\n} | {\n\tpersistentAddressTemplateId: string;\n});\n\nexport function getKeetaAssetMovementAnchorCreatePersistentForwardingRequestSigningData(input: KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest | KeetaAssetMovementAnchorCreatePersistentForwardingRequest): Signable {\n\treturn(objectToSignable({\n\t\tsourceLocation: convertAssetLocationInputToCanonical(input.sourceLocation),\n\t\tasset: convertAssetOrPairSearchInputToCanonical(input.asset),\n\t\toutgoingRail: input.outgoingRail,\n\t\t...('destinationLocation' in input ? {\n\t\t\tdestinationLocation: convertAssetLocationInputToCanonical(input.destinationLocation),\n\t\t\tdestinationAddress: input.destinationAddress\n\t\t} : {\n\t\t\tpersistentAddressTemplateId: input.persistentAddressTemplateId\n\t\t})\n\t}))\n}\n\nexport type KeetaAssetMovementAnchorCreatePersistentForwardingResponse = (({\n\tok: true;\n} & KeetaPersistentForwardingAddressDetails) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingClientRequest = {\n\taccount?: KeetaNetAccount;\n\tsigned?: HTTPSignedField | undefined;\n\tsearch?: {\n\t\tsourceLocation?: AssetLocationLike;\n\t\tdestinationLocation?: AssetLocationLike;\n\t\tasset?: MovableAsset;\n\t\tdestinationAddress?: string;\n\t\tpersistentAddressTemplateId?: string;\n\t}[];\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField | undefined;\n\tsearch?: {\n\t\tsourceLocation?: AssetLocationCanonical | undefined;\n\t\tdestinationLocation?: AssetLocationCanonical | undefined;\n\t\tasset?: MovableAssetSearchCanonical | undefined;\n\t\tdestinationAddress?: string | undefined;\n\t\tpersistentAddressTemplateId?: string | undefined;\n\t}[] | undefined;\n\tpagination?: PaginationQuery | undefined;\n}\n\nexport type KeetaAssetMovementAnchorListPersistentForwardingResponse = (({\n\tok: true;\n\taddresses: KeetaPersistentForwardingAddressDetails[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\nexport function getKeetaAssetMovementAnchorListPersistentForwardingRequestSigningData(_ignore_input: KeetaAssetMovementAnchorListPersistentForwardingClientRequest | KeetaAssetMovementAnchorListPersistentForwardingRequest): Signable {\n\treturn([ 'list-persistent-forwarding-addresses' ]);\n}\n\ntype PaginationQuery = {\n\tlimit?: number;\n\toffset?: number;\n}\n\ntype PaginationResponseInformation = {\n\ttotal: string;\n}\n\nexport type KeetaAssetMovementAnchorlistTransactionsClientRequest = {\n\taccount?: KeetaNetAccount;\n\tpersistentAddresses?: ({ location: AssetLocationLike; } & ({ persistentAddress?: string; persistentAddressTemplate: string; } | { persistentAddress: string; persistentAddressTemplate?: string; }))[];\n\tfrom?: { location: AssetLocationLike; userAddress?: string; asset?: MovableAsset; };\n\tto?: { location: AssetLocationLike; userAddress?: string; asset?: MovableAsset; };\n\ttransactions?: { location: AssetLocationLike; transaction: Partial<TransactionId>; }[] | undefined;\n\tpagination?: PaginationQuery;\n}\n\nexport type KeetaAssetMovementAnchorlistTransactionsRequest = {\n\taccount?: ToJSONSerializable<KeetaNetAccount> | undefined;\n\tsigned?: HTTPSignedField | undefined;\n\tpersistentAddresses?: ({ location: AssetLocationCanonical; } & ({ persistentAddress?: string | undefined; persistentAddressTemplate: string; } | { persistentAddress: string; persistentAddressTemplate?: string | undefined; }))[] | undefined;\n\tfrom?: { location: AssetLocationCanonical; userAddress?: string | undefined; asset?: MovableAsset | undefined; } | undefined;\n\tto?: { location: AssetLocationCanonical; userAddress?: string | undefined; asset?: MovableAsset | undefined; } | undefined;\n\ttransactions?: { location: AssetLocationCanonical; transaction: Partial<TransactionId>; }[] | undefined;\n\tpagination?: PaginationQuery | undefined;\n}\n\nexport function getKeetaAssetMovementAnchorlistTransactionsRequestSigningData(_ignore_input: KeetaAssetMovementAnchorlistTransactionsClientRequest | KeetaAssetMovementAnchorlistTransactionsRequest): Signable {\n\treturn([ 'list-transactions' ]);\n}\n\nexport type KeetaAssetMovementAnchorlistPersistentForwardingTransactionsResponse = (({\n\tok: true;\n\ttransactions: KeetaAssetMovementTransaction[];\n} & PaginationResponseInformation) | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaAssetMovementAnchorShareKYCClientRequest = {\n\taccount: KeetaNetAccount;\n\tattributes: string | SharableCertificateAttributes;\n\ttosAgreement?: { id: string; };\n}\n\nexport type KeetaAssetMovementAnchorShareKYCRequest = ConvertToExternalRequest<KeetaAssetMovementAnchorShareKYCClientRequest, {\n\tattributes: string;\n}, { signed: HTTPSignedField }>;\n\nexport function getKeetaAssetMovementAnchorShareKYCRequestSigningData(_ignore_input: KeetaAssetMovementAnchorShareKYCClientRequest | KeetaAssetMovementAnchorShareKYCRequest): Signable {\n\treturn([ 'share-kyc' ]);\n}\n\nexport type KeetaAssetMovementAnchorShareKYCResponse = (({\n\tok: true;\n} & ({\n\tisPending?: false;\n} | {\n\tisPending: true;\n\tpromiseURL?: string;\n})) | {\n\tok: false;\n\terror: string;\n});\n\ntype Account = InstanceType<typeof KeetaNet.lib.Account<Exclude<AccountKeyAlgorithm, IdentifierKeyAlgorithm>>>;\n\ntype KeetaAssetMovementAnchorKYCExternalURLFlow = {\n\ttype: 'url-flow';\n\turl: string;\n}\n\nexport interface KeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties {\n\ttosFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\tneededAttributes: string[] | undefined;\n\tshareWithPrincipals: ReturnType<Account['publicKeyString']['get']>[];\n\tacceptedIssuers: { name: string; value: string; }[][];\n}\n\n\ntype KeetaAssetMovementAnchorKYCShareNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorKYCShareNeededError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorKYCShareNeededError';\n\tprivate readonly KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID = '3f4d6acd-8915-40de-94fa-4c6c48c01623';\n\n\treadonly shareWithPrincipals: Account[];\n\treadonly neededAttributes: string[] | undefined;\n\treadonly tosFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\treadonly acceptedIssuers: { name: string; value: string; }[][];\n\n\tconstructor(args: {\n\t\tneededAttributes?: string[] | undefined;\n\t\tshareWithPrincipals: Account[];\n\t\ttosFlow?: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\t\tacceptedIssuers: { name: string; value: string; }[][];\n\t}, message?: string) {\n\t\tsuper(message ?? 'User Not Onboarded to Asset Movement Service');\n\t\tthis.statusCode = 403;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorKYCShareNeededError.KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.neededAttributes = args.neededAttributes;\n\t\tthis.tosFlow = args.tosFlow;\n\t\tthis.shareWithPrincipals = args.shareWithPrincipals;\n\t\tthis.acceptedIssuers = args.acceptedIssuers;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorKYCShareNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID', KeetaAssetMovementAnchorKYCShareNeededError.KeetaAssetMovementAnchorKYCShareNeededErrorObjectTypeID));\n\t}\n\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { tosFlow, neededAttributes, shareWithPrincipals, acceptedIssuers } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_KYC_SHARE_NEEDED',\n\t\t\t\tdata: { tosFlow, neededAttributes, shareWithPrincipals, acceptedIssuers },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorKYCShareNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\ttosFlow: this.tosFlow,\n\t\t\tneededAttributes: this.neededAttributes,\n\t\t\tshareWithPrincipals: this.shareWithPrincipals.map(function(account) {\n\t\t\t\treturn(account.publicKeyString.get());\n\t\t\t}),\n\t\t\tacceptedIssuers: this.acceptedIssuers\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorKYCShareNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorKYCShareNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorKYCShareNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\tshareWithPrincipals: parsed.shareWithPrincipals.map(function(pubKeyString) {\n\t\t\t\t\treturn(KeetaNet.lib.Account.fromPublicKeyString(pubKeyString).assertAccount());\n\t\t\t\t}),\n\t\t\t\tneededAttributes: parsed.neededAttributes,\n\t\t\t\ttosFlow: parsed.tosFlow,\n\t\t\t\tacceptedIssuers: parsed.acceptedIssuers\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport interface KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties {\n\ttoCompleteFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n}\n\n\ntype KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorAdditionalKYCNeededError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorAdditionalKYCNeededError';\n\tprivate readonly KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID = '3f4d6acd-8915-40de-94fa-4c6c48c01623';\n\n\treadonly toCompleteFlow: KeetaAssetMovementAnchorKYCExternalURLFlow | undefined;\n\n\tconstructor(args: KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties, message?: string) {\n\t\tsuper(message ?? 'User requires additional KYC to proceed with asset movement');\n\t\tthis.statusCode = 403;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorAdditionalKYCNeededError.KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.toCompleteFlow = args.toCompleteFlow;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorAdditionalKYCNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID', KeetaAssetMovementAnchorAdditionalKYCNeededError.KeetaAssetMovementAnchorAdditionalKYCNeededErrorObjectTypeID));\n\t}\n\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { toCompleteFlow } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_ADDITIONAL_KYC_NEEDED',\n\t\t\t\tdata: { toCompleteFlow },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorAdditionalKYCNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\ttoCompleteFlow: this.toCompleteFlow\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorAdditionalKYCNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorAdditionalKYCNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorAdditionalKYCNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\ttoCompleteFlow: parsed.toCompleteFlow\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\n\nexport interface KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties {\n\tforAsset?: AssetOrPair | undefined;\n\tforRail?: Rail | undefined;\n}\n\n\ntype KeetaAssetMovementAnchorOperationNotSupportedErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorOperationNotSupportedError extends KeetaAnchorUserError implements KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorOperationNotSupportedError';\n\tprivate readonly KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID = 'b613cd80-57ac-4be5-ad4a-bb8644d50de6';\n\n\treadonly forAsset: AssetOrPair | undefined;\n\treadonly forRail: Rail | undefined;\n\n\tconstructor(args: KeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties, message?: string) {\n\t\tsuper(message ?? `Operation not supported`);\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorOperationNotSupportedError.KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.forAsset = args.forAsset;\n\t\tthis.forRail = args.forRail;\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorOperationNotSupportedError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID', KeetaAssetMovementAnchorOperationNotSupportedError.KeetaAssetMovementAnchorOperationNotSupportedErrorObjectTypeID));\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { forAsset, forRail } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_OPERATION_NOT_SUPPORTED',\n\t\t\t\tdata: { forAsset, forRail },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorOperationNotSupportedErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\tforRail: this.forRail,\n\t\t\tforAsset: this.forAsset ? convertAssetOrPairSearchInputToCanonical(this.forAsset) : undefined\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorOperationNotSupportedError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorOperationNotSupportedError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorOperationNotSupportedErrorJSONProperties(other.data);\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\tforAsset: parsed.forAsset,\n\t\t\t\tforRail: parsed.forRail\n\t\t\t},\n\t\t\tmessage\n\t\t);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport type KeetaAssetMovementAnchorUserAction = ({\n\ttype: 'add-certificate';\n\n\taccount?: GenericAccount;\n\tcertificate: Certificate;\n\tintermediates?: Certificate[];\n} | {\n\ttype: 'grant-permission';\n\tpermissionToGrant: Omit<ACLRow, 'target' | 'entity'> & Partial<Pick<ACLRow, 'target' | 'entity'>>;\n}) & {\n\tdetails?: ClientRenderableContent;\n}\n\nexport type KeetaAssetMovementAnchorUserActionJSON =\n\tToJSONSerializable<Exclude<KeetaAssetMovementAnchorUserAction, { type: 'add-certificate'; }> |\n\t(Omit<Extract<KeetaAssetMovementAnchorUserAction, { type: 'add-certificate'; }>, 'certificate' | 'intermediates'> & {\n\t\tcertificate: string;\n\t\tintermediates?: string[];\n\t})>;\n\nexport interface KeetaAssetMovementAnchorUserActionNeededErrorProperties {\n\tactionsNeeded: KeetaAssetMovementAnchorUserAction[];\n}\n\nexport interface KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties extends Omit<KeetaAssetMovementAnchorUserActionNeededErrorProperties, 'actionsNeeded'> {\n\tactionsNeeded: KeetaAssetMovementAnchorUserActionJSON[];\n}\n\n\ntype KeetaAssetMovementAnchorUserActionNeededErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties;\n\nclass KeetaAssetMovementAnchorUserActionNeededError extends KeetaAnchorUserError implements KeetaAssetMovementAnchorUserActionNeededErrorProperties {\n\tstatic override readonly name: string = 'KeetaAssetMovementAnchorUserActionNeededError';\n\tprivate readonly KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID!: string;\n\tprivate static readonly KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID = 'f2160fd8-a1d3-4a6d-ae22-da0dd642c44e';\n\n\treadonly actionsNeeded: KeetaAssetMovementAnchorUserAction[];\n\n\tconstructor(args: KeetaAssetMovementAnchorUserActionNeededErrorProperties, message?: string) {\n\t\tsuper(message ?? `Actions are needed to perform operation`);\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID', {\n\t\t\tvalue: KeetaAssetMovementAnchorUserActionNeededError.KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\n\t\tthis.actionsNeeded = args.actionsNeeded;\n\t}\n\n\tstatic #parseJSONActions(actions: KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties['actionsNeeded']): KeetaAssetMovementAnchorUserActionNeededErrorProperties['actionsNeeded'] {\n\t\treturn(actions.map(function(action): KeetaAssetMovementAnchorUserAction {\n\t\t\tconst shared = {\n\t\t\t\t...(action.details ? { details: action.details } : {})\n\t\t\t} as const;\n\n\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\treturn({\n\t\t\t\t\t...shared,\n\t\t\t\t\ttype: action.type,\n\t\t\t\t\t...(action.account ? { account: KeetaNet.lib.Account.fromPublicKeyString(action.account).assertAccount() } : {}),\n\t\t\t\t\tcertificate: new KeetaNet.lib.Utils.Certificate.Certificate(action.certificate),\n\t\t\t\t\t...(action.intermediates ? {\n\t\t\t\t\t\tintermediates: action.intermediates.map(function(cert) {\n\t\t\t\t\t\t\treturn(new KeetaNet.lib.Utils.Certificate.Certificate(cert));\n\t\t\t\t\t\t})\n\t\t\t\t\t} : {})\n\t\t\t\t});\n\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\treturn({\n\t\t\t\t\t...shared,\n\t\t\t\t\ttype: action.type,\n\t\t\t\t\tpermissionToGrant: {\n\t\t\t\t\t\tprincipal: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.principal),\n\t\t\t\t\t\t...(action.permissionToGrant.entity ? { entity: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.entity) } : {}),\n\t\t\t\t\t\t...(action.permissionToGrant.target ? { target: KeetaNet.lib.Account.fromPublicKeyString(action.permissionToGrant.target) } : {}),\n\t\t\t\t\t\tpermissions: new KeetaNet.lib.Permissions(BigInt(action.permissionToGrant.permissions[0]), BigInt(action.permissionToGrant.permissions[1]))\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow(new Error('Unsupported action type'));\n\t\t\t}\n\t\t}));\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaAssetMovementAnchorUserActionNeededError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID', KeetaAssetMovementAnchorUserActionNeededError.KeetaAssetMovementAnchorUserActionNeededErrorObjectTypeID));\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\n\t\tconst { actionsNeeded } = this.toJSON();\n\n\t\tlet message = this.message;\n\t\tif (contentType === 'application/json') {\n\t\t\tmessage = JSON.stringify({\n\t\t\t\tok: false,\n\t\t\t\tname: this.name,\n\t\t\t\tcode: 'KEETA_ANCHOR_ASSET_MOVEMENT_USER_ACTION_NEEDED',\n\t\t\t\tdata: { actionsNeeded },\n\t\t\t\terror: this.message\n\t\t\t});\n\t\t}\n\n\t\treturn({\n\t\t\terror: message,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tcontentType: contentType\n\t\t});\n\t}\n\n\tstatic addOperationsToBuilder(actions: KeetaAssetMovementAnchorUserAction[], builder: UserClientBuilder): void {\n\t\tfor (const action of actions) {\n\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\tlet intermediates;\n\t\t\t\tif (action.intermediates) {\n\t\t\t\t\tintermediates = new KeetaNet.lib.Utils.Certificate.CertificateBundle(action.intermediates);\n\t\t\t\t}\n\t\t\t\tbuilder.modifyCertificate(KeetaNet.lib.Block.AdjustMethod.ADD, action.certificate, intermediates, action.account ? { account: action.account } : undefined);\n\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\tbuilder.updatePermissions(action.permissionToGrant.principal, action.permissionToGrant.permissions, action.permissionToGrant.target, KeetaNet.lib.Block.AdjustMethod.ADD, action.permissionToGrant.entity ? { account: action.permissionToGrant.entity } : {})\n\t\t\t}\n\t\t}\n\t}\n\n\ttoJSON(): KeetaAssetMovementAnchorUserActionNeededErrorJSON {\n\t\treturn({\n\t\t\t...super.toJSON(),\n\t\t\tactionsNeeded: this.actionsNeeded.map(function(action): KeetaAssetMovementAnchorUserActionNeededErrorJSONProperties['actionsNeeded'][number] {\n\t\t\t\tconst shared = {\n\t\t\t\t\t...(action.details ? { details: action.details } : {})\n\t\t\t\t} as const;\n\n\t\t\t\tif (action.type === 'add-certificate') {\n\t\t\t\t\treturn({\n\t\t\t\t\t\t...shared,\n\t\t\t\t\t\ttype: action.type,\n\t\t\t\t\t\t...(action.account ? { account: action.account.publicKeyString.get() } : {}),\n\t\t\t\t\t\tcertificate: action.certificate.toPEM(),\n\t\t\t\t\t\t...(action.intermediates ? { intermediates: action.intermediates.map(function(cert) {\n\t\t\t\t\t\t\treturn(cert.toPEM());\n\t\t\t\t\t\t}) } : {})\n\t\t\t\t\t});\n\t\t\t\t} else if (action.type === 'grant-permission') {\n\t\t\t\t\treturn({\n\t\t\t\t\t\t...shared,\n\t\t\t\t\t\ttype: action.type,\n\t\t\t\t\t\tpermissionToGrant: {\n\t\t\t\t\t\t\tprincipal: action.permissionToGrant.principal.publicKeyString.get(),\n\t\t\t\t\t\t\t...(action.permissionToGrant.entity ? { entity: action.permissionToGrant.entity.publicKeyString.get() } : {}),\n\t\t\t\t\t\t\t...(action.permissionToGrant.target ? { target: action.permissionToGrant.target.publicKeyString.get() } : {}),\n\t\t\t\t\t\t\tpermissions: [ String(action.permissionToGrant.permissions.base.bigint), String(action.permissionToGrant.permissions.external.bigint) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthrow(new Error('Unsupported action type'));\n\t\t\t\t}\n\t\t\t})\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaAssetMovementAnchorUserActionNeededError> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\tif (!('data' in other)) {\n\t\t\tthrow(new Error('Invalid KeetaAssetMovementAnchorUserActionNeededError JSON: missing data property'));\n\t\t}\n\n\t\tconst parsed = assertKeetaAssetMovementAnchorUserActionNeededErrorJSONProperties(other.data);\n\n\t\tconst error = new this({ actionsNeeded: this.#parseJSONActions(parsed.actionsNeeded) }, message);\n\n\t\terror.restoreFromJSON(other);\n\t\treturn(error);\n\t}\n}\n\nexport const Errors: {\n\tKYCShareNeeded: typeof KeetaAssetMovementAnchorKYCShareNeededError;\n\tAdditionalKYCNeeded: typeof KeetaAssetMovementAnchorAdditionalKYCNeededError;\n\tOperationNotSupported: typeof KeetaAssetMovementAnchorOperationNotSupportedError;\n\tUserActionNeeded: typeof KeetaAssetMovementAnchorUserActionNeededError;\n} = {\n\t/**\n\t * The user is required to share KYC details\n\t */\n\tKYCShareNeeded: KeetaAssetMovementAnchorKYCShareNeededError,\n\n\t/**\n\t * The user is required to complete additional KYC steps\n\t */\n\tAdditionalKYCNeeded: KeetaAssetMovementAnchorAdditionalKYCNeededError,\n\n\t/**\n\t * The requested operation is not supported\n\t */\n\tOperationNotSupported: KeetaAssetMovementAnchorOperationNotSupportedError,\n\n\t/**\n\t * An action is required by the user to complete the requested operation\n\t */\n\tUserActionNeeded: KeetaAssetMovementAnchorUserActionNeededError\n};\n"]}