@turnkey/core 1.0.0-beta.2 → 1.0.0-beta.4

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 (77) hide show
  1. package/dist/__clients__/core.d.ts +75 -2
  2. package/dist/__clients__/core.d.ts.map +1 -1
  3. package/dist/__clients__/core.js +637 -503
  4. package/dist/__clients__/core.js.map +1 -1
  5. package/dist/__clients__/core.mjs +640 -506
  6. package/dist/__clients__/core.mjs.map +1 -1
  7. package/dist/__generated__/sdk-client-base.d.ts +1 -1
  8. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  9. package/dist/__generated__/sdk-client-base.js +156 -250
  10. package/dist/__generated__/sdk-client-base.js.map +1 -1
  11. package/dist/__generated__/sdk-client-base.mjs +156 -250
  12. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  13. package/dist/__generated__/version.d.ts +1 -1
  14. package/dist/__generated__/version.js +1 -1
  15. package/dist/__generated__/version.mjs +1 -1
  16. package/dist/__types__/base.d.ts +1 -1
  17. package/dist/__wallet__/base.d.ts +11 -0
  18. package/dist/__wallet__/base.d.ts.map +1 -1
  19. package/dist/__wallet__/base.js +12 -1
  20. package/dist/__wallet__/base.js.map +1 -1
  21. package/dist/__wallet__/base.mjs +12 -1
  22. package/dist/__wallet__/base.mjs.map +1 -1
  23. package/dist/__wallet__/connector.d.ts +31 -4
  24. package/dist/__wallet__/connector.d.ts.map +1 -1
  25. package/dist/__wallet__/connector.js +35 -5
  26. package/dist/__wallet__/connector.js.map +1 -1
  27. package/dist/__wallet__/connector.mjs +35 -5
  28. package/dist/__wallet__/connector.mjs.map +1 -1
  29. package/dist/__wallet__/mobile/manager.d.ts +21 -5
  30. package/dist/__wallet__/mobile/manager.d.ts.map +1 -1
  31. package/dist/__wallet__/mobile/manager.js +28 -11
  32. package/dist/__wallet__/mobile/manager.js.map +1 -1
  33. package/dist/__wallet__/mobile/manager.mjs +28 -11
  34. package/dist/__wallet__/mobile/manager.mjs.map +1 -1
  35. package/dist/__wallet__/stamper.d.ts +73 -2
  36. package/dist/__wallet__/stamper.d.ts.map +1 -1
  37. package/dist/__wallet__/stamper.js +79 -13
  38. package/dist/__wallet__/stamper.js.map +1 -1
  39. package/dist/__wallet__/stamper.mjs +79 -13
  40. package/dist/__wallet__/stamper.mjs.map +1 -1
  41. package/dist/__wallet__/wallet-connect/base.d.ts +99 -19
  42. package/dist/__wallet__/wallet-connect/base.d.ts.map +1 -1
  43. package/dist/__wallet__/wallet-connect/base.js +172 -75
  44. package/dist/__wallet__/wallet-connect/base.js.map +1 -1
  45. package/dist/__wallet__/wallet-connect/base.mjs +172 -75
  46. package/dist/__wallet__/wallet-connect/base.mjs.map +1 -1
  47. package/dist/__wallet__/wallet-connect/client.d.ts +22 -14
  48. package/dist/__wallet__/wallet-connect/client.d.ts.map +1 -1
  49. package/dist/__wallet__/wallet-connect/client.js +22 -14
  50. package/dist/__wallet__/wallet-connect/client.js.map +1 -1
  51. package/dist/__wallet__/wallet-connect/client.mjs +22 -14
  52. package/dist/__wallet__/wallet-connect/client.mjs.map +1 -1
  53. package/dist/__wallet__/web/manager.d.ts +20 -12
  54. package/dist/__wallet__/web/manager.d.ts.map +1 -1
  55. package/dist/__wallet__/web/manager.js +29 -21
  56. package/dist/__wallet__/web/manager.js.map +1 -1
  57. package/dist/__wallet__/web/manager.mjs +29 -21
  58. package/dist/__wallet__/web/manager.mjs.map +1 -1
  59. package/dist/__wallet__/web/native/ethereum.d.ts +45 -11
  60. package/dist/__wallet__/web/native/ethereum.d.ts.map +1 -1
  61. package/dist/__wallet__/web/native/ethereum.js +58 -17
  62. package/dist/__wallet__/web/native/ethereum.js.map +1 -1
  63. package/dist/__wallet__/web/native/ethereum.mjs +58 -17
  64. package/dist/__wallet__/web/native/ethereum.mjs.map +1 -1
  65. package/dist/__wallet__/web/native/solana.d.ts +56 -3
  66. package/dist/__wallet__/web/native/solana.d.ts.map +1 -1
  67. package/dist/__wallet__/web/native/solana.js +95 -36
  68. package/dist/__wallet__/web/native/solana.js.map +1 -1
  69. package/dist/__wallet__/web/native/solana.mjs +95 -36
  70. package/dist/__wallet__/web/native/solana.mjs.map +1 -1
  71. package/dist/utils.d.ts +24 -1
  72. package/dist/utils.d.ts.map +1 -1
  73. package/dist/utils.js +54 -0
  74. package/dist/utils.js.map +1 -1
  75. package/dist/utils.mjs +54 -1
  76. package/dist/utils.mjs.map +1 -1
  77. package/package.json +7 -7
