@idos-network/kwil-infra 1.2.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/actions/index.d.mts +1 -1
  3. package/dist/actions/index.mjs.map +1 -1
  4. package/dist/facesign/index.d.mts +1 -1
  5. package/dist/facesign/index.mjs +1 -1
  6. package/dist/{facesign-signer-ADd4EASX.d.mts → facesign-signer-BC24j1eN.d.mts} +1 -1
  7. package/dist/facesign-signer-BC24j1eN.d.mts.map +1 -0
  8. package/dist/{facesign-signer-BY9Nti9F.mjs → facesign-signer-qzCcwunk.mjs} +1 -1
  9. package/dist/{facesign-signer-BY9Nti9F.mjs.map → facesign-signer-qzCcwunk.mjs.map} +1 -1
  10. package/dist/{index-UFgWkjYP.d.mts → index-iqkJfgWf.d.mts} +71 -72
  11. package/dist/index-iqkJfgWf.d.mts.map +1 -0
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +32 -18
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/signature-verification/index.d.mts +1 -2
  16. package/dist/signature-verification/index.d.mts.map +1 -1
  17. package/dist/signature-verification/index.mjs +11 -16
  18. package/dist/signature-verification/index.mjs.map +1 -1
  19. package/dist/xrp/utils.d.mts +35 -37
  20. package/dist/xrp/utils.d.mts.map +1 -1
  21. package/dist/xrp/utils.mjs.map +1 -1
  22. package/dist/xrpl-credentials/index.d.mts +156 -146
  23. package/dist/xrpl-credentials/index.d.mts.map +1 -1
  24. package/dist/xrpl-credentials/index.mjs.map +1 -1
  25. package/package.json +16 -11
  26. package/vitest.config.ts +4 -0
  27. package/.turbo/turbo-build.log +0 -47
  28. package/.turbo/turbo-test.log +0 -126
  29. package/.turbo/turbo-typecheck.log +0 -5
  30. package/dist/facesign-signer-ADd4EASX.d.mts.map +0 -1
  31. package/dist/index-UFgWkjYP.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/xrp/utils.ts"],"sourcesContent":["import type * as GemWallet from \"@gemwallet/api\";\nimport type { Xumm } from \"xumm\";\nexport type WalletName = \"XAMAN\" | \"GEM\";\n\nexport interface WalletConfig {\n name: WalletName;\n instance: Xumm | typeof GemWallet;\n}\n\nexport type XamanConfig = {\n name: \"XAMAN\";\n instance: Xumm;\n};\n\nexport type GemConfig = {\n name: \"GEM\";\n instance: typeof GemWallet;\n};\n\nexport type WalletInitConfig = XamanConfig | GemConfig;\n\ntype XrpWallet = \"Xumm\" | \"GemWallet\";\n\nexport function createXummPayload(message: string): Record<string, unknown> {\n const memoData = Buffer.from(message).toString(\"hex\"); // Encode message as hex for Memos\n return {\n custom_meta: {\n instruction: message,\n },\n txjson: {\n TransactionType: \"SignIn\",\n Memos: [\n {\n Memo: {\n MemoData: memoData,\n MemoType: Buffer.from(\"idOS\").toString(\"hex\"), // Optional type identifier\n },\n },\n ],\n },\n };\n}\n\nexport function signXummTx(xummInstance: Xumm, payload: Record<string, unknown>): Promise<string> {\n return new Promise((resolve) => {\n // oxlint-disable-next-line typescript/no-explicit-any -- xumm payload type is not easy to import\n xummInstance.payload?.createAndSubscribe(payload as unknown as any, async (event) => {\n if (!event.payload.response.hex) return;\n const hex = event.payload.response.hex;\n resolve(hex);\n });\n });\n}\n\nexport async function getXummPublicKey(wallet: Xumm): Promise<string | undefined> {\n const payload = createXummPayload(\"Sign request from idOS\");\n const txHash = await signXummTx(wallet, payload);\n\n let decode: typeof import(\"xrpl\").decode;\n try {\n ({ decode } = await import(\"xrpl\"));\n } catch {\n throw new Error(\n 'Missing optional peer dependency \"xrpl\". Install it to use Xumm public-key extraction.',\n );\n }\n\n let decodedTx: { SigningPubKey?: string };\n try {\n decodedTx = decode(txHash);\n } catch {\n throw new Error(\"Failed to decode Xumm transaction payload.\");\n }\n\n if (!decodedTx.SigningPubKey) {\n throw new Error(\"SigningPubKey not found in decoded Xumm transaction.\");\n }\n\n return decodedTx.SigningPubKey;\n}\n\nexport function signGemWalletTx(\n gemWalletInstance: typeof GemWallet,\n message: string,\n): Promise<string | undefined> {\n return gemWalletInstance.signMessage(message).then((response) => response.result?.signedMessage);\n}\n\nexport async function getGemWalletPublicKey(\n wallet: typeof GemWallet,\n): Promise<{ address: string; publicKey: string } | undefined> {\n if (\"isInstalled\" in wallet) {\n await wallet.isInstalled();\n const { publicKey, address } = await wallet\n .getPublicKey()\n .then((res) => res.result as { publicKey: string; address: string });\n return { address, publicKey };\n }\n}\n\nexport async function getXrpAddress(wallet: Xumm | typeof GemWallet): Promise<string | undefined> {\n if (\"isInstalled\" in wallet) {\n await wallet.isInstalled();\n return wallet.getAddress().then((response) => response.result?.address);\n }\n return wallet.user.account;\n}\n\n// Type guard to check if the wallet is an Xumm wallet\nexport function looksLikeXrpWallet(wallet: unknown): wallet is Xumm | typeof GemWallet {\n return (\n wallet !== null &&\n typeof wallet === \"object\" &&\n (\"authorize\" in wallet || \"isInstalled\" in wallet)\n );\n}\n\nexport async function getXrpWalletType(object: Record<string, unknown>): Promise<XrpWallet> {\n if (\"authorize\" in object) {\n return \"Xumm\";\n }\n if (\"isInstalled\" in object) {\n return \"GemWallet\";\n }\n throw new Error(\"Unknown wallet type\");\n}\n\nexport async function getXrpTxHash(\n message: string | Uint8Array,\n wallet: Xumm | typeof GemWallet,\n): Promise<string | undefined> {\n let messageString: string;\n\n const xrpWalletType = await getXrpWalletType(wallet as Record<string, unknown>);\n\n messageString = typeof message === \"string\" ? message : Buffer.from(message).toString(\"utf8\"); // Decode Uint8Array to string\n if (xrpWalletType === \"Xumm\") {\n const memoData = Buffer.from(messageString).toString(\"hex\"); // Encode message as hex for Memos\n\n const payload = {\n custom_meta: {\n instruction: messageString,\n },\n txjson: {\n TransactionType: \"SignIn\",\n Memos: [\n {\n Memo: {\n MemoData: memoData,\n MemoType: Buffer.from(\"idOS\").toString(\"hex\"), // Optional type identifier\n },\n },\n ],\n },\n };\n const xummTx = await signXummTx(wallet as Xumm, payload);\n console.log(\"xummTx\", xummTx);\n } else if (xrpWalletType === \"GemWallet\") {\n const signature = await signGemWalletTx(wallet as typeof GemWallet, messageString);\n if (!signature) {\n throw new Error(\"Failed to sign transaction with GemWallet\");\n }\n return signature;\n }\n}\n\nexport async function getXrpPublicKey(\n wallet: Xumm | typeof GemWallet,\n): Promise<{ address: string; publicKey: string } | undefined> {\n const xrpWalletType = await getXrpWalletType(wallet as Record<string, unknown>);\n if (xrpWalletType === \"Xumm\") {\n // @todo: should we remove xaman wallet support?\n const publicKey = await getXummPublicKey(wallet as Xumm);\n const address = await getXrpAddress(wallet);\n return { address: address as string, publicKey: publicKey as string };\n }\n return getGemWalletPublicKey(wallet as typeof GemWallet);\n}\n"],"mappings":";AAuBA,SAAgB,kBAAkB,SAA0C;CAC1E,MAAM,WAAW,OAAO,KAAK,QAAQ,CAAC,SAAS,MAAM;CACrD,OAAO;EACL,aAAa,EACX,aAAa,SACd;EACD,QAAQ;GACN,iBAAiB;GACjB,OAAO,CACL,EACE,MAAM;IACJ,UAAU;IACV,UAAU,OAAO,KAAK,OAAO,CAAC,SAAS,MAAM;IAC9C,EACF,CACF;GACF;EACF;;AAGH,SAAgB,WAAW,cAAoB,SAAmD;CAChG,OAAO,IAAI,SAAS,YAAY;EAE9B,aAAa,SAAS,mBAAmB,SAA2B,OAAO,UAAU;GACnF,IAAI,CAAC,MAAM,QAAQ,SAAS,KAAK;GACjC,MAAM,MAAM,MAAM,QAAQ,SAAS;GACnC,QAAQ,IAAI;IACZ;GACF;;AAGJ,eAAsB,iBAAiB,QAA2C;CAEhF,MAAM,SAAS,MAAM,WAAW,QADhB,kBAAkB,yBACa,CAAC;CAEhD,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,UAAW,MAAM,OAAO;SACrB;EACN,MAAM,IAAI,MACR,2FACD;;CAGH,IAAI;CACJ,IAAI;EACF,YAAY,OAAO,OAAO;SACpB;EACN,MAAM,IAAI,MAAM,6CAA6C;;CAG/D,IAAI,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,IAAI,UAAU,OAAO;QACxB,IAAI,kBAAkB,aAAa;EACxC,MAAM,YAAY,MAAM,gBAAgB,QAA4B,cAAc;EAClF,IAAI,CAAC,WACH,MAAM,IAAI,MAAM,4CAA4C;EAE9D,OAAO;;;AAIX,eAAsB,gBACpB,QAC6D;CAE7D,IAAI,MADwB,iBAAiB,OAAkC,KACzD,QAAQ;EAE5B,MAAM,YAAY,MAAM,iBAAiB,OAAe;EAExD,OAAO;GAAE,SAAS,MADI,cAAc,OAAO;GACK;GAAqB;;CAEvE,OAAO,sBAAsB,OAA2B"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/xrp/utils.ts"],"sourcesContent":["import type * as GemWallet from \"@gemwallet/api\";\nimport type { Xumm } from \"xumm\";\nexport type WalletName = \"XAMAN\" | \"GEM\";\n\nexport interface WalletConfig {\n name: WalletName;\n instance: Xumm | typeof GemWallet;\n}\n\nexport type XamanConfig = {\n name: \"XAMAN\";\n instance: Xumm;\n};\n\nexport type GemConfig = {\n name: \"GEM\";\n instance: typeof GemWallet;\n};\n\nexport type WalletInitConfig = XamanConfig | GemConfig;\n\ntype XrpWallet = \"Xumm\" | \"GemWallet\";\n\nexport function createXummPayload(message: string): Record<string, unknown> {\n const memoData = Buffer.from(message).toString(\"hex\"); // Encode message as hex for Memos\n return {\n custom_meta: {\n instruction: message,\n },\n txjson: {\n TransactionType: \"SignIn\",\n Memos: [\n {\n Memo: {\n MemoData: memoData,\n MemoType: Buffer.from(\"idOS\").toString(\"hex\"), // Optional type identifier\n },\n },\n ],\n },\n };\n}\n\nexport function signXummTx(xummInstance: Xumm, payload: Record<string, unknown>): Promise<string> {\n return new Promise((resolve) => {\n // oxlint-disable-next-line typescript/no-explicit-any -- xumm payload type is not easy to import\n xummInstance.payload?.createAndSubscribe(payload as unknown as any, async (event) => {\n if (!event.payload.response.hex) return;\n const hex = event.payload.response.hex;\n resolve(hex);\n });\n });\n}\n\nexport async function getXummPublicKey(wallet: Xumm): Promise<string | undefined> {\n const payload = createXummPayload(\"Sign request from idOS\");\n const txHash = await signXummTx(wallet, payload);\n\n let decode: typeof import(\"xrpl\").decode;\n try {\n ({ decode } = await import(\"xrpl\"));\n } catch {\n throw new Error(\n 'Missing optional peer dependency \"xrpl\". Install it to use Xumm public-key extraction.',\n );\n }\n\n let decodedTx: { SigningPubKey?: string };\n try {\n decodedTx = decode(txHash);\n } catch {\n throw new Error(\"Failed to decode Xumm transaction payload.\");\n }\n\n if (!decodedTx.SigningPubKey) {\n throw new Error(\"SigningPubKey not found in decoded Xumm transaction.\");\n }\n\n return decodedTx.SigningPubKey;\n}\n\nexport function signGemWalletTx(\n gemWalletInstance: typeof GemWallet,\n message: string,\n): Promise<string | undefined> {\n return gemWalletInstance.signMessage(message).then((response) => response.result?.signedMessage);\n}\n\nexport async function getGemWalletPublicKey(\n wallet: typeof GemWallet,\n): Promise<{ address: string; publicKey: string } | undefined> {\n if (\"isInstalled\" in wallet) {\n await wallet.isInstalled();\n const { publicKey, address } = await wallet\n .getPublicKey()\n .then((res) => res.result as { publicKey: string; address: string });\n return { address, publicKey };\n }\n}\n\nexport async function getXrpAddress(wallet: Xumm | typeof GemWallet): Promise<string | undefined> {\n if (\"isInstalled\" in wallet) {\n await wallet.isInstalled();\n return wallet.getAddress().then((response) => response.result?.address);\n }\n return wallet.user.account;\n}\n\n// Type guard to check if the wallet is an Xumm wallet\nexport function looksLikeXrpWallet(wallet: unknown): wallet is Xumm | typeof GemWallet {\n return (\n wallet !== null &&\n typeof wallet === \"object\" &&\n (\"authorize\" in wallet || \"isInstalled\" in wallet)\n );\n}\n\nexport async function getXrpWalletType(object: Record<string, unknown>): Promise<XrpWallet> {\n if (\"authorize\" in object) {\n return \"Xumm\";\n }\n if (\"isInstalled\" in object) {\n return \"GemWallet\";\n }\n throw new Error(\"Unknown wallet type\");\n}\n\nexport async function getXrpTxHash(\n message: string | Uint8Array,\n wallet: Xumm | typeof GemWallet,\n): Promise<string | undefined> {\n let messageString: string;\n\n const xrpWalletType = await getXrpWalletType(wallet as Record<string, unknown>);\n\n messageString = typeof message === \"string\" ? message : Buffer.from(message).toString(\"utf8\"); // Decode Uint8Array to string\n if (xrpWalletType === \"Xumm\") {\n const memoData = Buffer.from(messageString).toString(\"hex\"); // Encode message as hex for Memos\n\n const payload = {\n custom_meta: {\n instruction: messageString,\n },\n txjson: {\n TransactionType: \"SignIn\",\n Memos: [\n {\n Memo: {\n MemoData: memoData,\n MemoType: Buffer.from(\"idOS\").toString(\"hex\"), // Optional type identifier\n },\n },\n ],\n },\n };\n const xummTx = await signXummTx(wallet as Xumm, payload);\n console.log(\"xummTx\", xummTx);\n } else if (xrpWalletType === \"GemWallet\") {\n const signature = await signGemWalletTx(wallet as typeof GemWallet, messageString);\n if (!signature) {\n throw new Error(\"Failed to sign transaction with GemWallet\");\n }\n return signature;\n }\n}\n\nexport async function getXrpPublicKey(\n wallet: Xumm | typeof GemWallet,\n): Promise<{ address: string; publicKey: string } | undefined> {\n const xrpWalletType = await getXrpWalletType(wallet as Record<string, unknown>);\n if (xrpWalletType === \"Xumm\") {\n // @todo: should we remove xaman wallet support?\n const publicKey = await getXummPublicKey(wallet as Xumm);\n const address = await getXrpAddress(wallet);\n return { address: address as string, publicKey: publicKey as string };\n }\n return getGemWalletPublicKey(wallet as typeof GemWallet);\n}\n"],"mappings":";AAuBA,SAAgB,kBAAkB,SAA0C;CAC1E,MAAM,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;CACpD,OAAO;EACL,aAAa,EACX,aAAa,QACf;EACA,QAAQ;GACN,iBAAiB;GACjB,OAAO,CACL,EACE,MAAM;IACJ,UAAU;IACV,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS,KAAK;GAC9C,EACF,CACF;EACF;CACF;AACF;AAEA,SAAgB,WAAW,cAAoB,SAAmD;CAChG,OAAO,IAAI,SAAS,YAAY;EAE9B,aAAa,SAAS,mBAAmB,SAA2B,OAAO,UAAU;GACnF,IAAI,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,aACpB,SACA,QAC6B;CAC7B,IAAI;CAEJ,MAAM,gBAAgB,MAAM,iBAAiB,MAAiC;CAE9E,gBAAgB,OAAO,YAAY,WAAW,UAAU,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM;CAC5F,IAAI,kBAAkB,QAAQ;EAC5B,MAAM,WAAW,OAAO,KAAK,aAAa,CAAC,CAAC,SAAS,KAAK;EAkB1D,MAAM,SAAS,MAAM,WAAW,QAAgB;GAf9C,aAAa,EACX,aAAa,cACf;GACA,QAAQ;IACN,iBAAiB;IACjB,OAAO,CACL,EACE,MAAM;KACJ,UAAU;KACV,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS,KAAK;IAC9C,EACF,CACF;GACF;EAEoD,CAAC;EACvD,QAAQ,IAAI,UAAU,MAAM;CAC9B,OAAO,IAAI,kBAAkB,aAAa;EACxC,MAAM,YAAY,MAAM,gBAAgB,QAA4B,aAAa;EACjF,IAAI,CAAC,WACH,MAAM,IAAI,MAAM,2CAA2C;EAE7D,OAAO;CACT;AACF;AAEA,eAAsB,gBACpB,QAC6D;CAE7D,IAAI,MADwB,iBAAiB,MAAiC,MACxD,QAAQ;EAE5B,MAAM,YAAY,MAAM,iBAAiB,MAAc;EAEvD,OAAO;GAAE,SAAS,MADI,cAAc,MAAM;GACM;EAAoB;CACtE;CACA,OAAO,sBAAsB,MAA0B;AACzD"}
