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

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,16 @@
1
1
 
2
+ ## [4.20.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.7...v4.20.0) (2025-06-09)
3
+
4
+
5
+ ### Features
6
+
7
+ * 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))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * 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))
13
+
2
14
  ### [4.19.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.6...v4.19.7) (2025-06-06)
3
15
 
4
16
 
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.0";
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.0";
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.0",
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.0",
19
+ "@dynamic-labs/iconic": "4.20.0",
20
+ "@dynamic-labs/logger": "4.20.0",
21
+ "@dynamic-labs/multi-wallet": "4.20.0",
22
+ "@dynamic-labs/rpc-providers": "4.20.0",
23
+ "@dynamic-labs/store": "4.20.0",
24
+ "@dynamic-labs/types": "4.20.0",
25
+ "@dynamic-labs/utils": "4.20.0",
26
+ "@dynamic-labs/wallet-book": "4.20.0",
27
+ "@dynamic-labs/wallet-connector-core": "4.20.0",
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
  });
@@ -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
+ };