@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
@@ -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 Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
10
- * @class
11
- * @extends {ccc.SignerBtc}
9
+ * Class representing a Bitcoin signer that extends SignerBtc
10
+ * @public
12
11
  */
13
12
  class BitcoinSigner extends core_1.ccc.SignerBtc {
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) {
@@ -55,7 +53,6 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
55
53
  }
56
54
  /**
57
55
  * Gets the configuration for JoyID.
58
- * @private
59
56
  * @returns The configuration object.
60
57
  */
61
58
  getConfig() {
@@ -85,7 +82,7 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
85
82
  }
86
83
  /**
87
84
  * Gets the Bitcoin account address.
88
- * @returns {Promise<string>} A promise that resolves to the Bitcoin account address.
85
+ * @returns A promise that resolves to the Bitcoin account address.
89
86
  */
90
87
  async getBtcAccount() {
91
88
  const { address } = this.assertConnection();
@@ -93,7 +90,7 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
93
90
  }
94
91
  /**
95
92
  * Gets the Bitcoin public key.
96
- * @returns {Promise<ccc.Hex>} A promise that resolves to the Bitcoin public key.
93
+ * @returns A promise that resolves to the Bitcoin public key.
97
94
  */
98
95
  async getBtcPublicKey() {
99
96
  const { publicKey } = this.assertConnection();
@@ -101,7 +98,7 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
101
98
  }
102
99
  /**
103
100
  * Connects to the provider by requesting authentication.
104
- * @returns {Promise<void>} A promise that resolves when the connection is established.
101
+ * @returns A promise that resolves when the connection is established.
105
102
  */
106
103
  async connect() {
107
104
  const config = this.getConfig();
@@ -127,7 +124,7 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
127
124
  }
128
125
  /**
129
126
  * Checks if the signer is connected.
130
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
127
+ * @returns A promise that resolves to true if connected, false otherwise.
131
128
  */