@@ -1,177 +1,187 @@
1
- import * as _$xrpl from "xrpl";
2
1
  import { TxResponse, Wallet } from "xrpl";
3
-
4
2
  //#region src/xrpl-credentials/accept.d.ts
5
3
  /**
6
- * Payload structure for XRPL CredentialAccept transaction
7
- *
8
- * This type defines the required fields for creating a credential acceptance
9
- * transaction on the XRP Ledger. The CredentialType field is automatically
10
- * encoded as a hex string from the UTF-8 representation of the credential type.
11
- */
4
+ * Payload structure for XRPL CredentialAccept transaction
5
+ *
6
+ * This type defines the required fields for creating a credential acceptance
7
+ * transaction on the XRP Ledger. The CredentialType field is automatically
8
+ * encoded as a hex string from the UTF-8 representation of the credential type.
9
+ */
12
10
  type CredentialAcceptPayload = {
13
- /** Transaction type identifier - must be "CredentialAccept" */TransactionType: "CredentialAccept"; /** The issuer's XRPL address who created the Credential object */
14
- Issuer: string; /** The account's XRPL address who is receiving the credential */
15
- Account: string; /** The type of credential being accepted (encoded as hex string) */
11
+ /** Transaction type identifier - must be "CredentialAccept" */
12
+ TransactionType: "CredentialAccept";
13
+ /** The issuer's XRPL address who created the Credential object */
14
+ Issuer: string;
15
+ /** The account's XRPL address who is receiving the credential */
16
+ Account: string;
17
+ /** The type of credential being accepted (encoded as hex string) */
16
18
  CredentialType: string;
17
19
  };
