@dynamic-labs-sdk/wallet-connect 0.1.0-alpha.19 → 0.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/core.cjs.js +152 -21
- package/core.esm.js +153 -22
- package/isWalletConnectWalletProvider.cjs.js +1 -1
- package/isWalletConnectWalletProvider.esm.js +1 -1
- package/package.json +4 -3
- package/src/exports/core.d.ts +2 -2
- package/src/exports/core.d.ts.map +1 -1
- package/src/importWalletConnectAuthResponse/importWalletConnectAuthResponse.d.ts +26 -0
- package/src/importWalletConnectAuthResponse/importWalletConnectAuthResponse.d.ts.map +1 -0
- package/src/importWalletConnectAuthResponse/index.d.ts +2 -0
- package/src/importWalletConnectAuthResponse/index.d.ts.map +1 -0
- package/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/index.d.ts +2 -0
- package/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/index.d.ts.map +1 -0
- package/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/verifyWalletConnectAuths.d.ts +10 -0
- package/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/verifyWalletConnectAuths.d.ts.map +1 -0
- package/src/{connectWalletConnectSession/connectWalletConnectSession.d.ts → importWalletConnectSession/importWalletConnectSession.d.ts} +3 -3
- package/src/importWalletConnectSession/importWalletConnectSession.d.ts.map +1 -0
- package/src/importWalletConnectSession/index.d.ts +2 -0
- package/src/importWalletConnectSession/index.d.ts.map +1 -0
- package/src/sessionTopicsData/clearTemporarySessions/clearTemporarySessions.d.ts.map +1 -1
- package/src/syncSessionsToWalletProviders/addMissingWalletProvidersForSessions/addMissingWalletProvidersForSessions.d.ts.map +1 -1
- package/src/syncSessionsToWalletProviders/syncSessionsToWalletProviders.d.ts.map +1 -1
- package/src/connectWalletConnectSession/connectWalletConnectSession.d.ts.map +0 -1
- package/src/connectWalletConnectSession/index.d.ts +0 -2
- package/src/connectWalletConnectSession/index.d.ts.map +0 -1
- package/src/signClient/consts.d.ts +0 -10
- package/src/signClient/consts.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 0.1.0-alpha.21 (2025-10-16)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- don't refetch project settings on page refresh if there are connected wallets ([#571](https://github.com/dynamic-labs/dynamic-sdk/pull/571))
|
|
6
|
+
|
|
7
|
+
## 0.1.0-alpha.20 (2025-10-15)
|
|
8
|
+
|
|
9
|
+
This was a version bump only, there were no code changes.
|
|
10
|
+
|
|
1
11
|
## 0.1.0-alpha.19 (2025-10-10)
|
|
2
12
|
|
|
3
13
|
This was a version bump only, there were no code changes.
|
package/core.cjs.js
CHANGED
|
@@ -5,6 +5,7 @@ var isWalletConnectWalletProvider = require('./isWalletConnectWalletProvider.cjs
|
|
|
5
5
|
var client = require('@dynamic-labs-sdk/client');
|
|
6
6
|
var core = require('@dynamic-labs-sdk/client/core');
|
|
7
7
|
var z = require('zod/mini');
|
|
8
|
+
var utils = require('@walletconnect/utils');
|
|
8
9
|
var SignClient = require('@walletconnect/sign-client');
|
|
9
10
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
|
|
@@ -135,15 +136,6 @@ const sessionTopicsStorageKeySchema = core.createStorageKeySchema({
|
|
|
135
136
|
return sessionTopicsData != null ? sessionTopicsData : {};
|
|
136
137
|
};
|
|
137
138
|
|
|
138
|
-
/**
|
|
139
|
-
* Reason for disconnection when the user disconnects from a WalletConnect session.
|
|
140
|
-
*
|
|
141
|
-
* Source: https://github.com/WalletConnect/walletconnect-monorepo/blob/cc3a9d26dcbd05c92d5ded935b29dc3b6063d147/packages/utils/src/errors.ts#L87
|
|
142
|
-
*/ const USER_DISCONNECTED_REASON = {
|
|
143
|
-
code: 6000,
|
|
144
|
-
message: 'User disconnected.'
|
|
145
|
-
};
|
|
146
|
-
|
|
147
139
|
const createSignClient = async (client)=>{
|
|
148
140
|
var _client_projectSettings_sdk_walletConnect, _core_metadata, _core_metadata1;
|
|
149
141
|
const core$1 = core.getCore(client);
|
|
@@ -209,7 +201,11 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
209
201
|
/**
|
|
210
202
|
* Keep record on which wallet account IDs already exist but will have
|
|
211
203
|
* their wallet provider keys overridden to use the new WC wallet provider key.
|
|
212
|
-
|
|
204
|
+
*
|
|
205
|
+
* This will only ever be the case for unverified wallet accounts, however. That is
|
|
206
|
+
* because verified wallets will already override the wallet provider key on the verification
|
|
207
|
+
* step, which happens at the call to verifyWalletConnectAuths, which happens before this function.
|
|
208
|
+
*/ const unverifiedWalletAccountsToOverride = new Set();
|
|
213
209
|
for (const session of sessions){
|
|
214
210
|
const namespaceKeys = Object.keys(session.namespaces);
|
|
215
211
|
for (const namespaceKey of namespaceKeys){
|
|
@@ -219,7 +215,12 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
219
215
|
continue;
|
|
220
216
|
}
|
|
221
217
|
const walletProviderBuilder = namespaceRegistry.getWalletProviderBuilder(namespaceKey);
|
|
222
|
-
|
|
218
|
+
/**
|
|
219
|
+
* There being no wallet provider builder for this namespace simply means the customer
|
|
220
|
+
* didn't add an extension for the corresponding chain.
|
|
221
|
+
* For instance, if we get a namespace for Solana but only have an Evm extension,
|
|
222
|
+
* the solana namespace would fall here. No need to throw.
|
|
223
|
+
*/ if (!walletProviderBuilder) {
|
|
223
224
|
continue;
|
|
224
225
|
}
|
|
225
226
|
const walletProvider = await walletProviderBuilder({
|
|
@@ -257,17 +258,27 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
257
258
|
const existingWalletIsWalletConnect = core.splitWalletProviderKey(existingAccount.walletProviderKey).walletProviderType === sdkApiCore.WalletProviderEnum.WalletConnect;
|
|
258
259
|
if (allowOverridingWalletProviders || existingWalletIsWalletConnect) {
|
|
259
260
|
createdWalletAccounts[createdWalletAccount.id] = createdWalletAccount;
|
|
260
|
-
|
|
261
|
+
if (existingAccount.verifiedCredentialId) {
|
|
262
|
+
/**
|
|
263
|
+
* A verified wallet account only arrives here when its wallet provider key is lacking the suffix,
|
|
264
|
+
* which should be the sessionTopic. So we just need to add its entry to the verifiedCredentialId map.
|
|
265
|
+
*/ core.updateWalletProviderKeysForVerifiedCredentials({
|
|
266
|
+
keysToUpdate: {
|
|
267
|
+
[existingAccount.verifiedCredentialId]: walletProvider.key
|
|
268
|
+
}
|
|
269
|
+
}, client$1);
|
|
270
|
+
} else {
|
|
271
|
+
unverifiedWalletAccountsToOverride.add(createdWalletAccount.id);
|
|
272
|
+
}
|
|
261
273
|
}
|
|
262
274
|
}
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
|
-
if (
|
|
277
|
+
if (unverifiedWalletAccountsToOverride.size === 0 && brandNewWalletAccounts.size === 0) {
|
|
266
278
|
return {
|
|
267
279
|
walletProvidersWithActiveSession
|
|
268
280
|
};
|
|
269
281
|
}
|
|
270
|
-
// For now we only support connect only, so we only need to worry about unverified wallet accounts.
|
|
271
282
|
core.setUnverifiedWalletAccounts({
|
|
272
283
|
unverifiedWalletAccountsToUpdate: Object.values(createdWalletAccounts)
|
|
273
284
|
}, client$1);
|
|
@@ -295,7 +306,7 @@ const doSyncSessionsToWalletProviders = async ({ allowOverridingWalletProviders
|
|
|
295
306
|
}
|
|
296
307
|
// If we don't have data for this session, it is corrupted and we need to disconnect
|
|
297
308
|
void signClient.disconnect({
|
|
298
|
-
reason:
|
|
309
|
+
reason: utils.SDK_ERRORS.USER_DISCONNECTED,
|
|
299
310
|
topic: session.topic
|
|
300
311
|
});
|
|
301
312
|
return false;
|
|
@@ -335,14 +346,15 @@ const doSyncSessionsToWalletProviders = async ({ allowOverridingWalletProviders
|
|
|
335
346
|
}
|
|
336
347
|
}
|
|
337
348
|
// Step 4: kill sessions and their wallet providers if they have no more wallet accounts
|
|
349
|
+
// Ignore sessions that are NOT marked as shouldAddToDynamicWalletAccounts
|
|
338
350
|
for (const [sessionTopic, hasWalletAccount] of sessionTopicHasWalletAccountMap){
|
|
339
|
-
if (hasWalletAccount) {
|
|
351
|
+
if (hasWalletAccount || !sessionTopicsData[sessionTopic].shouldAddToDynamicWalletAccounts) {
|
|
340
352
|
continue;
|
|
341
353
|
}
|
|
342
354
|
const session = sessions.find((session)=>session.topic === sessionTopic);
|
|
343
355
|
if (session) {
|
|
344
356
|
void signClient.disconnect({
|
|
345
|
-
reason:
|
|
357
|
+
reason: utils.SDK_ERRORS.USER_DISCONNECTED,
|
|
346
358
|
topic: session.topic
|
|
347
359
|
});
|
|
348
360
|
}
|
|
@@ -382,7 +394,7 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
382
394
|
* @param addToDynamicWalletAccounts - Whether to add the wallet accounts to the dynamic's wallet accounts.
|
|
383
395
|
* @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
384
396
|
* @returns The wallet accounts.
|
|
385
|
-
*/ const
|
|
397
|
+
*/ const importWalletConnectSession = async ({ addToDynamicWalletAccounts = true, session }, client$1)=>{
|
|
386
398
|
/**
|
|
387
399
|
* You would normally get the session from the signClient.connect method. It takes the optionalNamespaces as an argument.
|
|
388
400
|
*
|
|
@@ -455,6 +467,125 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
455
467
|
};
|
|
456
468
|
};
|
|
457
469
|
|
|
470
|
+
const getAddressFromIss = (iss)=>iss.split(':')[4];
|
|
471
|
+
const verifyWalletConnectAuths = async ({ auths, chain, walletDisplayName }, client)=>{
|
|
472
|
+
/**
|
|
473
|
+
* The only differences between each auth object will be the signature (auth.s.s)
|
|
474
|
+
* and the iss (auth.p.iss).
|
|
475
|
+
*
|
|
476
|
+
* The iss is comprised of 2 WC fields that are irrelevant to us and then the CAIP-10 token
|
|
477
|
+
* of the address, where the first 2 fields are also split by the ":" character.
|
|
478
|
+
*
|
|
479
|
+
* Usually, there will be multiple auths if the wallet app bundles signatures for multiple
|
|
480
|
+
* networks at once, so the only field that will change among auth iss will be the networkId under iss.
|
|
481
|
+
*/ const visitedAddresses = new Set();
|
|
482
|
+
const authsFilteredByAddress = auths.filter((auth)=>{
|
|
483
|
+
const address = getAddressFromIss(auth.p.iss);
|
|
484
|
+
if (!address || visitedAddresses.has(address)) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
visitedAddresses.add(address);
|
|
488
|
+
return true;
|
|
489
|
+
});
|
|
490
|
+
let lastResponse = undefined;
|
|
491
|
+
/**
|
|
492
|
+
* WalletConnect's auth object is what they call a "Cacao" object, with data on the SIWE message
|
|
493
|
+
* and the signature itself.
|
|
494
|
+
* By consulting how they implemented their "validateSignedCacao" function,
|
|
495
|
+
* we are able to reconstruct the original message which can be used to verify the signature
|
|
496
|
+
* in our backend.
|
|
497
|
+
*/ for (const auth of authsFilteredByAddress){
|
|
498
|
+
const publicWalletAddress = getAddressFromIss(auth.p.iss);
|
|
499
|
+
core.assertDefined(publicWalletAddress, `Unable to get public wallet address from WalletConnect Cacao object iss: ${auth.p.iss}`);
|
|
500
|
+
const messageToSign = utils.formatMessage(auth.p, auth.p.iss);
|
|
501
|
+
const signature = auth.s.s;
|
|
502
|
+
lastResponse = await core.verifySignInMessage({
|
|
503
|
+
chain,
|
|
504
|
+
messageToSign,
|
|
505
|
+
signature,
|
|
506
|
+
walletAddress: publicWalletAddress,
|
|
507
|
+
walletDisplayName,
|
|
508
|
+
walletProviderType: sdkApiCore.WalletProviderEnum.WalletConnect
|
|
509
|
+
}, client);
|
|
510
|
+
}
|
|
511
|
+
if (!lastResponse) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Adds the user with the new wallet verified credentials
|
|
516
|
+
* This will add the new verified wallet accounts to the client`s state
|
|
517
|
+
*/ core.updateAuthFromVerifyResponse({
|
|
518
|
+
response: lastResponse
|
|
519
|
+
}, client);
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* A low level function that is used to connect a WalletConnect authenticate response to the Dynamic SDK.
|
|
524
|
+
* It will generate the wallet providers and wallet accounts for all accounts in the session.
|
|
525
|
+
*
|
|
526
|
+
* @see WalletConnect's docs on [session authentication](https://docs.reown.com/advanced/api/sign/dapp-usage#session-authenticate-with-recaps)
|
|
527
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
528
|
+
* @returns A promise that resolves to the connected and verified wallet account.
|
|
529
|
+
*/ const importWalletConnectAuthResponse = async ({ authResponse, chain }, client$1)=>{
|
|
530
|
+
const { session, auths } = authResponse;
|
|
531
|
+
/**
|
|
532
|
+
* Some wallets do not support WC's authenticate method (such as Rainbow).
|
|
533
|
+
* For these wallets, the authenticate method will act as a regular connect method.
|
|
534
|
+
* Therefore we must call verify individually.
|
|
535
|
+
*/ if (!auths || auths.length === 0) {
|
|
536
|
+
/**
|
|
537
|
+
* Set addToDynamicWalletAccounts to false to avoid adding the wallet accounts to the dynamic's wallet accounts
|
|
538
|
+
* while we are still verifying them.
|
|
539
|
+
* After verifying, we set addToDynamicWalletAccounts back to true.
|
|
540
|
+
*/ const { walletAccounts } = await importWalletConnectSession({
|
|
541
|
+
addToDynamicWalletAccounts: false,
|
|
542
|
+
session
|
|
543
|
+
}, client$1);
|
|
544
|
+
// This should not be concurrent because the first will be a verify and the rest will be a link
|
|
545
|
+
for (const walletAccount of walletAccounts){
|
|
546
|
+
await client.verifyWalletAccount({
|
|
547
|
+
walletAccount
|
|
548
|
+
}, client$1);
|
|
549
|
+
}
|
|
550
|
+
await setSessionTopicsData({
|
|
551
|
+
update: (sessionTopicsData)=>_extends({}, sessionTopicsData, {
|
|
552
|
+
[session.topic]: {
|
|
553
|
+
shouldAddToDynamicWalletAccounts: true
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
}, client$1);
|
|
557
|
+
return {
|
|
558
|
+
walletAccounts
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* This reconstructs the message that was signed by the wallet and verifies the signature
|
|
563
|
+
* in the backend. It will update the user with the new verified credentials.
|
|
564
|
+
*/ await verifyWalletConnectAuths({
|
|
565
|
+
auths,
|
|
566
|
+
chain,
|
|
567
|
+
walletDisplayName: session.peer.metadata.name
|
|
568
|
+
}, client$1);
|
|
569
|
+
const { walletAccounts } = await importWalletConnectSession({
|
|
570
|
+
addToDynamicWalletAccounts: true,
|
|
571
|
+
session
|
|
572
|
+
}, client$1);
|
|
573
|
+
const verifiedCredentialWalletProviderKeyMap = Object.fromEntries(walletAccounts.map((walletAccount)=>{
|
|
574
|
+
const { verifiedCredentialId } = walletAccount;
|
|
575
|
+
core.assertDefined(verifiedCredentialId, `Wallet account of ID ${walletAccount.id} still has no verified credential after being verified`);
|
|
576
|
+
return [
|
|
577
|
+
verifiedCredentialId,
|
|
578
|
+
walletAccount.walletProviderKey
|
|
579
|
+
];
|
|
580
|
+
}));
|
|
581
|
+
core.updateWalletProviderKeysForVerifiedCredentials({
|
|
582
|
+
keysToUpdate: verifiedCredentialWalletProviderKeyMap
|
|
583
|
+
}, client$1);
|
|
584
|
+
return {
|
|
585
|
+
walletAccounts
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
|
|
458
589
|
/**
|
|
459
590
|
* Clears all temporary sessions and disconnects from them.
|
|
460
591
|
*
|
|
@@ -473,7 +604,7 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
473
604
|
}
|
|
474
605
|
for (const topic of temporarySessionTopics){
|
|
475
606
|
await signClient.disconnect({
|
|
476
|
-
reason:
|
|
607
|
+
reason: utils.SDK_ERRORS.USER_DISCONNECTED,
|
|
477
608
|
topic
|
|
478
609
|
});
|
|
479
610
|
}
|
|
@@ -496,10 +627,10 @@ const initializeWalletConnectExtension = async (client)=>{
|
|
|
496
627
|
|
|
497
628
|
assertPackageVersion.assertPackageVersion(isWalletConnectWalletProvider.name, isWalletConnectWalletProvider.version);
|
|
498
629
|
|
|
499
|
-
exports.USER_DISCONNECTED_REASON = USER_DISCONNECTED_REASON;
|
|
500
|
-
exports.connectWalletConnectSession = connectWalletConnectSession;
|
|
501
630
|
exports.getNamespaceRegistry = getNamespaceRegistry;
|
|
502
631
|
exports.getSignClient = getSignClient;
|
|
632
|
+
exports.importWalletConnectAuthResponse = importWalletConnectAuthResponse;
|
|
633
|
+
exports.importWalletConnectSession = importWalletConnectSession;
|
|
503
634
|
exports.initializeWalletConnectExtension = initializeWalletConnectExtension;
|
|
504
635
|
exports.splitCaip10Token = splitCaip10Token;
|
|
505
636
|
exports.syncSessionsToWalletProviders = syncSessionsToWalletProviders;
|
package/core.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
|
|
2
2
|
import { i as isWalletConnectWalletProvider, n as name, v as version } from './isWalletConnectWalletProvider.esm.js';
|
|
3
|
-
import { getWalletAccounts } from '@dynamic-labs-sdk/client';
|
|
4
|
-
import { assertDefined, filterDuplicates, formatWalletAccountId, createStorageKeySchema, getCore, createRuntimeServiceAccessKey, getWalletProviderRegistry, WalletProviderPriority, splitWalletProviderKey, setUnverifiedWalletAccounts, createVisit, emitWalletAccountsChangedEvent, waitForProjectSettings, getWalletProviders } from '@dynamic-labs-sdk/client/core';
|
|
3
|
+
import { getWalletAccounts, verifyWalletAccount } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { assertDefined, filterDuplicates, formatWalletAccountId, createStorageKeySchema, getCore, createRuntimeServiceAccessKey, getWalletProviderRegistry, WalletProviderPriority, splitWalletProviderKey, updateWalletProviderKeysForVerifiedCredentials, setUnverifiedWalletAccounts, createVisit, emitWalletAccountsChangedEvent, waitForProjectSettings, getWalletProviders, verifySignInMessage, updateAuthFromVerifyResponse } from '@dynamic-labs-sdk/client/core';
|
|
5
5
|
import * as z from 'zod/mini';
|
|
6
|
+
import { SDK_ERRORS, formatMessage } from '@walletconnect/utils';
|
|
6
7
|
import SignClient from '@walletconnect/sign-client';
|
|
7
8
|
import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
8
9
|
|
|
@@ -114,15 +115,6 @@ const sessionTopicsStorageKeySchema = createStorageKeySchema({
|
|
|
114
115
|
return sessionTopicsData != null ? sessionTopicsData : {};
|
|
115
116
|
};
|
|
116
117
|
|
|
117
|
-
/**
|
|
118
|
-
* Reason for disconnection when the user disconnects from a WalletConnect session.
|
|
119
|
-
*
|
|
120
|
-
* Source: https://github.com/WalletConnect/walletconnect-monorepo/blob/cc3a9d26dcbd05c92d5ded935b29dc3b6063d147/packages/utils/src/errors.ts#L87
|
|
121
|
-
*/ const USER_DISCONNECTED_REASON = {
|
|
122
|
-
code: 6000,
|
|
123
|
-
message: 'User disconnected.'
|
|
124
|
-
};
|
|
125
|
-
|
|
126
118
|
const createSignClient = async (client)=>{
|
|
127
119
|
var _client_projectSettings_sdk_walletConnect, _core_metadata, _core_metadata1;
|
|
128
120
|
const core = getCore(client);
|
|
@@ -188,7 +180,11 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
188
180
|
/**
|
|
189
181
|
* Keep record on which wallet account IDs already exist but will have
|
|
190
182
|
* their wallet provider keys overridden to use the new WC wallet provider key.
|
|
191
|
-
|
|
183
|
+
*
|
|
184
|
+
* This will only ever be the case for unverified wallet accounts, however. That is
|
|
185
|
+
* because verified wallets will already override the wallet provider key on the verification
|
|
186
|
+
* step, which happens at the call to verifyWalletConnectAuths, which happens before this function.
|
|
187
|
+
*/ const unverifiedWalletAccountsToOverride = new Set();
|
|
192
188
|
for (const session of sessions){
|
|
193
189
|
const namespaceKeys = Object.keys(session.namespaces);
|
|
194
190
|
for (const namespaceKey of namespaceKeys){
|
|
@@ -198,7 +194,12 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
198
194
|
continue;
|
|
199
195
|
}
|
|
200
196
|
const walletProviderBuilder = namespaceRegistry.getWalletProviderBuilder(namespaceKey);
|
|
201
|
-
|
|
197
|
+
/**
|
|
198
|
+
* There being no wallet provider builder for this namespace simply means the customer
|
|
199
|
+
* didn't add an extension for the corresponding chain.
|
|
200
|
+
* For instance, if we get a namespace for Solana but only have an Evm extension,
|
|
201
|
+
* the solana namespace would fall here. No need to throw.
|
|
202
|
+
*/ if (!walletProviderBuilder) {
|
|
202
203
|
continue;
|
|
203
204
|
}
|
|
204
205
|
const walletProvider = await walletProviderBuilder({
|
|
@@ -236,17 +237,27 @@ const addMissingWalletProvidersForSessions = async ({ sessions, allowOverridingW
|
|
|
236
237
|
const existingWalletIsWalletConnect = splitWalletProviderKey(existingAccount.walletProviderKey).walletProviderType === WalletProviderEnum.WalletConnect;
|
|
237
238
|
if (allowOverridingWalletProviders || existingWalletIsWalletConnect) {
|
|
238
239
|
createdWalletAccounts[createdWalletAccount.id] = createdWalletAccount;
|
|
239
|
-
|
|
240
|
+
if (existingAccount.verifiedCredentialId) {
|
|
241
|
+
/**
|
|
242
|
+
* A verified wallet account only arrives here when its wallet provider key is lacking the suffix,
|
|
243
|
+
* which should be the sessionTopic. So we just need to add its entry to the verifiedCredentialId map.
|
|
244
|
+
*/ updateWalletProviderKeysForVerifiedCredentials({
|
|
245
|
+
keysToUpdate: {
|
|
246
|
+
[existingAccount.verifiedCredentialId]: walletProvider.key
|
|
247
|
+
}
|
|
248
|
+
}, client);
|
|
249
|
+
} else {
|
|
250
|
+
unverifiedWalletAccountsToOverride.add(createdWalletAccount.id);
|
|
251
|
+
}
|
|
240
252
|
}
|
|
241
253
|
}
|
|
242
254
|
}
|
|
243
255
|
}
|
|
244
|
-
if (
|
|
256
|
+
if (unverifiedWalletAccountsToOverride.size === 0 && brandNewWalletAccounts.size === 0) {
|
|
245
257
|
return {
|
|
246
258
|
walletProvidersWithActiveSession
|
|
247
259
|
};
|
|
248
260
|
}
|
|
249
|
-
// For now we only support connect only, so we only need to worry about unverified wallet accounts.
|
|
250
261
|
setUnverifiedWalletAccounts({
|
|
251
262
|
unverifiedWalletAccountsToUpdate: Object.values(createdWalletAccounts)
|
|
252
263
|
}, client);
|
|
@@ -274,7 +285,7 @@ const doSyncSessionsToWalletProviders = async ({ allowOverridingWalletProviders
|
|
|
274
285
|
}
|
|
275
286
|
// If we don't have data for this session, it is corrupted and we need to disconnect
|
|
276
287
|
void signClient.disconnect({
|
|
277
|
-
reason:
|
|
288
|
+
reason: SDK_ERRORS.USER_DISCONNECTED,
|
|
278
289
|
topic: session.topic
|
|
279
290
|
});
|
|
280
291
|
return false;
|
|
@@ -314,14 +325,15 @@ const doSyncSessionsToWalletProviders = async ({ allowOverridingWalletProviders
|
|
|
314
325
|
}
|
|
315
326
|
}
|
|
316
327
|
// Step 4: kill sessions and their wallet providers if they have no more wallet accounts
|
|
328
|
+
// Ignore sessions that are NOT marked as shouldAddToDynamicWalletAccounts
|
|
317
329
|
for (const [sessionTopic, hasWalletAccount] of sessionTopicHasWalletAccountMap){
|
|
318
|
-
if (hasWalletAccount) {
|
|
330
|
+
if (hasWalletAccount || !sessionTopicsData[sessionTopic].shouldAddToDynamicWalletAccounts) {
|
|
319
331
|
continue;
|
|
320
332
|
}
|
|
321
333
|
const session = sessions.find((session)=>session.topic === sessionTopic);
|
|
322
334
|
if (session) {
|
|
323
335
|
void signClient.disconnect({
|
|
324
|
-
reason:
|
|
336
|
+
reason: SDK_ERRORS.USER_DISCONNECTED,
|
|
325
337
|
topic: session.topic
|
|
326
338
|
});
|
|
327
339
|
}
|
|
@@ -361,7 +373,7 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
361
373
|
* @param addToDynamicWalletAccounts - Whether to add the wallet accounts to the dynamic's wallet accounts.
|
|
362
374
|
* @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
363
375
|
* @returns The wallet accounts.
|
|
364
|
-
*/ const
|
|
376
|
+
*/ const importWalletConnectSession = async ({ addToDynamicWalletAccounts = true, session }, client)=>{
|
|
365
377
|
/**
|
|
366
378
|
* You would normally get the session from the signClient.connect method. It takes the optionalNamespaces as an argument.
|
|
367
379
|
*
|
|
@@ -434,6 +446,125 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
434
446
|
};
|
|
435
447
|
};
|
|
436
448
|
|
|
449
|
+
const getAddressFromIss = (iss)=>iss.split(':')[4];
|
|
450
|
+
const verifyWalletConnectAuths = async ({ auths, chain, walletDisplayName }, client)=>{
|
|
451
|
+
/**
|
|
452
|
+
* The only differences between each auth object will be the signature (auth.s.s)
|
|
453
|
+
* and the iss (auth.p.iss).
|
|
454
|
+
*
|
|
455
|
+
* The iss is comprised of 2 WC fields that are irrelevant to us and then the CAIP-10 token
|
|
456
|
+
* of the address, where the first 2 fields are also split by the ":" character.
|
|
457
|
+
*
|
|
458
|
+
* Usually, there will be multiple auths if the wallet app bundles signatures for multiple
|
|
459
|
+
* networks at once, so the only field that will change among auth iss will be the networkId under iss.
|
|
460
|
+
*/ const visitedAddresses = new Set();
|
|
461
|
+
const authsFilteredByAddress = auths.filter((auth)=>{
|
|
462
|
+
const address = getAddressFromIss(auth.p.iss);
|
|
463
|
+
if (!address || visitedAddresses.has(address)) {
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
visitedAddresses.add(address);
|
|
467
|
+
return true;
|
|
468
|
+
});
|
|
469
|
+
let lastResponse = undefined;
|
|
470
|
+
/**
|
|
471
|
+
* WalletConnect's auth object is what they call a "Cacao" object, with data on the SIWE message
|
|
472
|
+
* and the signature itself.
|
|
473
|
+
* By consulting how they implemented their "validateSignedCacao" function,
|
|
474
|
+
* we are able to reconstruct the original message which can be used to verify the signature
|
|
475
|
+
* in our backend.
|
|
476
|
+
*/ for (const auth of authsFilteredByAddress){
|
|
477
|
+
const publicWalletAddress = getAddressFromIss(auth.p.iss);
|
|
478
|
+
assertDefined(publicWalletAddress, `Unable to get public wallet address from WalletConnect Cacao object iss: ${auth.p.iss}`);
|
|
479
|
+
const messageToSign = formatMessage(auth.p, auth.p.iss);
|
|
480
|
+
const signature = auth.s.s;
|
|
481
|
+
lastResponse = await verifySignInMessage({
|
|
482
|
+
chain,
|
|
483
|
+
messageToSign,
|
|
484
|
+
signature,
|
|
485
|
+
walletAddress: publicWalletAddress,
|
|
486
|
+
walletDisplayName,
|
|
487
|
+
walletProviderType: WalletProviderEnum.WalletConnect
|
|
488
|
+
}, client);
|
|
489
|
+
}
|
|
490
|
+
if (!lastResponse) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Adds the user with the new wallet verified credentials
|
|
495
|
+
* This will add the new verified wallet accounts to the client`s state
|
|
496
|
+
*/ updateAuthFromVerifyResponse({
|
|
497
|
+
response: lastResponse
|
|
498
|
+
}, client);
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* A low level function that is used to connect a WalletConnect authenticate response to the Dynamic SDK.
|
|
503
|
+
* It will generate the wallet providers and wallet accounts for all accounts in the session.
|
|
504
|
+
*
|
|
505
|
+
* @see WalletConnect's docs on [session authentication](https://docs.reown.com/advanced/api/sign/dapp-usage#session-authenticate-with-recaps)
|
|
506
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
507
|
+
* @returns A promise that resolves to the connected and verified wallet account.
|
|
508
|
+
*/ const importWalletConnectAuthResponse = async ({ authResponse, chain }, client)=>{
|
|
509
|
+
const { session, auths } = authResponse;
|
|
510
|
+
/**
|
|
511
|
+
* Some wallets do not support WC's authenticate method (such as Rainbow).
|
|
512
|
+
* For these wallets, the authenticate method will act as a regular connect method.
|
|
513
|
+
* Therefore we must call verify individually.
|
|
514
|
+
*/ if (!auths || auths.length === 0) {
|
|
515
|
+
/**
|
|
516
|
+
* Set addToDynamicWalletAccounts to false to avoid adding the wallet accounts to the dynamic's wallet accounts
|
|
517
|
+
* while we are still verifying them.
|
|
518
|
+
* After verifying, we set addToDynamicWalletAccounts back to true.
|
|
519
|
+
*/ const { walletAccounts } = await importWalletConnectSession({
|
|
520
|
+
addToDynamicWalletAccounts: false,
|
|
521
|
+
session
|
|
522
|
+
}, client);
|
|
523
|
+
// This should not be concurrent because the first will be a verify and the rest will be a link
|
|
524
|
+
for (const walletAccount of walletAccounts){
|
|
525
|
+
await verifyWalletAccount({
|
|
526
|
+
walletAccount
|
|
527
|
+
}, client);
|
|
528
|
+
}
|
|
529
|
+
await setSessionTopicsData({
|
|
530
|
+
update: (sessionTopicsData)=>_extends({}, sessionTopicsData, {
|
|
531
|
+
[session.topic]: {
|
|
532
|
+
shouldAddToDynamicWalletAccounts: true
|
|
533
|
+
}
|
|
534
|
+
})
|
|
535
|
+
}, client);
|
|
536
|
+
return {
|
|
537
|
+
walletAccounts
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* This reconstructs the message that was signed by the wallet and verifies the signature
|
|
542
|
+
* in the backend. It will update the user with the new verified credentials.
|
|
543
|
+
*/ await verifyWalletConnectAuths({
|
|
544
|
+
auths,
|
|
545
|
+
chain,
|
|
546
|
+
walletDisplayName: session.peer.metadata.name
|
|
547
|
+
}, client);
|
|
548
|
+
const { walletAccounts } = await importWalletConnectSession({
|
|
549
|
+
addToDynamicWalletAccounts: true,
|
|
550
|
+
session
|
|
551
|
+
}, client);
|
|
552
|
+
const verifiedCredentialWalletProviderKeyMap = Object.fromEntries(walletAccounts.map((walletAccount)=>{
|
|
553
|
+
const { verifiedCredentialId } = walletAccount;
|
|
554
|
+
assertDefined(verifiedCredentialId, `Wallet account of ID ${walletAccount.id} still has no verified credential after being verified`);
|
|
555
|
+
return [
|
|
556
|
+
verifiedCredentialId,
|
|
557
|
+
walletAccount.walletProviderKey
|
|
558
|
+
];
|
|
559
|
+
}));
|
|
560
|
+
updateWalletProviderKeysForVerifiedCredentials({
|
|
561
|
+
keysToUpdate: verifiedCredentialWalletProviderKeyMap
|
|
562
|
+
}, client);
|
|
563
|
+
return {
|
|
564
|
+
walletAccounts
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
|
|
437
568
|
/**
|
|
438
569
|
* Clears all temporary sessions and disconnects from them.
|
|
439
570
|
*
|
|
@@ -452,7 +583,7 @@ const syncSessionsToWalletProviders = async ({ debounceTime = 0, allowOverriding
|
|
|
452
583
|
}
|
|
453
584
|
for (const topic of temporarySessionTopics){
|
|
454
585
|
await signClient.disconnect({
|
|
455
|
-
reason:
|
|
586
|
+
reason: SDK_ERRORS.USER_DISCONNECTED,
|
|
456
587
|
topic
|
|
457
588
|
});
|
|
458
589
|
}
|
|
@@ -475,4 +606,4 @@ const initializeWalletConnectExtension = async (client)=>{
|
|
|
475
606
|
|
|
476
607
|
assertPackageVersion(name, version);
|
|
477
608
|
|
|
478
|
-
export {
|
|
609
|
+
export { getNamespaceRegistry, getSignClient, importWalletConnectAuthResponse, importWalletConnectSession, initializeWalletConnectExtension, splitCaip10Token, syncSessionsToWalletProviders };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/wallet-connect",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.
|
|
23
|
-
"@dynamic-labs-sdk/client": "0.1.0-alpha.
|
|
22
|
+
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.21",
|
|
23
|
+
"@dynamic-labs-sdk/client": "0.1.0-alpha.21",
|
|
24
24
|
"@walletconnect/sign-client": "2.21.8",
|
|
25
25
|
"@walletconnect/types": "2.21.8",
|
|
26
|
+
"@walletconnect/utils": "2.21.8",
|
|
26
27
|
"@dynamic-labs/sdk-api-core": "0.0.805",
|
|
27
28
|
"zod": "4.0.5"
|
|
28
29
|
},
|
package/src/exports/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { importWalletConnectAuthResponse } from '../importWalletConnectAuthResponse';
|
|
2
|
+
export { importWalletConnectSession } from '../importWalletConnectSession';
|
|
2
3
|
export { initializeWalletConnectExtension } from '../initializeWalletConnectExtension';
|
|
3
4
|
export { getNamespaceRegistry } from '../namespaceRegistry';
|
|
4
5
|
export type { NamespaceRegistry } from '../namespaceRegistry/namespaceRegistry.types';
|
|
5
|
-
export { USER_DISCONNECTED_REASON } from '../signClient/consts';
|
|
6
6
|
export { getSignClient } from '../signClient/getSignClient';
|
|
7
7
|
export { splitCaip10Token } from '../splitCaip10Token';
|
|
8
8
|
export { syncSessionsToWalletProviders } from '../syncSessionsToWalletProviders';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/exports/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/exports/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Chain, DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import { type WalletAccount } from '@dynamic-labs-sdk/client';
|
|
3
|
+
import type { AuthTypes } from '@walletconnect/types';
|
|
4
|
+
type ImportWalletConnectAuthResponseParams = {
|
|
5
|
+
/**
|
|
6
|
+
* The response from the WalletConnect authenticate method.
|
|
7
|
+
*/
|
|
8
|
+
authResponse: AuthTypes.AuthenticateResponseResult;
|
|
9
|
+
/**
|
|
10
|
+
* The chain with which the wallet account is associated.
|
|
11
|
+
*/
|
|
12
|
+
chain: Chain;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A low level function that is used to connect a WalletConnect authenticate response to the Dynamic SDK.
|
|
16
|
+
* It will generate the wallet providers and wallet accounts for all accounts in the session.
|
|
17
|
+
*
|
|
18
|
+
* @see WalletConnect's docs on [session authentication](https://docs.reown.com/advanced/api/sign/dapp-usage#session-authenticate-with-recaps)
|
|
19
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
20
|
+
* @returns A promise that resolves to the connected and verified wallet account.
|
|
21
|
+
*/
|
|
22
|
+
export declare const importWalletConnectAuthResponse: ({ authResponse, chain }: ImportWalletConnectAuthResponseParams, client: DynamicClient) => Promise<{
|
|
23
|
+
walletAccounts: WalletAccount[];
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=importWalletConnectAuthResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importWalletConnectAuthResponse.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/importWalletConnectAuthResponse/importWalletConnectAuthResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMtD,KAAK,qCAAqC,GAAG;IAC3C;;OAEG;IACH,YAAY,EAAE,SAAS,CAAC,0BAA0B,CAAC;IAEnD;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,4BACjB,qCAAqC,UACtD,aAAa,KACpB,OAAO,CAAC;IAAE,cAAc,EAAE,aAAa,EAAE,CAAA;CAAE,CA4E7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/importWalletConnectAuthResponse/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/verifyWalletConnectAuths.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Chain, DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { AuthTypes } from '@walletconnect/types';
|
|
3
|
+
type VerifyWalletConnectAuthsParams = {
|
|
4
|
+
auths: AuthTypes.Cacao[];
|
|
5
|
+
chain: Chain;
|
|
6
|
+
walletDisplayName: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const verifyWalletConnectAuths: ({ auths, chain, walletDisplayName }: VerifyWalletConnectAuthsParams, client: DynamicClient) => Promise<void>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=verifyWalletConnectAuths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyWalletConnectAuths.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/importWalletConnectAuthResponse/verifyWalletConnectAuths/verifyWalletConnectAuths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,wBAAwB,wCACE,8BAA8B,UAC3D,aAAa,kBAqEtB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
2
|
import { type WalletAccount } from '@dynamic-labs-sdk/client';
|
|
3
3
|
import type { SessionTypes } from '@walletconnect/types';
|
|
4
|
-
type
|
|
4
|
+
type ImportWalletConnectSessionParams = {
|
|
5
5
|
/**
|
|
6
6
|
* Whether this session's wallet accounts should be added to the dynamic's wallet accounts.
|
|
7
7
|
*/
|
|
@@ -20,8 +20,8 @@ type ConnectWithWalletConnectParams = {
|
|
|
20
20
|
* @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
21
21
|
* @returns The wallet accounts.
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const importWalletConnectSession: ({ addToDynamicWalletAccounts, session, }: ImportWalletConnectSessionParams, client: DynamicClient) => Promise<{
|
|
24
24
|
walletAccounts: WalletAccount[];
|
|
25
25
|
}>;
|
|
26
26
|
export {};
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=importWalletConnectSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importWalletConnectSession.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/importWalletConnectSession/importWalletConnectSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQzD,KAAK,gCAAgC,GAAG;IACtC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,6CAIlC,gCAAgC,UAC3B,aAAa,KACpB,OAAO,CAAC;IAAE,cAAc,EAAE,aAAa,EAAE,CAAA;CAAE,CA6F7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/importWalletConnectSession/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearTemporarySessions.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/sessionTopicsData/clearTemporarySessions/clearTemporarySessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,WAAkB,aAAa,
|
|
1
|
+
{"version":3,"file":"clearTemporarySessions.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/sessionTopicsData/clearTemporarySessions/clearTemporarySessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,WAAkB,aAAa,kBA4BjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addMissingWalletProvidersForSessions.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/syncSessionsToWalletProviders/addMissingWalletProvidersForSessions/addMissingWalletProvidersForSessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"addMissingWalletProvidersForSessions.d.ts","sourceRoot":"","sources":["../../../../../../packages/wallet-connect/src/syncSessionsToWalletProviders/addMissingWalletProvidersForSessions/addMissingWalletProvidersForSessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAWlC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAE3F,KAAK,0CAA0C,GAAG;IAChD,8BAA8B,EAAE,OAAO,CAAC;IACxC,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,oCAAoC,kDAI5C,0CAA0C,UACrC,aAAa,KACpB,OAAO,CAAC;IACT,gCAAgC,EAAE,2BAA2B,EAAE,CAAC;CACjE,CAkLA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncSessionsToWalletProviders.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/syncSessionsToWalletProviders/syncSessionsToWalletProviders.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"syncSessionsToWalletProviders.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/syncSessionsToWalletProviders/syncSessionsToWalletProviders.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAuJlC,KAAK,mCAAmC,GAAG;IACzC,8BAA8B,EAAE,OAAO,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,6BAA6B,sDAIrC,mCAAmC,UAC9B,aAAa,iBAetB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectWalletConnectSession.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/connectWalletConnectSession/connectWalletConnectSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQzD,KAAK,8BAA8B,GAAG;IACpC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,6CAInC,8BAA8B,UACzB,aAAa,KACpB,OAAO,CAAC;IAAE,cAAc,EAAE,aAAa,EAAE,CAAA;CAAE,CA6F7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/connectWalletConnectSession/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reason for disconnection when the user disconnects from a WalletConnect session.
|
|
3
|
-
*
|
|
4
|
-
* Source: https://github.com/WalletConnect/walletconnect-monorepo/blob/cc3a9d26dcbd05c92d5ded935b29dc3b6063d147/packages/utils/src/errors.ts#L87
|
|
5
|
-
*/
|
|
6
|
-
export declare const USER_DISCONNECTED_REASON: {
|
|
7
|
-
readonly code: 6000;
|
|
8
|
-
readonly message: "User disconnected.";
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../../../packages/wallet-connect/src/signClient/consts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC"}
|