@ckb-ccc/joy-id 0.0.12-alpha.0 → 0.0.12

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 (53) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +5 -5
  3. package/dist/btc/index.d.ts +9 -12
  4. package/dist/btc/index.d.ts.map +1 -1
  5. package/dist/btc/index.js +9 -12
  6. package/dist/ckb/index.d.ts +26 -33
  7. package/dist/ckb/index.d.ts.map +1 -1
  8. package/dist/ckb/index.js +26 -33
  9. package/dist/common/index.d.ts +3 -4
  10. package/dist/common/index.d.ts.map +1 -1
  11. package/dist/common/index.js +3 -3
  12. package/dist/connectionsStorage/index.d.ts +31 -26
  13. package/dist/connectionsStorage/index.d.ts.map +1 -1
  14. package/dist/connectionsStorage/index.js +11 -13
  15. package/dist/evm/index.d.ts +11 -16
  16. package/dist/evm/index.d.ts.map +1 -1
  17. package/dist/evm/index.js +11 -16
  18. package/dist/nostr/index.d.ts +9 -14
  19. package/dist/nostr/index.d.ts.map +1 -1
  20. package/dist/nostr/index.js +9 -14
  21. package/dist/signerFactory/index.d.ts +6 -4
  22. package/dist/signerFactory/index.d.ts.map +1 -1
  23. package/dist/signerFactory/index.js +6 -4
  24. package/dist.commonjs/btc/index.d.ts +9 -12
  25. package/dist.commonjs/btc/index.d.ts.map +1 -1
  26. package/dist.commonjs/btc/index.js +9 -12
  27. package/dist.commonjs/ckb/index.d.ts +26 -33
  28. package/dist.commonjs/ckb/index.d.ts.map +1 -1
  29. package/dist.commonjs/ckb/index.js +26 -33
  30. package/dist.commonjs/common/index.d.ts +3 -4
  31. package/dist.commonjs/common/index.d.ts.map +1 -1
  32. package/dist.commonjs/common/index.js +3 -3
  33. package/dist.commonjs/connectionsStorage/index.d.ts +31 -26
  34. package/dist.commonjs/connectionsStorage/index.d.ts.map +1 -1
  35. package/dist.commonjs/connectionsStorage/index.js +11 -13
  36. package/dist.commonjs/evm/index.d.ts +11 -16
  37. package/dist.commonjs/evm/index.d.ts.map +1 -1
  38. package/dist.commonjs/evm/index.js +11 -16
  39. package/dist.commonjs/nostr/index.d.ts +9 -14
  40. package/dist.commonjs/nostr/index.d.ts.map +1 -1
  41. package/dist.commonjs/nostr/index.js +9 -14
  42. package/dist.commonjs/signerFactory/index.d.ts +6 -4
  43. package/dist.commonjs/signerFactory/index.d.ts.map +1 -1
  44. package/dist.commonjs/signerFactory/index.js +6 -4
  45. package/package.json +9 -10
  46. package/src/btc/index.ts +9 -12
  47. package/src/ckb/index.ts +26 -33
  48. package/src/common/index.ts +3 -4
  49. package/src/connectionsStorage/index.ts +31 -26
  50. package/src/evm/index.ts +11 -16
  51. package/src/nostr/index.ts +9 -14
  52. package/src/signerFactory/index.ts +6 -4
  53. package/typedoc.json +6 -0
@@ -1,9 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage/index.js";
3
3
  /**
4
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.SignerEvm}
4
+ * Class representing an EVM signer that extends SignerEvm
5
+ * @public
7
6
  */
