@dynamic-labs/wallet-connector-core 4.0.0-alpha.25 → 4.0.0-alpha.27

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 (36) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +7 -7
  5. package/src/WalletConnectorBase/WalletConnectorBase.cjs +1 -1
  6. package/src/WalletConnectorBase/WalletConnectorBase.d.ts +1 -3
  7. package/src/WalletConnectorBase/WalletConnectorBase.js +1 -1
  8. package/src/WalletConnectorBase/types.d.ts +1 -1
  9. package/src/index.cjs +2 -0
  10. package/src/index.d.ts +1 -1
  11. package/src/index.js +1 -0
  12. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.cjs +16 -0
  13. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.d.ts +3 -0
  14. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/getDeepLinks.js +12 -0
  15. package/src/utils/getWalletMetadataFromWalletBook/getDeepLinks/index.d.ts +1 -0
  16. package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.cjs +36 -0
  17. package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.d.ts +3 -0
  18. package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/getDownloadLinks.js +32 -0
  19. package/src/utils/getWalletMetadataFromWalletBook/getDownloadLinks/index.d.ts +1 -0
  20. package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.cjs +15 -0
  21. package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.d.ts +1 -0
  22. package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/getIconUrl.js +11 -0
  23. package/src/utils/getWalletMetadataFromWalletBook/getIconUrl/index.d.ts +1 -0
  24. package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.cjs +15 -0
  25. package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.d.ts +1 -0
  26. package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/getValidHexColor.js +11 -0
  27. package/src/utils/getWalletMetadataFromWalletBook/getValidHexColor/index.d.ts +1 -0
  28. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.cjs +19 -0
  29. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.d.ts +3 -0
  30. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/getWalletLimitations.js +15 -0
  31. package/src/utils/getWalletMetadataFromWalletBook/getWalletLimitations/index.d.ts +1 -0
  32. package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs +36 -0
  33. package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.d.ts +10 -0
  34. package/src/utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js +32 -0
  35. package/src/utils/getWalletMetadataFromWalletBook/index.d.ts +1 -0
  36. package/src/utils/index.d.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## [4.0.0-alpha.27](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.26...v4.0.0-alpha.27) (2024-11-06)