18
20
  /**
19
- * Creates a credential acceptance payload for XRPL transactions
20
- *
21
- * This function constructs a properly formatted payload for credential acceptance
22
- * transactions. The credential type is automatically encoded from UTF-8 to hex
23
- * format as required by XRPL specifications.
24
- *
25
- * @param issuerAddress - The XRPL address of the credential issuer
26
- * @param accountAddress - The XRPL address of the account accepting the credential
27
- * @param credentialType - The human-readable idOS credential type (e.g., "KYC")
28
- * @returns A properly formatted CredentialAcceptPayload object
29
- *
30
- * @example
31
- * ```typescript
32
- * const payload = OriginalCredentialAcceptPayload(
33
- * "rIssuerAddress123...",
34
- * "rAccountAddress456...",
35
- * "KYC"
36
- * );
37
- * // Result: {
38
- * // TransactionType: "CredentialAccept",
39
- * // Issuer: "rIssuerAddress123...",
40
- * // Account: "rAccountAddress456...",
41
- * // CredentialType: "4B5943" // Hex encoded "KYC"
42
- * // }
43
- * ```
44
- */
21
+ * Creates a credential acceptance payload for XRPL transactions
22
+ *
23
+ * This function constructs a properly formatted payload for credential acceptance
24
+ * transactions. The credential type is automatically encoded from UTF-8 to hex
25
+ * format as required by XRPL specifications.
26
+ *
27
+ * @param issuerAddress - The XRPL address of the credential issuer
28
+ * @param accountAddress - The XRPL address of the account accepting the credential
29
+ * @param credentialType - The human-readable idOS credential type (e.g., "KYC")
30
+ * @returns A properly formatted CredentialAcceptPayload object
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const payload = OriginalCredentialAcceptPayload(
35
+ * "rIssuerAddress123...",
36
+ * "rAccountAddress456...",
37
+ * "KYC"
38
+ * );
39
+ * // Result: {
40
+ * // TransactionType: "CredentialAccept",
41
+ * // Issuer: "rIssuerAddress123...",
42
+ * // Account: "rAccountAddress456...",
43
+ * // CredentialType: "4B5943" // Hex encoded "KYC"
44
+ * // }
45
+ * ```
46
+ */
45
47
  declare function OriginalCredentialAcceptPayload(issuerAddress: string, accountAddress: string, credentialType: string): CredentialAcceptPayload;
46
48
  /**
47
- * Creates a copy credential acceptance payload for XRPL transactions
48
- *
49
- * This function constructs a payload for accepting a copy of an existing credential
50
- * with additional metadata including the original issuer and a timelock period.
51
- * The CredentialType field is encoded as a composite string containing:
52
- * - "AG-" prefix (indicating copy credential)
53
- * - Original credential type
54
- * - Original issuer address
55
- * - Timelock period in years
56
- *
57
- * @param copyCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS credential copy
58
- * @param accountAddress - The XRPL address of the account accepting the credential copy
59
- * @param originalCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS original credential
60
- * @param credentialType - The human-readable idOScredential type (e.g., "KYC")
61
- * @param timelockYears - The number of years for the timelock period (must be non-negative integer)
62
- * @returns A properly formatted CredentialAcceptPayload object for copy credentials
63
- * @throws {Error} When timelockYears is not a non-negative integer
64
- *
65
- * @example
66
- * ```typescript
67
- * const payload = await CopyCredentialAcceptPayload(
68
- * "rCopyIssuerAddress123...",
69
- * "rAccountAddress456...",
70
- * "rOriginalIssuerAddress789...",
71
- * "KYC",
72
- * 2
73
- * );
74
- * // Result: {
75
- * // TransactionType: "CredentialAccept",
76
- * // Issuer: "rCopyIssuerAddress123...",
77
- * // Account: "rAccountAddress456...",
78
- * // CredentialType: "41472D4B59432D..." // Hex encoded "AG-KYC-{originalIssuer}-2Y"
79
- * // }
80
- * ```
81
- */
49
+ * Creates a copy credential acceptance payload for XRPL transactions
50
+ *
51
+ * This function constructs a payload for accepting a copy of an existing credential
52
+ * with additional metadata including the original issuer and a timelock period.
53
+ * The CredentialType field is encoded as a composite string containing:
54
+ * - "AG-" prefix (indicating copy credential)
55
+ * - Original credential type
56
+ * - Original issuer address
57
+ * - Timelock period in years
58
+ *
59
+ * @param copyCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS credential copy
60
+ * @param accountAddress - The XRPL address of the account accepting the credential copy
61
+ * @param originalCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS original credential
62
+ * @param credentialType - The human-readable idOScredential type (e.g., "KYC")
63
+ * @param timelockYears - The number of years for the timelock period (must be non-negative integer)
64
+ * @returns A properly formatted CredentialAcceptPayload object for copy credentials
65
+ * @throws {Error} When timelockYears is not a non-negative integer
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const payload = await CopyCredentialAcceptPayload(
70
+ * "rCopyIssuerAddress123...",
71
+ * "rAccountAddress456...",
72
+ * "rOriginalIssuerAddress789...",
73
+ * "KYC",
74
+ * 2
75
+ * );
76
+ * // Result: {
77
+ * // TransactionType: "CredentialAccept",
78
+ * // Issuer: "rCopyIssuerAddress123...",
79
+ * // Account: "rAccountAddress456...",
80
+ * // CredentialType: "41472D4B59432D..." // Hex encoded "AG-KYC-{originalIssuer}-2Y"
81
+ * // }
82
+ * ```
83
+ */
82
84
  declare function CopyCredentialAcceptPayload(copyCredentialIssuerAddress: string, accountAddress: string, originalCredentialIssuerAddress: string, credentialType: string, timelockYears: number): Promise<CredentialAcceptPayload>;
83
85
  //#endregion
84
86
  //#region src/xrpl-credentials/create.d.ts
85
87
  /**
86
- * Parameters for creating an original credential on XRPL
87
- */
88
+ * Parameters for creating an original credential on XRPL
89
+ */
88
90
  type CreateCredentialForOriginalParams = {
89
- /** Unique identifier for the idOS credential, like `741a9caf-ec53-42c7-aed6-519950dcded5` */credId: string; /** Type/category of the credential, like `KYC` */
90
- credType: string; /** XRPL address of the user receiving the credential, like `rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe` */
91
+ /** Unique identifier for the idOS credential, like `741a9caf-ec53-42c7-aed6-519950dcded5` */
92
+ credId: string;
93
+ /** Type/category of the credential, like `KYC` */
94
+ credType: string;
95
+ /** XRPL address of the user receiving the credential, like `rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe` */
91
96
  userAddress: string;
92
97
  };
