@dynamic-labs/sdk-react-core 4.84.1 → 4.85.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +14 -14
  5. package/src/index.d.ts +1 -1
  6. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +5 -1
  7. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +5 -1
  8. package/src/lib/context/OnrampContext/utils/getOnrampProviders.cjs +2 -6
  9. package/src/lib/context/OnrampContext/utils/getOnrampProviders.js +4 -8
  10. package/src/lib/data/api/onramp/onramp.cjs +26 -1
  11. package/src/lib/data/api/onramp/onramp.d.ts +11 -1
  12. package/src/lib/data/api/onramp/onramp.js +26 -1
  13. package/src/lib/utils/functions/onrampProviders/index.cjs +1 -0
  14. package/src/lib/utils/functions/onrampProviders/index.js +1 -0
  15. package/src/lib/utils/hooks/index.d.ts +1 -1
  16. package/src/lib/utils/hooks/useAleoShieldedBalances/useAleoShieldedBalances.cjs +81 -10
  17. package/src/lib/utils/hooks/useAleoShieldedBalances/useAleoShieldedBalances.d.ts +18 -2
  18. package/src/lib/utils/hooks/useAleoShieldedBalances/useAleoShieldedBalances.js +82 -11
  19. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +4 -4
  20. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +4 -4
  21. package/src/lib/utils/hooks/usePrivateTokenBalances/index.d.ts +1 -1
  22. package/src/lib/utils/hooks/usePrivateTokenBalances/usePrivateTokenBalances.cjs +10 -2
  23. package/src/lib/utils/hooks/usePrivateTokenBalances/usePrivateTokenBalances.d.ts +17 -2
  24. package/src/lib/utils/hooks/usePrivateTokenBalances/usePrivateTokenBalances.js +10 -2
  25. package/src/lib/utils/hooks/useSyncDynamicWaas/instrumentWalletCreation.cjs +60 -0
  26. package/src/lib/utils/hooks/useSyncDynamicWaas/instrumentWalletCreation.d.ts +29 -0
  27. package/src/lib/utils/hooks/useSyncDynamicWaas/instrumentWalletCreation.js +55 -0
  28. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +14 -24
  29. package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +14 -24
  30. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +17 -1
  31. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +17 -1
  32. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/optimisticShield.cjs +28 -12
  33. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/optimisticShield.d.ts +8 -3
  34. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/optimisticShield.js +28 -12
