@dynamic-labs/wallet-connector-core 4.0.0-alpha.33 → 4.0.0-alpha.35

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 (28) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +8 -8
  5. package/src/WalletConnectorBase/WalletConnectorBase.cjs +1 -1
  6. package/src/WalletConnectorBase/WalletConnectorBase.js +1 -1
  7. package/src/index.cjs +2 -0
  8. package/src/index.d.ts +2 -2
  9. package/src/index.js +1 -0
  10. package/src/types.d.ts +39 -3
  11. package/src/utils/getWalletLinks/getWalletLinks.cjs +32 -0
  12. package/src/utils/getWalletLinks/getWalletLinks.d.ts +2 -0
  13. package/src/utils/getWalletLinks/getWalletLinks.js +28 -0
  14. package/src/utils/getWalletLinks/index.d.ts +1 -0
  15. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.cjs +21 -1
  16. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.d.ts +4 -1
  17. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.js +21 -1
  18. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.cjs +1 -1
  19. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.js +1 -1
  20. package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs +4 -1
  21. package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js +4 -1
  22. package/src/utils/index.d.ts +1 -0
  23. package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.cjs +3 -3
  24. package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.d.ts +3 -3
  25. package/src/utils/walletConnectDeepLinks/performPlatformSpecificConnectionMethod.js +3 -3
  26. package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.cjs +11 -8
  27. package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.d.ts +3 -3
  28. package/src/utils/walletConnectDeepLinks/walletConnectDeepLinks.js +11 -8
package/CHANGELOG.md CHANGED
@@ -1,4 +1,29 @@
1
1
 