93
98
  /**
94
- * Parameters for creating a time-locked copy credential on XRPL
95
- */
99
+ * Parameters for creating a time-locked copy credential on XRPL
100
+ */
96
101
  type CreateCredentialForCopyParams = {
97
- /** Unique identifier for the idOS credential */credId: string; /** Type/category of the credential */
98
- credType: string; /** XRPL address of the user receiving the credential */
99
- userAddress: string; /** Number of years to lock the credential (must be non-negative integer) */
100
- timelockYears: number; /** XRPL address of the original credential issuer */
102
+ /** Unique identifier for the idOS credential */
103
+ credId: string;
104
+ /** Type/category of the credential */
105
+ credType: string;
106
+ /** XRPL address of the user receiving the credential */
107
+ userAddress: string;
108
+ /** Number of years to lock the credential (must be non-negative integer) */
109
+ timelockYears: number;
110
+ /** XRPL address of the original credential issuer */
101
111
  origCredIssuerAddress: string;
102
112
  };
103
113
  /**
104
- * Service class for creating credentials on the XRPL blockchain
105
- *
106
- * This service provides methods to create both original and copy credentials
107
- * on the XRPL. It handles connection management, transaction submission,
108
- * and proper encoding of credential data according to XRPL specifications.
109
- *
110
- * @example
111
- * ```typescript
112
- * const wallet = Wallet.fromSeed("s...");
113
- * const xrplService = await XrplCredentialsCreate.init("wss://s.devnet.rippletest.net:51233", wallet);
114
- *
115
- * // Create original credential
116
- * await xrplService.createCredentialForOriginal({
117
- * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
118
- * credType: "KYC",
119
- * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe"
120
- * });
121
- * ```
122
- */
114
+ * Service class for creating credentials on the XRPL blockchain
115
+ *
116
+ * This service provides methods to create both original and copy credentials
117
+ * on the XRPL. It handles connection management, transaction submission,
118
+ * and proper encoding of credential data according to XRPL specifications.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const wallet = Wallet.fromSeed("s...");
123
+ * const xrplService = await XrplCredentialsCreate.init("wss://s.devnet.rippletest.net:51233", wallet);
124
+ *
125
+ * // Create original credential
126
+ * await xrplService.createCredentialForOriginal({
127
+ * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
128
+ * credType: "KYC",
129
+ * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe"
130
+ * });
131
+ * ```
132
+ */
123
133
  declare class XrplCredentialsCreate {
124
134
  #private;
125
- constructor(nodeUrl: string, wallet: Wallet, xrpl: typeof _$xrpl);
135
+ constructor(nodeUrl: string, wallet: Wallet, xrpl: typeof import("xrpl"));
126
136
  /**
127
- * Creates a new XRPL credentials service instance.
128
- *
129
- * @param nodeUrl - The WebSocket URL of the XRPL node to connect to
130
- * @param wallet - The XRPL wallet to use for signing transactions
131
- */
137
+ * Creates a new XRPL credentials service instance.
138
+ *
139
+ * @param nodeUrl - The WebSocket URL of the XRPL node to connect to
140
+ * @param wallet - The XRPL wallet to use for signing transactions
141
+ */
132
142
  static init(nodeUrl: string, wallet: Wallet): Promise<XrplCredentialsCreate>;
133
143
  /**
134
- * Creates a credential on the XRPL that reflects an idOS original credential.
135
- *
136
- * This method creates a new credential with the specified type and assigns it to the given user.
137
- * The credential type is encoded as a hex string, and the credential ID is encoded as a hex URI.
138
- *
139
- * @param params - Parameters for creating the original credential
140
- * @returns Promise resolving to the XRPL transaction result
141
- *
142
- * @example
143
- * ```typescript
144
- * await xrplService.createCredentialForOriginal({
145
- * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
146
- * credType: "KYC",
147
- * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe"
148
- * });
149
- * ```
150
- */
144
+ * Creates a credential on the XRPL that reflects an idOS original credential.
145
+ *
146
+ * This method creates a new credential with the specified type and assigns it to the given user.
147
+ * The credential type is encoded as a hex string, and the credential ID is encoded as a hex URI.
148
+ *
149
+ * @param params - Parameters for creating the original credential
150
+ * @returns Promise resolving to the XRPL transaction result
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * await xrplService.createCredentialForOriginal({
155
+ * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
156
+ * credType: "KYC",
157
+ * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe"
158
+ * });
159
+ * ```
160
+ */
151
161
  createCredentialForOriginal(params: CreateCredentialForOriginalParams): Promise<TxResponse>;