@@ -6,20 +6,38 @@ import { WalletInterfaceType, Chain, SignIntent } from '../../__types__/base.mjs
6
6
  import { Transaction } from 'ethers';
7
7
 
8
8
  class WalletConnectWallet {
9
+ /**
10
+ * Constructs a WalletConnectWallet bound to a WalletConnect client.
11
+ *
12
+ * - Subscribes to session deletions and automatically re-initiates pairing,
13
+ * updating `this.uri` so the UI can present a fresh QR/deeplink.
14
+ *
15
+ * @param client - The low-level WalletConnect client used for session/RPC.
16
+ */
9
17
  constructor(client) {
10
18
  this.client = client;
11
19
  this.interfaceType = WalletInterfaceType.WalletConnect;
12
20
  this.ethereumNamespaces = [];
13
21
  this.solanaNamespaces = [];
14
- this.client.onSessionDelete(() => { });
22
+ this.client.onSessionDelete(async () => {
23
+ try {
24
+ this.uri = await this.client.pair(this.buildNamespaces());
25
+ }
26
+ catch (err) {
27
+ console.warn("WalletConnect: failed to re-pair after session delete", err);
28
+ }
29
+ });
15
30
  }
16
31
  /**
17
- * Initializes WalletConnect pairing flow with the specified chains.
18
- * If an active session already exists, pairing is skipped.
32
+ * Initializes WalletConnect pairing flow with the specified namespaces.
19
33
  *
20
- * @param opts.ethereum - Whether to enable Ethereum pairing
21
- * @param opts.solana - Whether to enable Solana pairing
22
- * @throws {Error} If no chains are enabled
34
+ * - Saves the requested chain namespaces (e.g., `["eip155:1", "eip155:137", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]`).
35
+ * - If an active session already has connected accounts, pairing is skipped.
36
+ * - Otherwise initiates a pairing and stores the resulting URI.
37
+ *
38
+ * @param opts.ethereumNamespaces - List of EVM CAIP IDs (e.g., "eip155:1").
39
+ * @param opts.solanaNamespaces - List of Solana CAIP IDs (e.g., "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp").
40
+ * @throws {Error} If no namespaces are provided for either chain.
23
41
  */
24
42
  async init(opts) {
25
43
  this.ethereumNamespaces = opts.ethereumNamespaces;
@@ -34,39 +52,23 @@ class WalletConnectWallet {
34
52
  this.solanaNamespaces.length === 0) {
35
53
  throw new Error("At least one namespace must be enabled for WalletConnect");
36
54
  }
55
+ // we don't want to create more than one active session
56
+ // so we don't make a pair request if one is already active
57
+ // since pairing would mean initializing a new session
37
58
  const session = this.client.getSession();
38
59
  if (hasConnectedAccounts(session)) {
39
60
  return;
40
61
  }
41
- const namespaces = {};
42
- if (this.ethereumNamespaces.length > 0) {
43
- namespaces.eip155 = {
44
- methods: [
45
- "personal_sign",
46
- "eth_sendTransaction",
47
- "eth_chainId",
48
- "wallet_switchEthereumChain",
49
- "wallet_addEthereumChain",
50
- ],
51
- chains: this.ethereumNamespaces,
52
- events: ["accountsChanged", "chainChanged"],
53
- };
54
- }
55
- if (this.solanaNamespaces.length > 0) {
56
- namespaces.solana = {
57
- methods: [
58
- "solana_signMessage",
59
- "solana_signTransaction",
60
- "solana_sendTransaction",
61
- ],
62
- chains: this.solanaNamespaces,
63
- events: ["accountsChanged", "chainChanged"],
64
- };
65
- }
62
+ const namespaces = this.buildNamespaces();
66
63
  this.uri = await this.client.pair(namespaces);
67
64
  }
68
65
  /**
69
66
  * Returns WalletConnect providers with associated chain/account metadata.
67
+ *
68
+ * - Builds an EVM provider (if Ethereum namespaces are enabled).
69
+ * - Builds a Solana provider (if Solana namespaces are enabled).
70
+ *
71
+ * @returns A promise resolving to an array of WalletProvider objects.
70
72
  */
71
73
  async getProviders() {
72
74
  const session = this.client.getSession();
@@ -85,6 +87,12 @@ class WalletConnectWallet {
85
87
  }
86
88
  /**
87
89
  * Approves the session if needed and ensures at least one account is available.
90
+ *
91
+ * - Calls `approve()` on the underlying client when pairing is pending.
92
+ * - Throws if the approved session contains no connected accounts.
93
+ *
94
+ * @param _provider - Unused (present for interface compatibility).
95
+ * @throws {Error} If the session contains no accounts.
88
96
  */
89
97
  async connectWalletAccount(_provider) {
90
98
  const session = await this.client.approve();
@@ -92,12 +100,20 @@ class WalletConnectWallet {
92
100
  throw new Error("No account found in session");
93
101
  }
94
102
  /**
95
- * Switch the user’s WalletConnect session to a new EVM chain.
103
+ * Switches the user’s WalletConnect session to a new EVM chain.
104
+ *
105
+ * - Ethereum-only: only supported for providers on the Ethereum namespace.
106
+ * - No add-then-switch: WalletConnect cannot add chains mid-session. The target chain
107
+ * must be present in `ethereumNamespaces` negotiated at pairing time. To support a new chain,
108
+ * you must include it in the walletConfig.
109
+ * - Accepts a hex chain ID (e.g., "0x1"). If a `SwitchableChain` is passed, only its `id`
110
+ * (hex chain ID) is used; metadata is ignored for WalletConnect.
96
111
  *
97
- * @param provider the WalletProvider returned by getProviders()
98
- * @param chainOrId either:
99
- * a CAIP string ("eip155:1", "eip155:137", …)
100
- * a SwitchableChain object carrying full metadata
112
+ * @param provider - The WalletProvider returned by `getProviders()`.
113
+ * @param chainOrId - Hex chain ID (e.g., "0x1") or a `SwitchableChain` (its `id` is used).
114
+ * @returns A promise that resolves when the switch completes.
115
+ * @throws {Error} If no active session, provider is non-EVM, the chain is not in `ethereumNamespaces`,
116
+ * or the switch RPC fails.
101
117
  */
102
118
  async switchChain(provider, chainOrId) {
103
119
  if (provider.chainInfo.namespace !== Chain.Ethereum) {
@@ -124,13 +140,27 @@ class WalletConnectWallet {
124
140
  }
125
141
  }
126
142
  /**
127
- * Signs a message or transaction using the specified provider and intent.
143
+ * Signs a message or transaction using the specified wallet provider and intent.
144
+ *
145
+ * - Ensures an active WalletConnect session:
146
+ * - If a pairing is in progress (URI shown but not yet approved), this call will
147
+ * wait for the user to approve the session and may appear stuck until they do.
148
+ * - If no pairing is in progress, this will throw (e.g., "call pair() before approve()").
149
+ * - Ethereum:
150
+ * - `SignMessage` → `personal_sign` (returns hex signature).
151
+ * - `SignAndSendTransaction` → `eth_sendTransaction` (returns tx hash).
152
+ * - Solana:
153
+ * - `SignMessage` → `solana_signMessage` (returns hex signature).
154
+ * - `SignTransaction` → `solana_signTransaction` (returns hex signature).
155
+ * - `SignAndSendTransaction` → `solana_sendTransaction` (returns hex signature of the submitted tx).
128
156
  *
129
- * @param message - The message or serialized transaction to sign.
157
+ * @param payload - Payload or serialized transaction to sign.
130
158
  * @param provider - The WalletProvider to use.
131
- * @param intent - The type of signing intent (message, tx, send).
159
+ * @param intent - The signing intent.
160
+ * @returns A hex string (signature or transaction hash, depending on intent).
161
+ * @throws {Error} If no account is available, no pairing is in progress, or the intent is unsupported.
132
162
  */
133
- async sign(message, provider, intent) {
163
+ async sign(payload, provider, intent) {
134
164
  const session = await this.ensureSession();
135
165
  if (!hasConnectedAccounts(session)) {
136
166
  await this.connectWalletAccount(provider);
@@ -143,12 +173,12 @@ class WalletConnectWallet {
143
173
  switch (intent) {
144
174
  case SignIntent.SignMessage:
145
175
  return (await this.client.request(this.ethChain, "personal_sign", [
146
- message,
176
+ payload,
147
177
  address,
148
178
  ]));
149
179
  case SignIntent.SignAndSendTransaction:
150
180
  const account = provider.connectedAddresses[0];
151
- const tx = Transaction.from(message);
181
+ const tx = Transaction.from(payload);
152
182
  const txParams = {
153
183
  from: account,
154
184
  to: tx.to?.toString(),
@@ -172,7 +202,7 @@ class WalletConnectWallet {
172
202
  }
173
203
  switch (intent) {
174
204
  case SignIntent.SignMessage: {
175
- const msgBytes = new TextEncoder().encode(message);
205
+ const msgBytes = new TextEncoder().encode(payload);
176
206
  const msgB58 = bs58.encode(msgBytes);
177
207
  const { signature: sigB58 } = await this.client.request(this.solChain, "solana_signMessage", {
178
208
  pubkey: address,
@@ -181,7 +211,7 @@ class WalletConnectWallet {
181
211
  return uint8ArrayToHexString(bs58.decode(sigB58));
182
212
  }
183
213
  case SignIntent.SignTransaction: {
184
- const txBytes = uint8ArrayFromHexString(message);
214
+ const txBytes = uint8ArrayFromHexString(payload);
185
215
  const txBase64 = stringToBase64urlString(String.fromCharCode(...txBytes));
186
216
  const { signature: sigB58 } = await this.client.request(this.solChain, "solana_signTransaction", {
187
217
  feePayer: address,
@@ -190,7 +220,7 @@ class WalletConnectWallet {
190
220
  return uint8ArrayToHexString(bs58.decode(sigB58));
191
221
  }
192
222
  case SignIntent.SignAndSendTransaction: {
193
- const txBytes = uint8ArrayFromHexString(message);
223
+ const txBytes = uint8ArrayFromHexString(payload);
194
224
  const txBase64 = stringToBase64urlString(String.fromCharCode(...txBytes));
195
225
  const sigB58 = await this.client.request(this.solChain, "solana_sendTransaction", {
196
226
  feePayer: address,
@@ -208,8 +238,12 @@ class WalletConnectWallet {
208
238
  /**
209
239
  * Retrieves the public key of the connected wallet.
210
240
  *
241
+ * - Ethereum: signs a fixed challenge and recovers the compressed secp256k1 public key.
242
+ * - Solana: decodes the base58-encoded address to raw bytes.
243
+ *
211
244
  * @param provider - The WalletProvider to fetch the key from.
212
- * @returns Compressed public key as a hex string.
245
+ * @returns A compressed public key as a hex string.
246
+ * @throws {Error} If no account is available or the namespace is unsupported.
213
247
  */
214
248
  async getPublicKey(provider) {
215
249
  const session = this.client.getSession();
@@ -245,34 +279,13 @@ class WalletConnectWallet {
245
279
  }
246
280
  /**
247
281
  * Disconnects the current session and re-initiates a fresh pairing URI.
282
+ *
283
+ * - Calls `disconnect()` on the client, then `pair()` with current namespaces.
284
+ * - Updates `this.uri` so the UI can present a new QR/deeplink.
248
285
  */
249
286
  async disconnectWalletAccount(_provider) {
250
287
  await this.client.disconnect();
251
- const namespaces = {};
252
- if (this.ethereumNamespaces.length > 0) {
253
- namespaces.eip155 = {
254
- methods: [
255
- "personal_sign",
256
- "eth_sendTransaction",
257
- "eth_chainId",
258
- "wallet_switchEthereumChain",
259
- "wallet_addEthereumChain",
260
- ],
261
- chains: this.ethereumNamespaces,
262
- events: ["accountsChanged", "chainChanged"],
263
- };
264
- }
265
- if (this.solanaNamespaces.length > 0) {
266
- namespaces.solana = {
267
- methods: [
268
- "solana_signMessage",
269
- "solana_signTransaction",
270
- "solana_sendTransaction",
271
- ],
272
- chains: this.solanaNamespaces,
273
- events: ["accountsChanged", "chainChanged"],
274
- };
275
- }
288
+ const namespaces = this.buildNamespaces();
276
289
  await this.client.pair(namespaces).then((newUri) => {
277
290
  this.uri = newUri;
278
291
  });
@@ -280,8 +293,8 @@ class WalletConnectWallet {
280
293
  /**
281
294
  * Builds a lightweight provider interface for the given chain.
282
295
  *
283
- * @param chainId - The namespace chain ID (e.g., eip155:1)
284
- * @returns A WalletConnect-compatible provider implementation
296
+ * @param chainId - Namespace chain ID (e.g., "eip155:1" or "solana:101").
297
+ * @returns A WalletConnect-compatible provider that proxies JSON-RPC via WC.
285
298
  */
286
299
  makeProvider(chainId) {
287
300
  return {
@@ -293,8 +306,15 @@ class WalletConnectWallet {
293
306
  /**
294
307
  * Ensures there is an active WalletConnect session, initiating approval if necessary.
295
308
  *
296
- * @returns The current WalletConnect session
297
- * @throws {Error} If approval fails or session is not established
309
+ * - If a session exists, returns it immediately.
310
+ * - If no session exists but a pairing is in progress, awaits `approve()` —
311
+ * this will block until the user approves (or rejects) in their wallet.
312
+ * - If no session exists and no pairing is in progress, throws; the caller
313
+ * must have initiated pairing via `pair()` elsewhere.
314
+ *
315
+ * @returns The active WalletConnect session.
316
+ * @throws {Error} If approval is rejected, completes without establishing a session,
317
+ * or no pairing is in progress.
298
318
  */
299
319
  async ensureSession() {
300
320
  let session = this.client.getSession();
@@ -308,6 +328,13 @@ class WalletConnectWallet {
308
328
  }
309
329
  /**
310
330
  * Builds a WalletProvider descriptor for an EVM chain.
331
+ *
332
+ * - Extracts the connected address (if any) and current chain ID.
333
+ * - Includes the pairing `uri` if available.
334
+ *
335
+ * @param session - Current WalletConnect session (or null).
336
+ * @param info - Provider branding info (name, icon).
337
+ * @returns A WalletProvider object for Ethereum.
311
338
  */
312
339
  async buildEthProvider(session, info) {
313
340
  const raw = session?.namespaces.eip155?.accounts?.[0] ?? "";
@@ -329,6 +356,13 @@ class WalletConnectWallet {
329
356
  }
330
357
  /**
331
358
  * Builds a WalletProvider descriptor for Solana.
359
+ *
360
+ * - Extracts the connected address (if any).
361
+ * - Includes the fresh pairing `uri` if available.
362
+ *
363
+ * @param session - Current WalletConnect session (or null).
364
+ * @param info - Provider branding info (name, icon).
365
+ * @returns A WalletProvider object for Solana.
332
366
  */
333
367
  buildSolProvider(session, info) {
334
368
  const raw = session?.namespaces.solana?.accounts?.[0] ?? "";
@@ -342,15 +376,78 @@ class WalletConnectWallet {
342
376
  ...(this.uri && { uri: this.uri }),
343
377
  };
344
378
  }
379
+ /**
380
+ * Builds the requested WalletConnect namespaces from the current config.
381
+ *
382
+ * - Includes methods and events for Ethereum and/or Solana based on enabled namespaces.
383
+ *
384
+ * @returns A namespaces object suitable for `WalletConnectClient.pair()`.
385
+ */
386
+ buildNamespaces() {
387
+ const namespaces = {};
388
+ if (this.ethereumNamespaces.length > 0) {
389
+ namespaces.eip155 = {
390
+ methods: [
391
+ "personal_sign",
392
+ "eth_sendTransaction",
393
+ "eth_chainId",
394
+ "wallet_switchEthereumChain",
395
+ "wallet_addEthereumChain",
396
+ ],
397
+ chains: this.ethereumNamespaces,
398
+ events: ["accountsChanged", "chainChanged"],
399
+ };
400
+ }
401
+ if (this.solanaNamespaces.length > 0) {
402
+ namespaces.solana = {
403
+ methods: [
404
+ "solana_signMessage",
405
+ "solana_signTransaction",
406
+ "solana_sendTransaction",
407
+ ],
408
+ chains: this.solanaNamespaces,
409
+ events: ["accountsChanged", "chainChanged"],
410
+ };
411
+ }
412
+ return namespaces;
413
+ }
345
414
  }
415
+ /**
416
+ * Determines whether the session has at least one connected account
417
+ * across any namespace.
418
+ *
419
+ * - Safe to call with `null` (returns `false`).
420
+ * - Checks all namespaces for a non-empty `accounts` array.
421
+ *
422
+ * @param session - The current WalletConnect session, or `null`.
423
+ * @returns `true` if any namespace has ≥1 account; otherwise `false`.
424
+ */
346
425
  function hasConnectedAccounts(session) {
347
426
  return (!!session &&
348
427
  Object.values(session.namespaces).some((ns) => ns.accounts?.length > 0));
349
428
  }
429
+ /**
430
+ * Retrieves the first connected Ethereum account.
431
+ *
432
+ * - Safe to call with `null` (returns `undefined`).
433
+ * - Returns only the address portion (e.g., `0xabc...`), not the full CAIP string.
434
+ *
435
+ * @param session - The current WalletConnect session, or `null`.
436
+ * @returns The connected EVM address, or `undefined` if none.
437
+ */
350
438
  function getConnectedEthereum(session) {
351
439
  const acc = session?.namespaces.eip155?.accounts?.[0];
352
440
  return acc ? acc.split(":")[2] : undefined;
353
441
  }
442
+ /**
443
+ * Retrieves the first connected Solana account.
444
+ *
445
+ * - Safe to call with `null` (returns `undefined`).
446
+ * - Returns only the base58 address portion, not the full CAIP string.
447
+ *
448
+ * @param session - The current WalletConnect session, or `null`.
449
+ * @returns The connected Solana address (base58), or `undefined` if none.
450
+ */
354
451
  function getConnectedSolana(session) {
355
452
  const acc = session?.namespaces.solana?.accounts?.[0];
356
453
  return acc ? acc.split(":")[2] : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"base.mjs","sources":["../../../src/__wallet__/wallet-connect/base.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;MAsBa,mBAAmB,CAAA;AAW9B,IAAA,WAAA,CAAoB,MAA2B,EAAA;QAA3B,IAAM,CAAA,MAAA,GAAN,MAAM;AAVjB,QAAA,IAAA,CAAA,aAAa,GAAG,mBAAmB,CAAC,aAAa;QAElD,IAAkB,CAAA,kBAAA,GAAa,EAAE;QACjC,IAAgB,CAAA,gBAAA,GAAa,EAAE;QAQrC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAK,GAAG,CAAC;;AAGvC;;;;;;;AAOG;IACH,MAAM,IAAI,CAAC,IAGV,EAAA;AACC,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB;QACjD,IAAI,IAA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AAC;AAE3E;AAEA;;;;;;;;AAQG;AACH,SAAS,oBAAoB,CAC3B,OAAmC,EAAA;AAEnC,IAAA,MAAM,GAAG,GAAG,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,CAAC,CAAC;AACrD,IAAA,OAAO,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;AAC5C;AAEA;;;;;;;;AAQG;AACH,SAAS,kBAAkB,CACzB,OAAmC,EAAA;AAEnC,IAAA,MAAM,GAAG,GAAG,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,CAAC,CAAC;AACrD,IAAA,OAAO,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;AAC5C;;;;"}
@@ -1,4 +1,11 @@
1
1
  import type { CoreTypes, ProposalTypes, SessionTypes } from "@walletconnect/types";
2
+ /**
3
+ * WalletConnectClient is a low-level wrapper around the WalletConnect SignClient.
4
+ *
5
+ * - Used internally by `WalletConnectWallet` to manage connections and sessions.
6
+ * - Handles pairing, approval, session tracking, RPC requests, and disconnects.
7
+ * - Exposes a minimal API for lifecycle control; higher-level logic lives in `WalletConnectWallet`.
8
+ */
2
9
  export declare class WalletConnectClient {
3
10
  private client;
4
11
  private pendingApproval;
@@ -14,12 +21,12 @@ export declare class WalletConnectClient {
14
21
  /**
15
22
  * Initializes the WalletConnect SignClient with your project credentials.
16
23
  *
17
- * - Must be called before calling `pair()` or `request()`.
18
- * - Configures metadata and optionally a custom relay server.
24
+ * - Must be called before `pair()`, `approve()`, or `request()`.
25
+ * - Configures app metadata and an optional custom relay server.
19
26
  *
20
27
  * @param opts.projectId - WalletConnect project ID.
21
- * @param opts.metadata - Metadata about your app (name, URL, icons).
22
- * @param opts.relayUrl - (Optional) Custom relay server URL.
28
+ * @param opts.appMetadata - Metadata about your app (name, URL, icons).
29
+ * @param opts.relayUrl - (Optional) custom relay server URL.
23
30
  * @returns A promise that resolves once the client is initialized.
24
31
  */
25
32
  init(opts: {
@@ -30,21 +37,22 @@ export declare class WalletConnectClient {
30
37
  /**
31
38
  * Initiates a pairing request and returns a URI to be scanned or deep-linked.
32
39
  *
33
- * - Must be followed by a call to `approve()` to complete the pairing.
40
+ * - Requires `init()` to have been called.
41
+ * - Must be followed by `approve()` after the wallet approves.
34
42
  * - Throws if a pairing is already in progress.
35
43
  *
36
- * @param namespaces - Namespaces to request for optional capabilities.
44
+ * @param namespaces - Optional namespaces requesting capabilities.
37
45
  * @returns A WalletConnect URI for the wallet to connect with.
38
- * @throws {Error} If a pairing is already in progress or URI is not returned.
46
+ * @throws {Error} If a pairing is already in progress or no URI is returned.
39
47
  */
40
48
  pair(namespaces: ProposalTypes.OptionalNamespaces): Promise<string>;
41
49
  /**
42
50
  * Completes the pairing approval process after the wallet approves the request.
43
51
  *
44
- * - Must be called after `pair()` and after the wallet has scanned and approved the URI.
52
+ * - Requires `init()` and a pending pairing started via `pair()`.
45
53
  *
46
54
  * @returns A promise that resolves to the established session.
47
- * @throws {Error} If called before `pair()` or approval fails.
55
+ * @throws {Error} If called before `pair()` or if approval fails.
48
56
  */
49
57
  approve(): Promise<SessionTypes.Struct>;
50
58
  /**
@@ -56,13 +64,13 @@ export declare class WalletConnectClient {
56
64
  /**
57
65
  * Sends a JSON-RPC request over the active WalletConnect session.
58
66
  *
59
- * - The session must already be connected.
67
+ * - Requires `init()` and an active session.
60
68
  *
61
- * @param chainId - Chain ID of the target blockchain (e.g. `eip155:1`).
62
- * @param method - The RPC method name to call.
63
- * @param params - The parameters to pass into the RPC method.
69
+ * @param chainId - Target chain ID (e.g. `eip155:1`).
70
+ * @param method - RPC method name.
71
+ * @param params - Parameters for the RPC method.
64
72
  * @returns A promise that resolves with the RPC response.
65
- * @throws {Error} If no active session is found.
73
+ * @throws {Error} If no active session exists.
66
74
  */
67
75
  request(chainId: string, method: string, params: any[] | Record<string, any>): Promise<any>;
68
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/__wallet__/wallet-connect/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAc;IAG5B,OAAO,CAAC,eAAe,CAAqD;IAG5E,OAAO,CAAC,qBAAqB,CAAyB;IAEtD;;;;;;OAMG;IACI,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI;IAIrC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,IAAI,EAAE;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,SAAS,CAAC,QAAQ,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,IAAI,CAAC;IAajB;;;;;;;;;OASG;IACG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBzE;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAc7C;;;;OAIG;IACH,UAAU,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI;IAKxC;;;;;;;;;;OAUG;IACG,OAAO,CACX,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,GAAG,CAAC;IAaf;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CASlC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/__wallet__/wallet-connect/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAc;IAG5B,OAAO,CAAC,eAAe,CAAqD;IAG5E,OAAO,CAAC,qBAAqB,CAAyB;IAEtD;;;;;;OAMG;IACI,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI;IAIrC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,IAAI,EAAE;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,SAAS,CAAC,QAAQ,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,IAAI,CAAC;IAajB;;;;;;;;;;OAUG;IACG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBzE;;;;;;;OAOG;IAEG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAc7C;;;;OAIG;IACH,UAAU,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI;IAKxC;;;;;;;;;;OAUG;IACG,OAAO,CACX,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,GAAG,CAAC;IAaf;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CASlC"}
@@ -2,6 +2,13 @@
2
2
 
3
3
  var SignClient = require('@walletconnect/sign-client');
4
4
 
5
+ /**
6
+ * WalletConnectClient is a low-level wrapper around the WalletConnect SignClient.
7
+ *
8
+ * - Used internally by `WalletConnectWallet` to manage connections and sessions.
9
+ * - Handles pairing, approval, session tracking, RPC requests, and disconnects.
10
+ * - Exposes a minimal API for lifecycle control; higher-level logic lives in `WalletConnectWallet`.
11
+ */
5
12
  class WalletConnectClient {
6
13
  constructor() {
7
14
  // tracks the pending approval callback returned from `connect()`
@@ -22,12 +29,12 @@ class WalletConnectClient {
22
29
  /**
23
30
  * Initializes the WalletConnect SignClient with your project credentials.
24
31
  *
25
- * - Must be called before calling `pair()` or `request()`.
26
- * - Configures metadata and optionally a custom relay server.
32
+ * - Must be called before `pair()`, `approve()`, or `request()`.
33
+ * - Configures app metadata and an optional custom relay server.
27
34
  *
28
35
  * @param opts.projectId - WalletConnect project ID.
29
- * @param opts.metadata - Metadata about your app (name, URL, icons).
30
- * @param opts.relayUrl - (Optional) Custom relay server URL.
36
+ * @param opts.appMetadata - Metadata about your app (name, URL, icons).
37
+ * @param opts.relayUrl - (Optional) custom relay server URL.
31
38
  * @returns A promise that resolves once the client is initialized.
32
39
  */
33
40
  async init(opts) {
@@ -44,12 +51,13 @@ class WalletConnectClient {
44
51
  /**
45
52
  * Initiates a pairing request and returns a URI to be scanned or deep-linked.
46
53
  *
47
- * - Must be followed by a call to `approve()` to complete the pairing.
54
+ * - Requires `init()` to have been called.
55
+ * - Must be followed by `approve()` after the wallet approves.
48
56
  * - Throws if a pairing is already in progress.
49
57
  *
50
- * @param namespaces - Namespaces to request for optional capabilities.
58
+ * @param namespaces - Optional namespaces requesting capabilities.
51
59
  * @returns A WalletConnect URI for the wallet to connect with.
52
- * @throws {Error} If a pairing is already in progress or URI is not returned.
60
+ * @throws {Error} If a pairing is already in progress or no URI is returned.
53
61
  */
54
62
  async pair(namespaces) {
55
63
  if (this.pendingApproval) {
@@ -67,10 +75,10 @@ class WalletConnectClient {
67
75
  /**
68
76
  * Completes the pairing approval process after the wallet approves the request.
69
77
  *
70
- * - Must be called after `pair()` and after the wallet has scanned and approved the URI.
78
+ * - Requires `init()` and a pending pairing started via `pair()`.
71
79
  *
72
80
  * @returns A promise that resolves to the established session.
73
- * @throws {Error} If called before `pair()` or approval fails.
81
+ * @throws {Error} If called before `pair()` or if approval fails.
74
82
  */
75
83
  async approve() {
76
84
  if (!this.pendingApproval) {
@@ -97,13 +105,13 @@ class WalletConnectClient {
97
105
  /**
98
106
  * Sends a JSON-RPC request over the active WalletConnect session.
99
107
  *
100
- * - The session must already be connected.
108
+ * - Requires `init()` and an active session.
101
109
  *
102
- * @param chainId - Chain ID of the target blockchain (e.g. `eip155:1`).
103
- * @param method - The RPC method name to call.
104
- * @param params - The parameters to pass into the RPC method.
110
+ * @param chainId - Target chain ID (e.g. `eip155:1`).
111
+ * @param method - RPC method name.
112
+ * @param params - Parameters for the RPC method.
105
113
  * @returns A promise that resolves with the RPC response.
106
- * @throws {Error} If no active session is found.
114
+ * @throws {Error} If no active session exists.
107
115
  */
108
116
  async request(chainId, method, params) {
109
117
  const session = this.getSession();
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../../../src/__wallet__/wallet-connect/client.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;MAOa,mBAAmB,CAAA;AAAhC,IAAA,WAAA,GAAA;;QAIU,IAAe,CAAA,eAAA,GAAgD,IAAI;;QAGnE,IAAqB,CAAA,qBAAA,GAAsB,EAAE;;AAErD;;;;;;AAMG;AACI,IAAA,eAAe,CAAC,EAAc,EAAA;AACnC,QAAA,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;;AAGrC;;;;;;;;;;AAUG;IACH,MAAM,IAAI,CAAC,IAIV,EAAA;AACC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,WAAW;AAC1B,YAAA,IAAI,IAAI,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC;AACtD,SAAA,CAAC;;QAGF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAK;AACpC,YAAA,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AAChD,SAAC,CAAC;;AAGJ;;;;;;;;;AASG;IACH,MAAM,IAAI,CAA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