8
7
  export declare class EvmSigner extends ccc.SignerEvm {
9
8
  private readonly name;
@@ -13,9 +12,8 @@ export declare class EvmSigner extends ccc.SignerEvm {
13
12
  private connection?;
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  private assertConnection;
21
19
  /**
@@ -23,14 +21,13 @@ export declare class EvmSigner extends ccc.SignerEvm {
23
21
  * @param client - The client instance.
24
22
  * @param name - The name of the signer.
25
23
  * @param icon - The icon URL of the signer.
26
- * @param appUri - The application URI.
24
+ * @param _appUri - The application URI.
27
25
  * @param connectionsRepo - The connections repository.
28
26
  */
29
27
  constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
30
28
  /**
31
29
  * Gets the configuration for JoyID.
32
- * @private
33
- * @returns {object} The configuration object.
30
+ * @returns The configuration object.
34
31
  */
35
32
  private getConfig;
36
33
  /**
@@ -40,31 +37,29 @@ export declare class EvmSigner extends ccc.SignerEvm {
40
37
  getEvmAccount(): Promise<ccc.Hex>;
41
38
  /**
42
39
  * Connects to the provider by requesting authentication.
43
- * @returns {Promise<void>} A promise that resolves when the connection is established.
40
+ * @returns A promise that resolves when the connection is established.
44
41
  */
45
42
  connect(): Promise<void>;
46
43
  disconnect(): Promise<void>;
47
44
  /**
48
45
  * Checks if the signer is connected.
49
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
46
+ * @returns A promise that resolves to true if connected, false otherwise.
50
47
  */
51
48
  isConnected(): Promise<boolean>;
52
49
  /**
53
50
  * Signs a raw message with the EVM account.
54
- * @param {string | ccc.BytesLike} message - The message to sign.
55
- * @returns {Promise<ccc.Hex>} A promise that resolves to the signed message.
51
+ * @param message - The message to sign.
52
+ * @returns A promise that resolves to the signed message.
56
53
  */
57
54
  signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex>;
58
55
  /**
59
56
  * Saves the current connection.
60
- * @private
61
- * @returns {Promise<void>}
57
+ * @returns
62
58
  */
63
59
  private saveConnection;
64
60
  /**
65
61
  * Restores the previous connection.
66
- * @private
67
- * @returns {Promise<void>}
62
+ * @returns
68
63
  */
69
64
  private restoreConnection;
70
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,GAAG,CAAC,SAAS;IA2BxC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA7BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIvC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAQrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAuBvE;;;;OAIG;YACW,cAAc;IAU5B;;;;OAIG;YACW,iBAAiB;CAMhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,SAAU,SAAQ,GAAG,CAAC,SAAS;IA0BxC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIvC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAQrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAuBvE;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
@@ -6,16 +6,14 @@ const common_1 = require("@joyid/common");
6
6
  const index_js_1 = require("../common/index.js");
7
7
  const index_js_2 = require("../connectionsStorage/index.js");
8
8
  /**
9
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
10
- * @class
11
- * @extends {ccc.SignerEvm}
9
+ * Class representing an EVM signer that extends SignerEvm
10
+ * @public
12
11
  */
13
12
  class EvmSigner extends core_1.ccc.SignerEvm {
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  assertConnection() {
21
19
  if (!this.isConnected() || !this.connection) {
@@ -28,7 +26,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
28
26
  * @param client - The client instance.
29
27
  * @param name - The name of the signer.
30
28
  * @param icon - The icon URL of the signer.
31
- * @param appUri - The application URI.
29
+ * @param _appUri - The application URI.
32
30
  * @param connectionsRepo - The connections repository.
33
31
  */
34
32
  constructor(client, name, icon, _appUri, connectionsRepo = new index_js_2.ConnectionsRepoLocalStorage()) {
@@ -40,8 +38,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
40
38
  }
41
39
  /**
42
40
  * Gets the configuration for JoyID.
43
- * @private
44
- * @returns {object} The configuration object.
41
+ * @returns The configuration object.
45
42
  */
46
43
  getConfig() {
47
44
  return {
@@ -63,7 +60,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
63
60
  }
64
61
  /**
65
62
  * Connects to the provider by requesting authentication.
66
- * @returns {Promise<void>} A promise that resolves when the connection is established.
63
+ * @returns A promise that resolves when the connection is established.
67
64
  */
68
65
  async connect() {
69
66
  const config = this.getConfig();
@@ -85,7 +82,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
85
82
  }
86
83
  /**
87
84
  * Checks if the signer is connected.
88
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
85
+ * @returns A promise that resolves to true if connected, false otherwise.
89
86
  */
90
87
  async isConnected() {
91
88
  if (this.connection) {
@@ -96,8 +93,8 @@ class EvmSigner extends core_1.ccc.SignerEvm {
96
93
  }
97
94
  /**
98
95
  * Signs a raw message with the EVM account.
99
- * @param {string | ccc.BytesLike} message - The message to sign.
100
- * @returns {Promise<ccc.Hex>} A promise that resolves to the signed message.
96
+ * @param message - The message to sign.
97
+ * @returns A promise that resolves to the signed message.
101
98
  */
102
99
  async signMessageRaw(message) {
103
100
  const { address } = this.assertConnection();
@@ -113,8 +110,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
113
110
  }
114
111
  /**
115
112
  * Saves the current connection.
116
- * @private
117
- * @returns {Promise<void>}
113
+ * @returns
118
114
  */
119
115
  async saveConnection() {
120
116
  return this.connectionsRepo.set({
@@ -124,8 +120,7 @@ class EvmSigner extends core_1.ccc.SignerEvm {
124
120
  }
125
121
  /**
126
122
  * Restores the previous connection.
127
- * @private
128
- * @returns {Promise<void>}
123
+ * @returns
129
124
  */
130
125
  async restoreConnection() {
131
126
  this.connection = await this.connectionsRepo.get({
@@ -1,9 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage/index.js";
3
3
  /**
4
- * Class representing a Nostr signer that extends SignerNostr from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.SignerNostr}
4
+ * Class representing a Nostr signer that extends SignerNostr
5
+ * @public
7
6
  */
8
7
  export declare class NostrSigner extends ccc.SignerNostr {
9
8
  private readonly name;
@@ -13,9 +12,8 @@ export declare class NostrSigner extends ccc.SignerNostr {
13
12
  private connection?;
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  private assertConnection;
21
19
  /**
@@ -23,39 +21,36 @@ export declare class NostrSigner extends ccc.SignerNostr {
23
21
  * @param client - The client instance.
24
22
  * @param name - The name of the signer.
25
23
  * @param icon - The icon URL of the signer.
26
- * @param appUri - The application URI.
24
+ * @param _appUri - The application URI.
27
25
  * @param connectionsRepo - The connections repository.
28
26
  */
29
27
  constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
30
28
  /**
31
29
  * Gets the configuration for JoyID.
32
- * @private
33
- * @returns {object} The configuration object.
30
+ * @returns The configuration object.
34
31
  */
35
32
  private getConfig;
36
33
  /**
37
34
  * Connects to the provider by requesting authentication.
38
- * @returns {Promise<void>} A promise that resolves when the connection is established.
35
+ * @returns A promise that resolves when the connection is established.
39
36
  */
40
37
  connect(): Promise<void>;
41
38
  disconnect(): Promise<void>;
42
39
  /**
43
40
  * Checks if the signer is connected.
44
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
41
+ * @returns A promise that resolves to true if connected, false otherwise.
45
42
  */
46
43
  isConnected(): Promise<boolean>;
47
44
  getNostrPublicKey(): Promise<ccc.Hex>;
48
45
  signNostrEvent(event: ccc.NostrEvent): Promise<Required<ccc.NostrEvent>>;
49
46
  /**
50
47
  * Saves the current connection.
51
- * @private
52
- * @returns {Promise<void>}
48
+ * @returns
53
49
  */
54
50
  private saveConnection;
55
51
  /**
56
52
  * Restores the previous connection.
57
- * @private
58
- * @returns {Promise<void>}
53
+ * @returns
59
54
  */
60
55
  private restoreConnection;
61
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nostr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,GAAG,CAAC,WAAW;IA2B5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA7BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAYpC;;;;OAIG;YACW,cAAc;IAU5B;;;;OAIG;YACW,iBAAiB;CAMhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nostr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,GAAG,CAAC,WAAW;IA0B5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,oBAAQ,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAYpC;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
@@ -6,16 +6,14 @@ const common_1 = require("@joyid/common");
6
6
  const index_js_1 = require("../common/index.js");
7
7
  const index_js_2 = require("../connectionsStorage/index.js");
8
8
  /**
9
- * Class representing a Nostr signer that extends SignerNostr from @ckb-ccc/core.
10
- * @class
11
- * @extends {ccc.SignerNostr}
9
+ * Class representing a Nostr signer that extends SignerNostr
10
+ * @public
12
11
  */
13
12
  class NostrSigner extends core_1.ccc.SignerNostr {
14
13
  /**
15
14
  * Ensures that the signer is connected and returns the connection.
16
- * @private
17
15
  * @throws Will throw an error if not connected.
18
- * @returns {Connection} The current connection.
16
+ * @returns The current connection.
19
17
  */
20
18
  assertConnection() {
21
19
  if (!this.isConnected() || !this.connection) {
@@ -28,7 +26,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
28
26
  * @param client - The client instance.
29
27
  * @param name - The name of the signer.
30
28
  * @param icon - The icon URL of the signer.
31
- * @param appUri - The application URI.
29
+ * @param _appUri - The application URI.
32
30
  * @param connectionsRepo - The connections repository.
33
31
  */
34
32
  constructor(client, name, icon, _appUri, connectionsRepo = new index_js_2.ConnectionsRepoLocalStorage()) {
@@ -40,8 +38,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
40
38
  }
41
39
  /**
42
40
  * Gets the configuration for JoyID.
43
- * @private
44
- * @returns {object} The configuration object.
41
+ * @returns The configuration object.
45
42
  */
46
43
  getConfig() {
47
44
  return {
@@ -56,7 +53,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
56
53
  }
57
54
  /**
58
55
  * Connects to the provider by requesting authentication.
59
- * @returns {Promise<void>} A promise that resolves when the connection is established.
56
+ * @returns A promise that resolves when the connection is established.
60
57
  */
61
58
  async connect() {
62
59
  const config = this.getConfig();
@@ -78,7 +75,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
78
75
  }
79
76
  /**
80
77
  * Checks if the signer is connected.
81
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
78
+ * @returns A promise that resolves to true if connected, false otherwise.
82
79
  */
83
80
  async isConnected() {
84
81
  if (this.connection) {
@@ -100,8 +97,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
100
97
  }
101
98
  /**
102
99
  * Saves the current connection.
103
- * @private
104
- * @returns {Promise<void>}
100
+ * @returns
105
101
  */
106
102
  async saveConnection() {
107
103
  return this.connectionsRepo.set({
@@ -111,8 +107,7 @@ class NostrSigner extends core_1.ccc.SignerNostr {
111
107
  }
112
108
  /**
113
109
  * Restores the previous connection.
114
- * @private
115
- * @returns {Promise<void>}
110
+ * @returns
116
111
  */
117
112
  async restoreConnection() {
118
113
  this.connection = await this.connectionsRepo.get({
@@ -3,10 +3,12 @@ import { ccc } from "@ckb-ccc/core";
3
3
  * Gets the JoyID signers based on the client, name, and icon.
4
4
  * If the browser is standalone or a webview, returns SignerAlwaysError instances.
5
5
  * Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
6
- * @param {ccc.Client} client - The client instance.
7
- * @param {string} name - The name of the signer.
8
- * @param {string} icon - The icon URL of the signer.
9
- * @returns {ccc.SignerInfo[]} An array of signer information objects.
6
+ * @public
7
+ *
8
+ * @param client - The client instance.
9
+ * @param name - The name of the signer.
10
+ * @param icon - The icon URL of the signer.
11
+ * @returns An array of signer information objects.
10
12
  */
11
13
  export declare function getJoyIdSigners(client: ccc.Client, name: string, icon: string, preferredNetworks?: ccc.NetworkPreference[]): ccc.SignerInfo[];
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signerFactory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,GAC1C,GAAG,CAAC,UAAU,EAAE,CA8ClB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signerFactory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,GAC1C,GAAG,CAAC,UAAU,EAAE,CA8ClB"}
@@ -11,10 +11,12 @@ const index_js_4 = require("../nostr/index.js");
11
11
  * Gets the JoyID signers based on the client, name, and icon.
12
12
  * If the browser is standalone or a webview, returns SignerAlwaysError instances.
13
13
  * Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
14
- * @param {ccc.Client} client - The client instance.
15
- * @param {string} name - The name of the signer.
16
- * @param {string} icon - The icon URL of the signer.
17
- * @returns {ccc.SignerInfo[]} An array of signer information objects.
14
+ * @public
15
+ *
16
+ * @param client - The client instance.
17
+ * @param name - The name of the signer.
18
+ * @param icon - The icon URL of the signer.
19
+ * @returns An array of signer information objects.
18
20
  */
19
21
  function getJoyIdSigners(client, name, icon, preferredNetworks) {
20
22
  if ((0, common_1.isStandaloneBrowser)() || core_1.ccc.isWebview(window.navigator.userAgent)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/joy-id",
3
- "version": "0.0.12-alpha.0",
3
+ "version": "0.0.12",
4
4
  "description": "Connector's support for JoyID",
5
5
  "author": "Hanssen0 <hanssen0@hanssen0.com>",
6
6
  "license": "MIT",
@@ -18,11 +18,6 @@
18
18
  "default": "./dist.commonjs/index.js"
19
19
  }
20
20
  },
21
- "scripts": {
22
- "build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
23
- "lint": "eslint",
24
- "format": "prettier --write . && eslint --fix"
25
- },
26
21
  "devDependencies": {
27
22
  "@eslint/js": "^9.1.1",
28
23
  "copyfiles": "^2.4.1",
@@ -39,9 +34,13 @@
39
34
  "access": "public"
40
35
  },
41
36
  "dependencies": {
42
- "@ckb-ccc/core": "0.0.12-alpha.0",
43
37
  "@joyid/ckb": "^1.0.1",
44
- "@joyid/common": "^0.2.0"
38
+ "@joyid/common": "^0.2.0",
39
+ "@ckb-ccc/core": "0.0.12"
45
40
  },
46
- "gitHead": "171a9941a56575dd5db2e3fad21d04bff8ec3fc5"
47
- }
41
+ "scripts": {
42
+ "build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
43
+ "lint": "eslint",
44
+ "format": "prettier --write . && eslint --fix"
45
+ }
46
+ }
package/src/btc/index.ts CHANGED
@@ -8,9 +8,8 @@ import {
8
8
  } from "../connectionsStorage/index.js";
9
9
 
10
10
  /**
11
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
12
- * @class
13
- * @extends {ccc.SignerBtc}
11
+ * Class representing a Bitcoin signer that extends SignerBtc
12
+ * @public
14
13
  */
15
14
  export class BitcoinSigner extends ccc.SignerBtc {
16
15
  private connection?: Connection;
@@ -18,9 +17,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
18
17
 
19
18
  /**
20
19
  * Ensures that the signer is connected and returns the connection.
21
- * @private
22
20
  * @throws Will throw an error if not connected.
23
- * @returns {Connection} The current connection.
21
+ * @returns The current connection.
24
22
  */
25
23
  private assertConnection(): Connection {
26
24
  if (!this.isConnected() || !this.connection) {
@@ -64,7 +62,6 @@ export class BitcoinSigner extends ccc.SignerBtc {
64
62
 
65
63
  /**
66
64
  * Gets the configuration for JoyID.
67
- * @private
68
65
  * @returns The configuration object.
69
66
  */
70
67
  private getConfig() {
@@ -107,7 +104,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
107
104
 
108
105
  /**
109
106
  * Gets the Bitcoin account address.
110
- * @returns {Promise<string>} A promise that resolves to the Bitcoin account address.
107
+ * @returns A promise that resolves to the Bitcoin account address.
111
108
  */
112
109
  async getBtcAccount(): Promise<string> {
113
110
  const { address } = this.assertConnection();
@@ -116,7 +113,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
116
113
 
117
114
  /**
118
115
  * Gets the Bitcoin public key.
119
- * @returns {Promise<ccc.Hex>} A promise that resolves to the Bitcoin public key.
116
+ * @returns A promise that resolves to the Bitcoin public key.
120
117
  */
121
118
  async getBtcPublicKey(): Promise<ccc.Hex> {
122
119
  const { publicKey } = this.assertConnection();
@@ -125,7 +122,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
125
122
 
126
123
  /**
127
124
  * Connects to the provider by requesting authentication.
128
- * @returns {Promise<void>} A promise that resolves when the connection is established.
125
+ * @returns A promise that resolves when the connection is established.
129
126
  */
130
127
  async connect(): Promise<void> {
131
128
  const config = this.getConfig();
@@ -160,7 +157,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
160
157
 
161
158
  /**
162
159
  * Checks if the signer is connected.
163
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
160
+ * @returns A promise that resolves to true if connected, false otherwise.
164
161
  */
165
162
  async isConnected(): Promise<boolean> {
166
163
  if (this.connection) {
@@ -176,8 +173,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
176
173
 
177
174
  /**
178
175
  * Signs a raw message with the Bitcoin account.
179
- * @param {string | ccc.BytesLike} message - The message to sign.
180
- * @returns {Promise<string>} A promise that resolves to the signed message.
176
+ * @param message - The message to sign.
177
+ * @returns A promise that resolves to the signed message.
181
178
  */
182
179
  async signMessageRaw(message: string | ccc.BytesLike): Promise<string> {
183
180
  const { address } = this.assertConnection();
package/src/ckb/index.ts CHANGED
@@ -9,14 +9,13 @@ import {
9
9
  } from "../connectionsStorage/index.js";
10
10
 
11
11
  /**
12
- * Class representing a CKB signer that extends Signer from @ckb-ccc/core.
13
- * @class
14
- * @extends {ccc.Signer}
12
+ * Class representing a CKB signer that extends Signer
13
+ * @public
15
14
  */
16
15
  export class CkbSigner extends ccc.Signer {
17
16
  /**
18
17
  * Gets the signer type.
19
- * @returns {ccc.SignerType} The type of the signer.
18
+ * @returns The type of the signer.
20
19
  */
21
20
  get type(): ccc.SignerType {
22
21
  return ccc.SignerType.CKB;
@@ -24,7 +23,7 @@ export class CkbSigner extends ccc.Signer {
24
23
 
25
24
  /**
26
25
  * Gets the sign type.
27
- * @returns {ccc.SignerSignType} The sign type.
26
+ * @returns The sign type.
28
27
  */
29
28
  get signType(): ccc.SignerSignType {
30
29
  return ccc.SignerSignType.JoyId;
@@ -34,9 +33,8 @@ export class CkbSigner extends ccc.Signer {
34
33
 
35
34
  /**
36
35
  * Ensures that the signer is connected and returns the connection.
37
- * @private
38
36
  * @throws Will throw an error if not connected.
39
- * @returns {Promise<Connection>} A promise that resolves to the current connection.
37
+ * @returns A promise that resolves to the current connection.
40
38
  */
41
39
  private async assertConnection(): Promise<Connection> {
42
40
  if (!(await this.isConnected()) || !this.connection) {
@@ -48,12 +46,12 @@ export class CkbSigner extends ccc.Signer {
48
46
 
49
47
  /**
50
48
  * Creates an instance of CkbSigner.
51
- * @param {ccc.Client} client - The client instance.
52
- * @param {string} name - The name of the signer.
53
- * @param {string} icon - The icon URL of the signer.
54
- * @param {string} [_appUri] - The application URI.
55
- * @param {string} [_aggregatorUri] - The aggregator URI.
56
- * @param {ConnectionsRepo} [connectionsRepo=new ConnectionsRepoLocalStorage()] - The connections repository.
49
+ * @param client - The client instance.
50
+ * @param name - The name of the signer.
51
+ * @param icon - The icon URL of the signer.
52
+ * @param _appUri - The application URI.
53
+ * @param _aggregatorUri - The aggregator URI.
54
+ * @param connectionsRepo - The connections repository.
57
55
  */
58
56
  constructor(
59
57
  client: ccc.Client,
@@ -68,7 +66,6 @@ export class CkbSigner extends ccc.Signer {
68
66
 
69
67
  /**
70
68
  * Gets the configuration for JoyID.
71
- * @private
72
69
  * @returns The configuration object.
73
70
  */
74
71
  private getConfig() {
@@ -85,8 +82,7 @@ export class CkbSigner extends ccc.Signer {
85
82
 
86
83
  /**
87
84
  * Gets the aggregator URI.
88
- * @private
89
- * @returns {string} The aggregator URI.
85
+ * @returns The aggregator URI.
90
86
  */
91
87
  private getAggregatorUri(): string {
92
88
  if (this._aggregatorUri) {
@@ -100,7 +96,7 @@ export class CkbSigner extends ccc.Signer {
100
96
 
101
97
  /**
102
98
  * Connects to the provider by requesting authentication.
103
- * @returns {Promise<void>} A promise that resolves when the connection is established.
99
+ * @returns A promise that resolves when the connection is established.
104
100
  */
105
101
  async connect(): Promise<void> {
106
102
  const config = this.getConfig();
@@ -127,7 +123,7 @@ export class CkbSigner extends ccc.Signer {
127
123
 
128
124
  /**
129
125
  * Checks if the signer is connected.
130
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
126
+ * @returns A promise that resolves to true if connected, false otherwise.
131
127
  */
132
128
  async isConnected(): Promise<boolean> {
133
129
  if (this.connection) {
@@ -139,7 +135,7 @@ export class CkbSigner extends ccc.Signer {
139
135
 
140
136
  /**
141
137
  * Gets the internal address.
142
- * @returns {Promise<string>} A promise that resolves to the internal address.
138
+ * @returns A promise that resolves to the internal address.
143
139
  */
144
140
  async getInternalAddress(): Promise<string> {
145
141
  return (await this.assertConnection()).address;
@@ -147,7 +143,7 @@ export class CkbSigner extends ccc.Signer {
147
143
 
148
144
  /**
149
145
  * Gets the identity of the signer.
150
- * @returns {Promise<string>} A promise that resolves to the identity.
146
+ * @returns A promise that resolves to the identity.
151
147
  */
152
148
  async getIdentity(): Promise<string> {
153
149
  const connection = await this.assertConnection();
@@ -159,7 +155,7 @@ export class CkbSigner extends ccc.Signer {
159
155
 
160
156
  /**
161
157
  * Gets the address object.
162
- * @returns {Promise<ccc.Address>} A promise that resolves to the address object.
158
+ * @returns A promise that resolves to the address object.
163
159
  */
164
160
  async getAddressObj(): Promise<ccc.Address> {
165
161
  return await ccc.Address.fromString(
@@ -170,7 +166,7 @@ export class CkbSigner extends ccc.Signer {
170
166
 
171
167
  /**
172
168
  * Gets the address objects.
173
- * @returns {Promise<ccc.Address[]>} A promise that resolves to an array of address objects.
169
+ * @returns A promise that resolves to an array of address objects.
174
170
  */
175
171
  async getAddressObjs(): Promise<ccc.Address[]> {
176
172
  return [await this.getAddressObj()];
@@ -178,8 +174,8 @@ export class CkbSigner extends ccc.Signer {
178
174
 
179
175
  /**
180
176
  * Prepares a transaction.
181
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
182
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the prepared transaction.
177
+ * @param txLike - The transaction-like object.
178
+ * @returns A promise that resolves to the prepared transaction.
183
179
  */
184
180
  async prepareTransaction(
185
181
  txLike: ccc.TransactionLike,
@@ -204,7 +200,6 @@ export class CkbSigner extends ccc.Signer {
204
200
 
205
201
  /**
206
202
  * Prepares a transaction for a sub key.
207
- * @private
208
203
  * @param tx - The transaction object.
209
204
  * @param witness - The witness arguments.
210
205
  * @throws Will throw an error if no COTA cells are found for the sub key wallet.
@@ -253,8 +248,8 @@ export class CkbSigner extends ccc.Signer {
253
248
 
254
249
  /**
255
250
  * Signs a transaction.
256
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
257
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the signed transaction.
251
+ * @param txLike - The transaction-like object.
252
+ * @returns A promise that resolves to the signed transaction.
258
253
  */
259
254
  async signOnlyTransaction(
260
255
  txLike: ccc.TransactionLike,
@@ -306,8 +301,8 @@ export class CkbSigner extends ccc.Signer {
306
301
 
307
302
  /**
308
303
  * Signs a raw message with the account.
309
- * @param {string | ccc.BytesLike} message - The message to sign.
310
- * @returns {Promise<string>} A promise that resolves to the signed message.
304
+ * @param message - The message to sign.
305
+ * @returns A promise that resolves to the signed message.
311
306
  */
312
307
  async signMessageRaw(message: string | ccc.BytesLike): Promise<string> {
313
308
  const { address } = await this.assertConnection();
@@ -338,8 +333,7 @@ export class CkbSigner extends ccc.Signer {
338
333
 
339
334
  /**
340
335
  * Saves the current connection.
341
- * @private
342
- * @returns {Promise<void>}
336
+ * @returns
343
337
  */
344
338
  private async saveConnection(): Promise<void> {
345
339
  return this.connectionsRepo.set(
@@ -353,8 +347,7 @@ export class CkbSigner extends ccc.Signer {
353
347
 
354
348
  /**
355
349
  * Restores the previous connection.
356
- * @private
357
- * @returns {Promise<void>}
350
+ * @returns
358
351
  */
359
352
  private async restoreConnection(): Promise<void> {
360
353
  this.connection = await this.connectionsRepo.get({