152
162
  /**
153
- * Creates a time-locked credential copy on the XRPL.
154
- *
155
- * This method creates a Credential object in XRPL that reflects an idOS credential copy.
156
- * The credential type includes metadata about the original issuer and time-lock duration.
157
- * The composite credential type follows the format: "AG-{type}-{originalIssuer}-{timelock}Y"
158
- *
159
- * @param params - Parameters for creating the time-locked credential copy
160
- * @returns Promise resolving to the XRPL transaction result
161
- *
162
- * @throws {Error} When timelockYears is not a non-negative integer
163
- *
164
- * @example
165
- * ```typescript
166
- * const result = await xrplService.createCredentialForCopy({
167
- * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
168
- * credType: "KYC",
169
- * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe",
170
- * timelockYears: 5,
171
- * origCredIssuerAddress: "rU9C67bZ3ZvjXaJYwYqMqjMq1o4ZbwK3YN"
172
- * });
173
- * ```
174
- */
163
+ * Creates a time-locked credential copy on the XRPL.
164
+ *
165
+ * This method creates a Credential object in XRPL that reflects an idOS credential copy.
166
+ * The credential type includes metadata about the original issuer and time-lock duration.
167
+ * The composite credential type follows the format: "AG-{type}-{originalIssuer}-{timelock}Y"
168
+ *
169
+ * @param params - Parameters for creating the time-locked credential copy
170
+ * @returns Promise resolving to the XRPL transaction result
171
+ *
172
+ * @throws {Error} When timelockYears is not a non-negative integer
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * const result = await xrplService.createCredentialForCopy({
177
+ * credId: "741a9caf-ec53-42c7-aed6-519950dcded5",
178
+ * credType: "KYC",
179
+ * userAddress: "rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe",
180
+ * timelockYears: 5,
181
+ * origCredIssuerAddress: "rU9C67bZ3ZvjXaJYwYqMqjMq1o4ZbwK3YN"
182
+ * });
183
+ * ```
184
+ */
175
185
  createCredentialForCopy(params: CreateCredentialForCopyParams): Promise<TxResponse>;
176
186
  }
177
187
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/xrpl-credentials/accept.ts","../../src/xrpl-credentials/create.ts"],"mappings":";;;;;;;;AASA;;;KAAY,uBAAA;iEAEV,eAAA;EAEA,MAAA;EAEA,OAAA,UAgCF;EA9BE,cAAA;AAAA;;;;;;;;AAmFF;;;;;;;;;;;;;;;;AC7FA;;;;iBDwCgB,+BAAA,CACd,aAAA,UACA,cAAA,UACA,cAAA,WACC,uBAAA;;;;;AChCH;;;;;;;;;;;AAiCA;;;;;;;;;;;;;;;;;;;;;iBDgDsB,2BAAA,CACpB,2BAAA,UACA,cAAA,UACA,+BAAA,UACA,cAAA,UACA,aAAA,WACC,OAAA,CAAQ,uBAAA;;;;;;KCnGC,iCAAA;EDEA,6FCAV,MAAA,UDAU;ECEV,QAAA;EAEA,WAAA;AAAA;;;ADkCF;KC5BY,6BAAA;kDAEV,MAAA;EAEA,QAAA;EAEA,WAAA;EAEA,aAAA,UDyEF;ECvEE,qBAAA;AAAA;;;;;;;;;;;;;;AAtBF;;;;;;;cA6Ca,qBAAA;EAAA;EAKX,WAAA,CAAY,OAAA,UAAiB,MAAA,EAAQ,MAAA,EAAQ,IAAA,SAAR,MAAA;EAtC3B;;;;;;EAAA,OAkDG,IAAA,CAAK,OAAA,UAAiB,MAAA,EAAQ,MAAA,GAAS,OAAA,CAAQ,qBAAA;;;;AAjB9D;;;;;;;;;;;;;;;EAiDE,2BAAA,CACE,MAAA,EAAQ,iCAAA,GACP,OAAA,CAAQ,UAAA;;;;;;;;;;;;;;;;;;;;;;;;EAmDX,uBAAA,CAA8B,MAAA,EAAQ,6BAAA,GAAgC,OAAA,CAAQ,UAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/xrpl-credentials/accept.ts","../../src/xrpl-credentials/create.ts"],"mappings":";;;;;;;;;KASY;;EAEV;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8Bc,gCACd,uBACA,wBACA,yBACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiDmB,4BACpB,qCACA,wBACA,yCACA,wBACA,wBACC,QAAQ;;;;;;KCnGC;;EAEV;;EAEA;;EAEA;;;;;KAMU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;cAuBW;;EAKX,YAAY,iBAAiB,QAAQ,QAAQ;;;;;;;SAYhC,KAAK,iBAAiB,QAAQ,SAAS,QAAQ;;;;;;;;;;;;;;;;;;;EAgC5D,4BACE,QAAQ,oCACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;EAmDX,wBAA8B,QAAQ,gCAAgC,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["#client","#wallet","#xrpl"],"sources":["../../src/xrpl-credentials/accept.ts","../../src/xrpl-credentials/create.ts"],"sourcesContent":["import { hexEncode, utf8Encode } from \"@idos-network/utils/codecs\";\n\n/**\n * Payload structure for XRPL CredentialAccept transaction\n *\n * This type defines the required fields for creating a credential acceptance\n * transaction on the XRP Ledger. The CredentialType field is automatically\n * encoded as a hex string from the UTF-8 representation of the credential type.\n */\nexport type CredentialAcceptPayload = {\n /** Transaction type identifier - must be \"CredentialAccept\" */\n TransactionType: \"CredentialAccept\";\n /** The issuer's XRPL address who created the Credential object */\n Issuer: string;\n /** The account's XRPL address who is receiving the credential */\n Account: string;\n /** The type of credential being accepted (encoded as hex string) */\n CredentialType: string;\n};\n\n/**\n * Creates a credential acceptance payload for XRPL transactions\n *\n * This function constructs a properly formatted payload for credential acceptance\n * transactions. The credential type is automatically encoded from UTF-8 to hex\n * format as required by XRPL specifications.\n *\n * @param issuerAddress - The XRPL address of the credential issuer\n * @param accountAddress - The XRPL address of the account accepting the credential\n * @param credentialType - The human-readable idOS credential type (e.g., \"KYC\")\n * @returns A properly formatted CredentialAcceptPayload object\n *\n * @example\n * ```typescript\n * const payload = OriginalCredentialAcceptPayload(\n * \"rIssuerAddress123...\",\n * \"rAccountAddress456...\",\n * \"KYC\"\n * );\n * // Result: {\n * // TransactionType: \"CredentialAccept\",\n * // Issuer: \"rIssuerAddress123...\",\n * // Account: \"rAccountAddress456...\",\n * // CredentialType: \"4B5943\" // Hex encoded \"KYC\"\n * // }\n * ```\n */\nexport function OriginalCredentialAcceptPayload(\n issuerAddress: string,\n accountAddress: string,\n credentialType: string,\n): CredentialAcceptPayload {\n // Encode the credential type from UTF-8 to hex format\n // This is required by XRPL for proper transaction processing\n const encodedCredentialType = hexEncode(utf8Encode(credentialType));\n\n return {\n TransactionType: \"CredentialAccept\",\n Issuer: issuerAddress,\n Account: accountAddress,\n CredentialType: encodedCredentialType,\n };\n}\n\n/**\n * Creates a copy credential acceptance payload for XRPL transactions\n *\n * This function constructs a payload for accepting a copy of an existing credential\n * with additional metadata including the original issuer and a timelock period.\n * The CredentialType field is encoded as a composite string containing:\n * - \"AG-\" prefix (indicating copy credential)\n * - Original credential type\n * - Original issuer address\n * - Timelock period in years\n *\n * @param copyCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS credential copy\n * @param accountAddress - The XRPL address of the account accepting the credential copy\n * @param originalCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS original credential\n * @param credentialType - The human-readable idOScredential type (e.g., \"KYC\")\n * @param timelockYears - The number of years for the timelock period (must be non-negative integer)\n * @returns A properly formatted CredentialAcceptPayload object for copy credentials\n * @throws {Error} When timelockYears is not a non-negative integer\n *\n * @example\n * ```typescript\n * const payload = await CopyCredentialAcceptPayload(\n * \"rCopyIssuerAddress123...\",\n * \"rAccountAddress456...\",\n * \"rOriginalIssuerAddress789...\",\n * \"KYC\",\n * 2\n * );\n * // Result: {\n * // TransactionType: \"CredentialAccept\",\n * // Issuer: \"rCopyIssuerAddress123...\",\n * // Account: \"rAccountAddress456...\",\n * // CredentialType: \"41472D4B59432D...\" // Hex encoded \"AG-KYC-{originalIssuer}-2Y\"\n * // }\n * ```\n */\nexport async function CopyCredentialAcceptPayload(\n copyCredentialIssuerAddress: string,\n accountAddress: string,\n originalCredentialIssuerAddress: string,\n credentialType: string,\n timelockYears: number,\n): Promise<CredentialAcceptPayload> {\n // Validate that timelockYears is a non-negative integer\n if (!Number.isInteger(timelockYears) || timelockYears < 0) {\n throw new Error(\"timelockYears must be a non-negative integer\");\n }\n\n let decodeAccountID: typeof import(\"xrpl\").decodeAccountID;\n try {\n ({ decodeAccountID } = await import(\"xrpl\"));\n } catch {\n throw new Error(\n 'Missing optional peer dependency \"xrpl\". Install it to use CopyCredentialAcceptPayload.',\n );\n }\n\n // Create a composite credential type string that includes:\n // - \"AG-\" prefix (indicating this is a copy credential)\n // - Original credential type\n // - Original issuer Account ID (decoded from XRPL address format)\n // - Timelock period in years\n const type = Buffer.concat([\n utf8Encode(\"AG\"),\n utf8Encode(\"-\"),\n utf8Encode(credentialType),\n utf8Encode(\"-\"),\n decodeAccountID(originalCredentialIssuerAddress),\n utf8Encode(\"-\"),\n utf8Encode(`${timelockYears}Y`),\n ]);\n\n return {\n TransactionType: \"CredentialAccept\",\n Issuer: copyCredentialIssuerAddress,\n Account: accountAddress,\n CredentialType: hexEncode(type),\n };\n}\n","import type { Client, TxResponse, Wallet } from \"xrpl\";\n\nimport { hexEncode, utf8Encode } from \"@idos-network/utils/codecs\";\n\n/**\n * Parameters for creating an original credential on XRPL\n */\nexport type CreateCredentialForOriginalParams = {\n /** Unique identifier for the idOS credential, like `741a9caf-ec53-42c7-aed6-519950dcded5` */\n credId: string;\n /** Type/category of the credential, like `KYC` */\n credType: string;\n /** XRPL address of the user receiving the credential, like `rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe` */\n userAddress: string;\n};\n\n/**\n * Parameters for creating a time-locked copy credential on XRPL\n */\nexport type CreateCredentialForCopyParams = {\n /** Unique identifier for the idOS credential */\n credId: string;\n /** Type/category of the credential */\n credType: string;\n /** XRPL address of the user receiving the credential */\n userAddress: string;\n /** Number of years to lock the credential (must be non-negative integer) */\n timelockYears: number;\n /** XRPL address of the original credential issuer */\n origCredIssuerAddress: string;\n};\n\n/**\n * Service class for creating credentials on the XRPL blockchain\n *\n * This service provides methods to create both original and copy credentials\n * on the XRPL. It handles connection management, transaction submission,\n * and proper encoding of credential data according to XRPL specifications.\n *\n * @example\n * ```typescript\n * const wallet = Wallet.fromSeed(\"s...\");\n * const xrplService = await XrplCredentialsCreate.init(\"wss://s.devnet.rippletest.net:51233\", wallet);\n *\n * // Create original credential\n * await xrplService.createCredentialForOriginal({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\"\n * });\n * ```\n */\nexport class XrplCredentialsCreate {\n readonly #client: Client;\n readonly #wallet: Wallet;\n readonly #xrpl: typeof import(\"xrpl\");\n\n constructor(nodeUrl: string, wallet: Wallet, xrpl: typeof import(\"xrpl\")) {\n this.#xrpl = xrpl;\n this.#wallet = wallet;\n this.#client = new this.#xrpl.Client(nodeUrl);\n }\n\n /**\n * Creates a new XRPL credentials service instance.\n *\n * @param nodeUrl - The WebSocket URL of the XRPL node to connect to\n * @param wallet - The XRPL wallet to use for signing transactions\n */\n static async init(nodeUrl: string, wallet: Wallet): Promise<XrplCredentialsCreate> {\n let xrpl: typeof import(\"xrpl\");\n\n try {\n xrpl = await import(\"xrpl\");\n } catch {\n throw new Error(\n \"Missing optional peer dependency 'xrpl'. Install it to use XrplCredentialsCreate.\",\n );\n }\n\n return new XrplCredentialsCreate(nodeUrl, wallet, xrpl);\n }\n\n /**\n * Creates a credential on the XRPL that reflects an idOS original credential.\n *\n * This method creates a new credential with the specified type and assigns it to the given user.\n * The credential type is encoded as a hex string, and the credential ID is encoded as a hex URI.\n *\n * @param params - Parameters for creating the original credential\n * @returns Promise resolving to the XRPL transaction result\n *\n * @example\n * ```typescript\n * await xrplService.createCredentialForOriginal({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\"\n * });\n * ```\n */\n async createCredentialForOriginal(\n params: CreateCredentialForOriginalParams,\n ): Promise<TxResponse> {\n const { credId, credType, userAddress } = params;\n\n // Connect to the XRPL node\n await this.#client.connect();\n\n // Submit the credential creation transaction and wait for confirmation\n const res = await this.#client.submitAndWait(\n {\n TransactionType: \"CredentialCreate\",\n Account: this.#wallet.address,\n Subject: userAddress,\n // Encode credential type as hex string (required by XRPL)\n CredentialType: hexEncode(utf8Encode(credType)),\n // Encode credential ID as hex URI (required by XRPL)\n URI: hexEncode(utf8Encode(credId)),\n },\n {\n wallet: this.#wallet,\n },\n );\n\n // Disconnect from the XRPL node\n await this.#client.disconnect();\n\n return res;\n }\n\n /**\n * Creates a time-locked credential copy on the XRPL.\n *\n * This method creates a Credential object in XRPL that reflects an idOS credential copy.\n * The credential type includes metadata about the original issuer and time-lock duration.\n * The composite credential type follows the format: \"AG-{type}-{originalIssuer}-{timelock}Y\"\n *\n * @param params - Parameters for creating the time-locked credential copy\n * @returns Promise resolving to the XRPL transaction result\n *\n * @throws {Error} When timelockYears is not a non-negative integer\n *\n * @example\n * ```typescript\n * const result = await xrplService.createCredentialForCopy({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\",\n * timelockYears: 5,\n * origCredIssuerAddress: \"rU9C67bZ3ZvjXaJYwYqMqjMq1o4ZbwK3YN\"\n * });\n * ```\n */\n async createCredentialForCopy(params: CreateCredentialForCopyParams): Promise<TxResponse> {\n const { credId, credType, userAddress, timelockYears, origCredIssuerAddress } = params;\n\n // Validate timelockYears is a non-negative integer\n if (!Number.isInteger(timelockYears) || timelockYears < 0) {\n throw new Error(\"timelockYears must be a non-negative integer\");\n }\n\n // Connect to the XRPL node\n await this.#client.connect();\n\n // Create composite credential type with metadata:\n // Format: \"AG-{credType}-{originalIssuer}-{timelock}Y\"\n const type = Buffer.concat([\n utf8Encode(\"AG\"), // \"AG\" prefix for copy credentials\n utf8Encode(\"-\"), // Separator\n utf8Encode(credType), // Original credential type\n utf8Encode(\"-\"), // Separator\n this.#xrpl.decodeAccountID(origCredIssuerAddress), // Original issuer address (decoded)\n utf8Encode(\"-\"), // Separator\n utf8Encode(`${timelockYears}Y`), // Timelock period in years\n ]);\n\n // Submit the credential copy creation transaction and wait for confirmation\n const res = await this.#client.submitAndWait(\n {\n TransactionType: \"CredentialCreate\",\n Account: this.#wallet.address,\n Subject: userAddress,\n // Use the composite credential type with metadata\n CredentialType: hexEncode(type),\n // Encode credential ID as hex URI (required by XRPL)\n URI: hexEncode(utf8Encode(credId)),\n },\n {\n wallet: this.#wallet,\n },\n );\n\n // Disconnect from the XRPL node\n await this.#client.disconnect();\n\n return res;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,gCACd,eACA,gBACA,gBACyB;CAKzB,OAAO;EACL,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,gBAN4B,UAAU,WAAW,eAAe,CAM3B;EACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCH,eAAsB,4BACpB,6BACA,gBACA,iCACA,gBACA,eACkC;CAElC,IAAI,CAAC,OAAO,UAAU,cAAc,IAAI,gBAAgB,GACtD,MAAM,IAAI,MAAM,+CAA+C;CAGjE,I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cAAc,IAAI,gBAAgB,GACtD,MAAM,IAAI,MAAM,+CAA+C;EAIjE,MAAM,KAAKA,QAAQ,SAAS;EAI5B,MAAM,OAAO,OAAO,OAAO;GACzB,WAAW,KAAK;GAChB,WAAW,IAAI;GACf,WAAW,SAAS;GACpB,WAAW,IAAI;GACf,KAAKE,MAAM,gBAAgB,sBAAsB;GACjD,WAAW,IAAI;GACf,WAAW,GAAG,cAAc,GAAG;GAChC,CAAC;EAGF,MAAM,MAAM,MAAM,KAAKF,QAAQ,cAC7B;GACE,iBAAiB;GACjB,SAAS,KAAKC,QAAQ;GACtB,SAAS;GAET,gBAAgB,UAAU,KAAK;GAE/B,KAAK,UAAU,WAAW,OAAO,CAAC;GACnC,EACD,EACE,QAAQ,KAAKA,SACd,CACF;EAGD,MAAM,KAAKD,QAAQ,YAAY;EAE/B,OAAO"}
1
+ {"version":3,"file":"index.mjs","names":["#client","#wallet","#xrpl"],"sources":["../../src/xrpl-credentials/accept.ts","../../src/xrpl-credentials/create.ts"],"sourcesContent":["import { hexEncode, utf8Encode } from \"@idos-network/utils/codecs\";\n\n/**\n * Payload structure for XRPL CredentialAccept transaction\n *\n * This type defines the required fields for creating a credential acceptance\n * transaction on the XRP Ledger. The CredentialType field is automatically\n * encoded as a hex string from the UTF-8 representation of the credential type.\n */\nexport type CredentialAcceptPayload = {\n /** Transaction type identifier - must be \"CredentialAccept\" */\n TransactionType: \"CredentialAccept\";\n /** The issuer's XRPL address who created the Credential object */\n Issuer: string;\n /** The account's XRPL address who is receiving the credential */\n Account: string;\n /** The type of credential being accepted (encoded as hex string) */\n CredentialType: string;\n};\n\n/**\n * Creates a credential acceptance payload for XRPL transactions\n *\n * This function constructs a properly formatted payload for credential acceptance\n * transactions. The credential type is automatically encoded from UTF-8 to hex\n * format as required by XRPL specifications.\n *\n * @param issuerAddress - The XRPL address of the credential issuer\n * @param accountAddress - The XRPL address of the account accepting the credential\n * @param credentialType - The human-readable idOS credential type (e.g., \"KYC\")\n * @returns A properly formatted CredentialAcceptPayload object\n *\n * @example\n * ```typescript\n * const payload = OriginalCredentialAcceptPayload(\n * \"rIssuerAddress123...\",\n * \"rAccountAddress456...\",\n * \"KYC\"\n * );\n * // Result: {\n * // TransactionType: \"CredentialAccept\",\n * // Issuer: \"rIssuerAddress123...\",\n * // Account: \"rAccountAddress456...\",\n * // CredentialType: \"4B5943\" // Hex encoded \"KYC\"\n * // }\n * ```\n */\nexport function OriginalCredentialAcceptPayload(\n issuerAddress: string,\n accountAddress: string,\n credentialType: string,\n): CredentialAcceptPayload {\n // Encode the credential type from UTF-8 to hex format\n // This is required by XRPL for proper transaction processing\n const encodedCredentialType = hexEncode(utf8Encode(credentialType));\n\n return {\n TransactionType: \"CredentialAccept\",\n Issuer: issuerAddress,\n Account: accountAddress,\n CredentialType: encodedCredentialType,\n };\n}\n\n/**\n * Creates a copy credential acceptance payload for XRPL transactions\n *\n * This function constructs a payload for accepting a copy of an existing credential\n * with additional metadata including the original issuer and a timelock period.\n * The CredentialType field is encoded as a composite string containing:\n * - \"AG-\" prefix (indicating copy credential)\n * - Original credential type\n * - Original issuer address\n * - Timelock period in years\n *\n * @param copyCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS credential copy\n * @param accountAddress - The XRPL address of the account accepting the credential copy\n * @param originalCredentialIssuerAddress - The XRPL address of the issuer created a XRPL Credential object related to idOS original credential\n * @param credentialType - The human-readable idOScredential type (e.g., \"KYC\")\n * @param timelockYears - The number of years for the timelock period (must be non-negative integer)\n * @returns A properly formatted CredentialAcceptPayload object for copy credentials\n * @throws {Error} When timelockYears is not a non-negative integer\n *\n * @example\n * ```typescript\n * const payload = await CopyCredentialAcceptPayload(\n * \"rCopyIssuerAddress123...\",\n * \"rAccountAddress456...\",\n * \"rOriginalIssuerAddress789...\",\n * \"KYC\",\n * 2\n * );\n * // Result: {\n * // TransactionType: \"CredentialAccept\",\n * // Issuer: \"rCopyIssuerAddress123...\",\n * // Account: \"rAccountAddress456...\",\n * // CredentialType: \"41472D4B59432D...\" // Hex encoded \"AG-KYC-{originalIssuer}-2Y\"\n * // }\n * ```\n */\nexport async function CopyCredentialAcceptPayload(\n copyCredentialIssuerAddress: string,\n accountAddress: string,\n originalCredentialIssuerAddress: string,\n credentialType: string,\n timelockYears: number,\n): Promise<CredentialAcceptPayload> {\n // Validate that timelockYears is a non-negative integer\n if (!Number.isInteger(timelockYears) || timelockYears < 0) {\n throw new Error(\"timelockYears must be a non-negative integer\");\n }\n\n let decodeAccountID: typeof import(\"xrpl\").decodeAccountID;\n try {\n ({ decodeAccountID } = await import(\"xrpl\"));\n } catch {\n throw new Error(\n 'Missing optional peer dependency \"xrpl\". Install it to use CopyCredentialAcceptPayload.',\n );\n }\n\n // Create a composite credential type string that includes:\n // - \"AG-\" prefix (indicating this is a copy credential)\n // - Original credential type\n // - Original issuer Account ID (decoded from XRPL address format)\n // - Timelock period in years\n const type = Buffer.concat([\n utf8Encode(\"AG\"),\n utf8Encode(\"-\"),\n utf8Encode(credentialType),\n utf8Encode(\"-\"),\n decodeAccountID(originalCredentialIssuerAddress),\n utf8Encode(\"-\"),\n utf8Encode(`${timelockYears}Y`),\n ]);\n\n return {\n TransactionType: \"CredentialAccept\",\n Issuer: copyCredentialIssuerAddress,\n Account: accountAddress,\n CredentialType: hexEncode(type),\n };\n}\n","import type { Client, TxResponse, Wallet } from \"xrpl\";\n\nimport { hexEncode, utf8Encode } from \"@idos-network/utils/codecs\";\n\n/**\n * Parameters for creating an original credential on XRPL\n */\nexport type CreateCredentialForOriginalParams = {\n /** Unique identifier for the idOS credential, like `741a9caf-ec53-42c7-aed6-519950dcded5` */\n credId: string;\n /** Type/category of the credential, like `KYC` */\n credType: string;\n /** XRPL address of the user receiving the credential, like `rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe` */\n userAddress: string;\n};\n\n/**\n * Parameters for creating a time-locked copy credential on XRPL\n */\nexport type CreateCredentialForCopyParams = {\n /** Unique identifier for the idOS credential */\n credId: string;\n /** Type/category of the credential */\n credType: string;\n /** XRPL address of the user receiving the credential */\n userAddress: string;\n /** Number of years to lock the credential (must be non-negative integer) */\n timelockYears: number;\n /** XRPL address of the original credential issuer */\n origCredIssuerAddress: string;\n};\n\n/**\n * Service class for creating credentials on the XRPL blockchain\n *\n * This service provides methods to create both original and copy credentials\n * on the XRPL. It handles connection management, transaction submission,\n * and proper encoding of credential data according to XRPL specifications.\n *\n * @example\n * ```typescript\n * const wallet = Wallet.fromSeed(\"s...\");\n * const xrplService = await XrplCredentialsCreate.init(\"wss://s.devnet.rippletest.net:51233\", wallet);\n *\n * // Create original credential\n * await xrplService.createCredentialForOriginal({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\"\n * });\n * ```\n */\nexport class XrplCredentialsCreate {\n readonly #client: Client;\n readonly #wallet: Wallet;\n readonly #xrpl: typeof import(\"xrpl\");\n\n constructor(nodeUrl: string, wallet: Wallet, xrpl: typeof import(\"xrpl\")) {\n this.#xrpl = xrpl;\n this.#wallet = wallet;\n this.#client = new this.#xrpl.Client(nodeUrl);\n }\n\n /**\n * Creates a new XRPL credentials service instance.\n *\n * @param nodeUrl - The WebSocket URL of the XRPL node to connect to\n * @param wallet - The XRPL wallet to use for signing transactions\n */\n static async init(nodeUrl: string, wallet: Wallet): Promise<XrplCredentialsCreate> {\n let xrpl: typeof import(\"xrpl\");\n\n try {\n xrpl = await import(\"xrpl\");\n } catch {\n throw new Error(\n \"Missing optional peer dependency 'xrpl'. Install it to use XrplCredentialsCreate.\",\n );\n }\n\n return new XrplCredentialsCreate(nodeUrl, wallet, xrpl);\n }\n\n /**\n * Creates a credential on the XRPL that reflects an idOS original credential.\n *\n * This method creates a new credential with the specified type and assigns it to the given user.\n * The credential type is encoded as a hex string, and the credential ID is encoded as a hex URI.\n *\n * @param params - Parameters for creating the original credential\n * @returns Promise resolving to the XRPL transaction result\n *\n * @example\n * ```typescript\n * await xrplService.createCredentialForOriginal({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\"\n * });\n * ```\n */\n async createCredentialForOriginal(\n params: CreateCredentialForOriginalParams,\n ): Promise<TxResponse> {\n const { credId, credType, userAddress } = params;\n\n // Connect to the XRPL node\n await this.#client.connect();\n\n // Submit the credential creation transaction and wait for confirmation\n const res = await this.#client.submitAndWait(\n {\n TransactionType: \"CredentialCreate\",\n Account: this.#wallet.address,\n Subject: userAddress,\n // Encode credential type as hex string (required by XRPL)\n CredentialType: hexEncode(utf8Encode(credType)),\n // Encode credential ID as hex URI (required by XRPL)\n URI: hexEncode(utf8Encode(credId)),\n },\n {\n wallet: this.#wallet,\n },\n );\n\n // Disconnect from the XRPL node\n await this.#client.disconnect();\n\n return res;\n }\n\n /**\n * Creates a time-locked credential copy on the XRPL.\n *\n * This method creates a Credential object in XRPL that reflects an idOS credential copy.\n * The credential type includes metadata about the original issuer and time-lock duration.\n * The composite credential type follows the format: \"AG-{type}-{originalIssuer}-{timelock}Y\"\n *\n * @param params - Parameters for creating the time-locked credential copy\n * @returns Promise resolving to the XRPL transaction result\n *\n * @throws {Error} When timelockYears is not a non-negative integer\n *\n * @example\n * ```typescript\n * const result = await xrplService.createCredentialForCopy({\n * credId: \"741a9caf-ec53-42c7-aed6-519950dcded5\",\n * credType: \"KYC\",\n * userAddress: \"rPT1Sjq2YGrBMTttX4GZHjKu9dyf6bpAYe\",\n * timelockYears: 5,\n * origCredIssuerAddress: \"rU9C67bZ3ZvjXaJYwYqMqjMq1o4ZbwK3YN\"\n * });\n * ```\n */\n async createCredentialForCopy(params: CreateCredentialForCopyParams): Promise<TxResponse> {\n const { credId, credType, userAddress, timelockYears, origCredIssuerAddress } = params;\n\n // Validate timelockYears is a non-negative integer\n if (!Number.isInteger(timelockYears) || timelockYears < 0) {\n throw new Error(\"timelockYears must be a non-negative integer\");\n }\n\n // Connect to the XRPL node\n await this.#client.connect();\n\n // Create composite credential type with metadata:\n // Format: \"AG-{credType}-{originalIssuer}-{timelock}Y\"\n const type = Buffer.concat([\n utf8Encode(\"AG\"), // \"AG\" prefix for copy credentials\n utf8Encode(\"-\"), // Separator\n utf8Encode(credType), // Original credential type\n utf8Encode(\"-\"), // Separator\n this.#xrpl.decodeAccountID(origCredIssuerAddress), // Original issuer address (decoded)\n utf8Encode(\"-\"), // Separator\n utf8Encode(`${timelockYears}Y`), // Timelock period in years\n ]);\n\n // Submit the credential copy creation transaction and wait for confirmation\n const res = await this.#client.submitAndWait(\n {\n TransactionType: \"CredentialCreate\",\n Account: this.#wallet.address,\n Subject: userAddress,\n // Use the composite credential type with metadata\n CredentialType: hexEncode(type),\n // Encode credential ID as hex URI (required by XRPL)\n URI: hexEncode(utf8Encode(credId)),\n },\n {\n wallet: this.#wallet,\n },\n );\n\n // Disconnect from the XRPL node\n await this.#client.disconnect();\n\n return res;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,gCACd,eACA,gBACA,gBACyB;CAKzB,OAAO;EACL,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,gBAN4B,UAAU,WAAW,cAAc,CAM3B;CACtC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,eAAsB,4BACpB,6BACA,gBACA,iCACA,gBACA,eACkC;CAElC,IAAI,CAAC,OAAO,UAAU,aAAa,KAAK,gBAAgB,GACtD,MAAM,IAAI,MAAM,8CAA8C;CAGhE,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,mBAAoB,MAAM,OAAO;CACtC,QAAQ;EACN,MAAM,IAAI,MACR,2FACF;CACF;CAiBA,OAAO;EACL,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,gBAAgB,UAdL,OAAO,OAAO;GACzB,WAAW,IAAI;GACf,WAAW,GAAG;GACd,WAAW,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GACd,KAAKE,MAAM,gBAAgB,qBAAqB;GAChD,WAAW,GAAG;GACd,WAAW,GAAG,cAAc,EAAE;EAChC,CAAC;EAGD,MAAM,MAAM,MAAM,KAAKF,QAAQ,cAC7B;GACE,iBAAiB;GACjB,SAAS,KAAKC,QAAQ;GACtB,SAAS;GAET,gBAAgB,UAAU,IAAI;GAE9B,KAAK,UAAU,WAAW,MAAM,CAAC;EACnC,GACA,EACE,QAAQ,KAAKA,QACf,CACF;EAGA,MAAM,KAAKD,QAAQ,WAAW;EAE9B,OAAO;CACT;AACF"}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@idos-network/kwil-infra",
3
- "version": "1.2.0",
3
+ "version": "1.5.0",
4
4
  "description": "Infrastructure and wallets for idOS",
5
5
  "license": "MIT",
6
- "repository": "github:idos-network/idos-sdk-js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "github:idos-network/idos-sdk-js"
9
+ },
7
10
  "type": "module",
