@dynamic-labs/wallet-connector-core 4.0.0-alpha.29 → 4.0.0-alpha.30

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 CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ ## [4.0.0-alpha.30](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.29...v4.0.0-alpha.30) (2024-11-13)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * check wallet limitations from metadata (#7413)
8
+
9
+ ### Bug Fixes
10
+
11
+ * confirmation ui disabled for solana signall and signTransaction ([#7403](https://github.com/dynamic-labs/dynamic-auth/issues/7403)) ([98a352a](https://github.com/dynamic-labs/dynamic-auth/commit/98a352a826202abad734f00df1b3d19080ecf1e2))
12
+ * get starknet wallets directly from window ([#7421](https://github.com/dynamic-labs/dynamic-auth/issues/7421)) ([13e24f7](https://github.com/dynamic-labs/dynamic-auth/commit/13e24f70accf7747f5137fc3f2b05c00939c3af3))
13
+ * issue with SollanaWalletConnectorWithConfig embedded wallets ([#7405](https://github.com/dynamic-labs/dynamic-auth/issues/7405)) ([f08ecd6](https://github.com/dynamic-labs/dynamic-auth/commit/f08ecd6955faf191177bb9833b7a594637a6c4cc))
14
+ * set override key in starknet injected connector ([#7420](https://github.com/dynamic-labs/dynamic-auth/issues/7420)) ([74b2887](https://github.com/dynamic-labs/dynamic-auth/commit/74b28874661b3bad1e0a0f92aa9d3c987dc71225))
15
+
16
+
17
+ * check wallet limitations from metadata ([#7413](https://github.com/dynamic-labs/dynamic-auth/issues/7413)) ([a419de6](https://github.com/dynamic-labs/dynamic-auth/commit/a419de643ea4ff240a27825c10670ba92589b71b))
18
+
2
19
  ## [4.0.0-alpha.29](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.28...v4.0.0-alpha.29) (2024-11-07)
3
20
 
4
21
  ## [4.0.0-alpha.28](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.27...v4.0.0-alpha.28) (2024-11-07)
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.29";
6
+ var version = "4.0.0-alpha.30";
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.29";
2
+ var version = "4.0.0-alpha.30";
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.29",
3
+ "version": "4.0.0-alpha.30",
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.563"
22
22
  },
23
23
  "peerDependencies": {
24
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.29",
25
- "@dynamic-labs/logger": "4.0.0-alpha.29",
26
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.29",
27
- "@dynamic-labs/types": "4.0.0-alpha.29",
28
- "@dynamic-labs/utils": "4.0.0-alpha.29",
29
- "@dynamic-labs/wallet-book": "4.0.0-alpha.29",
24
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.30",
25
+ "@dynamic-labs/logger": "4.0.0-alpha.30",
26
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.30",
27
+ "@dynamic-labs/types": "4.0.0-alpha.30",
28
+ "@dynamic-labs/utils": "4.0.0-alpha.30",
29
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.30",
30
30
  "eventemitter3": "5.0.1"
31
31
  }
32
32
  }
package/src/index.cjs CHANGED
@@ -37,6 +37,8 @@ var isSessionKeyCompatibleWallet = require('./utils/isSessionKeyCompatible/isSes
37
37
  var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
38
38
  var getMobileExperience = require('./utils/getMobileExperience/getMobileExperience.cjs');
39
39
  var getWalletMetadataFromWalletBook = require('./utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.cjs');
40
+ var isConnectorMethodSupported = require('./utils/isConnectorMethodSupported/isConnectorMethodSupported.cjs');
41
+ var isConnectorEventSupported = require('./utils/isConnectorEventSupported/isConnectorEventSupported.cjs');
40
42
  var Wallet = require('./Wallet/Wallet.cjs');
41
43
  var WalletConnectorBase = require('./WalletConnectorBase/WalletConnectorBase.cjs');
42
44
  var types = require('./WalletConnectorBase/types.cjs');
@@ -79,6 +81,8 @@ exports.isSessionKeyCompatibleWallet = isSessionKeyCompatibleWallet.isSessionKey
79
81
  exports.isSessionKeyCompatibleWalletConnector = isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector;
80
82
  exports.getMobileExperience = getMobileExperience.getMobileExperience;
81
83
  exports.getWalletMetadataFromWalletBook = getWalletMetadataFromWalletBook.getWalletMetadataFromWalletBook;
84
+ exports.isConnectorMethodSupported = isConnectorMethodSupported.isConnectorMethodSupported;
85
+ exports.isConnectorEventSupported = isConnectorEventSupported.isConnectorEventSupported;
82
86
  exports.Wallet = Wallet.Wallet;
83
87
  exports.WalletConnectorBase = WalletConnectorBase.WalletConnectorBase;
84
88
  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
- 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, 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, } 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';
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
@@ -33,6 +33,8 @@ export { isSessionKeyCompatibleWallet } from './utils/isSessionKeyCompatible/isS
33
33
  export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatible/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
34
34
  export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';
35
35
  export { getWalletMetadataFromWalletBook } from './utils/getWalletMetadataFromWalletBook/getWalletMetadataFromWalletBook.js';
36
+ export { isConnectorMethodSupported } from './utils/isConnectorMethodSupported/isConnectorMethodSupported.js';
37
+ export { isConnectorEventSupported } from './utils/isConnectorEventSupported/isConnectorEventSupported.js';
36
38
  export { Wallet } from './Wallet/Wallet.js';
37
39
  export { WalletConnectorBase } from './WalletConnectorBase/WalletConnectorBase.js';
38
40
  export { Chains, socialProviders } from './WalletConnectorBase/types.js';
package/src/types.d.ts CHANGED
@@ -10,6 +10,10 @@ export type WalletLimitations = {
10
10
  unsupportedEvents?: WalletEvent[];
11
11
  unsupportedMethods?: WalletMethod[];
12
12
  };
13
+ mobile?: {
14
+ unsupportedEvents?: WalletEvent[];
15
+ unsupportedMethods?: WalletMethod[];
16
+ };
13
17
  };
14
18
  export type WalletDownloadLinks = {
15
19
  chromeId?: string;
@@ -4,6 +4,9 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var walletBook = require('@dynamic-labs/wallet-book');
7
+ var logger = require('../logger.cjs');
8
+ require('@dynamic-labs/utils');
9
+ require('../../../_virtual/_tslib.cjs');
7
10
  var getIconUrl = require('./getIconUrl/getIconUrl.cjs');
8
11
  var getValidHexColor = require('./getValidHexColor/getValidHexColor.cjs');
9
12
  var getDeepLinks = require('./getDeepLinks/getDeepLinks.cjs');
@@ -13,12 +16,14 @@ var getWalletLimitations = require('./getWalletLimitations/getWalletLimitations.
13
16
  const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook: walletBook$1, walletFallback, }) => {
14
17
  var _a, _b, _c, _d, _e, _f, _g;
15
18
  if (!walletBook$1 && !walletFallback) {
16
- throw new Error('Wallet book is required');
19
+ logger.logger.warn('Wallet book is required');
20
+ return;
17
21
  }
18
22
  const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : walletBook.getWalletBookWallet(walletBook$1, walletKey, walletFallback);
19
23
  // if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
20
24
  if (!wallet) {
21
- throw new Error('Wallet not found in wallet book');
25
+ logger.logger.warn('Wallet not found in wallet book');
26
+ return;
22
27
  }
23
28
  return {
24
29
  brandColor: getValidHexColor.getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
@@ -6,5 +6,5 @@ type GetWalletMetadataFromWalletBookOpts = {
6
6
  walletBook?: WalletBookSchema;
7
7
  walletFallback?: WalletSchema;
8
8
  };
9
- export declare const getWalletMetadataFromWalletBook: ({ walletKey, walletBookWallet, walletBook, walletFallback, }: GetWalletMetadataFromWalletBookOpts) => WalletMetadata;
9
+ export declare const getWalletMetadataFromWalletBook: ({ walletKey, walletBookWallet, walletBook, walletFallback, }: GetWalletMetadataFromWalletBookOpts) => WalletMetadata | undefined;
10
10
  export {};
@@ -1,5 +1,8 @@
1
1
  'use client'
2
2
  import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
3
+ import { logger } from '../logger.js';
4
+ import '@dynamic-labs/utils';
5
+ import '../../../_virtual/_tslib.js';
3
6
  import { getIconUrl } from './getIconUrl/getIconUrl.js';
4
7
  import { getValidHexColor } from './getValidHexColor/getValidHexColor.js';
5
8
  import { getDeepLinks } from './getDeepLinks/getDeepLinks.js';
@@ -9,12 +12,14 @@ import { getWalletLimitations } from './getWalletLimitations/getWalletLimitation
9
12
  const getWalletMetadataFromWalletBook = ({ walletKey, walletBookWallet, walletBook, walletFallback, }) => {
10
13
  var _a, _b, _c, _d, _e, _f, _g;
11
14
  if (!walletBook && !walletFallback) {
12
- throw new Error('Wallet book is required');
15
+ logger.warn('Wallet book is required');
16
+ return;
13
17
  }
14
18
  const wallet = walletBookWallet !== null && walletBookWallet !== void 0 ? walletBookWallet : getWalletBookWallet(walletBook, walletKey, walletFallback);
15
19
  // if no walletBookWallet is provided and no wallet is found in the wallet book, throw an error
16
20
  if (!wallet) {
17
- throw new Error('Wallet not found in wallet book');
21
+ logger.warn('Wallet not found in wallet book');
22
+ return;
18
23
  }
19
24
  return {
20
25
  brandColor: getValidHexColor((_a = wallet === null || wallet === void 0 ? void 0 : wallet.brand) === null || _a === void 0 ? void 0 : _a.primaryColor),
@@ -27,3 +27,5 @@ export * from './isSendBalanceWalletConnector';
27
27
  export * from './isSessionKeyCompatible';
28
28
  export * from './getMobileExperience';
29
29
  export * from './getWalletMetadataFromWalletBook';
30
+ export * from './isConnectorMethodSupported';
31
+ export * from './isConnectorEventSupported';
@@ -0,0 +1 @@
1
+ export { isConnectorEventSupported } from './isConnectorEventSupported';
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isConnectorEventSupported = (connector, event, platform) => {
7
+ var _a, _b, _c;
8
+ return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedEvents) === null || _c === void 0 ? void 0 : _c.includes(event));
9
+ };
10
+
11
+ exports.isConnectorEventSupported = isConnectorEventSupported;
@@ -0,0 +1,3 @@
1
+ import { WalletLimitations, WalletEvent } from '../../types';
2
+ import { InternalWalletConnector } from '../../WalletConnectorBase';
3
+ export declare const isConnectorEventSupported: (connector: InternalWalletConnector, event: WalletEvent, platform: keyof NonNullable<WalletLimitations>) => boolean;
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ const isConnectorEventSupported = (connector, event, platform) => {
3
+ var _a, _b, _c;
4
+ return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedEvents) === null || _c === void 0 ? void 0 : _c.includes(event));
5
+ };
6
+
7
+ export { isConnectorEventSupported };
@@ -3,12 +3,9 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var walletBook = require('@dynamic-labs/wallet-book');
7
-
8
6
  const isConnectorMethodSupported = (connector, method, platform) => {
9
- const walletBookWallet = connector.constructorProps.walletData ||
10
- walletBook.getWalletBookWallet(connector.walletBook, connector.key);
11
- return walletBook.isWalletMethodSupported(walletBookWallet, method, platform);
7
+ var _a, _b, _c;
8
+ return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedMethods) === null || _c === void 0 ? void 0 : _c.includes(method));
12
9
  };
13
10
 
14
11
  exports.isConnectorMethodSupported = isConnectorMethodSupported;
@@ -1,3 +1,3 @@
1
- import { WalletSchema } from '@dynamic-labs/wallet-book';
2
1
  import { InternalWalletConnector } from '../..';
3
- export declare const isConnectorMethodSupported: (connector: InternalWalletConnector, method: string, platform: keyof NonNullable<WalletSchema['walletLimitations']>) => boolean;
2
+ import { WalletLimitations, WalletMethod } from '../../types';
3
+ export declare const isConnectorMethodSupported: (connector: InternalWalletConnector, method: WalletMethod, platform: keyof NonNullable<WalletLimitations>) => boolean;
@@ -1,10 +1,7 @@
1
1
  'use client'
2
- import { getWalletBookWallet, isWalletMethodSupported } from '@dynamic-labs/wallet-book';
3
-
4
2
  const isConnectorMethodSupported = (connector, method, platform) => {
5
- const walletBookWallet = connector.constructorProps.walletData ||
6
- getWalletBookWallet(connector.walletBook, connector.key);
7
- return isWalletMethodSupported(walletBookWallet, method, platform);
3
+ var _a, _b, _c;
4
+ return !((_c = (_b = (_a = connector.metadata.walletLimitations) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.unsupportedMethods) === null || _c === void 0 ? void 0 : _c.includes(method));
8
5
  };
9
6
 
10
7
  export { isConnectorMethodSupported };