package/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ ## [4.85.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.84.1...v4.85.0) (2026-05-29)
3
+
4
+
5
+ ### Features
6
+
7
+ * **moonpay:** add getMoonPayCurrencies API, MOONPAY_PROVIDER_ID, and chain enum fix ([#11362](https://github.com/dynamic-labs/dynamic-auth/issues/11362)) ([8f1c841](https://github.com/dynamic-labs/dynamic-auth/commit/8f1c841dcab3249e82a7152be373c0e0204a2f47))
8
+ * **sdk-react-core:** extend usePrivateTokenBalances with `accountAddress`, `tokenAddresses`, `includeNativeBalance`, `includeFiat` ([#11380](https://github.com/dynamic-labs/dynamic-auth/issues/11380)) ([ccb6d47](https://github.com/dynamic-labs/dynamic-auth/commit/ccb6d47b4683a12a13aaf8311ecffae3d46464a3))
9
+ * **sdk-react-core:** forward `chainName` + `networkId` through `usePrivateTokenBalances` ([#11383](https://github.com/dynamic-labs/dynamic-auth/issues/11383)) ([c2ad110](https://github.com/dynamic-labs/dynamic-auth/commit/c2ad1103d4d4fdba67fc9b50b60945a843adae99))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **aleo:** drop optimistically deducted unshielded rows when balance hits zero ([#11371](https://github.com/dynamic-labs/dynamic-auth/issues/11371)) ([a3bb8e8](https://github.com/dynamic-labs/dynamic-auth/commit/a3bb8e8fa7e877340c829c991ba31eeb8fa4fcf1)), closes [#11337](https://github.com/dynamic-labs/dynamic-auth/issues/11337)
15
+ * **aleo:** re-read gas sponsored flag after async fetchFee resolves ([#11375](https://github.com/dynamic-labs/dynamic-auth/issues/11375)) ([d27e74a](https://github.com/dynamic-labs/dynamic-auth/commit/d27e74a309aff18eb6b18046fe34e9e64363d331))
16
+ * remediate high-severity dependency vulnerabilities ([#11339](https://github.com/dynamic-labs/dynamic-auth/issues/11339)) ([f025b30](https://github.com/dynamic-labs/dynamic-auth/commit/f025b308e29153de49c88d91233139bb00caaf4e))
17
+ * **waas:** guard upgradeToDynamicWaas on the wallet arg, not primaryWallet ([#11324](https://github.com/dynamic-labs/dynamic-auth/issues/11324)) ([3e95eaf](https://github.com/dynamic-labs/dynamic-auth/commit/3e95eaf50afd2f49ff1cc416e5bf211ee04fbb23))
18
+
2
19
  ### [4.84.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.84.0...v4.84.1) (2026-05-28)
3
20
 
4
21
 
package/package.cjs CHANGED
@@ -3,12 +3,12 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.84.1";
6
+ var version = "4.85.0";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.985",
9
9
  "@dynamic-labs-sdk/client": "1.1.0",
10
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.351",
11
- "@dynamic-labs-wallet/forward-mpc-client": "0.9.0",
10
+ "@dynamic-labs-wallet/browser-wallet-client": "1.0.7",
11
+ "@dynamic-labs-wallet/forward-mpc-client": "0.10.1",
12
12
  "@hcaptcha/react-hcaptcha": "1.4.4",
13
13
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
14
14
  "country-list": "2.3.0",
package/package.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use client'
2
- var version = "4.84.1";
2
+ var version = "4.85.0";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.985",
5
5
  "@dynamic-labs-sdk/client": "1.1.0",
6
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.351",
7
- "@dynamic-labs-wallet/forward-mpc-client": "0.9.0",
6
+ "@dynamic-labs-wallet/browser-wallet-client": "1.0.7",
7
+ "@dynamic-labs-wallet/forward-mpc-client": "0.10.1",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
9
9
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
10
10
  "country-list": "2.3.0",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.84.1",
3
+ "version": "4.85.0",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.985",
6
6
  "@dynamic-labs-sdk/client": "1.1.0",
7
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.351",
8
- "@dynamic-labs-wallet/forward-mpc-client": "0.9.0",
7
+ "@dynamic-labs-wallet/browser-wallet-client": "1.0.7",
8
+ "@dynamic-labs-wallet/forward-mpc-client": "0.10.1",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
10
10
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
11
11
  "country-list": "2.3.0",
@@ -17,17 +17,17 @@
17
17
  "yup": "0.32.11",
18
18
  "react-international-phone": "4.5.0",
19
19
  "bs58": "5.0.0",
20
- "@dynamic-labs/assert-package-version": "4.84.1",
21
- "@dynamic-labs/iconic": "4.84.1",
22
- "@dynamic-labs/locale": "4.84.1",
23
- "@dynamic-labs/logger": "4.84.1",
24
- "@dynamic-labs/multi-wallet": "4.84.1",
25
- "@dynamic-labs/rpc-providers": "4.84.1",
26
- "@dynamic-labs/store": "4.84.1",
27
- "@dynamic-labs/types": "4.84.1",
28
- "@dynamic-labs/utils": "4.84.1",
29
- "@dynamic-labs/wallet-book": "4.84.1",
30
- "@dynamic-labs/wallet-connector-core": "4.84.1",
20
+ "@dynamic-labs/assert-package-version": "4.85.0",
21
+ "@dynamic-labs/iconic": "4.85.0",
22
+ "@dynamic-labs/locale": "4.85.0",
23
+ "@dynamic-labs/logger": "4.85.0",
24
+ "@dynamic-labs/multi-wallet": "4.85.0",
25
+ "@dynamic-labs/rpc-providers": "4.85.0",
26
+ "@dynamic-labs/store": "4.85.0",
27
+ "@dynamic-labs/types": "4.85.0",
28
+ "@dynamic-labs/utils": "4.85.0",
29
+ "@dynamic-labs/wallet-book": "4.85.0",
30
+ "@dynamic-labs/wallet-connector-core": "4.85.0",
31
31
  "eventemitter3": "5.0.1"
32
32
  },
33
33
  "devDependencies": {
package/src/index.d.ts CHANGED
@@ -124,7 +124,7 @@ export {
124
124
  /** @deprecated */
125
125
  DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
126
126
  export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, usePrivateTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useRefreshAuth, useResetWaasSession, useWalletOptions, useSmartWallets, useSignEip7702Authorization, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useDeletePasskey, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, useUpgradeToDynamicWaasFlow, useGetMfaToken, useGetWalletPassword, useIsPasswordEncrypted, useWalletPassword, useIsMfaRequiredForAction, useWalletDelegation, DelegationError, type DelegationOperation, type DelegationWalletRef, useWalletBackup, useBackupWallets, isWalletBackedUp, BackupError, CloudBackupProvider, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, findMissingGoogleDriveBackupScopes, hasAllGoogleDriveBackupScopes, isInsufficientGoogleDriveScopesError, useGoogleDriveBackupReadiness, useExchangeAccounts, useStepUpAuthentication, } from './lib/utils/hooks';
127
- export type { GoogleDriveBackupAccessError, GoogleDriveBackupReadiness, GoogleDriveBackupReadinessStatus, UseGoogleDriveBackupReadinessReturn, UsePrivateTokenBalancesReturn, } from './lib/utils/hooks';
127
+ export type { GoogleDriveBackupAccessError, GoogleDriveBackupReadiness, GoogleDriveBackupReadinessStatus, UseGoogleDriveBackupReadinessReturn, UsePrivateTokenBalancesArgs, UsePrivateTokenBalancesReturn, } from './lib/utils/hooks';
128
128
  export type { IsStepUpRequiredParams, PromptMfaParams, StepUpAuthenticationState, UseStepUpAuthenticationParams, UseStepUpAuthenticationReturn, VerifyOtpParams, VerifyPasskeyMfaParams, VerifyRecoveryCodeParams, VerifySocialParams, VerifyTotpMfaParams, VerifyWalletParams, } from './lib/utils/hooks';
129
129
  export {
130
130
  /** @deprecated use useOnramp instead */
@@ -123,7 +123,11 @@ require('../../../Popper/PopperContext/PopperContext.cjs');
123
123
  const TokensBalanceDropdown = ({ tokenBalances, currentToken, setCurrentToken, isLoading, setFieldValue, setErrors, }) => {
124
124
  const { t } = reactI18next.useTranslation();
125
125
  const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
126
- const filteredTokenBalances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [];
126
+ // Hide rows the user can't actually send from: anonymous tokens (no
127
+ // `name` set — usually a server-side data hole) and tokens whose
128
+ // on-chain balance is non-positive. The picker is a "pick what to
129
+ // send" affordance, so an entry the user can't pick is just noise.
130
+ const filteredTokenBalances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => { var _a; return token.name && ((_a = token.rawBalance) !== null && _a !== void 0 ? _a : 0) > 0; })) || [];
127
131
  const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
128
132
  const anchorRef = React.useRef(null);
129
133
  const fetchTokenData = (selectedToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -119,7 +119,11 @@ import '../../../Popper/PopperContext/PopperContext.js';
119
119
  const TokensBalanceDropdown = ({ tokenBalances, currentToken, setCurrentToken, isLoading, setFieldValue, setErrors, }) => {
120
120
  const { t } = useTranslation();
121
121
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
122
- const filteredTokenBalances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [];
122
+ // Hide rows the user can't actually send from: anonymous tokens (no
123
+ // `name` set — usually a server-side data hole) and tokens whose
124
+ // on-chain balance is non-positive. The picker is a "pick what to
125
+ // send" affordance, so an entry the user can't pick is just noise.
126
+ const filteredTokenBalances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => { var _a; return token.name && ((_a = token.rawBalance) !== null && _a !== void 0 ? _a : 0) > 0; })) || [];
123
127
  const { primaryWallet } = useInternalDynamicContext();
124
128
  const anchorRef = useRef(null);
125
129
  const fetchTokenData = (selectedToken) => __awaiter(void 0, void 0, void 0, function* () {
@@ -9,18 +9,14 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
9
  var onramp = require('../../../data/api/onramp/onramp.cjs');
10
10
  var getWalletAdditionalAddressByType = require('../../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.cjs');
11
11
 
12
- const DEFAULT_NETWORK = 'evm';
13
12
  const DEFAULT_CHAIN = '1';
14
13
  const getOnrampProviders = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ address, chainName, environmentId, network, primaryWallet, token, tokenAmount, currency, includeDisabled = false, merchantName, }) {
15
14
  var _b;
16
- const tempChainNameToUse = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
17
- ? (_b = walletConnectorCore.getChainInfo(primaryWallet.chain)) === null || _b === void 0 ? void 0 : _b.name
18
- : undefined;
19
- const chainNameToUse = chainName !== null && chainName !== void 0 ? chainName : tempChainNameToUse;
15
+ const chainNameToUse = (_b = chainName !== null && chainName !== void 0 ? chainName : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) !== null && _b !== void 0 ? _b : undefined;
20
16
  const bitcoinAddress = primaryWallet &&
21
17
  walletConnectorCore.isBitcoinConnector(primaryWallet.connector) &&
22
18
  getWalletAdditionalAddressByType.getWalletAdditionalAddressByType(sdkApiCore.WalletAddressType.Payment, primaryWallet);
23
- const chainHasNetwork = network && chainNameToUse === DEFAULT_NETWORK;
19
+ const chainHasNetwork = network && chainNameToUse === sdkApiCore.ChainEnum.Evm;
24
20
  let networkToUse;
25
21
  if (chainHasNetwork) {
26
22
  networkToUse = (network === null || network === void 0 ? void 0 : network.toString()) || DEFAULT_CHAIN;
@@ -1,22 +1,18 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
- import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
4
- import { getChainInfo, isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
3
+ import { WalletAddressType, ChainEnum } from '@dynamic-labs/sdk-api-core';
4
+ import { isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import { getOnrampProviders as getOnrampProviders$1 } from '../../../data/api/onramp/onramp.js';
6
6
  import { getWalletAdditionalAddressByType } from '../../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.js';
7
7
 
8
- const DEFAULT_NETWORK = 'evm';
9
8
  const DEFAULT_CHAIN = '1';
10
9
  const getOnrampProviders = (_a) => __awaiter(void 0, [_a], void 0, function* ({ address, chainName, environmentId, network, primaryWallet, token, tokenAmount, currency, includeDisabled = false, merchantName, }) {
11
10
  var _b;
12
- const tempChainNameToUse = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
13
- ? (_b = getChainInfo(primaryWallet.chain)) === null || _b === void 0 ? void 0 : _b.name
14
- : undefined;
15
- const chainNameToUse = chainName !== null && chainName !== void 0 ? chainName : tempChainNameToUse;
11
+ const chainNameToUse = (_b = chainName !== null && chainName !== void 0 ? chainName : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) !== null && _b !== void 0 ? _b : undefined;
16
12
  const bitcoinAddress = primaryWallet &&
17
13
  isBitcoinConnector(primaryWallet.connector) &&
18
14
  getWalletAdditionalAddressByType(WalletAddressType.Payment, primaryWallet);
19
- const chainHasNetwork = network && chainNameToUse === DEFAULT_NETWORK;
15
+ const chainHasNetwork = network && chainNameToUse === ChainEnum.Evm;
20
16
  let networkToUse;
21
17
  if (chainHasNetwork) {
22
18
  networkToUse = (network === null || network === void 0 ? void 0 : network.toString()) || DEFAULT_CHAIN;
@@ -4,9 +4,34 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
+ require('../../../config/ApiEndpoint.cjs');
8
+ require('@dynamic-labs-sdk/client/core');
9
+ require('@dynamic-labs/sdk-api-core');
10
+ require('react');
11
+ require('eventemitter3');
12
+ require('@dynamic-labs/utils');
13
+ require('@dynamic-labs-sdk/client');
14
+ require('@dynamic-labs/iconic');
15
+ require('@dynamic-labs/wallet-connector-core');
16
+ require('react/jsx-runtime');
17
+ require('../../../context/ViewContext/ViewContext.cjs');
18
+ require('../../../shared/logger.cjs');
19
+ require('@dynamic-labs/wallet-book');
20
+ require('../../../utils/constants/colors.cjs');
21
+ require('../../../utils/constants/values.cjs');
22
+ require('../../../shared/consts/index.cjs');
23
+ require('@dynamic-labs/multi-wallet');
24
+ require('react-international-phone');
25
+ require('../../../store/state/nonce/nonce.cjs');
7
26
  var api = require('../api.cjs');
27
+ require('@dynamic-labs/locale');
28
+ require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
29
+ require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
30
+ require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
31
+ require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
32
+ require('../../../events/dynamicEvents.cjs');
8
33
 
9
- const getOnrampProviders = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ chain, environmentId, networkId, token, tokenAmount, walletAddress, currency, includeDisabled, merchantName, }) {
34
+ const getOnrampProviders = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ chain, environmentId, networkId, token, tokenAmount, walletAddress, currency, includeDisabled, merchantName, }) {
10
35
  const { onramps } = yield api.sdkApi().getSupportedOnramps({
11
36
  chain,
12
37
  currency,
@@ -1,4 +1,14 @@
1
- import { RampConfiguration } from '@dynamic-labs/sdk-api-core';
1
+ import { ChainEnum, RampConfiguration } from '@dynamic-labs/sdk-api-core';
2
+ export type MoonPayCurrency = {
3
+ code: string;
4
+ icon: string;
5
+ name: string;
6
+ };
7
+ export declare const getMoonPayCurrencies: ({ chain, environmentId, networkId, }: {
8
+ chain: ChainEnum;
9
+ environmentId: string;
10
+ networkId?: string;
11
+ }) => Promise<MoonPayCurrency[]>;
2
12
  export declare const getOnrampProviders: ({ chain, environmentId, networkId, token, tokenAmount, walletAddress, currency, includeDisabled, merchantName, }: {
3
13
  chain: string;
4
14
  environmentId: string;
@@ -1,8 +1,33 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import '../../../config/ApiEndpoint.js';
4
+ import '@dynamic-labs-sdk/client/core';
5
+ import '@dynamic-labs/sdk-api-core';
6
+ import 'react';
7
+ import 'eventemitter3';
8
+ import '@dynamic-labs/utils';
9
+ import '@dynamic-labs-sdk/client';
10
+ import '@dynamic-labs/iconic';
11
+ import '@dynamic-labs/wallet-connector-core';
12
+ import 'react/jsx-runtime';
13
+ import '../../../context/ViewContext/ViewContext.js';
14
+ import '../../../shared/logger.js';
15
+ import '@dynamic-labs/wallet-book';
16
+ import '../../../utils/constants/colors.js';
17
+ import '../../../utils/constants/values.js';
18
+ import '../../../shared/consts/index.js';
19
+ import '@dynamic-labs/multi-wallet';
20
+ import 'react-international-phone';
21
+ import '../../../store/state/nonce/nonce.js';
3
22
  import { sdkApi } from '../api.js';
23
+ import '@dynamic-labs/locale';
24
+ import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
25
+ import '../../../store/state/primaryWalletId/primaryWalletId.js';
26
+ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
27
+ import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
28
+ import '../../../events/dynamicEvents.js';
4
29
 
5
- const getOnrampProviders = (_a) => __awaiter(void 0, [_a], void 0, function* ({ chain, environmentId, networkId, token, tokenAmount, walletAddress, currency, includeDisabled, merchantName, }) {
30
+ const getOnrampProviders = (_c) => __awaiter(void 0, [_c], void 0, function* ({ chain, environmentId, networkId, token, tokenAmount, walletAddress, currency, includeDisabled, merchantName, }) {
6
31
  const { onramps } = yield sdkApi().getSupportedOnramps({
7
32
  chain,
8
33
  currency,
@@ -15,6 +15,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
15
15
  const providerDisplayModes = {
16
16
  [sdkApiCore.ProviderEnum.CoinbaseOnramp]: 'popup',
17
17
  [sdkApiCore.ProviderEnum.CryptoDotCom]: 'popup',
18
+ [sdkApiCore.ProviderEnum.MoonPay]: 'popup',
18
19
  // Default for other providers is iframe
19
20
  };
20
21
 
@@ -11,6 +11,7 @@ import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
11
11
  const providerDisplayModes = {
12
12
  [ProviderEnum.CoinbaseOnramp]: 'popup',
13
13
  [ProviderEnum.CryptoDotCom]: 'popup',
14
+ [ProviderEnum.MoonPay]: 'popup',
14
15
  // Default for other providers is iframe
15
16
  };
16
17
 
@@ -57,7 +57,7 @@ export { useMergeUserAccounts } from './useMergeUserAccounts';
57
57
  export { useTokenBalances } from './useTokenBalances';
58
58
  export { useMultichainTokenBalances } from './useMultichainTokenBalances';
59
59
  export { usePrivateTokenBalances } from './usePrivateTokenBalances';
60
- export type { UsePrivateTokenBalancesReturn } from './usePrivateTokenBalances';
60
+ export type { UsePrivateTokenBalancesArgs, UsePrivateTokenBalancesReturn, } from './usePrivateTokenBalances';
61
61
  export { useUserAuth } from './useUserAuth';
62
62
  export { useSwitchWallet } from './useSwitchWallet';
63
63
  export { useSyncEmbeddedWalletFlow } from './useSyncEmbeddedWalletFlow';
@@ -8,6 +8,7 @@ var React = require('react');
8
8
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
9
  require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
10
10
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
11
+ var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
11
12
  var getAleoCuratedPrices = require('../../../data/api/aleo/getAleoCuratedPrices.cjs');
12
13
  var dynamicContextProps = require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
13
14
 
@@ -283,14 +284,37 @@ const buildTokenBalances = (records, networkId, lookupCurated) => {
283
284
  * - The connector doesn't expose `listOwnedRecords` (e.g. external Aleo wallet)
284
285
  * - The user owns no records that match a known program/record pair
285
286
  */
286
- const useAleoShieldedBalances = () => {
287
+ const useAleoShieldedBalances = (args = {}) => {
288
+ const { accountAddress, tokenAddresses, includeNativeBalance = true, includeFiat = true, chainName, networkId, } = args;
287
289
  const { primaryWallet, network } = useInternalDynamicContext.useInternalDynamicContext();
290
+ const { userWallets } = UserWalletsContext.useInternalUserWallets();
288
291
  const [tokenBalances, setTokenBalances] = React.useState([]);
289
292
  const [isLoading, setIsLoading] = React.useState(false);
290
293
  const [error, setError] = React.useState();
291
- const connector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
294
+ // `accountAddress` is treated as an override of the primary wallet:
295
+ // walk the user-wallets list looking for a matching address (case-
296
+ // insensitive to be tolerant of how the address is formatted at the
297
+ // call site — Aleo addresses are bech32 and casing-insensitive in
298
+ // practice). When no `accountAddress` is provided, fall back to the
299
+ // primary wallet to preserve the existing single-wallet semantics.
300
+ const targetWallet = React.useMemo(() => {
301
+ var _a;
302
+ if (!accountAddress)
303
+ return primaryWallet;
304
+ const normalized = accountAddress.toLowerCase();
305
+ return ((_a = userWallets.find((w) => { var _a; return ((_a = w.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === normalized; })) !== null && _a !== void 0 ? _a : undefined);
306
+ }, [accountAddress, primaryWallet, userWallets]);
307
+ const connector = targetWallet === null || targetWallet === void 0 ? void 0 : targetWallet.connector;
292
308
  const isAleo = (connector === null || connector === void 0 ? void 0 : connector.connectedChain) === sdkApiCore.ChainEnum.Aleo;
293
- const supportsShielded = isAleo &&
309
+ // When a `chainName` override is passed, treat anything other than
310
+ // `ChainEnum.Aleo` as "the caller explicitly asked for a non-Aleo
311
+ // chain we don't support yet" and short-circuit. Today Aleo is the
312
+ // only chain with a private-balance path, but customers should be
313
+ // able to call the public hook with whatever `chainName` matches
314
+ // their app's active chain and have it transparently no-op.
315
+ const chainNameSupported = chainName === undefined || chainName === sdkApiCore.ChainEnum.Aleo;
316
+ const supportsShielded = chainNameSupported &&
317
+ isAleo &&
294
318
  typeof (connector === null || connector === void 0 ? void 0 : connector.listOwnedRecords) === 'function';
295
319
  // Mirror the live connector into a ref so `fetchShielded` can read it
296
320
  // without depending on the (often unstable) object reference. Some test
@@ -300,7 +324,36 @@ const useAleoShieldedBalances = () => {
300
324
  const connectorRef = React.useRef(connector);
301
325
  connectorRef.current = connector;
302
326
  const connectorKey = connector === null || connector === void 0 ? void 0 : connector.key;
303
- const networkKey = network !== undefined && network !== null ? String(network) : undefined;
327
+ // When a `networkId` override is provided, use it instead of the
328
+ // context's `network` value when resolving the Aleo network param.
329
+ // Empty string falls back to undefined so `resolveAleoNetwork`
330
+ // returns `aleoNetworkParam: undefined` and the prices fetch is
331
+ // skipped (matching the behaviour when no network is known).
332
+ const effectiveNetwork = networkId !== null && networkId !== void 0 ? networkId : network;
333
+ const networkKey = effectiveNetwork !== undefined && effectiveNetwork !== null
334
+ ? String(effectiveNetwork)
335
+ : undefined;
336
+ // Normalise the address filter once per render into a stable
337
+ // primitive key (sorted, comma-joined, lowercased) so the
338
+ // `useCallback` dep below doesn't invalidate on every render when the
339
+ // caller passes a fresh array literal each time (which is the typical
340
+ // pattern in React function components). The matching Set is derived
341
+ // from the same key to keep both memos in lockstep.
342
+ const tokenAddressFilterKey = React.useMemo(() => {
343
+ if (!tokenAddresses)
344
+ return undefined;
345
+ return [...tokenAddresses]
346
+ .map((a) => a.toLowerCase())
347
+ .sort((a, b) => a.localeCompare(b))
348
+ .join('|');
349
+ }, [tokenAddresses]);
350
+ const tokenAddressFilter = React.useMemo(() => {
351
+ if (tokenAddressFilterKey === undefined)
352
+ return undefined;
353
+ if (tokenAddressFilterKey === '')
354
+ return new Set();
355
+ return new Set(tokenAddressFilterKey.split('|'));
356
+ }, [tokenAddressFilterKey]);
304
357
  const fetchShielded = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
305
358
  var _a;
306
359
  const liveConnector = connectorRef.current;
@@ -319,9 +372,15 @@ const useAleoShieldedBalances = () => {
319
372
  // token row, leaving the widget with no price source. Prices are
320
373
  // best-effort: a failure leaves balances unpriced rather than
321
374
  // dropping the shielded list entirely.
375
+ //
376
+ // When the caller opts out of fiat (`includeFiat: false`) we skip
377
+ // the curated-prices fetch entirely — same semantic as
378
+ // `useTokenBalances` honouring its own `includeFiat` flag. Logos
379
+ // for matched tokens then fall through to the bundled defaults
380
+ // (`ALEO_CREDITS_LOGO`, `UNKNOWN_TOKEN_LOGO`, spec overrides).
322
381
  const { safeNetworkId, aleoNetworkParam } = resolveAleoNetwork(networkKey);
323
382
  const environmentId = dynamicContextProps.getEnvironmentId();
324
- const shouldFetchPrices = Boolean(aleoNetworkParam && environmentId);
383
+ const shouldFetchPrices = Boolean(includeFiat && aleoNetworkParam && environmentId);
325
384
  const [result, priceList] = yield Promise.all([
326
385
  liveConnector.listOwnedRecords(),
327
386
  shouldFetchPrices && aleoNetworkParam
@@ -334,11 +393,16 @@ const useAleoShieldedBalances = () => {
334
393
  const records = (_a = result === null || result === void 0 ? void 0 : result.records) !== null && _a !== void 0 ? _a : [];
335
394
  const lookupCurated = buildCuratedTokenLookup(priceList);
336
395
  const balances = [];
337
- const credits = buildCreditsBalance(records, safeNetworkId, lookupCurated);
338
- if (credits)
339
- balances.push(credits);
396
+ if (includeNativeBalance) {
397
+ const credits = buildCreditsBalance(records, safeNetworkId, lookupCurated);
398
+ if (credits)
399
+ balances.push(credits);
400
+ }
340
401
  balances.push(...buildTokenBalances(records, safeNetworkId, lookupCurated));
341
- setTokenBalances(balances);
402
+ const filtered = tokenAddressFilter
403
+ ? balances.filter((b) => { var _a; return tokenAddressFilter.has(((_a = b.address) !== null && _a !== void 0 ? _a : '').toLowerCase()); })
404
+ : balances;
405
+ setTokenBalances(filtered);
342
406
  }
343
407
  catch (err) {
344
408
  const msg = err instanceof Error ? err.message : String(err);
@@ -348,7 +412,14 @@ const useAleoShieldedBalances = () => {
348
412
  finally {
349
413
  setIsLoading(false);
350
414
  }
351
- }), [connectorKey, networkKey, supportsShielded]);
415
+ }), [
416
+ connectorKey,
417
+ includeFiat,
418
+ includeNativeBalance,
419
+ networkKey,
420
+ supportsShielded,
421
+ tokenAddressFilter,
422
+ ]);
352
423
  React.useEffect(() => {
353
424
  if (!supportsShielded) {
354
425
  setTokenBalances((prev) => (prev.length === 0 ? prev : []));
@@ -1,4 +1,20 @@
1
- import { TokenBalance } from '@dynamic-labs/sdk-api-core';
1
+ import { ChainEnum, TokenBalance } from '@dynamic-labs/sdk-api-core';
2
+ /**
3
+ * Optional inputs that mirror the corresponding `useTokenBalances`
4
+ * params so the public `usePrivateTokenBalances` hook can pass through
5
+ * the same shape. Defaults here are tuned for the **widget's existing
6
+ * consumer** (`ActiveWalletBalance`), which expects the native ALEO
7
+ * row + fiat lookup to be on by default. The public hook overrides
8
+ * these defaults to match `useTokenBalances`' false / false.
9
+ */
10
+ export type UseAleoShieldedBalancesArgs = {
11
+ accountAddress?: string;
12
+ tokenAddresses?: string[];
13
+ includeNativeBalance?: boolean;
14
+ includeFiat?: boolean;
15
+ chainName?: ChainEnum;
16
+ networkId?: number;
17
+ };
2
18
  /**
3
19
  * Hook that returns the active wallet's shielded (private) Aleo token
4
20
  * balances as a `TokenBalance[]` so the widget can render them through the
@@ -15,7 +31,7 @@ import { TokenBalance } from '@dynamic-labs/sdk-api-core';
15
31
  * - The connector doesn't expose `listOwnedRecords` (e.g. external Aleo wallet)
16
32
  * - The user owns no records that match a known program/record pair
17
33
  */
18
- export declare const useAleoShieldedBalances: () => {
34
+ export declare const useAleoShieldedBalances: (args?: UseAleoShieldedBalancesArgs) => {
19
35
  tokenBalances: TokenBalance[];
20
36
  isLoading: boolean;
21
37
  error: string | undefined;