@dynamic-labs/sdk-react-core 4.19.7 → 4.20.1

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,28 @@
1
1
 
2
+ ### [4.20.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.0...v4.20.1) (2025-06-09)
3
+
4
+
5
+ ### Features
6
+
7
+ * **global-wallet:** new createKernelClient method to native api ([#8883](https://github.com/dynamic-labs/dynamic-auth/issues/8883)) ([005b34c](https://github.com/dynamic-labs/dynamic-auth/commit/005b34c230ceb5e945547e129231c108a6cec444))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * default embedded wallet chain enum ([#8917](https://github.com/dynamic-labs/dynamic-auth/issues/8917)) ([e9fd715](https://github.com/dynamic-labs/dynamic-auth/commit/e9fd715506598bfabbc71454421885d05a06a3ec))
13
+
14
+ ## [4.20.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.7...v4.20.0) (2025-06-09)
15
+
16
+
17
+ ### Features
18
+
19
+ * encapsulate waas connectors within main connectors ([#8878](https://github.com/dynamic-labs/dynamic-auth/issues/8878)) ([fd1b6ab](https://github.com/dynamic-labs/dynamic-auth/commit/fd1b6ab037ff7ce5c66b30d9611689e8cc03b97b))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * hide duplicate social connection logo on global wallets ([#8903](https://github.com/dynamic-labs/dynamic-auth/issues/8903)) ([c2f86e7](https://github.com/dynamic-labs/dynamic-auth/commit/c2f86e7aae91764b174abaa18439ffbdf7287475))
25
+
2
26
  ### [4.19.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.6...v4.19.7) (2025-06-06)
3
27
 
4
28
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.19.7";
6
+ var version = "4.20.1";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.681",
9
9
  "@dynamic-labs-sdk/client": "0.0.1-alpha.5",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.19.7";
2
+ var version = "4.20.1";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.681",
5
5
  "@dynamic-labs-sdk/client": "0.0.1-alpha.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.19.7",
3
+ "version": "4.20.1",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.681",
6
6
  "@dynamic-labs-sdk/client": "0.0.1-alpha.5",
@@ -15,16 +15,16 @@
15
15
  "yup": "0.32.11",
16
16
  "react-international-phone": "4.2.5",
17
17
  "bs58": "5.0.0",
18
- "@dynamic-labs/assert-package-version": "4.19.7",
19
- "@dynamic-labs/iconic": "4.19.7",
20
- "@dynamic-labs/logger": "4.19.7",
21
- "@dynamic-labs/multi-wallet": "4.19.7",
22
- "@dynamic-labs/rpc-providers": "4.19.7",
23
- "@dynamic-labs/store": "4.19.7",
24
- "@dynamic-labs/types": "4.19.7",
25
- "@dynamic-labs/utils": "4.19.7",
26
- "@dynamic-labs/wallet-book": "4.19.7",
27
- "@dynamic-labs/wallet-connector-core": "4.19.7",
18
+ "@dynamic-labs/assert-package-version": "4.20.1",
19
+ "@dynamic-labs/iconic": "4.20.1",
20
+ "@dynamic-labs/logger": "4.20.1",
21
+ "@dynamic-labs/multi-wallet": "4.20.1",
22
+ "@dynamic-labs/rpc-providers": "4.20.1",
23
+ "@dynamic-labs/store": "4.20.1",
24
+ "@dynamic-labs/types": "4.20.1",
25
+ "@dynamic-labs/utils": "4.20.1",
26
+ "@dynamic-labs/wallet-book": "4.20.1",
27
+ "@dynamic-labs/wallet-connector-core": "4.20.1",
28
28
  "eventemitter3": "5.0.1"
29
29
  },
30
30
  "devDependencies": {
@@ -20,7 +20,15 @@ const getSessionInformationExpiration = (session) => {
20
20
  };
21
21
  /** Returns the spending limit of the session in ETH */
22
22
  const getSessionInformationSpendingLimit = (session) => {
23
- const { limit } = session.session.feeLimit;
23
+ var _a, _b;
24
+ const policies = session.session.transferPolicies;
25
+ if (!policies) {
26
+ return '0 ETH';
27
+ }
28
+ let limit = BigInt(0);
29
+ for (const policy of policies) {
30
+ limit += (_b = (_a = policy.valueLimit) === null || _a === void 0 ? void 0 : _a.limit) !== null && _b !== void 0 ? _b : BigInt(0);
31
+ }
24
32
  const formatter = new Intl.NumberFormat(undefined, {
25
33
  maximumFractionDigits: 6,
26
34
  });
@@ -7,5 +7,7 @@ export declare const getSessionInformationTimeSinceCreation: (session: SessionIn
7
7
  export declare const getSessionInformationExpiration: (session: SessionInformation) => string;
8
8
  /** Returns the spending limit of the session in ETH */
9
9
  export declare const getSessionInformationSpendingLimit: (session: SessionInformation) => string;
10
+ /** Returns the fee limit of the session in ETH */
11
+ export declare const getSessionInformationFeeLimit: (session: SessionInformation) => string;
10
12
  /** Exports the session information as a JSON string with a helper to process bigints */
11
13
  export declare const getSessionInformationJson: (session: SessionInformation) => string;
@@ -16,7 +16,15 @@ const getSessionInformationExpiration = (session) => {
16
16
  };
17
17
  /** Returns the spending limit of the session in ETH */
18
18
  const getSessionInformationSpendingLimit = (session) => {
19
- const { limit } = session.session.feeLimit;
19
+ var _a, _b;
20
+ const policies = session.session.transferPolicies;
21
+ if (!policies) {
22
+ return '0 ETH';
23
+ }
24
+ let limit = BigInt(0);
25
+ for (const policy of policies) {
26
+ limit += (_b = (_a = policy.valueLimit) === null || _a === void 0 ? void 0 : _a.limit) !== null && _b !== void 0 ? _b : BigInt(0);
27
+ }
20
28
  const formatter = new Intl.NumberFormat(undefined, {
21
29
  maximumFractionDigits: 6,
22
30
  });
@@ -102,6 +102,13 @@ require('../../../store/state/tokenBalances.cjs');
102
102
  require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
103
103
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
104
104
 
105
+ const getEmbeddedChain = (chainName) => {
106
+ if (chainName === 'SOL')
107
+ return sdkApiCore.EmbeddedWalletChainEnum.Sol;
108
+ if (chainName === 'BTC')
109
+ return sdkApiCore.EmbeddedWalletChainEnum.Btc;
110
+ return sdkApiCore.EmbeddedWalletChainEnum.Evm;
111
+ };
105
112
  // This hook needs to be async that's why it's not using useMutation
106
113
  const useCreateDynamicEmbeddedWalletMutation = () => {
107
114
  var _a, _b;
@@ -116,9 +123,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
116
123
  const primaryEmbeddedChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
117
124
  const embeddedChains = embeddedChainConfig
118
125
  .filter((chain) => chain.enabled)
119
- .map((c) => c.name === 'SOL'
120
- ? sdkApiCore.EmbeddedWalletChainEnum.Sol
121
- : sdkApiCore.EmbeddedWalletChainEnum.Evm);
126
+ .map((c) => getEmbeddedChain(c.name));
122
127
  const createDynamicEmbeddedWalletMutation = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
123
128
  var _d, _e;
124
129
  setIsLoading(true);
@@ -190,4 +195,5 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
190
195
  };
191
196
  };
192
197
 
198
+ exports.getEmbeddedChain = getEmbeddedChain;
193
199
  exports.useCreateDynamicEmbeddedWalletMutation = useCreateDynamicEmbeddedWalletMutation;
@@ -10,6 +10,7 @@ type MutationProps = {
10
10
  };
11
11
  chains?: EmbeddedWalletChainEnum[];
12
12
  };
13
+ export declare const getEmbeddedChain: (chainName: string) => EmbeddedWalletChainEnum.Evm | EmbeddedWalletChainEnum.Sol | EmbeddedWalletChainEnum.Btc;
13
14
  export declare const useCreateDynamicEmbeddedWalletMutation: () => {
14
15
  createDynamicEmbeddedWalletMutation: ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }: MutationProps) => Promise<void>;
15
16
  error: unknown;
@@ -98,6 +98,13 @@ import '../../../store/state/tokenBalances.js';
98
98
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
99
99
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
100
100
 
101
+ const getEmbeddedChain = (chainName) => {
102
+ if (chainName === 'SOL')
103
+ return EmbeddedWalletChainEnum.Sol;
104
+ if (chainName === 'BTC')
105
+ return EmbeddedWalletChainEnum.Btc;
106
+ return EmbeddedWalletChainEnum.Evm;
107
+ };
101
108
  // This hook needs to be async that's why it's not using useMutation
102
109
  const useCreateDynamicEmbeddedWalletMutation = () => {
103
110
  var _a, _b;
@@ -112,9 +119,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
112
119
  const primaryEmbeddedChain = findPrimaryEmbeddedChain(projectSettings);
113
120
  const embeddedChains = embeddedChainConfig
114
121
  .filter((chain) => chain.enabled)
115
- .map((c) => c.name === 'SOL'
116
- ? EmbeddedWalletChainEnum.Sol
117
- : EmbeddedWalletChainEnum.Evm);
122
+ .map((c) => getEmbeddedChain(c.name));
118
123
  const createDynamicEmbeddedWalletMutation = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
119
124
  var _d, _e;
120
125
  setIsLoading(true);
@@ -186,4 +191,4 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
186
191
  };
187
192
  };
188
193
 
189
- export { useCreateDynamicEmbeddedWalletMutation };
194
+ export { getEmbeddedChain, useCreateDynamicEmbeddedWalletMutation };
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
7
7
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
8
+ const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
8
9
 
9
10
  exports.DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR;
11
+ exports.INVALID_CHAINS_ERROR = INVALID_CHAINS_ERROR;
10
12
  exports.NO_ENABLED_CHAINS_ERROR = NO_ENABLED_CHAINS_ERROR;
@@ -1,2 +1,3 @@
1
1
  export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chains";
2
2
  export declare const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = "Dynamic Waas connector not found";
3
+ export declare const INVALID_CHAINS_ERROR = "The following chains are not enabled for embedded wallets";
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
3
3
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
4
+ const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
4
5
 
5
- export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR };
6
+ export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, INVALID_CHAINS_ERROR, NO_ENABLED_CHAINS_ERROR };
@@ -160,11 +160,16 @@ const useDynamicWaas = () => {
160
160
  apiBaseUrl,
161
161
  isCookieAuthEnabled,
162
162
  ]);
