@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.
- package/CHANGELOG.md +41 -0
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.mjs.map +1 -1
- package/dist/facesign/index.d.mts +1 -1
- package/dist/facesign/index.mjs +1 -1
- package/dist/{facesign-signer-ADd4EASX.d.mts → facesign-signer-BC24j1eN.d.mts} +1 -1
- package/dist/facesign-signer-BC24j1eN.d.mts.map +1 -0
- package/dist/{facesign-signer-BY9Nti9F.mjs → facesign-signer-qzCcwunk.mjs} +1 -1
- package/dist/{facesign-signer-BY9Nti9F.mjs.map → facesign-signer-qzCcwunk.mjs.map} +1 -1
- package/dist/{index-UFgWkjYP.d.mts → index-iqkJfgWf.d.mts} +71 -72
- package/dist/index-iqkJfgWf.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +32 -18
- package/dist/index.mjs.map +1 -1
- package/dist/signature-verification/index.d.mts +1 -2
- package/dist/signature-verification/index.d.mts.map +1 -1
- package/dist/signature-verification/index.mjs +11 -16
- package/dist/signature-verification/index.mjs.map +1 -1
- package/dist/xrp/utils.d.mts +35 -37
- package/dist/xrp/utils.d.mts.map +1 -1
- package/dist/xrp/utils.mjs.map +1 -1
- package/dist/xrpl-credentials/index.d.mts +156 -146
- package/dist/xrpl-credentials/index.d.mts.map +1 -1
- package/dist/xrpl-credentials/index.mjs.map +1 -1
- package/package.json +16 -11
- package/vitest.config.ts +4 -0
- package/.turbo/turbo-build.log +0 -47
- package/.turbo/turbo-test.log +0 -126
- package/.turbo/turbo-typecheck.log +0 -5
- package/dist/facesign-signer-ADd4EASX.d.mts.map +0 -1
- package/dist/index-UFgWkjYP.d.mts.map +0 -1
package/dist/xrp/utils.mjs.map
CHANGED
|
@@ -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,
|
|
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,CAAC,MAAM,QAAQ,SAAS,KAAK;GACjC,MAAM,MAAM,MAAM,QAAQ,SAAS;GACnC,QAAQ,GAAG;EACb,CAAC;CACH,CAAC;AACH;AAEA,eAAsB,iBAAiB,QAA2C;CAEhF,MAAM,SAAS,MAAM,WAAW,QADhB,kBAAkB,wBACY,CAAC;CAE/C,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,UAAW,MAAM,OAAO;CAC7B,QAAQ;EACN,MAAM,IAAI,MACR,0FACF;CACF;CAEA,IAAI;CACJ,IAAI;EACF,YAAY,OAAO,MAAM;CAC3B,QAAQ;EACN,MAAM,IAAI,MAAM,4CAA4C;CAC9D;CAEA,IAAI,CAAC,UAAU,eACb,MAAM,IAAI,MAAM,sDAAsD;CAGxE,OAAO,UAAU;AACnB;AAEA,SAAgB,gBACd,mBACA,SAC6B;CAC7B,OAAO,kBAAkB,YAAY,OAAO,CAAC,CAAC,MAAM,aAAa,SAAS,QAAQ,aAAa;AACjG;AAEA,eAAsB,sBACpB,QAC6D;CAC7D,IAAI,iBAAiB,QAAQ;EAC3B,MAAM,OAAO,YAAY;EACzB,MAAM,EAAE,WAAW,YAAY,MAAM,OAClC,aAAa,CAAC,CACd,MAAM,QAAQ,IAAI,MAAgD;EACrE,OAAO;GAAE;GAAS;EAAU;CAC9B;AACF;AAEA,eAAsB,cAAc,QAA8D;CAChG,IAAI,iBAAiB,QAAQ;EAC3B,MAAM,OAAO,YAAY;EACzB,OAAO,OAAO,WAAW,CAAC,CAAC,MAAM,aAAa,SAAS,QAAQ,OAAO;CACxE;CACA,OAAO,OAAO,KAAK;AACrB;AAGA,SAAgB,mBAAmB,QAAoD;CACrF,OACE,WAAW,QACX,OAAO,WAAW,aACjB,eAAe,UAAU,iBAAiB;AAE/C;AAEA,eAAsB,iBAAiB,QAAqD;CAC1F,IAAI,eAAe,QACjB,OAAO;CAET,IAAI,iBAAiB,QACnB,OAAO;CAET,MAAM,IAAI,MAAM,qBAAqB;AACvC;AAEA,eAAsB,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" */
|
|
14
|
-
|
|
15
|
-
|
|
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` */
|
|
90
|
-
|
|
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 */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
135
|
+
constructor(nodeUrl: string, wallet: Wallet, xrpl: typeof import("xrpl"));
|
|
126
136
|
/**
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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":"
|
|
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,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,mBAAoB,MAAM,OAAO;SAC9B;EACN,MAAM,IAAI,MACR,4FACD;;CAkBH,OAAO;EACL,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,gBAAgB,UAdL,OAAO,OAAO;GACzB,WAAW,KAAK;GAChB,WAAW,IAAI;GACf,WAAW,eAAe;GAC1B,WAAW,IAAI;GACf,gBAAgB,gCAAgC;GAChD,WAAW,IAAI;GACf,WAAW,GAAG,cAAc,GAAG;GAChC,CAM+B,CAAC;EAChC;;;;;;;;;;;;;;;;;;;;;;;;ACzFH,IAAa,wBAAb,MAAa,sBAAsB;CACjC;CACA;CACA;CAEA,YAAY,SAAiB,QAAgB,MAA6B;EACxE,KAAKE,QAAQ;EACb,KAAKD,UAAU;EACf,KAAKD,UAAU,IAAI,KAAKE,MAAM,OAAO,QAAQ;;;;;;;;CAS/C,aAAa,KAAK,SAAiB,QAAgD;EACjF,IAAI;EAEJ,IAAI;GACF,OAAO,MAAM,OAAO;UACd;GACN,MAAM,IAAI,MACR,oFACD;;EAGH,OAAO,IAAI,sBAAsB,SAAS,QAAQ,KAAK;;;;;;;;;;;;;;;;;;;;CAqBzD,MAAM,4BACJ,QACqB;EACrB,MAAM,EAAE,QAAQ,UAAU,gBAAgB;EAG1C,MAAM,KAAKF,QAAQ,SAAS;EAG5B,MAAM,MAAM,MAAM,KAAKA,QAAQ,cAC7B;GACE,iBAAiB;GACjB,SAAS,KAAKC,QAAQ;GACtB,SAAS;GAET,gBAAgB,UAAU,WAAW,SAAS,CAAC;GAE/C,KAAK,UAAU,WAAW,OAAO,CAAC;GACnC,EACD,EACE,QAAQ,KAAKA,SACd,CACF;EAGD,MAAM,KAAKD,QAAQ,YAAY;EAE/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CA0BT,MAAM,wBAAwB,QAA4D;EACxF,MAAM,EAAE,QAAQ,UAAU,aAAa,eAAe,0BAA0B;EAGhF,IAAI,CAAC,OAAO,UAAU,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,cAAc;GACzB,WAAW,GAAG;GACd,gBAAgB,+BAA+B;GAC/C,WAAW,GAAG;GACd,WAAW,GAAG,cAAc,EAAE;EAChC,CAM+B,CAAC;CAChC;AACF;;;;;;;;;;;;;;;;;;;;;;;AC1FA,IAAa,wBAAb,MAAa,sBAAsB;CACjC;CACA;CACA;CAEA,YAAY,SAAiB,QAAgB,MAA6B;EACxE,KAAKE,QAAQ;EACb,KAAKD,UAAU;EACf,KAAKD,UAAU,IAAI,KAAKE,MAAM,OAAO,OAAO;CAC9C;;;;;;;CAQA,aAAa,KAAK,SAAiB,QAAgD;EACjF,IAAI;EAEJ,IAAI;GACF,OAAO,MAAM,OAAO;EACtB,QAAQ;GACN,MAAM,IAAI,MACR,mFACF;EACF;EAEA,OAAO,IAAI,sBAAsB,SAAS,QAAQ,IAAI;CACxD;;;;;;;;;;;;;;;;;;;CAoBA,MAAM,4BACJ,QACqB;EACrB,MAAM,EAAE,QAAQ,UAAU,gBAAgB;EAG1C,MAAM,KAAKF,QAAQ,QAAQ;EAG3B,MAAM,MAAM,MAAM,KAAKA,QAAQ,cAC7B;GACE,iBAAiB;GACjB,SAAS,KAAKC,QAAQ;GACtB,SAAS;GAET,gBAAgB,UAAU,WAAW,QAAQ,CAAC;GAE9C,KAAK,UAAU,WAAW,MAAM,CAAC;EACnC,GACA,EACE,QAAQ,KAAKA,QACf,CACF;EAGA,MAAM,KAAKD,QAAQ,WAAW;EAE9B,OAAO;CACT;;;;;;;;;;;;;;;;;;;;;;;;CAyBA,MAAM,wBAAwB,QAA4D;EACxF,MAAM,EAAE,QAAQ,UAAU,aAAa,eAAe,0BAA0B;EAGhF,IAAI,CAAC,OAAO,UAAU,aAAa,KAAK,gBAAgB,GACtD,MAAM,IAAI,MAAM,8CAA8C;EAIhE,MAAM,KAAKA,QAAQ,QAAQ;EAI3B,MAAM,OAAO,OAAO,OAAO;GACzB,WAAW,IAAI;GACf,WAAW,GAAG;GACd,WAAW,QAAQ;GACnB,WAAW,GAAG;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.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Infrastructure and wallets for idOS",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
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.
|
|
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.
|
|
49
|
+
"@idos-network/utils": "1.5.0"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
52
|
"@gemwallet/api": "^3.8.0",
|
|
50
|
-
"@types/node": "25.
|
|
53
|
+
"@types/node": "25.9.5",
|
|
54
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
51
55
|
"jsdom": "^22.1.0",
|
|
52
|
-
"tsdown": "^0.22.
|
|
53
|
-
"typescript": "^5.
|
|
54
|
-
"vitest": "4.1.
|
|
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.
|
|
64
|
+
"ethers": "^6.17.0",
|
|
61
65
|
"near-api-js": "4.0.4",
|
|
62
66
|
"ripple-keypairs": "^2.0.0",
|
|
63
|
-
"viem": "2.
|
|
64
|
-
"xrpl": "^4.
|
|
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
package/.turbo/turbo-build.log
DELETED
|
@@ -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
|
-
[34mℹ[39m [34mtsdown v0.22.0[39m powered by [38;2;255;126;23mrolldown v1.0.0[39m
|
|
7
|
-
[34mℹ[39m config file: [4m/Users/strnadj/Projects/idos/idos-sdk-js/packages/kwil-infra/tsdown.config.ts[24m
|
|
8
|
-
[34mℹ[39m entry: [34m./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[39m
|
|
9
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
|
-
[34mℹ[39m Build start
|
|
11
|
-
[34mℹ[39m Cleaning 31 files
|
|
12
|
-
[34mℹ[39m Hint: consider adding [34mdeps.onlyBundle[39m option to avoid unintended bundling of dependencies, or set [34mdeps.onlyBundle: false[39m to disable this hint.
|
|
13
|
-
See more at [4mhttps://tsdown.dev/options/dependencies#deps-onlybundle[24m
|
|
14
|
-
Detected dependencies in bundle:
|
|
15
|
-
- [34m@gemwallet/api[39m
|
|
16
|
-
- [34mxumm-sdk[39m
|
|
17
|
-
- [34mxumm-oauth2-pkce[39m
|
|
18
|
-
- [34mxumm-xapp-sdk[39m
|
|
19
|
-
- [34mxumm[39m
|
|
20
|
-
[34mℹ[39m [2mdist/[22m[1mactions/index.mjs[22m [2m37.28 kB[22m [2m│ gzip: 5.51 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m15.28 kB[22m [2m│ gzip: 4.28 kB[22m
|
|
22
|
-
[34mℹ[39m [2mdist/[22m[1mxrpl-credentials/index.mjs[22m [2m 8.13 kB[22m [2m│ gzip: 2.22 kB[22m
|
|
23
|
-
[34mℹ[39m [2mdist/[22m[1msignature-verification/index.mjs[22m [2m 5.42 kB[22m [2m│ gzip: 1.48 kB[22m
|
|
24
|
-
[34mℹ[39m [2mdist/[22m[1mxrp/utils.mjs[22m [2m 3.42 kB[22m [2m│ gzip: 1.14 kB[22m
|
|
25
|
-
[34mℹ[39m [2mdist/[22m[1mfacesign/index.mjs[22m [2m 0.11 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
26
|
-
[34mℹ[39m [2mdist/[22mactions/index.mjs.map [2m80.23 kB[22m [2m│ gzip: 9.52 kB[22m
|
|
27
|
-
[34mℹ[39m [2mdist/[22mxrp/utils.d.mts.map [2m43.87 kB[22m [2m│ gzip: 10.14 kB[22m
|
|
28
|
-
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m33.79 kB[22m [2m│ gzip: 9.09 kB[22m
|
|
29
|
-
[34mℹ[39m [2mdist/[22mindex-Ci6QhKJo.d.mts.map [2m19.55 kB[22m [2m│ gzip: 2.69 kB[22m
|
|
30
|
-
[34mℹ[39m [2mdist/[22mxrpl-credentials/index.mjs.map [2m14.54 kB[22m [2m│ gzip: 3.66 kB[22m
|
|
31
|
-
[34mℹ[39m [2mdist/[22mfacesign-signer-BY9Nti9F.mjs.map [2m14.08 kB[22m [2m│ gzip: 3.73 kB[22m
|
|
32
|
-
[34mℹ[39m [2mdist/[22msignature-verification/index.mjs.map [2m11.84 kB[22m [2m│ gzip: 3.27 kB[22m
|
|
33
|
-
[34mℹ[39m [2mdist/[22mxrp/utils.mjs.map [2m 7.77 kB[22m [2m│ gzip: 2.48 kB[22m
|
|
34
|
-
[34mℹ[39m [2mdist/[22mfacesign-signer-BY9Nti9F.mjs [2m 7.12 kB[22m [2m│ gzip: 1.84 kB[22m
|
|
35
|
-
[34mℹ[39m [2mdist/[22mxrpl-credentials/index.d.mts.map [2m 0.94 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
36
|
-
[34mℹ[39m [2mdist/[22mfacesign-signer-ADd4EASX.d.mts.map [2m 0.52 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
37
|
-
[34mℹ[39m [2mdist/[22msignature-verification/index.d.mts.map [2m 0.24 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
38
|
-
[34mℹ[39m [2mdist/[22m[32m[1mxrp/utils.d.mts[22m[39m [2m39.80 kB[22m [2m│ gzip: 8.15 kB[22m
|
|
39
|
-
[34mℹ[39m [2mdist/[22m[32m[1mactions/index.d.mts[22m[39m [2m11.40 kB[22m [2m│ gzip: 2.12 kB[22m
|
|
40
|
-
[34mℹ[39m [2mdist/[22m[32m[1mxrpl-credentials/index.d.mts[22m[39m [2m 7.78 kB[22m [2m│ gzip: 2.12 kB[22m
|
|
41
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.68 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
42
|
-
[34mℹ[39m [2mdist/[22m[32m[1msignature-verification/index.d.mts[22m[39m [2m 0.43 kB[22m [2m│ gzip: 0.27 kB[22m
|
|
43
|
-
[34mℹ[39m [2mdist/[22m[32m[1mfacesign/index.d.mts[22m[39m [2m 0.23 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
44
|
-
[34mℹ[39m [2mdist/[22m[32mindex-Ci6QhKJo.d.mts[39m [2m36.45 kB[22m [2m│ gzip: 6.43 kB[22m
|
|
45
|
-
[34mℹ[39m [2mdist/[22m[32mfacesign-signer-ADd4EASX.d.mts[39m [2m 0.82 kB[22m [2m│ gzip: 0.39 kB[22m
|
|
46
|
-
[34mℹ[39m 26 files, total: 401.70 kB
|
|
47
|
-
[32m✔[39m Build complete in [32m948ms[39m
|