2
+ ## [4.0.0-alpha.35](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.34...v4.0.0-alpha.35) (2024-11-25)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * eclipse and solana wallets getting mixed up in connect only ([#7487](https://github.com/dynamic-labs/dynamic-auth/issues/7487)) ([6cabfb8](https://github.com/dynamic-labs/dynamic-auth/commit/6cabfb8da4d23a858652634844653aadc75be062))
8
+ * eclipse wallets never get detected ([#7479](https://github.com/dynamic-labs/dynamic-auth/issues/7479)) ([4a1a040](https://github.com/dynamic-labs/dynamic-auth/commit/4a1a04027e447a0c5c42b2dd3808b82c2ce7724c))
9
+ * **ui:** add missing rule for social login modals ([#7476](https://github.com/dynamic-labs/dynamic-auth/issues/7476)) ([59b5a2d](https://github.com/dynamic-labs/dynamic-auth/commit/59b5a2de10600decedbc167ee30e7900ec53618b))
10
+ * use correct fallback connector for each chain ([#7318](https://github.com/dynamic-labs/dynamic-auth/issues/7318)) ([91dcf8b](https://github.com/dynamic-labs/dynamic-auth/commit/91dcf8b6be4932c8e4122ce4dbceafee7ba1d194))
11
+
12
+ ## [4.0.0-alpha.34](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.33...v4.0.0-alpha.34) (2024-11-20)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * remove `supportsSatsConnect` helper ([#7453](https://github.com/dynamic-labs/dynamic-auth/issues/7453)) ([920c63b](https://github.com/dynamic-labs/dynamic-auth/commit/920c63bbb5a38dc3d676664db512a4da539c0909))
18
+ * moved `getWalletLinks` helper from `@dynamic-labs/wallet-book` to `@dynamic-labs/wallet-connector-core` ([#7416](https://github.com/dynamic-labs/dynamic-auth/issues/7416)) ([73fdfa8](https://github.com/dynamic-labs/dynamic-auth/commit/73fdfa8a19fe4c2cca55410d5ed3cb7b5bd8cdfd))
19
+
20
+ ### Features
21
+
22
+ * allow listening to dynamic events without using a hook ([#7466](https://github.com/dynamic-labs/dynamic-auth/issues/7466)) ([3b34e1b](https://github.com/dynamic-labs/dynamic-auth/commit/3b34e1bd2737003b987887a02d0e21436e9bf908))
23
+ * emit primaryWalletChanged event when primary wallets changes ([#7464](https://github.com/dynamic-labs/dynamic-auth/issues/7464)) ([3bc6ba0](https://github.com/dynamic-labs/dynamic-auth/commit/3bc6ba055e0232bff3c6c6bb93d3d57b1dd90bc6))
24
+ * emit primaryWalletNetworkChanged event when primary wallet network changes ([#7465](https://github.com/dynamic-labs/dynamic-auth/issues/7465)) ([33cc629](https://github.com/dynamic-labs/dynamic-auth/commit/33cc629d3c6a03c381b7e5591a8f4557987cc6fc))
25
+
26
+
2
27
  ## [4.0.0-alpha.33](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.32...v4.0.0-alpha.33) (2024-11-18)
3
28
 
4
29
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.33";
6
+ var version = "4.0.0-alpha.35";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.33";
2
+ var version = "4.0.0-alpha.35";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wallet-connector-core",
3
- "version": "4.0.0-alpha.33",
3
+ "version": "4.0.0-alpha.35",
4
4
  "description": "Core package for utilities and types for handling multiple wallet/chain support Dynamic SDK",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/sdk-api-core": "0.0.565"
21
+ "@dynamic-labs/sdk-api-core": "0.0.570"
22
22
  },
23
23
  "peerDependencies": {
24
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.33",
25
- "@dynamic-labs/logger": "4.0.0-alpha.33",
26
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.33",
27
- "@dynamic-labs/types": "4.0.0-alpha.33",
28
- "@dynamic-labs/utils": "4.0.0-alpha.33",
29
- "@dynamic-labs/wallet-book": "4.0.0-alpha.33",
24
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.35",
25
+ "@dynamic-labs/logger": "4.0.0-alpha.35",
26
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.35",
27
+ "@dynamic-labs/types": "4.0.0-alpha.35",
28
+ "@dynamic-labs/utils": "4.0.0-alpha.35",
29
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.35",
30
30
  "eventemitter3": "5.0.1"
31
31
  }
32
32
  }
@@ -409,7 +409,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
409
409
  validateActiveWallet(expectedAddress) {
410
410
  return _tslib.__awaiter(this, void 0, void 0, function* () {
411
411
  logger.logger.debug('validateActiveWallet - validating wallet', expectedAddress);
412
- const canFetchConnectedAccounts = isConnectorMethodSupported.isConnectorMethodSupported(this, 'getConnectedAccounts', 'browserExtension');
412
+ const canFetchConnectedAccounts = isConnectorMethodSupported.isConnectorMethodSupported(this, 'getConnectedAccounts', 'desktop');
413
413
  logger.logger.debug('validateActiveWallet - getting connected accounts', {
414
414
  canFetchConnectedAccounts,
415
415
  });
@@ -401,7 +401,7 @@ class WalletConnectorBase extends EventEmitter {
401
401
  validateActiveWallet(expectedAddress) {
402
402
  return __awaiter(this, void 0, void 0, function* () {
403
403
  logger.debug('validateActiveWallet - validating wallet', expectedAddress);
404
- const canFetchConnectedAccounts = isConnectorMethodSupported(this, 'getConnectedAccounts', 'browserExtension');
404
+ const canFetchConnectedAccounts = isConnectorMethodSupported(this, 'getConnectedAccounts', 'desktop');
405
405
  logger.debug('validateActiveWallet - getting connected accounts', {
406
406
  canFetchConnectedAccounts,
407
407
  });
package/src/index.cjs CHANGED
@@ -39,6 +39,7 @@ var getMobileExperience = require('./utils/getMobileExperience/getMobileExperien
39
39
  var getWalletMetadataFromWalletBook = require('./utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs');
40
40
  var isConnectorMethodSupported = require('./utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs');
41
41
  var isConnectorEventSupported = require('./utils/isConnectorEventSupported/isConnectorEventSupported.cjs');
42
+ var getWalletLinks = require('./utils/getWalletLinks/getWalletLinks.cjs');
42
43
  var Wallet = require('./Wallet/Wallet.cjs');
43
44
  var WalletConnectorBase = require('./WalletConnectorBase/WalletConnectorBase.cjs');
44
45
  var types = require('./WalletConnectorBase/types.cjs');
@@ -84,6 +85,7 @@ exports.getMobileExperience = getMobileExperience.getMobileExperience;
84
85
  exports.getWalletMetadataFromWalletBook = getWalletMetadataFromWalletBook.getWalletMetadataFromWalletBook;
85
86
  exports.isConnectorMethodSupported = isConnectorMethodSupported.isConnectorMethodSupported;
86
87
  exports.isConnectorEventSupported = isConnectorEventSupported.isConnectorEventSupported;
88
+ exports.getWalletLinks = getWalletLinks.getWalletLinks;
87
89
  exports.Wallet = Wallet.Wallet;
88
90
  exports.WalletConnectorBase = WalletConnectorBase.WalletConnectorBase;
89
91
  exports.Chains = types.Chains;
package/src/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { walletConnectorEvents } from './events';
2
2
  export { type Attestation, type AuthenticatorRecoveryHandler, type AuthenticatorType, type BitcoinSignPsbtRequest, type BitcoinSignPsbtRequestSignature, type BitcoinSignPsbtResponse, type ExportHandler, type ExtendedPrivateKey, type IAccountAbstractionWalletConnector, type IBitcoinWalletConnector, type ICoinbaseMPCWalletConnector, type IEmailOTPWalletConnector, type IEmailWalletConnector, type IHardwareWalletConnector, type IPasskeyWalletConnector, type IPhantomRedirectConnector, type IPhantomRedirectConnectorWithEvents, type ISendBalanceWalletConnector, type ISessionKeyCompatibleWalletConnector, type ISMSWalletConnector, type ITurnkeyWalletConnector, type ITurnkeyWalletConnectorStamper, type IWalletConnectConnector, type RawPrivateKey, type RecoveryEmailParams, type RecoveryWebAuthnAttestation, type SignAllTransactionsListener, type SignAndSendTransactionListener, type SignMessageListener, type SignTransactionListener, type WebAuthnAttestation, } from './interfaces';
3
- export type { AccountChangeEventHandler, ChainChangeEventHandler, DisconnectEventHandler, WalletConnectorCore, WalletMetadata, WalletDeepLinks, WalletDownloadLinks, WalletLimitations, } from './types';
4
- export { addHexPrefix, bufferToHex, eventListenerHandlers, getChainInfo, getChainInfoWithOverrides, getDeepLink, getMobileExperience, getRpcUrlForChain, getWalletConnectorByKey, isAccountAbstractionConnector, isBitcoinConnector, isBloctoConnector, isCoinbaseMpcWalletConnector, isEmailOTPWalletConnector, isEmailWalletConnector, isEmbeddedConnector, isHardwareWalletConnector, isHex, isMagicConnector, isPasskeyWalletConnector, isPhantomRedirectConnector, isSameAddress, isSendBalanceWalletConnector, isSessionKeyCompatibleWallet, isSessionKeyCompatibleWalletConnector, isSocialWalletConnector, isTurnkeyWalletConnector, isWalletConnectConnector, isConnectorMethodSupported, isConnectorEventSupported, getWalletMetadataFromWalletBook, logger, performPlatformSpecificConnectionMethod, ProviderLookup, setChainInfoOverrides, shouldLowercaseAddress, utf8ToHex, type ChainDisplayOverrides, type DeepLinkVariant, type ProviderCondition, } from './utils';
3
+ export type { AccountChangeEventHandler, ChainChangeEventHandler, DisconnectEventHandler, WalletConnectorCore, WalletMetadata, WalletDeepLinks, WalletDownloadLinks, WalletLimitations, WalletLinks, } from './types';
4
+ export { addHexPrefix, bufferToHex, eventListenerHandlers, getChainInfo, getChainInfoWithOverrides, getDeepLink, getMobileExperience, getRpcUrlForChain, getWalletConnectorByKey, isAccountAbstractionConnector, isBitcoinConnector, isBloctoConnector, isCoinbaseMpcWalletConnector, isEmailOTPWalletConnector, isEmailWalletConnector, isEmbeddedConnector, isHardwareWalletConnector, isHex, isMagicConnector, isPasskeyWalletConnector, isPhantomRedirectConnector, isSameAddress, isSendBalanceWalletConnector, isSessionKeyCompatibleWallet, isSessionKeyCompatibleWalletConnector, isSocialWalletConnector, isTurnkeyWalletConnector, isWalletConnectConnector, isConnectorMethodSupported, isConnectorEventSupported, getWalletMetadataFromWalletBook, getWalletLinks, logger, performPlatformSpecificConnectionMethod, ProviderLookup, setChainInfoOverrides, shouldLowercaseAddress, utf8ToHex, type ChainDisplayOverrides, type DeepLinkVariant, type ProviderCondition, } from './utils';
5
5
  export { Wallet, type WalletConstructor, type WalletProps } from './Wallet';
6
6
  export { Chains, socialProviders, WalletConnectorBase, type Chain, type ChainInfo, type GetAddressOpts, type InternalWalletConnector, type NameServiceData, type PayloadParams, type SocialProvider, type WalletConnector, type WalletConnectorConstructor, type WalletConnectorEventTypes, type WalletConnectorExtension, type WalletConnectorsMethod, } from './WalletConnectorBase';
7
7
  export { WalletBookSingleton } from './WalletBookSingleton';
package/src/index.js CHANGED
@@ -35,6 +35,7 @@ export { getMobileExperience } from './utils/getMobileExperience/getMobileExperi
35
35
  export { getWalletMetadataFromWalletBook } from './utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js';
36
36
  export { isConnectorMethodSupported } from './utils/isConnectorMethodSupported/isConnectorMethodSupported.js';
37
37
  export { isConnectorEventSupported } from './utils/isConnectorEventSupported/isConnectorEventSupported.js';
38
+ export { getWalletLinks } from './utils/getWalletLinks/getWalletLinks.js';
38
39
  export { Wallet } from './Wallet/Wallet.js';
39
40
  export { WalletConnectorBase } from './WalletConnectorBase/WalletConnectorBase.js';
40
41
  export { Chains, socialProviders } from './WalletConnectorBase/types.js';
package/src/types.d.ts CHANGED
@@ -6,7 +6,7 @@ export type DisconnectEventHandler = (error?: {
6
6
  export type WalletEvent = 'accountChanged' | 'chainChanged';
7
7
  export type WalletMethod = 'getConnectedAccounts';
8
8
  export type WalletLimitations = {
9
- browserExtension?: {
9
+ desktop?: {
10
10
  unsupportedEvents?: WalletEvent[];
11
11
  unsupportedMethods?: WalletMethod[];
12
12
  };
@@ -15,18 +15,54 @@ export type WalletLimitations = {
15
15
  unsupportedMethods?: WalletMethod[];
16
16
  };
17
17
  };
18
+ /**
19
+ * @property android - The full url to download the wallet on Android
20
+ * @property brave - The full url to download the wallet on Brave
21
+ * @property chrome - The full url to download the wallet on Chrome
22
+ * @property edge - The full url to download the wallet on Edge
23
+ * @property firefox - The full url to download the wallet on Firefox
24
+ * @property ios - The full url to download the wallet on iOS
25
+ */
26
+ export type WalletLinks = {
27
+ android: string;
28
+ brave: string;
29
+ chrome: string;
30
+ edge: string;
31
+ firefox: string;
32
+ ios: string;
33
+ };
18
34
  export type WalletDownloadLinks = {
19
35
  chromeId?: string;
20
36
  edgeId?: string;
21
37
  firefoxId?: string;
22
38
  operaId?: string;
23
39
  safariId?: string;
40
+ /**
41
+ * @property androidId - The id to download the wallet on Google Play
42
+ */
24
43
  androidId?: string;
44
+ /**
45
+ * @property iosId - The id to download the wallet on App Store
46
+ */
25
47
  iosId?: string;
48
+ /**
49
+ * @property android - The url to download the wallet on Android
50
+ */
51
+ androidUrl?: string;
52
+ /**
53
+ * @property ios - The url to download the wallet on iOS
54
+ */
55
+ iosUrl?: string;
26
56
  };
27
57
  export type WalletDeepLinks = {
28
- native?: string;
29
- universal?: string;
58
+ mobile?: {
59
+ native?: string;
60
+ universal?: string;
61
+ };
62
+ desktop?: {
63
+ native?: string;
64
+ universal?: string;
65
+ };
30
66
  };
31
67
  /**
32
68
  * @property id - A key that can be used to identify the wallet/connector, based on the wallet name
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletBook = require('@dynamic-labs/wallet-book');
7
+
8
+ const getWalletLinks = (downloadLinks) => {
9
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10
+ const links = {
11
+ android: '',
12
+ brave: '',
13
+ chrome: '',
14
+ edge: '',
15
+ firefox: '',
16
+ ios: '',
17
+ };
18
+ if (!downloadLinks) {
19
+ return links;
20
+ }
21
+ links.brave = (_a = walletBook.renderTemplate('chromeUrl', downloadLinks.chromeId)) !== null && _a !== void 0 ? _a : '';
22
+ links.chrome = (_b = walletBook.renderTemplate('chromeUrl', downloadLinks.chromeId)) !== null && _b !== void 0 ? _b : '';
23
+ links.edge = (_c = walletBook.renderTemplate('edgeUrl', downloadLinks.edgeId)) !== null && _c !== void 0 ? _c : '';
24
+ links.firefox = (_d = walletBook.renderTemplate('firefoxUrl', downloadLinks.firefoxId)) !== null && _d !== void 0 ? _d : '';
25
+ links.ios =
26
+ (_f = (_e = walletBook.renderTemplate('iosUrl', downloadLinks.iosId)) !== null && _e !== void 0 ? _e : downloadLinks.iosUrl) !== null && _f !== void 0 ? _f : '';
27
+ links.android =
28
+ (_h = (_g = walletBook.renderTemplate('androidUrl', downloadLinks.androidId)) !== null && _g !== void 0 ? _g : downloadLinks.androidUrl) !== null && _h !== void 0 ? _h : '';
29
+ return links;
30
+ };
31
+
32
+ exports.getWalletLinks = getWalletLinks;
@@ -0,0 +1,2 @@
1
+ import { WalletDownloadLinks, WalletLinks } from '../../types';
2
+ export declare const getWalletLinks: (downloadLinks: WalletDownloadLinks | undefined) => WalletLinks;
@@ -0,0 +1,28 @@
1
+ 'use client'
2
+ import { renderTemplate } from '@dynamic-labs/wallet-book';
3
+
4
+ const getWalletLinks = (downloadLinks) => {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h;
6
+ const links = {
7
+ android: '',
8
+ brave: '',
9
+ chrome: '',
10
+ edge: '',
11
+ firefox: '',
12
+ ios: '',
13
+ };
14
+ if (!downloadLinks) {
15
+ return links;
16
+ }
17
+ links.brave = (_a = renderTemplate('chromeUrl', downloadLinks.chromeId)) !== null && _a !== void 0 ? _a : '';
18
+ links.chrome = (_b = renderTemplate('chromeUrl', downloadLinks.chromeId)) !== null && _b !== void 0 ? _b : '';
19
+ links.edge = (_c = renderTemplate('edgeUrl', downloadLinks.edgeId)) !== null && _c !== void 0 ? _c : '';
20
+ links.firefox = (_d = renderTemplate('firefoxUrl', downloadLinks.firefoxId)) !== null && _d !== void 0 ? _d : '';
21
+ links.ios =
22
+ (_f = (_e = renderTemplate('iosUrl', downloadLinks.iosId)) !== null && _e !== void 0 ? _e : downloadLinks.iosUrl) !== null && _f !== void 0 ? _f : '';
23
+ links.android =
24
+ (_h = (_g = renderTemplate('androidUrl', downloadLinks.androidId)) !== null && _g !== void 0 ? _g : downloadLinks.androidUrl) !== null && _h !== void 0 ? _h : '';
25
+ return links;
26
+ };
27
+
28
+ export { getWalletLinks };
@@ -0,0 +1 @@
1
+ export { getWalletLinks } from './getWalletLinks';
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- const getDeepLinks = (mobile) => {
6
+ const getMobileDeepLinks = (mobile) => {
7
7
  if (!mobile) {
8
8
  return;
9
9
  }
@@ -12,5 +12,25 @@ const getDeepLinks = (mobile) => {
12
12
  universal: mobile.universal,
13
13
  };
14
14
  };
15
+ const getDesktopDeepLinks = (desktop) => {
16
+ if (!desktop) {
17
+ return;
18
+ }
19
+ return {
20
+ native: desktop.native,
21
+ universal: desktop.universal,
22
+ };
23
+ };
24
+ const getDeepLinks = ({ mobile, desktop, }) => {
25
+ const mobileDeepLinks = getMobileDeepLinks(mobile);
26
+ const desktopDeepLinks = getDesktopDeepLinks(desktop);
27
+ if (!mobileDeepLinks && !desktopDeepLinks) {
28
+ return;
29
+ }
30
+ return {
31
+ desktop: desktopDeepLinks,
32
+ mobile: mobileDeepLinks,
33
+ };
34
+ };
15
35
 
16
36
  exports.getDeepLinks = getDeepLinks;
@@ -1,3 +1,6 @@
1
1
  import { WalletSchema } from '@dynamic-labs/wallet-book';
2
2
  import { WalletDeepLinks } from '../../../types';
3
- export declare const getDeepLinks: (mobile?: WalletSchema['mobile']) => WalletDeepLinks | undefined;
3
+ export declare const getDeepLinks: ({ mobile, desktop, }: {
4
+ mobile?: WalletSchema['mobile'];
5
+ desktop?: WalletSchema['desktop'];
6
+ }) => WalletDeepLinks | undefined;
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- const getDeepLinks = (mobile) => {
2
+ const getMobileDeepLinks = (mobile) => {
3
3
  if (!mobile) {
4
4
  return;
5
5
  }
@@ -8,5 +8,25 @@ const getDeepLinks = (mobile) => {
8
8
  universal: mobile.universal,
9
9
  };
10
10
  };
11
+ const getDesktopDeepLinks = (desktop) => {
12
+ if (!desktop) {
13
+ return;
14
+ }
15
+ return {
16
+ native: desktop.native,
17
+ universal: desktop.universal,
18
+ };
19
+ };
20
+ const getDeepLinks = ({ mobile, desktop, }) => {
21
+ const mobileDeepLinks = getMobileDeepLinks(mobile);
22
+ const desktopDeepLinks = getDesktopDeepLinks(desktop);
23
+ if (!mobileDeepLinks && !desktopDeepLinks) {
24
+ return;
25
+ }
26
+ return {
27
+ desktop: desktopDeepLinks,
28
+ mobile: mobileDeepLinks,
29
+ };
30
+ };
11
31
 
12
32
  export { getDeepLinks };
@@ -9,7 +9,7 @@ const getWalletLimitations = (walletLimitations) => {
9
9
  }
10
10
  const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
11
11
  return {
12
- browserExtension: {
12
+ desktop: {
13
13
  unsupportedEvents: unsupportedEvents,
14
14
  unsupportedMethods: unsupportedMethods,
15
15
  },
@@ -5,7 +5,7 @@ const getWalletLimitations = (walletLimitations) => {
5
5
  }
6
6
  const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
7
7
  return {
8
- browserExtension: {
8
+ desktop: {
9
9
  unsupportedEvents: unsupportedEvents,
10
10
  unsupportedMethods: unsupportedMethods,
11
11
  },
@@ -27,7 +27,10 @@ const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBo
27
27
  }
28
28
  return {
29
29
  brandColor: getValidHexColor.getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
30
- deepLinks: getDeepLinks.getDeepLinks(wallet === null || wallet === void 0 ? void 0 : wallet.mobile),
30
+ deepLinks: getDeepLinks.getDeepLinks({
31
+ desktop: wallet === null || wallet === void 0 ? void 0 : wallet.desktop,
32
+ mobile: wallet === null || wallet === void 0 ? void 0 : wallet.mobile,
33
+ }),
31
34
  downloadLinks: getDownloadLinks.getDownloadLinks(wallet),
32
35
  groupKey: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.chainGroup) !== null && _b !== void 0 ? _b : wallet === null || wallet === void 0 ? void 0 : wallet.walletGroup,
33
36
  icon: (_d = getIconUrl.getIconUrl((_c = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _c === void 0 ? void 0 : _c.spriteId)) !== null && _d !== void 0 ? _d : '',
@@ -23,7 +23,10 @@ const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBo
23
23
  }
24
24
  return {
25
25
  brandColor: getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
26
- deepLinks: getDeepLinks(wallet === null || wallet === void 0 ? void 0 : wallet.mobile),
26
+ deepLinks: getDeepLinks({
27
+ desktop: wallet === null || wallet === void 0 ? void 0 : wallet.desktop,
28
+ mobile: wallet === null || wallet === void 0 ? void 0 : wallet.mobile,
29
+ }),
27
30
  downloadLinks: getDownloadLinks(wallet),
28
31
  groupKey: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.chainGroup) !== null && _b !== void 0 ? _b : wallet === null || wallet === void 0 ? void 0 : wallet.walletGroup,
29
32
  icon: (_d = getIconUrl((_c = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _c === void 0 ? void 0 : _c.spriteId)) !== null && _d !== void 0 ? _d : '',
@@ -29,3 +29,4 @@ export * from './getMobileExperience';
29
29
  export * from './getWalletMetadataFromWalletBook';
30
30
  export * from './isConnectorMethodSupported';
31
31
  export * from './isConnectorEventSupported';
32
+ export * from './getWalletLinks';
@@ -6,10 +6,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var utils = require('@dynamic-labs/utils');
7
7
  var walletConnectDeepLinks = require('./walletConnectDeepLinks.cjs');
8
8
 
9
- const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference) => {
9
+ const performPlatformSpecificConnectionMethod = (uri, deepLinks, opts, preference) => {
10
10
  var _a, _b, _c;
11
11
  const deepLink = walletConnectDeepLinks.getDeepLink({
12
- metadata,
12
+ deepLinks,
13
13
  mode: 'connection',
14
14
  preference,
15
15
  uri,
@@ -18,7 +18,7 @@ const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference
18
18
  window.location.href = deepLink;
19
19
  }
20
20
  else {
21
- if ((_a = metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
21
+ if ((_a = deepLinks === null || deepLinks === void 0 ? void 0 : deepLinks.desktop) === null || _a === void 0 ? void 0 : _a.native) {
22
22
  (_b = opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
23
23
  }
24
24
  (_c = opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
@@ -1,4 +1,4 @@
1
- import type { WalletSchema } from '@dynamic-labs/wallet-book';
2
- import type { GetAddressOpts } from '../..';
1
+ import type { GetAddressOpts } from '../../WalletConnectorBase/types';
2
+ import type { WalletDeepLinks } from '../../types';
3
3
  import { DeepLinkVariant } from './walletConnectDeepLinks';
4
- export declare const performPlatformSpecificConnectionMethod: (uri: string, metadata: WalletSchema, opts: Pick<GetAddressOpts, 'onDesktopUri' | 'onDisplayUri'>, preference: DeepLinkVariant) => void;
4
+ export declare const performPlatformSpecificConnectionMethod: (uri: string, deepLinks: WalletDeepLinks | undefined, opts: Pick<GetAddressOpts, 'onDesktopUri' | 'onDisplayUri'>, preference: DeepLinkVariant) => void;
@@ -2,10 +2,10 @@
2
2
  import { isMobile } from '@dynamic-labs/utils';
3
3
  import { getDeepLink } from './walletConnectDeepLinks.js';
4
4
 
5
- const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference) => {
5
+ const performPlatformSpecificConnectionMethod = (uri, deepLinks, opts, preference) => {
6
6
  var _a, _b, _c;
7
7
  const deepLink = getDeepLink({
8
- metadata,
8
+ deepLinks,
9
9
  mode: 'connection',
10
10
  preference,
11
11
  uri,
@@ -14,7 +14,7 @@ const performPlatformSpecificConnectionMethod = (uri, metadata, opts, preference
14
14
  window.location.href = deepLink;
15
15
  }
16
16
  else {
17
- if ((_a = metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
17
+ if ((_a = deepLinks === null || deepLinks === void 0 ? void 0 : deepLinks.desktop) === null || _a === void 0 ? void 0 : _a.native) {
18
18
  (_b = opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
19
19
  }
20
20
  (_c = opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var utils = require('@dynamic-labs/utils');
7
7
 
8
- const getConnectionDeepLink = (uri, metadata, preference) => {
8
+ const getConnectionDeepLink = (uri, deepLinks, preference) => {
9
9
  // on android, the connection deeplink is simply the uri
10
10
  // see: https://docs.walletconnect.com/mobile-linking#for-android
11
11
  if (utils.isAndroid()) {
12
12
  return uri;
13
13
  }
14
- const deepLink = getRegularDeepLink(uri, metadata, preference);
14
+ const deepLink = getRegularDeepLink(uri, deepLinks, preference);
15
15
  if (!deepLink) {
16
16
  return `${deepLink}?uri=${encodeURIComponent(uri)}`;
17
17
  }
@@ -21,7 +21,7 @@ const getConnectionDeepLink = (uri, metadata, preference) => {
21
21
  deepLinkUrl.search = deepLinkParams.toString();
22
22
  return deepLinkUrl.toString();
23
23
  };
24
- const getRegularDeepLink = (uri, metadata, preference) => {
24
+ const getRegularDeepLink = (uri, deepLinks, preference) => {
25
25
  var _a, _b, _c, _d;
26
26
  if (utils.isAndroid()) {
27
27
  // on android, the deeplink is simply the uri, without the query params
@@ -31,19 +31,22 @@ const getRegularDeepLink = (uri, metadata, preference) => {
31
31
  const index = utils.isMobile() ? 'mobile' : 'desktop';
32
32
  let origin;
33
33
  if (preference === 'native') {
34
- origin = ((_a = metadata[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata[index]) === null || _b === void 0 ? void 0 : _b.universal);
34
+ origin = ((_a = deepLinks[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = deepLinks[index]) === null || _b === void 0 ? void 0 : _b.universal);
35
35
  }
36
36
  else {
37
- origin = ((_c = metadata[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata[index]) === null || _d === void 0 ? void 0 : _d.native);
37
+ origin = ((_c = deepLinks[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = deepLinks[index]) === null || _d === void 0 ? void 0 : _d.native);
38
38
  }
39
39
  return origin || '';
40
40
  };
41
- const getDeepLink = ({ mode, uri = '', metadata, preference, }) => {
41
+ const getDeepLink = ({ mode, uri = '', deepLinks, preference, }) => {
42
+ if (!deepLinks) {
43
+ return '';
44
+ }
42
45
  switch (mode) {
43
46
  case 'connection':
44
- return getConnectionDeepLink(uri, metadata, preference);
47
+ return getConnectionDeepLink(uri, deepLinks, preference);
45
48
  case 'regular':
46
- return getRegularDeepLink(uri, metadata, preference);
49
+ return getRegularDeepLink(uri, deepLinks, preference);
47
50
  }
48
51
  };
49
52
 
@@ -1,10 +1,10 @@
1
- import type { WalletSchema } from '@dynamic-labs/wallet-book';
1
+ import type { WalletDeepLinks } from '../../types';
2
2
  export type DeepLinkVariant = 'native' | 'universal';
3
3
  type GetDeepLinkArgs = {
4
- metadata: WalletSchema;
4
+ deepLinks: WalletDeepLinks | undefined;
5
5
  mode: 'connection' | 'regular';
6
6
  uri?: string;
7
7
  preference: DeepLinkVariant;
8
8
  };
9
- export declare const getDeepLink: ({ mode, uri, metadata, preference, }: GetDeepLinkArgs) => string;
9
+ export declare const getDeepLink: ({ mode, uri, deepLinks, preference, }: GetDeepLinkArgs) => string;
10
10
  export {};
@@ -1,13 +1,13 @@
1
1
  'use client'
2
2
  import { isAndroid, isMobile } from '@dynamic-labs/utils';
3
3
 
4
- const getConnectionDeepLink = (uri, metadata, preference) => {
4
+ const getConnectionDeepLink = (uri, deepLinks, preference) => {
5
5
  // on android, the connection deeplink is simply the uri
6
6
  // see: https://docs.walletconnect.com/mobile-linking#for-android
7
7
  if (isAndroid()) {
8
8
  return uri;
9
9
  }
10
- const deepLink = getRegularDeepLink(uri, metadata, preference);
10
+ const deepLink = getRegularDeepLink(uri, deepLinks, preference);
11
11
  if (!deepLink) {
12
12
  return `${deepLink}?uri=${encodeURIComponent(uri)}`;
13
13
  }
@@ -17,7 +17,7 @@ const getConnectionDeepLink = (uri, metadata, preference) => {
17
17
  deepLinkUrl.search = deepLinkParams.toString();
18
18
  return deepLinkUrl.toString();
19
19
  };
20
- const getRegularDeepLink = (uri, metadata, preference) => {
20
+ const getRegularDeepLink = (uri, deepLinks, preference) => {
21
21
  var _a, _b, _c, _d;
22
22
  if (isAndroid()) {
23
23
  // on android, the deeplink is simply the uri, without the query params
@@ -27,19 +27,22 @@ const getRegularDeepLink = (uri, metadata, preference) => {
27
27
  const index = isMobile() ? 'mobile' : 'desktop';
28
28
  let origin;
29
29
  if (preference === 'native') {
30
- origin = ((_a = metadata[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata[index]) === null || _b === void 0 ? void 0 : _b.universal);
30
+ origin = ((_a = deepLinks[index]) === null || _a === void 0 ? void 0 : _a.native) || ((_b = deepLinks[index]) === null || _b === void 0 ? void 0 : _b.universal);
31
31
  }
32
32
  else {
33
- origin = ((_c = metadata[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata[index]) === null || _d === void 0 ? void 0 : _d.native);
33
+ origin = ((_c = deepLinks[index]) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = deepLinks[index]) === null || _d === void 0 ? void 0 : _d.native);
34
34
  }
35
35
  return origin || '';
36
36
  };
37
- const getDeepLink = ({ mode, uri = '', metadata, preference, }) => {
37
+ const getDeepLink = ({ mode, uri = '', deepLinks, preference, }) => {
38
+ if (!deepLinks) {
39
+ return '';
40
+ }
38
41
  switch (mode) {
39
42
  case 'connection':
40
- return getConnectionDeepLink(uri, metadata, preference);
43
+ return getConnectionDeepLink(uri, deepLinks, preference);
41
44
  case 'regular':
42
- return getRegularDeepLink(uri, metadata, preference);
45
+ return getRegularDeepLink(uri, deepLinks, preference);
43
46
  }
44
47
  };
45
48