3
+
4
+
5
+ ### Features
6
+
7
+ * allows adding connection configuration for solana connectors ([#7354](https://github.com/dynamic-labs/dynamic-auth/issues/7354)) ([01e35ee](https://github.com/dynamic-labs/dynamic-auth/commit/01e35ee5bfe4605df48e4188a753111efe483048))
8
+ * allows passing solana connection config to dynamic client ([#7357](https://github.com/dynamic-labs/dynamic-auth/issues/7357)) ([6da14ce](https://github.com/dynamic-labs/dynamic-auth/commit/6da14ceb481147aea31d192fe268be43a8af80e9))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * check legacy vs eip1599 tx in global connectivity ([#7341](https://github.com/dynamic-labs/dynamic-auth/issues/7341)) ([b223ea7](https://github.com/dynamic-labs/dynamic-auth/commit/b223ea7a5ed5637e11da1040c631c48bc23ba76d))
14
+ * global connectivity multiple transactions in a row ([#7342](https://github.com/dynamic-labs/dynamic-auth/issues/7342)) ([d13c1af](https://github.com/dynamic-labs/dynamic-auth/commit/d13c1afec6b3680961621d8317f55549b3ed428f))
15
+
16
+ ## [4.0.0-alpha.26](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.25...v4.0.0-alpha.26) (2024-11-04)
17
+
2
18
  ## [4.0.0-alpha.25](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.24...v4.0.0-alpha.25) (2024-11-01)
3
19
 
4
20
  ## [4.0.0-alpha.24](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.23...v4.0.0-alpha.24) (2024-10-31)
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.25";
6
+ var version = "4.0.0-alpha.27";
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.25";
2
+ var version = "4.0.0-alpha.27";
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.25",
3
+ "version": "4.0.0-alpha.27",
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",
@@ -21,12 +21,12 @@
21
21
  "@dynamic-labs/sdk-api-core": "0.0.559"
22
22
  },
23
23
  "peerDependencies": {
24
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.25",
25
- "@dynamic-labs/logger": "4.0.0-alpha.25",
26
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.25",
27
- "@dynamic-labs/types": "4.0.0-alpha.25",
28
- "@dynamic-labs/utils": "4.0.0-alpha.25",
29
- "@dynamic-labs/wallet-book": "4.0.0-alpha.25",
24
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.27",
25
+ "@dynamic-labs/logger": "4.0.0-alpha.27",
26
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.27",
27
+ "@dynamic-labs/types": "4.0.0-alpha.27",
28
+ "@dynamic-labs/utils": "4.0.0-alpha.27",
29
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.27",
30
30
  "eventemitter3": "5.0.1"
31
31
  }
32
32
  }
@@ -289,7 +289,7 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
289
289
  }
290
290
  get metadata() {
291
291
  var _a;
292
- return (_a = this._metadata) !== null && _a !== void 0 ? _a : { id: this.key };
292
+ return (_a = this._metadata) !== null && _a !== void 0 ? _a : { icon: '', id: this.key, name: this.name };
293
293
  }
294
294
  /**
295
295
  * Whether the wallet connector should fall back to a different wallet connector
@@ -220,9 +220,7 @@ export declare abstract class WalletConnectorBase<C extends WalletConstructor<an
220
220
  * Override key or the normalized wallet name if needed
221
221
  */
222
222
  get key(): string;
223
- get metadata(): WalletMetadata | {
224
- id: string;
225
- };
223
+ get metadata(): WalletMetadata;
226
224
  /**
227
225
  * Wallet name
228
226
  */
@@ -281,7 +281,7 @@ class WalletConnectorBase extends EventEmitter {
281
281
  }
282
282
  get metadata() {
283
283
  var _a;
284
- return (_a = this._metadata) !== null && _a !== void 0 ? _a : { id: this.key };
284
+ return (_a = this._metadata) !== null && _a !== void 0 ? _a : { icon: '', id: this.key, name: this.name };
285
285
  }
286
286
  /**
287
287
  * Whether the wallet connector should fall back to a different wallet connector
@@ -22,7 +22,7 @@ export type NameServiceData = {
22
22
  name?: string;
23
23
  };
24
24
  export type InternalWalletConnector = WalletConnectorCore.WalletConnector;
25
- export type WalletConnector = Pick<InternalWalletConnector, 'canConnectViaCustodialService' | 'canConnectViaQrCode' | 'canConnectViaSocial' | 'chainRpcProviders' | 'connect' | 'connectedChain' | 'createWallet' | 'constructorProps' | 'endSession' | 'getAddress' | 'getAdditionalAddresses' | 'getConnectedAccounts' | 'getDeepLink' | 'getMobileOrInstalledWallet' | 'getNetwork' | 'getSession' | 'initEventListener' | 'isAvailable' | 'isEmbeddedWallet' | 'isInitialized' | 'isInstalledOnBrowser' | 'isTestnet' | 'isWalletConnect' | 'key' | 'name' | 'parseAddress' | 'proveOwnership' | 'providerResources' | 'supportedChains' | 'supportsNetworkSwitching' | 'switchNetwork' | 'switchNetworkOnlyFromWallet' | 'teardownEventListeners'> & EventEmitter<WalletConnectorEventTypes>;
25
+ export type WalletConnector = Pick<InternalWalletConnector, 'canConnectViaCustodialService' | 'canConnectViaQrCode' | 'canConnectViaSocial' | 'chainRpcProviders' | 'connect' | 'connectedChain' | 'createWallet' | 'constructorProps' | 'endSession' | 'getAddress' | 'getAdditionalAddresses' | 'getConnectedAccounts' | 'getDeepLink' | 'getMobileOrInstalledWallet' | 'getNetwork' | 'getSession' | 'initEventListener' | 'isAvailable' | 'isEmbeddedWallet' | 'isInitialized' | 'isInstalledOnBrowser' | 'isTestnet' | 'isWalletConnect' | 'key' | 'metadata' | 'name' | 'parseAddress' | 'proveOwnership' | 'providerResources' | 'supportedChains' | 'supportsNetworkSwitching' | 'switchNetwork' | 'switchNetworkOnlyFromWallet' | 'teardownEventListeners'> & EventEmitter<WalletConnectorEventTypes>;
26
26
  export interface WalletConnectorConstructor {
27
27
  new (props?: any): InternalWalletConnector;
28
28
  }
package/src/index.cjs CHANGED
@@ -36,6 +36,7 @@ var isSendBalanceWalletConnector = require('./utils/isSendBalanceWalletConnector
36
36
  var isSessionKeyCompatibleWallet = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.cjs');
37
37
  var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
38
38
  var getMobileExperience = require('./utils/getMobileExperience/getMobileExperience.cjs');
39
+ var getWalletMetadataFromWalletBook = require('./utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs');
39
40
  var Wallet = require('./Wallet/Wallet.cjs');
40
41
  var WalletConnectorBase = require('./WalletConnectorBase/WalletConnectorBase.cjs');
41
42
  var types = require('./WalletConnectorBase/types.cjs');
@@ -77,6 +78,7 @@ exports.isSendBalanceWalletConnector = isSendBalanceWalletConnector.isSendBalanc
77
78
  exports.isSessionKeyCompatibleWallet = isSessionKeyCompatibleWallet.isSessionKeyCompatibleWallet;
78
79
  exports.isSessionKeyCompatibleWalletConnector = isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector;
79
80
  exports.getMobileExperience = getMobileExperience.getMobileExperience;
81
+ exports.getWalletMetadataFromWalletBook = getWalletMetadataFromWalletBook.getWalletMetadataFromWalletBook;
80
82
  exports.Wallet = Wallet.Wallet;
81
83
  exports.WalletConnectorBase = WalletConnectorBase.WalletConnectorBase;
82
84
  exports.Chains = types.Chains;
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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
3
  export type { AccountChangeEventHandler, ChainChangeEventHandler, DisconnectEventHandler, WalletConnectorCore, WalletMetadata, } 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, logger, performPlatformSpecificConnectionMethod, ProviderLookup, setChainInfoOverrides, shouldLowercaseAddress, utf8ToHex, type ChainDisplayOverrides, type DeepLinkVariant, type ProviderCondition, } from './utils';
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, getWalletMetadataFromWalletBook, 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';
package/src/index.js CHANGED
@@ -32,6 +32,7 @@ export { isSendBalanceWalletConnector } from './utils/isSendBalanceWalletConnect
32
32
  export { isSessionKeyCompatibleWallet } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWallet/isSessionKeyCompatibleWallet.js';
33
33
  export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
34
34
  export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';
35
+ export { getWalletMetadataFromWalletBook } from './utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js';
35
36
  export { Wallet } from './Wallet/Wallet.js';
36
37
  export { WalletConnectorBase } from './WalletConnectorBase/WalletConnectorBase.js';
37
38
  export { Chains, socialProviders } from './WalletConnectorBase/types.js';
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const getDeepLinks = (mobile) => {
7
+ if (!mobile) {
8
+ return;
9
+ }
10
+ return {
11
+ native: mobile.native,
12
+ universal: mobile.universal,
13
+ };
14
+ };
15
+
16
+ exports.getDeepLinks = getDeepLinks;
@@ -0,0 +1,3 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { WalletDeepLinks } from '../../../types';
3
+ export declare const getDeepLinks: (mobile?: WalletSchema['mobile']) => WalletDeepLinks | undefined;
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ const getDeepLinks = (mobile) => {
3
+ if (!mobile) {
4
+ return;
5
+ }
6
+ return {
7
+ native: mobile.native,
8
+ universal: mobile.universal,
9
+ };
10
+ };
11
+
12
+ export { getDeepLinks };
@@ -0,0 +1 @@
1
+ export * from './getDeepLinks';
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const getMobileDownloadLinks = (mobile) => {
7
+ if (!mobile) {
8
+ return;
9
+ }
10
+ return {
11
+ androidId: mobile.androidId,
12
+ iosId: mobile.iosId,
13
+ };
14
+ };
15
+ const getDesktopDownloadLinks = (desktop) => {
16
+ if (!desktop) {
17
+ return;
18
+ }
19
+ return {
20
+ chromeId: desktop.chromeId,
21
+ edgeId: desktop.edgeId,
22
+ firefoxId: desktop.firefoxId,
23
+ operaId: desktop.operaId,
24
+ safariId: desktop.safariId,
25
+ };
26
+ };
27
+ const getDownloadLinks = (wallet) => {
28
+ const mobileLinks = getMobileDownloadLinks(wallet.mobile);
29
+ const desktopLinks = getDesktopDownloadLinks(wallet.desktop);
30
+ if (!mobileLinks && !desktopLinks) {
31
+ return;
32
+ }
33
+ return Object.assign(Object.assign({}, mobileLinks), desktopLinks);
34
+ };
35
+
36
+ exports.getDownloadLinks = getDownloadLinks;
@@ -0,0 +1,3 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { WalletDownloadLinks } from '../../../types';
3
+ export declare const getDownloadLinks: (wallet: WalletSchema) => WalletDownloadLinks | undefined;
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ const getMobileDownloadLinks = (mobile) => {
3
+ if (!mobile) {
4
+ return;
5
+ }
6
+ return {
7
+ androidId: mobile.androidId,
8
+ iosId: mobile.iosId,
9
+ };
10
+ };
11
+ const getDesktopDownloadLinks = (desktop) => {
12
+ if (!desktop) {
13
+ return;
14
+ }
15
+ return {
16
+ chromeId: desktop.chromeId,
17
+ edgeId: desktop.edgeId,
18
+ firefoxId: desktop.firefoxId,
19
+ operaId: desktop.operaId,
20
+ safariId: desktop.safariId,
21
+ };
22
+ };
23
+ const getDownloadLinks = (wallet) => {
24
+ const mobileLinks = getMobileDownloadLinks(wallet.mobile);
25
+ const desktopLinks = getDesktopDownloadLinks(wallet.desktop);
26
+ if (!mobileLinks && !desktopLinks) {
27
+ return;
28
+ }
29
+ return Object.assign(Object.assign({}, mobileLinks), desktopLinks);
30
+ };
31
+
32
+ export { getDownloadLinks };
@@ -0,0 +1 @@
1
+ export * from './getDownloadLinks';
@@ -0,0 +1,15 @@
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 getIconUrl = (spriteId) => {
9
+ if (!spriteId) {
10
+ return walletBook.renderTemplate('iconicUrl', 'defaultwallet');
11
+ }
12
+ return walletBook.renderTemplate('iconicUrl', spriteId);
13
+ };
14
+
15
+ exports.getIconUrl = getIconUrl;
@@ -0,0 +1 @@
1
+ export declare const getIconUrl: (spriteId?: string) => string | undefined;
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import { renderTemplate } from '@dynamic-labs/wallet-book';
3
+
4
+ const getIconUrl = (spriteId) => {
5
+ if (!spriteId) {
6
+ return renderTemplate('iconicUrl', 'defaultwallet');
7
+ }
8
+ return renderTemplate('iconicUrl', spriteId);
9
+ };
10
+
11
+ export { getIconUrl };
@@ -0,0 +1 @@
1
+ export * from './getIconUrl';
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const getValidHexColor = (color) => {
7
+ if (!color) {
8
+ return;
9
+ }
10
+ // Check if string starts with # and is followed by either 3 or 6 valid hex characters
11
+ const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
12
+ return hexColorRegex.test(color) ? color : undefined;
13
+ };
14
+
15
+ exports.getValidHexColor = getValidHexColor;
@@ -0,0 +1 @@
1
+ export declare const getValidHexColor: (color?: string) => `#${string}` | undefined;
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ const getValidHexColor = (color) => {
3
+ if (!color) {
4
+ return;
5
+ }
6
+ // Check if string starts with # and is followed by either 3 or 6 valid hex characters
7
+ const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
8
+ return hexColorRegex.test(color) ? color : undefined;
9
+ };
10
+
11
+ export { getValidHexColor };
@@ -0,0 +1 @@
1
+ export * from './getValidHexColor';
@@ -0,0 +1,19 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const getWalletLimitations = (walletLimitations) => {
7
+ if (!(walletLimitations === null || walletLimitations === void 0 ? void 0 : walletLimitations.browserExtension)) {
8
+ return;
9
+ }
10
+ const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
11
+ return {
12
+ browserExtension: {
13
+ unsupportedEvents: unsupportedEvents,
14
+ unsupportedMethods: unsupportedMethods,
15
+ },
16
+ };
17
+ };
18
+
19
+ exports.getWalletLimitations = getWalletLimitations;
@@ -0,0 +1,3 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { WalletLimitations } from '../../../types';
3
+ export declare const getWalletLimitations: (walletLimitations: WalletSchema['walletLimitations']) => WalletLimitations | undefined;
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ const getWalletLimitations = (walletLimitations) => {
3
+ if (!(walletLimitations === null || walletLimitations === void 0 ? void 0 : walletLimitations.browserExtension)) {
4
+ return;
5
+ }
6
+ const { unsupportedEvents, unsupportedMethods } = walletLimitations.browserExtension;
7
+ return {
8
+ browserExtension: {
9
+ unsupportedEvents: unsupportedEvents,
10
+ unsupportedMethods: unsupportedMethods,
11
+ },
12
+ };
13
+ };
14
+
15
+ export { getWalletLimitations };
@@ -0,0 +1 @@
1
+ export * from './getWalletLimitations';
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletBook = require('@dynamic-labs/wallet-book');
7
+ var getIconUrl = require('./getIconUrl/getIconUrl.cjs');
8
+ var getValidHexColor = require('./getValidHexColor/getValidHexColor.cjs');
9
+ var getDeepLinks = require('./getDeepLinks/getDeepLinks.cjs');
10
+ var getDownloadLinks = require('./getDownloadLinks/getDownloadLinks.cjs');
11
+ var getWalletLimitations = require('./getWalletLimitations/getWalletLimitations.cjs');
12
+
13
+ const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook: walletBook$1, walletFallback, }) => {
14
+ var _a, _b, _c, _d, _e;
15
+ if (!walletBook$1 && !walletFallback) {
16
+ throw new Error('Wallet book is required');
17
+ }
18
+ const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : walletBook.getWalletBookWallet(walletBook$1, walletKey, walletFallback);
19
+ // if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
20
+ if (!wallet) {
21
+ throw new Error('Wallet not found in wallet book');
22
+ }
23
+ return {
24
+ brandColor: getValidHexColor.getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
25
+ deepLinks: getDeepLinks.getDeepLinks(wallet === null || wallet === void 0 ? void 0 : wallet.mobile),
26
+ downloadLinks: getDownloadLinks.getDownloadLinks(wallet),
27
+ 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,
28
+ 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 : '',
29
+ id: walletKey,
30
+ name: wallet.name,
31
+ rdns: (_e = wallet.eip6963Config) === null || _e === void 0 ? void 0 : _e.rdns,
32
+ walletLimitations: getWalletLimitations.getWalletLimitations(wallet.walletLimitations),
33
+ };
34
+ };
35
+
36
+ exports.getWalletMetadataFromWalletBook = getWalletMetadataFromWalletBook;
@@ -0,0 +1,10 @@
1
+ import { WalletBookSchema, WalletSchema } from '@dynamic-labs/wallet-book';
2
+ import { WalletMetadata } from '../../types';
3
+ type GetWalletMetadataFromWalletBookOpts = {
4
+ walletKey: string;
5
+ walletBookWallet?: WalletSchema;
6
+ walletBook?: WalletBookSchema;
7
+ walletFallback?: WalletSchema;
8
+ };
9
+ export declare const getWalletMetadataFromWalletBook: ({ walletKey, walletBookWallet, walletBook, walletFallback, }: GetWalletMetadataFromWalletBookOpts) => WalletMetadata;
10
+ export {};
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
3
+ import { getIconUrl } from './getIconUrl/getIconUrl.js';
4
+ import { getValidHexColor } from './getValidHexColor/getValidHexColor.js';
5
+ import { getDeepLinks } from './getDeepLinks/getDeepLinks.js';
6
+ import { getDownloadLinks } from './getDownloadLinks/getDownloadLinks.js';
7
+ import { getWalletLimitations } from './getWalletLimitations/getWalletLimitations.js';
8
+
9
+ const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook, walletFallback, }) => {
10
+ var _a, _b, _c, _d, _e;
11
+ if (!walletBook && !walletFallback) {
12
+ throw new Error('Wallet book is required');
13
+ }
14
+ const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : getWalletBookWallet(walletBook, walletKey, walletFallback);
15
+ // if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
16
+ if (!wallet) {
17
+ throw new Error('Wallet not found in wallet book');
18
+ }
19
+ return {
20
+ brandColor: getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
21
+ deepLinks: getDeepLinks(wallet === null || wallet === void 0 ? void 0 : wallet.mobile),
22
+ downloadLinks: getDownloadLinks(wallet),
23
+ 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,
24
+ 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 : '',
25
+ id: walletKey,
26
+ name: wallet.name,
27
+ rdns: (_e = wallet.eip6963Config) === null || _e === void 0 ? void 0 : _e.rdns,
28
+ walletLimitations: getWalletLimitations(wallet.walletLimitations),
29
+ };
30
+ };
31
+
32
+ export { getWalletMetadataFromWalletBook };
@@ -0,0 +1 @@
1
+ export * from './getWalletMetadataFromWalletBook';
@@ -26,3 +26,4 @@ export * from './isWalletConnectConnector';
26
26
  export * from './isSendBalanceWalletConnector';
27
27
  export * from './isSessionKeyCompatible';
28
28
  export * from './getMobileExperience';
29
+ export * from './getWalletMetadataFromWalletBook';