@keetanetwork/anchor 0.0.19 → 0.0.21

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":"json.js","sourceRoot":"","sources":["../../../src/lib/utils/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,8DAA8D;AAC9D,SAAS,qBAAqB,CAAY,GAAW,EAAE,QAAiB,EAAE,UAAgC,EAAE,UAAU,EAAE,KAAK,EAAE;IAC9H,8GAA8G;IAC9G,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAEvB,QAAQ,OAAO,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACb,OAAM,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,WAAW;YACf,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtB,KAAK,QAAQ;YACZ,OAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAChC,KAAK,UAAU;YACd,sEAAsE;YACtE,IAAI,UAAU,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAC/D,gJAAgJ;gBAChJ,MAAM,UAAU,GAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC3C,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAChD,sEAAsE;oBACtE,OAAM,CAAC,UAAU,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;gBAChC,CAAC;YACF,CAAC;YACD,sEAAsE;YACtE,OAAM,CAAC,aAAa,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACnC,KAAK,QAAQ;YACZ,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E;IACtE,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAC3D;;;;WAIG;QACH,gJAAgJ;QAChJ,OAAO,QAAgB,CAAC;IACzB,CAAC;IAED,sEAAsE;IACtE,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QACrE,iHAAiH;QACjH,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7E,8GAA8G;YAC9G,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YACrC,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACzB,OAAM,CAAC,aAAa,MAAM,GAAG,CAAC,CAAC;YAChC,CAAC;QACF,CAAC;IACF,CAAC;IAED,+DAA+D;IAC/D,OAAM,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,OAAqD;IAClG,kGAAkG;IAClG,OAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,UAAoB,GAAW,EAAE,KAAc;QACtF,OAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,qBAAqB;CACrB,CAAC","sourcesContent":["import { types as nodeUtilsTypes } from 'util';\nimport { Buffer } from './buffer.js';\nimport type { JSONSerializable, ToJSONSerializable } from '@keetanetwork/keetanet-client/lib/utils/conversion.js';\nexport type { JSONSerializable, ToJSONSerializable };\n\ntype ConvertToJSONOptions = {\n\tsearchable?: boolean;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction convertToJSONReplacer(this: any, key: string, jsonItem: unknown, options: ConvertToJSONOptions = { searchable: false }): JSONSerializable {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\tconst item = this[key];\n\n\tswitch (typeof item) {\n\t\tcase 'string':\n\t\tcase 'boolean':\n\t\t\treturn(item);\n\t\tcase 'undefined':\n\t\t\treturn(String(item));\n\t\tcase 'symbol':\n\t\t\treturn(`[${item.toString()}]`);\n\t\tcase 'function':\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tif ('toString' in item && typeof item.toString === 'function') {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n\t\t\t\tconst itemString: string = item.toString();\n\t\t\t\tif (itemString.toString().startsWith('class ')) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\treturn(`[Class ${item.name}]`);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\treturn(`[Function ${item.name}]`);\n\t\tcase 'bigint':\n\t\t\tif (item < BigInt(Number.MAX_SAFE_INTEGER) && item > BigInt(Number.MIN_SAFE_INTEGER)) {\n\t\t\t\treturn(Number(item.toString()));\n\t\t\t} else {\n\t\t\t\tif (item < 0n) {\n\t\t\t\t\tconst absItem = item * -1n;\n\t\t\t\t\tif (options.searchable) {\n\t\t\t\t\t\treturn(`-0x${absItem.toString(16)}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn(`-0x${absItem.toString(16)}[=>${item.toString(10)}]`);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (options.searchable) {\n\t\t\t\t\t\treturn(`0x${item.toString(16)}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn(`0x${item.toString(16)}[=>${item.toString(10)}]`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase 'number':\n\t\t\tif (options.searchable) {\n\t\t\t\tif (isNaN(item)) {\n\t\t\t\t\treturn('#NaN');\n\t\t\t\t}\n\n\t\t\t\tif (item === -Infinity) {\n\t\t\t\t\treturn('#-Inf');\n\t\t\t\t}\n\n\t\t\t\tif (item === Infinity) {\n\t\t\t\t\treturn('#Inf');\n\t\t\t\t}\n\n\t\t\t\treturn(item);\n\t\t\t}\n\n\t\t\tif (item === -Infinity) {\n\t\t\t\treturn('-∞');\n\t\t\t}\n\t\t\tif (item === Infinity) {\n\t\t\t\treturn('∞');\n\t\t\t}\n\n\t\t\tif (isNaN(item)) {\n\t\t\t\treturn('#NaN');\n\t\t\t}\n\n\t\t\treturn(item);\n\t\tdefault:\n\t\t\t/* We handle other cases outside of this switch */\n\t\t\tbreak;\n\t}\n\n\tif (item === undefined) {\n\t\treturn(String(item));\n\t}\n\n\tif (item === null) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn(item);\n\t}\n\n\tif (Array.isArray(item)) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn(item);\n\t}\n\n\tif (nodeUtilsTypes.isDate(item)) {\n\t\tif (options.searchable) {\n\t\t\treturn(item.toISOString());\n\t\t}\n\n\t\treturn(`[Date ${item.toISOString()}]`);\n\t}\n\n\tif (Buffer.isBuffer(item)) {\n\t\treturn(item.toString('base64'));\n\t}\n\n\tif (nodeUtilsTypes.isArrayBuffer(item)) {\n\t\treturn(Buffer.from(item).toString('base64'));\n\t}\n\n\tif (item instanceof Promise) {\n\t\treturn('[Promise]');\n\t}\n\n\tif (!(item instanceof Object)) {\n\t\tthrow(new Error(`internal error: Unknown type ${typeof item}`));\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\tif ('publicKeyString' in item && typeof item.publicKeyString === 'object' && item.publicKeyString !== null) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\t\tif ('get' in item.publicKeyString && item.publicKeyString.get !== undefined) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tif (typeof item.publicKeyString.get === 'function') {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\t\t\t\tlet addToString: string = 'UNKNOWN';\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\tif ('hasPrivateKey' in item && typeof item.hasPrivateKey === 'boolean') {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\t\t\t\t\tconst hasPrivateKey = item.hasPrivateKey;\n\t\t\t\t\tif (hasPrivateKey) {\n\t\t\t\t\t\taddToString = 'PRIVATE';\n\t\t\t\t\t} else {\n\t\t\t\t\t\taddToString = 'PUBLIC';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n\t\t\t\treturn(`[Account ${item.publicKeyString.get()} ${addToString}]`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\tif ('toJSON' in item && typeof item.toJSON === 'function') {\n\t\t/*\n\t\t * No need to call toJSON() if it's a function, as it will\n\t\t * be called by the JSON.stringify() function and passed in\n\t\t * as the second argument to this function (jsonItem).\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any,@typescript-eslint/consistent-type-assertions\n\t\treturn(jsonItem as any);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\tif ('constructor' in item && typeof item.constructor === 'function') {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\t\tif ('name' in item.constructor && typeof item.constructor.name === 'string') {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\t\t\tconst typeID = item.constructor.name;\n\t\t\tif (typeID !== 'Object') {\n\t\t\t\treturn(`[Instance ${typeID}]`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn(item);\n}\n\nexport function convertToJSON(input: unknown, options?: Parameters<typeof convertToJSONReplacer>[2]): JSONSerializable {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any\n\treturn(JSON.parse(JSON.stringify(input, function(this: any, key: string, value: unknown) {\n\t\treturn(convertToJSONReplacer.call(this, key, value, options));\n\t})));\n}\n\n/** @internal */\nexport const _Testing = {\n\tconvertToJSONReplacer\n};\n"]}
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/lib/utils/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,8DAA8D;AAC9D,SAAS,qBAAqB,CAAY,GAAW,EAAE,QAAiB,EAAE,UAAgC,EAAE,UAAU,EAAE,KAAK,EAAE;IAC9H,8GAA8G;IAC9G,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAEvB,QAAQ,OAAO,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACb,OAAM,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,WAAW;YACf,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtB,KAAK,QAAQ;YACZ,OAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAChC,KAAK,UAAU;YACd,sEAAsE;YACtE,IA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,EAAE,KAAc;QACtF,OAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,qBAAqB;CACrB,CAAC","sourcesContent":["import { types as nodeUtilsTypes } from './util.js';\nimport { Buffer } from './buffer.js';\nimport type { JSONSerializable, ToJSONSerializable } from '@keetanetwork/keetanet-client/lib/utils/conversion.js';\nexport type { JSONSerializable, ToJSONSerializable };\n\ntype ConvertToJSONOptions = {\n\tsearchable?: boolean;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction convertToJSONReplacer(this: any, key: string, jsonItem: unknown, options: ConvertToJSONOptions = { searchable: false }): JSONSerializable {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\tconst item = this[key];\n\n\tswitch (typeof item) {\n\t\tcase 'string':\n\t\tcase 'boolean':\n\t\t\treturn(item);\n\t\tcase 'undefined':\n\t\t\treturn(String(item));\n\t\tcase 'symbol':\n\t\t\treturn(`[${item.toString()}]`);\n\t\tcase 'function':\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tif ('toString' in item && typeof item.toString === 'function') {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n\t\t\t\tconst itemString: string = item.toString();\n\t\t\t\tif (itemString.toString().startsWith('class ')) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\treturn(`[Class ${item.name}]`);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\treturn(`[Function ${item.name}]`);\n\t\tcase 'bigint':\n\t\t\tif (item < BigInt(Number.MAX_SAFE_INTEGER) && item > BigInt(Number.MIN_SAFE_INTEGER)) {\n\t\t\t\treturn(Number(item.toString()));\n\t\t\t} else {\n\t\t\t\tif (item < 0n) {\n\t\t\t\t\tconst absItem = item * -1n;\n\t\t\t\t\tif (options.searchable) {\n\t\t\t\t\t\treturn(`-0x${absItem.toString(16)}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn(`-0x${absItem.toString(16)}[=>${item.toString(10)}]`);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (options.searchable) {\n\t\t\t\t\t\treturn(`0x${item.toString(16)}`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn(`0x${item.toString(16)}[=>${item.toString(10)}]`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase 'number':\n\t\t\tif (options.searchable) {\n\t\t\t\tif (isNaN(item)) {\n\t\t\t\t\treturn('#NaN');\n\t\t\t\t}\n\n\t\t\t\tif (item === -Infinity) {\n\t\t\t\t\treturn('#-Inf');\n\t\t\t\t}\n\n\t\t\t\tif (item === Infinity) {\n\t\t\t\t\treturn('#Inf');\n\t\t\t\t}\n\n\t\t\t\treturn(item);\n\t\t\t}\n\n\t\t\tif (item === -Infinity) {\n\t\t\t\treturn('-∞');\n\t\t\t}\n\t\t\tif (item === Infinity) {\n\t\t\t\treturn('∞');\n\t\t\t}\n\n\t\t\tif (isNaN(item)) {\n\t\t\t\treturn('#NaN');\n\t\t\t}\n\n\t\t\treturn(item);\n\t\tdefault:\n\t\t\t/* We handle other cases outside of this switch */\n\t\t\tbreak;\n\t}\n\n\tif (item === undefined) {\n\t\treturn(String(item));\n\t}\n\n\tif (item === null) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn(item);\n\t}\n\n\tif (Array.isArray(item)) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn(item);\n\t}\n\n\tif (nodeUtilsTypes.isDate(item)) {\n\t\tif (options.searchable) {\n\t\t\treturn(item.toISOString());\n\t\t}\n\n\t\treturn(`[Date ${item.toISOString()}]`);\n\t}\n\n\tif (Buffer.isBuffer(item)) {\n\t\treturn(item.toString('base64'));\n\t}\n\n\tif (nodeUtilsTypes.isArrayBuffer(item)) {\n\t\treturn(Buffer.from(item).toString('base64'));\n\t}\n\n\tif (item instanceof Promise) {\n\t\treturn('[Promise]');\n\t}\n\n\tif (!(item instanceof Object)) {\n\t\tthrow(new Error(`internal error: Unknown type ${typeof item}`));\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\tif ('publicKeyString' in item && typeof item.publicKeyString === 'object' && item.publicKeyString !== null) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\t\tif ('get' in item.publicKeyString && item.publicKeyString.get !== undefined) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tif (typeof item.publicKeyString.get === 'function') {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\t\t\t\tlet addToString: string = 'UNKNOWN';\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\tif ('hasPrivateKey' in item && typeof item.hasPrivateKey === 'boolean') {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\t\t\t\t\tconst hasPrivateKey = item.hasPrivateKey;\n\t\t\t\t\tif (hasPrivateKey) {\n\t\t\t\t\t\taddToString = 'PRIVATE';\n\t\t\t\t\t} else {\n\t\t\t\t\t\taddToString = 'PUBLIC';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n\t\t\t\treturn(`[Account ${item.publicKeyString.get()} ${addToString}]`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\tif ('toJSON' in item && typeof item.toJSON === 'function') {\n\t\t/*\n\t\t * No need to call toJSON() if it's a function, as it will\n\t\t * be called by the JSON.stringify() function and passed in\n\t\t * as the second argument to this function (jsonItem).\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any,@typescript-eslint/consistent-type-assertions\n\t\treturn(jsonItem as any);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\tif ('constructor' in item && typeof item.constructor === 'function') {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-member-access\n\t\tif ('name' in item.constructor && typeof item.constructor.name === 'string') {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n\t\t\tconst typeID = item.constructor.name;\n\t\t\tif (typeID !== 'Object') {\n\t\t\t\treturn(`[Instance ${typeID}]`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn(item);\n}\n\nexport function convertToJSON(input: unknown, options?: Parameters<typeof convertToJSONReplacer>[2]): JSONSerializable {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any\n\treturn(JSON.parse(JSON.stringify(input, function(this: any, key: string, value: unknown) {\n\t\treturn(convertToJSONReplacer.call(this, key, value, options));\n\t})));\n}\n\n/** @internal */\nexport const _Testing = {\n\tconvertToJSONReplacer\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
2
+ [P in keyof T]?: DeepPartial<T[P]>;
3
+ } : T;
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,CAAC,IAExB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,GACvC,CAAC,SAAS,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACxD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type DeepPartial<T> =\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tT extends (...args: any[]) => any ? T :\n\t\tT extends (infer U)[] ? DeepPartial<U>[] :\n\t\t\tT extends object ? { [P in keyof T]?: DeepPartial<T[P]> } :\n\t\t\t\tT;\n"]}
@@ -0,0 +1,7 @@
1
+ import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
2
+ declare const util: typeof KeetaNetLib.Utils.Helper.util;
3
+ declare const types: typeof util.types;
4
+ declare const inspect: typeof util.inspect;
5
+ export { types, inspect };
6
+ export default util;
7
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEnE,QAAA,MAAM,IAAI,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,IAAoC,CAAC;AAEjF,QAAA,MAAM,KAAK,EAAE,OAAO,IAAI,CAAC,KAAkB,CAAC;AAC5C,QAAA,MAAM,OAAO,EAAE,OAAO,IAAI,CAAC,OAAsB,CAAC;AAElD,OAAO,EACN,KAAK,EACL,OAAO,EACP,CAAA;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
2
+ const util = KeetaNetLib.Utils.Helper.util;
3
+ const types = util.types;
4
+ const inspect = util.inspect;
5
+ export { types, inspect };
6
+ export default util;
7
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/lib/utils/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,IAAI,GAAyC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AAEjF,MAAM,KAAK,GAAsB,IAAI,CAAC,KAAK,CAAC;AAC5C,MAAM,OAAO,GAAwB,IAAI,CAAC,OAAO,CAAC;AAElD,OAAO,EACN,KAAK,EACL,OAAO,EACP,CAAA;AAED,eAAe,IAAI,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nconst util: typeof KeetaNetLib.Utils.Helper.util = KeetaNetLib.Utils.Helper.util;\n\nconst types: typeof util.types = util.types;\nconst inspect: typeof util.inspect = util.inspect;\n\nexport {\n\ttypes,\n\tinspect\n}\n\nexport default util;\n"]}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@keetanetwork/anchor",
9
- "version": "0.0.19",
9
+ "version": "0.0.21",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@keetanetwork/currency-info": "1.2.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "KeetaNetwork Network Anchor",
5
5
  "main": "client/index.js",
6
6
  "scripts": {
@@ -65,26 +65,45 @@ export type KeetaKYCAnchorGetCertificateResponse = ({
65
65
  error: string;
66
66
  });
67
67
  declare class KeetaKYCAnchorVerificationNotFoundError extends KeetaAnchorUserError {
68
- protected statusCode: number;
68
+ static readonly name: string;
69
+ private readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID;
70
+ private static readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID;
69
71
  constructor(message?: string);
72
+ static isInstance(input: unknown): input is KeetaKYCAnchorVerificationNotFoundError;
70
73
  }
71
74
  declare class KeetaKYCAnchorCertificateNotFoundError extends KeetaAnchorUserError {
72
- protected statusCode: number;
75
+ static readonly name: string;
76
+ private readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID;
77
+ private static readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID;
73
78
  constructor(message?: string);
79
+ static isInstance(input: unknown): input is KeetaKYCAnchorCertificateNotFoundError;
74
80
  }
75
81
  declare class KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {
76
- protected statusCode: number;
82
+ static readonly name: string;
83
+ private readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID;
84
+ private static readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID;
77
85
  readonly amount: bigint;
78
86
  readonly token: KeetaNetToken;
79
87
  constructor(cost: {
80
88
  amount: bigint | string;
81
89
  token: KeetaNetToken | string;
82
90
  }, message?: string);
91
+ static isInstance(input: unknown): input is KeetaKYCAnchorCertificatePaymentRequired;
83
92
  asErrorResponse(contentType: 'text/plain' | 'application/json'): {
84
93
  error: string;
85
94
  statusCode: number;
86
95
  contentType: string;
87
96
  };
97
+ toJSON(): {
98
+ ok: false;
99
+ retryable: boolean;
100
+ error: string;
101
+ name: string;
102
+ statusCode: number;
103
+ amount: string;
104
+ token: string;
105
+ };
106
+ static fromJSON(input: unknown): Promise<KeetaKYCAnchorCertificatePaymentRequired>;
88
107
  }
89
108
  export declare const Errors: {
90
109
  VerificationNotFound: typeof KeetaKYCAnchorVerificationNotFoundError;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/services/kyc/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,qBAAqB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,KAAK,aAAa,GAAG,YAAY,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;AAEtH,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;AAEtF,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;AAC/F,MAAM,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,uCAAuC;IACvD,YAAY,EAAE,0BAA0B,CAAC;IACzC,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzF,MAAM,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QAEd,SAAS,EAAE,MAAM,CAAC;QAElB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;CACF;AAED,KAAK,4BAA4B,GAAG,UAA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a/F,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wCAAwC;IAIpF,eAAe,CAAC,WAAW,EAAE,YAAY,GAAG,kBAAkB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE;IAuB3H,MAAM,IAAI;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;WAY9G,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,wCAAwC,CAAC;CAuBxF;AAED,eAAO,MAAM,MAAM,EAAE;IACpB,oBAAoB,EAAE,OAAO,uCAAuC,CAAC;IACrE,mBAAmB,EAAE,OAAO,sCAAsC,CAAC;IACnE,eAAe,EAAE,OAAO,wCAAwC,CAAC;CAiBjE,CAAA;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;CAAE,CAAC,CAE5I;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,uCAAuC,EAAE,SAAS,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrI"}
@@ -2,25 +2,55 @@ import * as KeetaNet from '@keetanetwork/keetanet-client';
2
2
  import * as Signing from '../../lib/utils/signing.js';
3
3
  import { KeetaAnchorUserError } from '../../lib/error.js';
4
4
  class KeetaKYCAnchorVerificationNotFoundError extends KeetaAnchorUserError {
5
- statusCode = 400;
5
+ static name = 'KeetaKYCAnchorVerificationNotFoundError';
6
+ KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID;
7
+ static KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID = '79d7036f-58ad-4eec-b64c-26bdf98cd3c1';
6
8
  constructor(message) {
7
9
  super(message ?? 'Verification ID not found');
10
+ this.statusCode = 400;
11
+ Object.defineProperty(this, 'KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID', {
12
+ value: KeetaKYCAnchorVerificationNotFoundError.KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID,
13
+ enumerable: false
14
+ });
15
+ }
16
+ static isInstance(input) {
17
+ return (this.hasPropWithValue(input, 'KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID', KeetaKYCAnchorVerificationNotFoundError.KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID));
8
18
  }
9
19
  }
10
20
  class KeetaKYCAnchorCertificateNotFoundError extends KeetaAnchorUserError {
11
- statusCode = 404;
21
+ static name = 'KeetaKYCAnchorCertificateNotFoundError';
22
+ KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID;
23
+ static KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID = '6f4d9620-df33-468e-ae03-898d4fa67aeb';
12
24
  constructor(message) {
13
25
  super(message ?? 'Certificate not found (pending)');
26
+ this.statusCode = 404;
27
+ Object.defineProperty(this, 'KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID', {
28
+ value: KeetaKYCAnchorCertificateNotFoundError.KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID,
29
+ enumerable: false
30
+ });
31
+ }
32
+ static isInstance(input) {
33
+ return (this.hasPropWithValue(input, 'KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID', KeetaKYCAnchorCertificateNotFoundError.KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID));
14
34
  }
15
35
  }
16
36
  class KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {
17
- statusCode = 402;
37
+ static name = 'KeetaKYCAnchorCertificatePaymentRequired';
38
+ KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID;
39
+ static KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID = '92b2481d-b29b-4fa2-a295-3a47d99c0869';
18
40
  amount;
19
41
  token;
20
42
  constructor(cost, message) {
21
43
  super(message ?? 'Payment required for certificate');
44
+ this.statusCode = 402;
22
45
  this.amount = BigInt(cost.amount);
23
46
  this.token = KeetaNet.lib.Account.toAccount(cost.token);
47
+ Object.defineProperty(this, 'KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID', {
48
+ value: KeetaKYCAnchorCertificatePaymentRequired.KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID,
49
+ enumerable: false
50
+ });
51
+ }
52
+ static isInstance(input) {
53
+ return (this.hasPropWithValue(input, 'KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID', KeetaKYCAnchorCertificatePaymentRequired.KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID));
24
54
  }
25
55
  asErrorResponse(contentType) {
26
56
  let message = this.message;
@@ -43,6 +73,33 @@ class KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {
43
73
  contentType: contentType
44
74
  });
45
75
  }
76
+ toJSON() {
77
+ return ({
78
+ ok: false,
79
+ retryable: this.retryable,
80
+ error: this.message,
81
+ name: this.name,
82
+ statusCode: this.statusCode,
83
+ amount: `0x${this.amount.toString(16)}`,
84
+ token: this.token.publicKeyString.get()
85
+ });
86
+ }
87
+ static async fromJSON(input) {
88
+ const { message, other } = this.extractErrorProperties(input, this);
89
+ // Extract required properties specific to PaymentRequired
90
+ if (!('amount' in other) || typeof other.amount !== 'string') {
91
+ throw (new Error('Invalid KeetaKYCAnchorCertificatePaymentRequired JSON object: missing or invalid amount'));
92
+ }
93
+ if (!('token' in other) || typeof other.token !== 'string') {
94
+ throw (new Error('Invalid KeetaKYCAnchorCertificatePaymentRequired JSON object: missing or invalid token'));
95
+ }
96
+ const error = new this({
97
+ amount: other.amount,
98
+ token: other.token
99
+ }, message);
100
+ error.restoreFromJSON(other);
101
+ return (error);
102
+ }
46
103
  }
47
104
  export const Errors = {
48
105
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/kyc/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAyE5B,MAAM,uCAAwC,SAAQ,oBAAoB;IAC/D,UAAU,GAAG,GAAG,CAAC;IAC3B,YAAY,OAAgB;QAC3B,KAAK,CAAC,OAAO,IAAI,2BAA2B,CAAC,CAAC;IAC/C,CAAC;CACD;AAED,MAAM,sCAAuC,SAAQ,oBAAoB;IAC9D,UAAU,GAAG,GAAG,CAAC;IAC3B,YAAY,OAAgB;QAC3B,KAAK,CAAC,OAAO,IAAI,iCAAiC,CAAC,CAAC;IACrD,CAAC;CACD;AAED,MAAM,wCAAyC,SAAQ,oBAAoB;IAChE,UAAU,GAAG,GAAG,CAAC;IAClB,MAAM,CAAS;IACf,KAAK,CAAgB;IAC9B,YAAY,IAAiE,EAAE,OAAgB;QAC9F,KAAK,CAAC,OAAO,IAAI,kCAAkC,CAAC,CAAC;QAErD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAwD,IAAI,CAAC,KAAK,CAAC,CAAC;IAChH,CAAC;IAED,eAAe,CAAC,WAA8C;QAC7D,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;YACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;gBACxB,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,mCAAmC;gBACzC,IAAI,EAAE;oBACL,IAAI,EAAE;wBACL,MAAM,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;wBACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;qBACvC;iBACD;gBACD,KAAK,EAAE,IAAI,CAAC,OAAO;aACnB,CAAC,CAAC;QACJ,CAAC;QAED,OAAM,CAAC;YACN,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,WAAW;SACxB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAIf;IACH;;OAEG;IACH,oBAAoB,EAAE,uCAAuC;IAE7D;;;OAGG;IACH,mBAAmB,EAAE,sCAAsC;IAE3D;;OAEG;IACH,eAAe,EAAE,wCAAwC;CACzD,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAgC;IACxE,OAAM,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA4E;IAClH,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,OAAM,CAAC,MAAM,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import type {\n\tServiceMetadata,\n\tServiceSearchCriteria\n} from '../../lib/resolver.ts';\nimport * as KeetaNet from '@keetanetwork/keetanet-client';\nimport * as Signing from '../../lib/utils/signing.js';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\n\ntype KeetaNetToken = InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>;\n\nexport type CountryCodesSearchCriteria = ServiceSearchCriteria<'kyc'>['countryCodes'];\n\nexport type Operations = NonNullable<ServiceMetadata['services']['kyc']>[string]['operations'];\nexport type OperationNames = keyof Operations;\n\nexport interface KeetaKYCAnchorCreateVerificationRequest {\n\tcountryCodes: CountryCodesSearchCriteria;\n\taccount: ReturnType<InstanceType<typeof KeetaNet.lib.Account>['publicKeyString']['get']>;\n\tsigned: {\n\t\tnonce: string;\n\t\t/* Date and time of the request in ISO 8601 format */\n\t\ttimestamp: string;\n\t\t/* Signature of the account public key and the nonce as an ASN.1 Sequence, Base64 DER */\n\t\tsignature: string;\n\t};\n}\n\ntype KeetaNetTokenPublicKeyString = ReturnType<InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>['publicKeyString']['get']>;\nexport type KeetaKYCAnchorCreateVerificationResponse = ({\n\tok: true;\n\n\t/**\n\t * The ID of the verification request -- this is a unique identifier\n\t * for the verification request that can be used to fetch the\n\t * certificate later\n\t */\n\tid: string;\n\t/**\n\t * The expected cost of the verification request, in the form of a\n\t * token and a range of minimum and maximum expected costs\n\t */\n\texpectedCost: {\n\t\tmin: string;\n\t\tmax: string;\n\t\ttoken: KeetaNetTokenPublicKeyString;\n\t};\n\t/**\n\t * The URL to the verification service where the user can complete the\n\t * verification process. This URL is expected to be a web URL that the\n\t * user can visit to complete the verification.\n\t */\n\twebURL: string;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaKYCAnchorGetCertificateResponse = ({\n\tok: true;\n\t/**\n\t * The certificates that were issued by the KYC Anchor service.\n\t * Typically this will just be a single certificate, but\n\t * it could also be multiple certificates if the service\n\t * issues multiple certificates for a single verification.\n\t *\n\t * Each certificate is represented as a PEM-encoded string.\n\t * The `intermediates` field is optional and may contain\n\t * additional intermediate certificates that are required to\n\t * validate the certificate chain.\n\t */\n\tresults: ({\n\t\tcertificate: string;\n\t\tintermediates?: string[];\n\t})[];\n} | {\n\tok: false;\n\terror: string;\n});\n\nclass KeetaKYCAnchorVerificationNotFoundError extends KeetaAnchorUserError {\n\tprotected statusCode = 400;\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Verification ID not found');\n\t}\n}\n\nclass KeetaKYCAnchorCertificateNotFoundError extends KeetaAnchorUserError {\n\tprotected statusCode = 404;\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Certificate not found (pending)');\n\t}\n}\n\nclass KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {\n\tprotected statusCode = 402;\n\treadonly amount: bigint;\n\treadonly token: KeetaNetToken;\n\tconstructor(cost: { amount: bigint | string; token: KeetaNetToken | string; }, message?: string) {\n\t\tsuper(message ?? 'Payment required for certificate');\n\n\t\tthis.amount = BigInt(cost.amount);\n\t\tthis.token = KeetaNet.lib.Account.toAccount<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>(cost.token);\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\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\tcode: 'KEETA_ANCHOR_KYC_PAYMENT_REQUIRED',\n\t\t\t\tdata: {\n\t\t\t\t\tcost: {\n\t\t\t\t\t\tamount: `0x${this.amount.toString(16)}`,\n\t\t\t\t\t\ttoken: this.token.publicKeyString.get()\n\t\t\t\t\t}\n\t\t\t\t},\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\nexport const Errors: {\n\tVerificationNotFound: typeof KeetaKYCAnchorVerificationNotFoundError;\n\tCertificateNotFound: typeof KeetaKYCAnchorCertificateNotFoundError;\n\tPaymentRequired: typeof KeetaKYCAnchorCertificatePaymentRequired;\n} = {\n\t/**\n\t * The verification ID was not found\n\t */\n\tVerificationNotFound: KeetaKYCAnchorVerificationNotFoundError,\n\n\t/**\n\t * The certificate for the verification ID was not found\n\t * (typically this means the verification is still pending)\n\t */\n\tCertificateNotFound: KeetaKYCAnchorCertificateNotFoundError,\n\n\t/**\n\t * Payment is required for the certificate\n\t */\n\tPaymentRequired: KeetaKYCAnchorCertificatePaymentRequired\n}\n\nexport async function generateSignedData(account: Signing.SignableAccount): Promise<{ nonce: string; timestamp: string; signature: string; }> {\n\treturn(await Signing.SignData(account, []));\n}\n\nexport async function verifySignedData(request: Pick<KeetaKYCAnchorCreateVerificationRequest, 'account' | 'signed'>): Promise<boolean> {\n\tconst account = KeetaNet.lib.Account.fromPublicKeyString(request.account);\n\treturn(await Signing.VerifySignedData(account, [], request.signed));\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/services/kyc/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAyE5B,MAAM,uCAAwC,SAAQ,oBAAoB;IACzE,MAAM,CAAmB,IAAI,GAAW,yCAAyC,CAAC;IACjE,mDAAmD,CAAU;IACtE,MAAM,CAAU,mDAAmD,GAAG,sCAAsC,CAAC;IAErH,YAAY,OAAgB;QAC3B,KAAK,CAAC,OAAO,IAAI,2BAA2B,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QAEtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,qDAAqD,EAAE;YAClF,KAAK,EAAE,uCAAuC,CAAC,mDAAmD;YAClG,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,KAAc;QAC/B,OAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,qDAAqD,EAAE,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,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import type {\n\tServiceMetadata,\n\tServiceSearchCriteria\n} from '../../lib/resolver.ts';\nimport * as KeetaNet from '@keetanetwork/keetanet-client';\nimport * as Signing from '../../lib/utils/signing.js';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\n\ntype KeetaNetToken = InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>;\n\nexport type CountryCodesSearchCriteria = ServiceSearchCriteria<'kyc'>['countryCodes'];\n\nexport type Operations = NonNullable<ServiceMetadata['services']['kyc']>[string]['operations'];\nexport type OperationNames = keyof Operations;\n\nexport interface KeetaKYCAnchorCreateVerificationRequest {\n\tcountryCodes: CountryCodesSearchCriteria;\n\taccount: ReturnType<InstanceType<typeof KeetaNet.lib.Account>['publicKeyString']['get']>;\n\tsigned: {\n\t\tnonce: string;\n\t\t/* Date and time of the request in ISO 8601 format */\n\t\ttimestamp: string;\n\t\t/* Signature of the account public key and the nonce as an ASN.1 Sequence, Base64 DER */\n\t\tsignature: string;\n\t};\n}\n\ntype KeetaNetTokenPublicKeyString = ReturnType<InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>['publicKeyString']['get']>;\nexport type KeetaKYCAnchorCreateVerificationResponse = ({\n\tok: true;\n\n\t/**\n\t * The ID of the verification request -- this is a unique identifier\n\t * for the verification request that can be used to fetch the\n\t * certificate later\n\t */\n\tid: string;\n\t/**\n\t * The expected cost of the verification request, in the form of a\n\t * token and a range of minimum and maximum expected costs\n\t */\n\texpectedCost: {\n\t\tmin: string;\n\t\tmax: string;\n\t\ttoken: KeetaNetTokenPublicKeyString;\n\t};\n\t/**\n\t * The URL to the verification service where the user can complete the\n\t * verification process. This URL is expected to be a web URL that the\n\t * user can visit to complete the verification.\n\t */\n\twebURL: string;\n} | {\n\tok: false;\n\terror: string;\n});\n\nexport type KeetaKYCAnchorGetCertificateResponse = ({\n\tok: true;\n\t/**\n\t * The certificates that were issued by the KYC Anchor service.\n\t * Typically this will just be a single certificate, but\n\t * it could also be multiple certificates if the service\n\t * issues multiple certificates for a single verification.\n\t *\n\t * Each certificate is represented as a PEM-encoded string.\n\t * The `intermediates` field is optional and may contain\n\t * additional intermediate certificates that are required to\n\t * validate the certificate chain.\n\t */\n\tresults: ({\n\t\tcertificate: string;\n\t\tintermediates?: string[];\n\t})[];\n} | {\n\tok: false;\n\terror: string;\n});\n\nclass KeetaKYCAnchorVerificationNotFoundError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaKYCAnchorVerificationNotFoundError';\n\tprivate readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID!: string;\n\tprivate static readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID = '79d7036f-58ad-4eec-b64c-26bdf98cd3c1';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Verification ID not found');\n\t\tthis.statusCode = 400;\n\n\t\tObject.defineProperty(this, 'KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID', {\n\t\t\tvalue: KeetaKYCAnchorVerificationNotFoundError.KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaKYCAnchorVerificationNotFoundError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID', KeetaKYCAnchorVerificationNotFoundError.KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID));\n\t}\n}\n\nclass KeetaKYCAnchorCertificateNotFoundError extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaKYCAnchorCertificateNotFoundError';\n\tprivate readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID!: string;\n\tprivate static readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID = '6f4d9620-df33-468e-ae03-898d4fa67aeb';\n\n\tconstructor(message?: string) {\n\t\tsuper(message ?? 'Certificate not found (pending)');\n\t\tthis.statusCode = 404;\n\n\t\tObject.defineProperty(this, 'KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID', {\n\t\t\tvalue: KeetaKYCAnchorCertificateNotFoundError.KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaKYCAnchorCertificateNotFoundError {\n\t\treturn(this.hasPropWithValue(input, 'KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID', KeetaKYCAnchorCertificateNotFoundError.KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID));\n\t}\n}\n\nclass KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {\n\tstatic override readonly name: string = 'KeetaKYCAnchorCertificatePaymentRequired';\n\tprivate readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID!: string;\n\tprivate static readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID = '92b2481d-b29b-4fa2-a295-3a47d99c0869';\n\treadonly amount: bigint;\n\treadonly token: KeetaNetToken;\n\n\tconstructor(cost: { amount: bigint | string; token: KeetaNetToken | string; }, message?: string) {\n\t\tsuper(message ?? 'Payment required for certificate');\n\t\tthis.statusCode = 402;\n\n\t\tthis.amount = BigInt(cost.amount);\n\t\tthis.token = KeetaNet.lib.Account.toAccount<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>(cost.token);\n\n\t\tObject.defineProperty(this, 'KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID', {\n\t\t\tvalue: KeetaKYCAnchorCertificatePaymentRequired.KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tstatic isInstance(input: unknown): input is KeetaKYCAnchorCertificatePaymentRequired {\n\t\treturn(this.hasPropWithValue(input, 'KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID', KeetaKYCAnchorCertificatePaymentRequired.KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID));\n\t}\n\n\tasErrorResponse(contentType: 'text/plain' | 'application/json'): { error: string; statusCode: number; contentType: string } {\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\tcode: 'KEETA_ANCHOR_KYC_PAYMENT_REQUIRED',\n\t\t\t\tdata: {\n\t\t\t\t\tcost: {\n\t\t\t\t\t\tamount: `0x${this.amount.toString(16)}`,\n\t\t\t\t\t\ttoken: this.token.publicKeyString.get()\n\t\t\t\t\t}\n\t\t\t\t},\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(): { ok: false; retryable: boolean; error: string; name: string; statusCode: number; amount: string; token: string } {\n\t\treturn({\n\t\t\tok: false,\n\t\t\tretryable: this.retryable,\n\t\t\terror: this.message,\n\t\t\tname: this.name,\n\t\t\tstatusCode: this.statusCode,\n\t\t\tamount: `0x${this.amount.toString(16)}`,\n\t\t\ttoken: this.token.publicKeyString.get()\n\t\t});\n\t}\n\n\tstatic async fromJSON(input: unknown): Promise<KeetaKYCAnchorCertificatePaymentRequired> {\n\t\tconst { message, other } = this.extractErrorProperties(input, this);\n\n\t\t// Extract required properties specific to PaymentRequired\n\t\tif (!('amount' in other) || typeof other.amount !== 'string') {\n\t\t\tthrow(new Error('Invalid KeetaKYCAnchorCertificatePaymentRequired JSON object: missing or invalid amount'));\n\t\t}\n\n\t\tif (!('token' in other) || typeof other.token !== 'string') {\n\t\t\tthrow(new Error('Invalid KeetaKYCAnchorCertificatePaymentRequired JSON object: missing or invalid token'));\n\t\t}\n\n\t\tconst error = new this(\n\t\t\t{\n\t\t\t\tamount: other.amount,\n\t\t\t\ttoken: other.token\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 const Errors: {\n\tVerificationNotFound: typeof KeetaKYCAnchorVerificationNotFoundError;\n\tCertificateNotFound: typeof KeetaKYCAnchorCertificateNotFoundError;\n\tPaymentRequired: typeof KeetaKYCAnchorCertificatePaymentRequired;\n} = {\n\t/**\n\t * The verification ID was not found\n\t */\n\tVerificationNotFound: KeetaKYCAnchorVerificationNotFoundError,\n\n\t/**\n\t * The certificate for the verification ID was not found\n\t * (typically this means the verification is still pending)\n\t */\n\tCertificateNotFound: KeetaKYCAnchorCertificateNotFoundError,\n\n\t/**\n\t * Payment is required for the certificate\n\t */\n\tPaymentRequired: KeetaKYCAnchorCertificatePaymentRequired\n}\n\nexport async function generateSignedData(account: Signing.SignableAccount): Promise<{ nonce: string; timestamp: string; signature: string; }> {\n\treturn(await Signing.SignData(account, []));\n}\n\nexport async function verifySignedData(request: Pick<KeetaKYCAnchorCreateVerificationRequest, 'account' | 'signed'>): Promise<boolean> {\n\tconst account = KeetaNet.lib.Account.fromPublicKeyString(request.account);\n\treturn(await Signing.VerifySignedData(account, [], request.signed));\n}\n"]}