8
11
  "sideEffects": false,
9
12
  "main": "./dist/index.mjs",
@@ -39,29 +42,30 @@
39
42
  "access": "public"
40
43
  },
41
44
  "dependencies": {
42
- "@idos-network/kwil-js": "0.1.3",
45
+ "@idos-network/kwil-js": "0.1.5",
43
46
  "tiny-invariant": "^1.3.3",
44
47
  "tweetnacl": "^1.0.3",
45
48
  "zod": "4.4.3",
46
- "@idos-network/utils": "1.2.0"
49
+ "@idos-network/utils": "1.5.0"
47
50
  },
48
51
  "devDependencies": {
49
52
  "@gemwallet/api": "^3.8.0",
50
- "@types/node": "25.6.2",
53
+ "@types/node": "25.9.5",
54
+ "@vitest/coverage-v8": "4.1.10",
51
55
  "jsdom": "^22.1.0",
52
- "tsdown": "^0.22.0",
53
- "typescript": "^5.8.3",
54
- "vitest": "4.1.5",
56
+ "tsdown": "^0.22.14",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "4.1.10",
55
59
  "xumm": "^1.8.0"
56
60
  },
57
61
  "peerDependencies": {
58
62
  "@near-wallet-selector/core": "8.10.2",
59
63
  "@stellar/stellar-sdk": "^13.3.0",
60
- "ethers": "^6.14.0",
64
+ "ethers": "^6.17.0",
61
65
  "near-api-js": "4.0.4",
62
66
  "ripple-keypairs": "^2.0.0",
63
- "viem": "2.48.11",
64
- "xrpl": "^4.3.0"
67
+ "viem": "2.55.11",
68
+ "xrpl": "^4.6.0"
65
69
  },