163
- const createWalletAccount = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
163
+ const createWalletAccount = React.useCallback((chainNames) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
164
164
  if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
165
165
  throw new utils.DynamicError(constants.NO_ENABLED_CHAINS_ERROR);
166
166
  }
167
- const createdWalletAccounts = yield Promise.all(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.map((chain) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
167
+ const invalidChains = chainNames === null || chainNames === void 0 ? void 0 : chainNames.filter((chain) => !enabledChainNames.includes(chain));
168
+ if (invalidChains && invalidChains.length) {
169
+ throw new utils.DynamicError(`${constants.INVALID_CHAINS_ERROR}: ${invalidChains.join(', ')}`);
170
+ }
171
+ const chainsToCreate = chainNames ? chainNames : enabledChainNames;
172
+ const createdWalletAccounts = yield Promise.all(chainsToCreate === null || chainsToCreate === void 0 ? void 0 : chainsToCreate.map((chain) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
168
173
  const walletConnector = getWalletConnector(chain);
169
174
  if (!walletConnector)
170
175
  return undefined;
@@ -1,4 +1,5 @@
1
1
  import { IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
2
+ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
2
3
  export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, authToken, relayUrl, }: {
3
4
  walletConnector: IDynamicWaasConnector;
4
5
  environmentId: string;
@@ -7,7 +8,7 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
7
8
  relayUrl: string;
8
9
  }) => IDynamicWaasConnector;
9
10
  export declare const useDynamicWaas: () => {
10
- createWalletAccount: () => Promise<({
11
+ createWalletAccount: (chainNames?: ChainEnum[]) => Promise<({
11
12
  chainName: string;
12
13
  accountAddress: string;
13
14
  publicKeyHex: string;
@@ -17,7 +18,7 @@ export declare const useDynamicWaas: () => {
17
18
  getWaasWallets: () => import("@dynamic-labs/wallet-connector-core").Wallet<import("@dynamic-labs/wallet-connector-core").WalletConnectorCore.WalletConnector>[];
18
19
  getWalletConnector: (chainName: string) => IDynamicWaasConnector | undefined;
19
20
  importPrivateKey: ({ chainName, privateKey, }: {
20
- chainName: string;
21
+ chainName: ChainEnum;
21
22
  privateKey: string;
22
23
  }) => Promise<void>;
23
24
  shouldAutoCreateDynamicWaasWallet: boolean | undefined;
@@ -94,7 +94,7 @@ import '../../../context/OnrampContext/OnrampContext.js';
94
94
  import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
95
95
  import '../../../../index.js';
96
96
  import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
97
- import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR } from './constants.js';
97
+ import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR } from './constants.js';
98
98
  import '../../../store/state/tokenBalances.js';
99
99
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
100
100
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
@@ -156,11 +156,16 @@ const useDynamicWaas = () => {
156
156
  apiBaseUrl,
157
157
  isCookieAuthEnabled,
158
158
  ]);
159
- const createWalletAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
159
+ const createWalletAccount = useCallback((chainNames) => __awaiter(void 0, void 0, void 0, function* () {
160
160
  if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
161
161
  throw new DynamicError(NO_ENABLED_CHAINS_ERROR);
162
162
  }
163
- const createdWalletAccounts = yield Promise.all(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.map((chain) => __awaiter(void 0, void 0, void 0, function* () {
163
+ const invalidChains = chainNames === null || chainNames === void 0 ? void 0 : chainNames.filter((chain) => !enabledChainNames.includes(chain));
164
+ if (invalidChains && invalidChains.length) {
165
+ throw new DynamicError(`${INVALID_CHAINS_ERROR}: ${invalidChains.join(', ')}`);
166
+ }
167
+ const chainsToCreate = chainNames ? chainNames : enabledChainNames;
168
+ const createdWalletAccounts = yield Promise.all(chainsToCreate === null || chainsToCreate === void 0 ? void 0 : chainsToCreate.map((chain) => __awaiter(void 0, void 0, void 0, function* () {
164
169
  const walletConnector = getWalletConnector(chain);
165
170
  if (!walletConnector)
166
171
  return undefined;
@@ -11,7 +11,7 @@ export type SessionConfig = {
11
11
  expiresAt: bigint;
12
12
  feeLimit: Limit;
13
13
  callPolicies: unknown[];
14
- transferPolicies: unknown[];
14
+ transferPolicies: TransferPolicy[];
15
15
  };
16
16
  export type Limit = {
17
17
  limitType: LimitType;
@@ -23,3 +23,8 @@ export declare enum LimitType {
23
23
  Lifetime = 1,
24
24
  Allowance = 2
25
25
  }
26
+ export type TransferPolicy = {
27
+ target: string;
28
+ maxValuePerUse: bigint;
29
+ valueLimit: Limit;
30
+ };
@@ -0,0 +1,4 @@
1
+ import { ExchangeKeyEnum, ProviderEnum } from '@dynamic-labs/sdk-api-core';
2
+ export declare const convertExchangeKeytoProviderEnum: (exchangeKey: ExchangeKeyEnum) => ProviderEnum;
3
+ export declare const convertProviderToExchangeKeyEnum: (provider: ProviderEnum) => ExchangeKeyEnum;
4
+ export declare const isProviderExchange: (provider: ProviderEnum) => boolean;