132
129
  async isConnected() {
133
130
  if (this.connection) {
@@ -141,8 +138,8 @@ class BitcoinSigner extends core_1.ccc.SignerBtc {
141
138
  }
142
139
  /**
143
140
  * Signs a raw message with the Bitcoin account.
144
- * @param {string | ccc.BytesLike} message - The message to sign.
145
- * @returns {Promise<string>} A promise that resolves to the signed message.
141
+ * @param message - The message to sign.
142
+ * @returns A promise that resolves to the signed message.
146
143
  */
147
144
  async signMessageRaw(message) {
148
145
  const { address } = this.assertConnection();
@@ -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 CKB signer that extends Signer from @ckb-ccc/core.
5
- * @class
6
- * @extends {ccc.Signer}
4
+ * Class representing a CKB signer that extends Signer
5
+ * @public
7
6
  */
8
7
  export declare class CkbSigner extends ccc.Signer {
9
8
  private readonly name;
@@ -13,84 +12,80 @@ export declare class CkbSigner extends ccc.Signer {
13
12
  private readonly connectionsRepo;
14
13
  /**
15
14
  * Gets the signer type.
16
- * @returns {ccc.SignerType} The type of the signer.
15
+ * @returns The type of the signer.
17
16
  */
18
17
  get type(): ccc.SignerType;
19
18
  /**
20
19
  * Gets the sign type.
21
- * @returns {ccc.SignerSignType} The sign type.
20
+ * @returns The sign type.
22
21
  */
23
22
  get signType(): ccc.SignerSignType;
24
23
  private connection?;
25
24
  /**
26
25
  * Ensures that the signer is connected and returns the connection.
27
- * @private
28
26
  * @throws Will throw an error if not connected.
29
- * @returns {Promise<Connection>} A promise that resolves to the current connection.
27
+ * @returns A promise that resolves to the current connection.
30
28
  */
31
29
  private assertConnection;
32
30
  /**
33
31
  * Creates an instance of CkbSigner.
34
- * @param {ccc.Client} client - The client instance.
35
- * @param {string} name - The name of the signer.
36
- * @param {string} icon - The icon URL of the signer.
37
- * @param {string} [_appUri] - The application URI.
38
- * @param {string} [_aggregatorUri] - The aggregator URI.
39
- * @param {ConnectionsRepo} [connectionsRepo=new ConnectionsRepoLocalStorage()] - The connections repository.
32
+ * @param client - The client instance.
33
+ * @param name - The name of the signer.
34
+ * @param icon - The icon URL of the signer.
35
+ * @param _appUri - The application URI.
36
+ * @param _aggregatorUri - The aggregator URI.
37
+ * @param connectionsRepo - The connections repository.
40
38
  */
41
39
  constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, _aggregatorUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
42
40
  /**
43
41
  * Gets the configuration for JoyID.
44
- * @private
45
42
  * @returns The configuration object.
46
43
  */
47
44
  private getConfig;
48
45
  /**
49
46
  * Gets the aggregator URI.
50
- * @private
51
- * @returns {string} The aggregator URI.
47
+ * @returns The aggregator URI.
52
48
  */
53
49
  private getAggregatorUri;
54
50
  /**
55
51
  * Connects to the provider by requesting authentication.
56
- * @returns {Promise<void>} A promise that resolves when the connection is established.
52
+ * @returns A promise that resolves when the connection is established.
57
53
  */
58
54
  connect(): Promise<void>;
59
55
  disconnect(): Promise<void>;
60
56
  /**
61
57
  * Checks if the signer is connected.
62
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
58
+ * @returns A promise that resolves to true if connected, false otherwise.
63
59
  */
64
60
  isConnected(): Promise<boolean>;
65
61
  /**
66
62
  * Gets the internal address.
67
- * @returns {Promise<string>} A promise that resolves to the internal address.
63
+ * @returns A promise that resolves to the internal address.
68
64
  */
69
65
  getInternalAddress(): Promise<string>;
70
66
  /**
71
67
  * Gets the identity of the signer.
72
- * @returns {Promise<string>} A promise that resolves to the identity.
68
+ * @returns A promise that resolves to the identity.
73
69
  */
74
70
  getIdentity(): Promise<string>;
75
71
  /**
76
72
  * Gets the address object.
77
- * @returns {Promise<ccc.Address>} A promise that resolves to the address object.
73
+ * @returns A promise that resolves to the address object.
78
74
  */
79
75
  getAddressObj(): Promise<ccc.Address>;
80
76
  /**
81
77
  * Gets the address objects.
82
- * @returns {Promise<ccc.Address[]>} A promise that resolves to an array of address objects.
78
+ * @returns A promise that resolves to an array of address objects.
83
79
  */
84
80
  getAddressObjs(): Promise<ccc.Address[]>;
85
81
  /**
86
82
  * Prepares a transaction.
87
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
88
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the prepared transaction.
83
+ * @param txLike - The transaction-like object.
84
+ * @returns A promise that resolves to the prepared transaction.
89
85
  */
90
86
  prepareTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
91
87
  /**
92
88
  * Prepares a transaction for a sub key.
93
- * @private
94
89
  * @param tx - The transaction object.
95
90
  * @param witness - The witness arguments.
96
91
  * @throws Will throw an error if no COTA cells are found for the sub key wallet.
@@ -98,26 +93,24 @@ export declare class CkbSigner extends ccc.Signer {
98
93
  private prepareTransactionForSubKey;
99
94
  /**
100
95
  * Signs a transaction.
101
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
102
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the signed transaction.
96
+ * @param txLike - The transaction-like object.
97
+ * @returns A promise that resolves to the signed transaction.
103
98
  */
104
99
  signOnlyTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
105
100
  /**
106
101
  * Signs a raw message with the account.
107
- * @param {string | ccc.BytesLike} message - The message to sign.
108
- * @returns {Promise<string>} A promise that resolves to the signed message.
102
+ * @param message - The message to sign.
103
+ * @returns A promise that resolves to the signed message.
109
104
  */
110
105
  signMessageRaw(message: string | ccc.BytesLike): Promise<string>;
111
106
  /**
112
107
  * Saves the current connection.
113
- * @private
114
- * @returns {Promise<void>}
108
+ * @returns
115
109
  */
116
110
  private saveConnection;
117
111
  /**
118
112
  * Restores the previous connection.
119
- * @private
120
- * @returns {Promise<void>}
113
+ * @returns
121
114
  */
122
115
  private restoreConnection;
123
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ckb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,GAAG,CAAC,MAAM;IA4CrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IA/ClC;;;OAGG;IACH,IAAI,IAAI,IAAI,GAAG,CAAC,UAAU,CAEzB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,GAAG,CAAC,cAAc,CAEjC;IAED,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;;OAKG;YACW,gBAAgB;IAQ9B;;;;;;;;OAQG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD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mB3B;;;;;OAKG;YACW,2BAA2B;IA0CzC;;;;OAIG;IACG,mBAAmB,CACvB,MAAM,EAAE,GAAG,CAAC,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IA8C3B;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BtE;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
@@ -7,30 +7,28 @@ const common_1 = require("@joyid/common");
7
7
  const index_js_1 = require("../common/index.js");
8
8
  const index_js_2 = require("../connectionsStorage/index.js");
9
9
  /**
10
- * Class representing a CKB signer that extends Signer from @ckb-ccc/core.
11
- * @class
12
- * @extends {ccc.Signer}
10
+ * Class representing a CKB signer that extends Signer
11
+ * @public
13
12
  */
14
13
  class CkbSigner extends core_1.ccc.Signer {
15
14
  /**
16
15
  * Gets the signer type.
17
- * @returns {ccc.SignerType} The type of the signer.
16
+ * @returns The type of the signer.
18
17
  */
19
18
  get type() {
20
19
  return core_1.ccc.SignerType.CKB;
21
20
  }
22
21
  /**
23
22
  * Gets the sign type.
24
- * @returns {ccc.SignerSignType} The sign type.
23
+ * @returns The sign type.
25
24
  */
26
25
  get signType() {
27
26
  return core_1.ccc.SignerSignType.JoyId;
28
27
  }
29
28
  /**
30
29
  * Ensures that the signer is connected and returns the connection.
31
- * @private
32
30
  * @throws Will throw an error if not connected.
33
- * @returns {Promise<Connection>} A promise that resolves to the current connection.
31
+ * @returns A promise that resolves to the current connection.
34
32
  */
35
33
  async assertConnection() {
36
34
  if (!(await this.isConnected()) || !this.connection) {
@@ -40,12 +38,12 @@ class CkbSigner extends core_1.ccc.Signer {
40
38
  }
41
39
  /**
42
40
  * Creates an instance of CkbSigner.
43
- * @param {ccc.Client} client - The client instance.
44
- * @param {string} name - The name of the signer.
45
- * @param {string} icon - The icon URL of the signer.
46
- * @param {string} [_appUri] - The application URI.
47
- * @param {string} [_aggregatorUri] - The aggregator URI.
48
- * @param {ConnectionsRepo} [connectionsRepo=new ConnectionsRepoLocalStorage()] - The connections repository.
41
+ * @param client - The client instance.
42
+ * @param name - The name of the signer.
43
+ * @param icon - The icon URL of the signer.
44
+ * @param _appUri - The application URI.
45
+ * @param _aggregatorUri - The aggregator URI.
46
+ * @param connectionsRepo - The connections repository.
49
47
  */
50
48
  constructor(client, name, icon, _appUri, _aggregatorUri, connectionsRepo = new index_js_2.ConnectionsRepoLocalStorage()) {
51
49
  super(client);
@@ -57,7 +55,6 @@ class CkbSigner extends core_1.ccc.Signer {
57
55
  }
58
56
  /**
59
57
  * Gets the configuration for JoyID.
60
- * @private
61
58
  * @returns The configuration object.
62
59
  */
63
60
  getConfig() {
@@ -72,8 +69,7 @@ class CkbSigner extends core_1.ccc.Signer {
72
69
  }
73
70
  /**
74
71
  * Gets the aggregator URI.
75
- * @private
76
- * @returns {string} The aggregator URI.
72
+ * @returns The aggregator URI.
77
73
  */
78
74
  getAggregatorUri() {
79
75
  if (this._aggregatorUri) {
@@ -85,7 +81,7 @@ class CkbSigner extends core_1.ccc.Signer {
85
81
  }
86
82
  /**
87
83
  * Connects to the provider by requesting authentication.
88
- * @returns {Promise<void>} A promise that resolves when the connection is established.
84
+ * @returns A promise that resolves when the connection is established.
89
85
  */
90
86
  async connect() {
91
87
  const config = this.getConfig();
@@ -107,7 +103,7 @@ class CkbSigner extends core_1.ccc.Signer {
107
103
  }
108
104
  /**
109
105
  * Checks if the signer is connected.
110
- * @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
106
+ * @returns A promise that resolves to true if connected, false otherwise.
111
107
  */
112
108
  async isConnected() {
113
109
  if (this.connection) {
@@ -118,14 +114,14 @@ class CkbSigner extends core_1.ccc.Signer {
118
114
  }
119
115
  /**
120
116
  * Gets the internal address.
121
- * @returns {Promise<string>} A promise that resolves to the internal address.
117
+ * @returns A promise that resolves to the internal address.
122
118
  */
123
119
  async getInternalAddress() {
124
120
  return (await this.assertConnection()).address;
125
121
  }
126
122
  /**
127
123
  * Gets the identity of the signer.
128
- * @returns {Promise<string>} A promise that resolves to the identity.
124
+ * @returns A promise that resolves to the identity.
129
125
  */
130
126
  async getIdentity() {
131
127
  const connection = await this.assertConnection();
@@ -136,22 +132,22 @@ class CkbSigner extends core_1.ccc.Signer {
136
132
  }
137
133
  /**
138
134
  * Gets the address object.
139
- * @returns {Promise<ccc.Address>} A promise that resolves to the address object.
135
+ * @returns A promise that resolves to the address object.
140
136
  */
141
137
  async getAddressObj() {
142
138
  return await core_1.ccc.Address.fromString(await this.getInternalAddress(), this.client);
143
139
  }
144
140
  /**
145
141
  * Gets the address objects.
146
- * @returns {Promise<ccc.Address[]>} A promise that resolves to an array of address objects.
142
+ * @returns A promise that resolves to an array of address objects.
147
143
  */
148
144
  async getAddressObjs() {
149
145
  return [await this.getAddressObj()];
150
146
  }
151
147
  /**
152
148
  * Prepares a transaction.
153
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
154
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the prepared transaction.
149
+ * @param txLike - The transaction-like object.
150
+ * @returns A promise that resolves to the prepared transaction.
155
151
  */
156
152
  async prepareTransaction(txLike) {
157
153
  const tx = core_1.ccc.Transaction.from(txLike);
@@ -168,7 +164,6 @@ class CkbSigner extends core_1.ccc.Signer {
168
164
  }
169
165
  /**
170
166
  * Prepares a transaction for a sub key.
171
- * @private
172
167
  * @param tx - The transaction object.
173
168
  * @param witness - The witness arguments.
174
169
  * @throws Will throw an error if no COTA cells are found for the sub key wallet.
@@ -201,8 +196,8 @@ class CkbSigner extends core_1.ccc.Signer {
201
196
  }
202
197
  /**
203
198
  * Signs a transaction.
204
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
205
- * @returns {Promise<ccc.Transaction>} A promise that resolves to the signed transaction.
199
+ * @param txLike - The transaction-like object.
200
+ * @returns A promise that resolves to the signed transaction.
206
201
  */
207
202
  async signOnlyTransaction(txLike) {
208
203
  const tx = core_1.ccc.Transaction.from(txLike);
@@ -236,8 +231,8 @@ class CkbSigner extends core_1.ccc.Signer {
236
231
  }
237
232
  /**
238
233
  * Signs a raw message with the account.
239
- * @param {string | ccc.BytesLike} message - The message to sign.
240
- * @returns {Promise<string>} A promise that resolves to the signed message.
234
+ * @param message - The message to sign.
235
+ * @returns A promise that resolves to the signed message.
241
236
  */
242
237
  async signMessageRaw(message) {
243
238
  const { address } = await this.assertConnection();
@@ -257,8 +252,7 @@ class CkbSigner extends core_1.ccc.Signer {
257
252
  }
258
253
  /**
259
254
  * Saves the current connection.
260
- * @private
261
- * @returns {Promise<void>}
255
+ * @returns
262
256
  */
263
257
  async saveConnection() {
264
258
  return this.connectionsRepo.set({
@@ -268,8 +262,7 @@ class CkbSigner extends core_1.ccc.Signer {
268
262
  }
269
263
  /**
270
264
  * Restores the previous connection.
271
- * @private
272
- * @returns {Promise<void>}
265
+ * @returns
273
266
  */
274
267
  async restoreConnection() {
275
268
  this.connection = await this.connectionsRepo.get({
@@ -1,7 +1,6 @@
1
1
  import { AuthResponseData, DappRequestType, EvmWeb2LoginResponse, PopupConfigOptions, SignCkbTxResponseData, SignCotaNFTResponseData, SignEvmTxResponseData, SignMessageResponseData, SignNostrEventData } from "@joyid/common";
2
2
  /**
3
3
  * Interface representing the return type for various Dapp request types.
4
- * @interface
5
4
  */
6
5
  export interface PopupReturnType {
7
6
  [DappRequestType.Auth]: AuthResponseData;
@@ -24,9 +23,9 @@ export interface PopupReturnType {
24
23
  }
25
24
  /**
26
25
  * Creates a popup window for JoyID Dapp requests.
27
- * @param {string} url - The URL to open in the popup.
28
- * @param {PopupConfigOptions<T> & { joyidAppURL: string }} config - The popup configuration options.
29
- * @returns {Promise<PopupReturnType[T]>} A promise that resolves to the response data of the requested type.
26
+ * @param url - The URL to open in the popup.
27
+ * @param config - The popup configuration options.
28
+ * @returns A promise that resolves to the response data of the requested type.
30
29
  * @throws {PopupNotSupportedError} If popups are not supported in the current browser.
31
30
  * @throws {PopupCancelledError} If the popup is closed by the user.
32
31
  * @throws {PopupTimeoutError} If the popup operation times out.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EAEpB,kBAAkB,EAGlB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAInB,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACzC,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACvD,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACjD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IAClD,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE;QAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IACnD,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACvD,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACtD,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACrD,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC;IAC3C,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC;IAC3C,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC;IACnC,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IACtC,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAC1C,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC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C,eAAe,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IACtC,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAC1C,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,eAAe,EACzD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACtD,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CA0D7B"}
@@ -4,9 +4,9 @@ exports.createPopup = void 0;
4
4
  const common_1 = require("@joyid/common");
5
5
  /**
6
6
  * Creates a popup window for JoyID Dapp requests.
7
- * @param {string} url - The URL to open in the popup.
8
- * @param {PopupConfigOptions<T> & { joyidAppURL: string }} config - The popup configuration options.
9
- * @returns {Promise<PopupReturnType[T]>} A promise that resolves to the response data of the requested type.
7
+ * @param url - The URL to open in the popup.
8
+ * @param config - The popup configuration options.
9
+ * @returns A promise that resolves to the response data of the requested type.
10
10
  * @throws {PopupNotSupportedError} If popups are not supported in the current browser.
11
11
  * @throws {PopupCancelledError} If the popup is closed by the user.
12
12
  * @throws {PopupTimeoutError} If the popup operation times out.
@@ -1,80 +1,85 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  /**
3
3
  * Type representing an account selector with a URI and address type.
4
- * @typedef {Object} AccountSelector
5
- * @property {string} uri - The URI of the account.
6
- * @property {string} addressType - The address type of the account.
7
4
  */
8
5
  export type AccountSelector = {
6
+ /**
7
+ * The URI of the account.
8
+ */
9
9
  uri: string;
10
+ /**
11
+ * The address type of the account.
12
+ */
10
13
  addressType: string;
11
14
  };
12
15
  /**
13
- * Checks if two AccountSelectors are equal.
14
- * @param {AccountSelector} a - The first account selector.
15
- * @param {AccountSelector} b - The second account selector.
16
- * @returns {boolean} True if the selectors are equal, false otherwise.
16
+ * Checks if a AccountSelector matches the filter
17
+ * @param a - The first account selector.
18
+ * @param filter - The account selector filter.
19
+ * @returns True if the selector matches the filter
17
20
  */
18
21
  export declare function isSelectorMatch(a: AccountSelector, filter: AccountSelector): boolean;
19
22
  /**
20
23
  * Type representing a connection with an address, public key, and key type.
21
- * @typedef {Object} Connection
22
- * @property {string} address - The address of the connection.
23
- * @property {ccc.Hex} publicKey - The public key of the connection.
24
- * @property {string} keyType - The key type of the connection.
25
24
  */
26
25
  export type Connection = {
26
+ /**
27
+ * The address of the connection.
28
+ */
27
29
  readonly address: string;
30
+ /**
31
+ * The public key of the connection.
32
+ */
28
33
  readonly publicKey: ccc.Hex;
34
+ /**
35
+ * The key type of the connection.
36
+ */
29
37
  readonly keyType: string;
30
38
  };
31
39
  /**
32
40
  * Interface representing a repository for managing connections.
33
- * @interface
34
41
  */
35
42
  export interface ConnectionsRepo {
36
43
  /**
37
44
  * Gets a connection for the given selector.
38
- * @param {AccountSelector} selector - The account selector.
39
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
45
+ * @param selector - The account selector.
46
+ * @returns A promise that resolves to the connection, if found.
40
47
  */
41
48
  get(selector: AccountSelector): Promise<Connection | undefined>;
42
49
  /**
43
50
  * Sets a connection for the given selector.
44
- * @param {AccountSelector} selector - The account selector.
45
- * @param {Connection | undefined} connection - The connection to set.
46
- * @returns {Promise<void>} A promise that resolves when the connection is set.
51
+ * @param selector - The account selector.
52
+ * @param connection - The connection to set.
53
+ * @returns A promise that resolves when the connection is set.
47
54
  */
48
55
  set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
49
56
  }
50
57
  /**
51
58
  * Class representing a local storage-based repository for managing connections.
52
- * @class
53
- * @implements {ConnectionsRepo}
54
59
  */
55
60
  export declare class ConnectionsRepoLocalStorage implements ConnectionsRepo {
56
61
  private readonly storageKey;
57
62
  /**
58
63
  * Creates an instance of ConnectionsRepoLocalStorage.
59
- * @param {string} [storageKey="ccc-joy-id-signer"] - The local storage key.
64
+ * @param [storageKey="ccc-joy-id-signer"] - The local storage key.
60
65
  */
61
66
  constructor(storageKey?: string);
62
67
  /**
63
68
  * Reads all connections from local storage.
64
- * @returns {Promise<[AccountSelector, Connection][]>} A promise that resolves to an array of selectors and connections.
69
+ * @returns A promise that resolves to an array of selectors and connections.
65
70
  */
66
71
  readConnections(): Promise<[AccountSelector, Connection][]>;
67
72
  /**
68
73
  * Gets a connection for the given selector.
69
- * @param {AccountSelector} selector - The account selector.
70
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
74
+ * @param selector - The account selector.
75
+ * @returns A promise that resolves to the connection, if found.
71
76
  */
72
77
  get(selector: AccountSelector): Promise<Connection | undefined>;
73
78
  /**
74
79
  * Sets a connection for the given selector.
75
- * @param {AccountSelector} selector - The account selector.
76
- * @param {Connection | undefined} connection - The connection to set.
77
- * @returns {Promise<void>}
80
+ * @param selector - The account selector.
81
+ * @param connection - The connection to set.
82
+ * @returns
78
83
  */
79
84
  set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
80
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectionsStorage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,eAAe,EAClB,MAAM,EAAE,eAAe,GACtB,OAAO,CAET;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;GA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OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,GAAG,CACD,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IAKrD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJvC;;;OAGG;gBAC0B,UAAU,SAAsB;IAE7D;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,CAAC;IAIjE;;;;OAIG;IACG,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAMrE;;;;;OAKG;IACG,GAAG,CACP,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC;CAoBjB"}
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionsRepoLocalStorage = exports.isSelectorMatch = void 0;
4
4
  /**
5
- * Checks if two AccountSelectors are equal.
6
- * @param {AccountSelector} a - The first account selector.
7
- * @param {AccountSelector} b - The second account selector.
8
- * @returns {boolean} True if the selectors are equal, false otherwise.
5
+ * Checks if a AccountSelector matches the filter
6
+ * @param a - The first account selector.
7
+ * @param filter - The account selector filter.
8
+ * @returns True if the selector matches the filter
9
9
  */
10
10
  function isSelectorMatch(a, filter) {
11
11
  return a.uri === filter.uri && a.addressType.startsWith(filter.addressType);
@@ -13,37 +13,35 @@ function isSelectorMatch(a, filter) {
13
13
  exports.isSelectorMatch = isSelectorMatch;
14
14
  /**
15
15
  * Class representing a local storage-based repository for managing connections.
16
- * @class
17
- * @implements {ConnectionsRepo}
18
16
  */
19
17
  class ConnectionsRepoLocalStorage {
20
18
  /**
21
19
  * Creates an instance of ConnectionsRepoLocalStorage.
22
- * @param {string} [storageKey="ccc-joy-id-signer"] - The local storage key.
20
+ * @param [storageKey="ccc-joy-id-signer"] - The local storage key.
23
21
  */
24
22
  constructor(storageKey = "ccc-joy-id-signer") {
25
23
  this.storageKey = storageKey;
26
24
  }
27
25
  /**
28
26
  * Reads all connections from local storage.
29
- * @returns {Promise<[AccountSelector, Connection][]>} A promise that resolves to an array of selectors and connections.
27
+ * @returns A promise that resolves to an array of selectors and connections.
30
28
  */
31
29
  async readConnections() {
32
30
  return JSON.parse(window.localStorage.getItem(this.storageKey) ?? "[]");
33
31
  }
34
32
  /**
35
33
  * Gets a connection for the given selector.
36
- * @param {AccountSelector} selector - The account selector.
37
- * @returns {Promise<Connection | undefined>} A promise that resolves to the connection, if found.
34
+ * @param selector - The account selector.
35
+ * @returns A promise that resolves to the connection, if found.
38
36
  */
39
37
  async get(selector) {
40
38
  return (await this.readConnections()).find(([s]) => isSelectorMatch(selector, s))?.[1];
41
39
  }
42
40
  /**
43
41
  * Sets a connection for the given selector.
44
- * @param {AccountSelector} selector - The account selector.
45
- * @param {Connection | undefined} connection - The connection to set.
46
- * @returns {Promise<void>}
42
+ * @param selector - The account selector.
43
+ * @param connection - The connection to set.
44
+ * @returns
47
45
  */
48
46
  async set(selector, connection) {
49
47
  const connections = await this.readConnections();