66
70
  "peerDependenciesMeta": {
67
71
  "near-api-js": {
@@ -88,6 +92,7 @@
88
92
  "dev": "tsdown --watch",
89
93
  "publint": "pnpx publint --strict",
90
94
  "test": "vitest",
95
+ "coverage": "vitest run --coverage",
91
96
  "typecheck": "tsc --noEmit"
92
97
  }
93
98
  }
package/vitest.config.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { defineConfig } from "vitest/config";
2
+
3
+ import { coverageConfig } from "../../vitest.shared";
4
+
2
5
  export default defineConfig({
3
6
  test: {
4
7
  environment: "jsdom",
8
+ coverage: coverageConfig,
5
9
  },
6
10
  });
@@ -1,47 +0,0 @@
1
-
2
- 
3
- > @idos-network/kwil-infra@1.1.1 build /Users/strnadj/Projects/idos/idos-sdk-js/packages/kwil-infra
4
- > tsdown
5
-
6
- ℹ tsdown v0.22.0 powered by rolldown v1.0.0
7
- ℹ config file: /Users/strnadj/Projects/idos/idos-sdk-js/packages/kwil-infra/tsdown.config.ts
8
- ℹ entry: ./src/index.ts, ./src/actions/index.ts, ./src/signature-verification/index.ts, ./src/xrp/utils.ts, ./src/facesign/index.ts, ./src/xrpl-credentials/index.ts
9
- ℹ tsconfig: tsconfig.json
10
- ℹ Build start
11
- ℹ Cleaning 31 files
12
- ℹ Hint: consider adding deps.onlyBundle option to avoid unintended bundling of dependencies, or set deps.onlyBundle: false to disable this hint.
13
- See more at https://tsdown.dev/options/dependencies#deps-onlybundle
14
- Detected dependencies in bundle:
15
- - @gemwallet/api
16
- - xumm-sdk
17
- - xumm-oauth2-pkce
18
- - xumm-xapp-sdk
19
- - xumm
20
- ℹ dist/actions/index.mjs 37.28 kB │ gzip: 5.51 kB
21
- ℹ dist/index.mjs 15.28 kB │ gzip: 4.28 kB
22
- ℹ dist/xrpl-credentials/index.mjs  8.13 kB │ gzip: 2.22 kB
23
- ℹ dist/signature-verification/index.mjs  5.42 kB │ gzip: 1.48 kB
24
- ℹ dist/xrp/utils.mjs  3.42 kB │ gzip: 1.14 kB
25
- ℹ dist/facesign/index.mjs  0.11 kB │ gzip: 0.10 kB
26
- ℹ dist/actions/index.mjs.map 80.23 kB │ gzip: 9.52 kB
27
- ℹ dist/xrp/utils.d.mts.map 43.87 kB │ gzip: 10.14 kB
28
- ℹ dist/index.mjs.map 33.79 kB │ gzip: 9.09 kB
29
- ℹ dist/index-Ci6QhKJo.d.mts.map 19.55 kB │ gzip: 2.69 kB
30
- ℹ dist/xrpl-credentials/index.mjs.map 14.54 kB │ gzip: 3.66 kB
31
- ℹ dist/facesign-signer-BY9Nti9F.mjs.map 14.08 kB │ gzip: 3.73 kB
32
- ℹ dist/signature-verification/index.mjs.map 11.84 kB │ gzip: 3.27 kB
33
- ℹ dist/xrp/utils.mjs.map  7.77 kB │ gzip: 2.48 kB
34
- ℹ dist/facesign-signer-BY9Nti9F.mjs  7.12 kB │ gzip: 1.84 kB
35
- ℹ dist/xrpl-credentials/index.d.mts.map  0.94 kB │ gzip: 0.43 kB
36
- ℹ dist/facesign-signer-ADd4EASX.d.mts.map  0.52 kB │ gzip: 0.28 kB
37
- ℹ dist/signature-verification/index.d.mts.map  0.24 kB │ gzip: 0.18 kB
38
- ℹ dist/xrp/utils.d.mts 39.80 kB │ gzip: 8.15 kB
39
- ℹ dist/actions/index.d.mts 11.40 kB │ gzip: 2.12 kB
40
- ℹ dist/xrpl-credentials/index.d.mts  7.78 kB │ gzip: 2.12 kB
41
- ℹ dist/index.d.mts  0.68 kB │ gzip: 0.28 kB
42
- ℹ dist/signature-verification/index.d.mts  0.43 kB │ gzip: 0.27 kB
43
- ℹ dist/facesign/index.d.mts  0.23 kB │ gzip: 0.14 kB
44
- ℹ dist/index-Ci6QhKJo.d.mts 36.45 kB │ gzip: 6.43 kB
45
- ℹ dist/facesign-signer-ADd4EASX.d.mts  0.82 kB │ gzip: 0.39 kB
46
- ℹ 26 files, total: 401.70 kB
47
- ✔ Build complete in 948ms