@dynamic-labs-sdk/react-hooks 1.30.3 → 1.31.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/dist/core.cjs +1 -1
- package/dist/core.esm.js +1 -1
- package/dist/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.d.ts +21 -1
- package/dist/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/index.cjs +52 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +53 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{useBaseState-CI69lvc_.cjs → useBaseState-CG4VKkZG.cjs} +2 -2
- package/dist/{useBaseState-CI69lvc_.cjs.map → useBaseState-CG4VKkZG.cjs.map} +1 -1
- package/dist/{useBaseState-dkF7NJuA.esm.js → useBaseState-Dpb-P_Py.esm.js} +2 -2
- package/dist/{useBaseState-dkF7NJuA.esm.js.map → useBaseState-Dpb-P_Py.esm.js.map} +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as useDynamicClient, c as version, i as useBaseMutation, n as useBaseQuery, o as DynamicProvider, r as QUERY_KEY_PREFIX, s as name, t as useBaseState } from "./useBaseState-
|
|
1
|
+
import { a as useDynamicClient, c as version, i as useBaseMutation, n as useBaseQuery, o as DynamicProvider, r as QUERY_KEY_PREFIX, s as name, t as useBaseState } from "./useBaseState-Dpb-P_Py.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
import { acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, addNetwork, assertWalletAccountSigningAvailability, attachFlowSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, broadcastFlow, cancelFlow, checkStepUpAuth, claimYieldRewards, completeDeviceRegistration, completeSocialRedirect, confirmTransaction, connectAndVerifyWithWalletProvider, connectWithWalletProvider, createCoinbaseExchangeTransfer, createCoinbaseOnrampOrder, createCryptoDotComPayment, createKrakenExchangeTransfer, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, depositToYieldVault, detectSocialRedirectUrl, executeSwapTransaction, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalanceForAddress, getCoinbaseAccounts, getCoinbaseBuyUrl, getConnectedAddresses, getFlow, getFlowQuote, getGoogleDriveBackupReadiness, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMoonPayCurrencies, getMoonPayUrl, getMultichainTokenBalances, getNativeBalance, getPasskeys, getRegisteredDevices, getSwapQuote, getSwapStatus, getTokenBalances, getTransactionHistory, getUserSocialAccounts, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletOptionsCatalogue, getWalletProviderDataByKey, getYieldDetails, getYieldPosition, getYieldRewards, isDeviceRegistrationRequired, isMfaRequiredForAction, isPendingRecoveryCodesAcknowledgment, isUserMissingMfaAuth, isUserOnboardingComplete, listYieldVaults, logout, mergeUserAccounts, onEvent, onWalletProviderEvent, onceEvent, prepareFlowSigning, proveWalletAccountOwnership, refreshAuth, registerPasskey, registerTotpMfaDevice, removeWalletAccount, requestExternalAuthElevatedToken, revokeAllRegisteredDevices, revokeRegisteredDevice, screenTransaction, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signInWithSocialPopUp, signInWithSocialRedirect, signMessage, submitFlowTransaction, switchActiveNetwork, transferAmount, transferWalletAccount, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, withdrawFromYieldVault } from "@dynamic-labs-sdk/client";
|
|
4
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { hashKey, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { getCore } from "@dynamic-labs-sdk/client/core";
|
|
7
7
|
import { addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createPolicy, createWaasOfflineRecoveryShares, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getAccountPolicyLayer, getBusinessAccount, getPolicy, getSignerPolicyLayer, getWalletPolicyLayer, getWalletRecoveryState, importWaasPrivateKey, listBusinessAccounts, migrateFromFireblocks, refreshWaasWalletAccountShares, removeAccountPolicyRule, removeBusinessAccountMember, removeBusinessAccountSigner, removeBusinessAccountWallet, removePolicyRules, removeSignerPolicyRule, removeWalletPolicyRule, revokeWaasDelegation, setWaasWalletAccountPassword, signSerializedTransaction, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword, upsertAccountPolicyRule, upsertSignerPolicyRule, upsertWalletPolicyRule } from "@dynamic-labs-sdk/client/waas";
|
|
@@ -2538,21 +2538,62 @@ const CATALOGUE_STALE_TIME_MS = 36e5;
|
|
|
2538
2538
|
* `walletProviderUnregistered` (on removal). Wiring both keeps the catalogue in
|
|
2539
2539
|
* sync without consumers pairing the hook with a manual listener.
|
|
2540
2540
|
*
|
|
2541
|
+
* Also refetches on `networkProviderBuilderRegistered`: the catalogue is scoped
|
|
2542
|
+
* to the chains the client has an extension for, and an extension added after
|
|
2543
|
+
* the first fetch emits no wallet provider event of its own.
|
|
2544
|
+
*
|
|
2545
|
+
* With `includeMobileOptions: true` the installed wallets are returned as
|
|
2546
|
+
* react-query placeholder data while the wallet book loads, so `data` is
|
|
2547
|
+
* populated before the full catalogue resolves and `status` is `'success'`
|
|
2548
|
+
* from the start — `isPlaceholderData` is what tells a partial catalogue from
|
|
2549
|
+
* the complete one.
|
|
2550
|
+
*
|
|
2541
2551
|
* @example
|
|
2542
2552
|
* ```tsx
|
|
2543
2553
|
* const { data: catalogue, isLoading } = useGetWalletOptionsCatalogue();
|
|
2544
2554
|
* ```
|
|
2545
2555
|
*/
|
|
2546
|
-
const useGetWalletOptionsCatalogue = ({ queryParams, ...args } = {}) =>
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
+
const useGetWalletOptionsCatalogue = ({ queryParams, returnInstalledOptionsWhileLoading = true, ...args } = {}) => {
|
|
2557
|
+
const wantsInstalledPlaceholder = (args.includeMobileOptions ?? false) && returnInstalledOptionsWhileLoading && queryParams?.enabled !== false;
|
|
2558
|
+
const middlewares = [
|
|
2559
|
+
invalidateOnEvent({ event: "walletProviderChanged" }),
|
|
2560
|
+
invalidateOnEvent({ event: "walletProviderUnregistered" }),
|
|
2561
|
+
invalidateOnEvent({ event: "networkProviderBuilderRegistered" })
|
|
2562
|
+
];
|
|
2563
|
+
const catalogueArgs = {
|
|
2564
|
+
...args,
|
|
2565
|
+
includeMobileOptions: args.includeMobileOptions ?? false
|
|
2566
|
+
};
|
|
2567
|
+
const installedOnlyArgs = {
|
|
2568
|
+
...args,
|
|
2569
|
+
includeMobileOptions: false
|
|
2570
|
+
};
|
|
2571
|
+
const catalogueCacheKey = hashKey([catalogueArgs]);
|
|
2572
|
+
const loadedCatalogueCacheKeyRef = useRef(void 0);
|
|
2573
|
+
const installedOnlyResult = useBaseQuery({
|
|
2574
|
+
enabled: wantsInstalledPlaceholder && loadedCatalogueCacheKeyRef.current !== catalogueCacheKey,
|
|
2575
|
+
middlewares,
|
|
2576
|
+
queryFn: (client) => getWalletOptionsCatalogue(installedOnlyArgs, client),
|
|
2577
|
+
queryKey: ["useGetWalletOptionsCatalogue", installedOnlyArgs],
|
|
2578
|
+
queryParams: {
|
|
2579
|
+
retry: false,
|
|
2580
|
+
staleTime: CATALOGUE_STALE_TIME_MS
|
|
2581
|
+
}
|
|
2582
|
+
});
|
|
2583
|
+
const fullCatalogueResult = useBaseQuery({
|
|
2584
|
+
middlewares,
|
|
2585
|
+
queryFn: (client) => getWalletOptionsCatalogue(catalogueArgs, client),
|
|
2586
|
+
queryKey: ["useGetWalletOptionsCatalogue", catalogueArgs],
|
|
2587
|
+
queryParams: {
|
|
2588
|
+
retry: false,
|
|
2589
|
+
staleTime: CATALOGUE_STALE_TIME_MS,
|
|
2590
|
+
...wantsInstalledPlaceholder ? { placeholderData: () => installedOnlyResult.data } : {},
|
|
2591
|
+
...queryParams
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
loadedCatalogueCacheKeyRef.current = fullCatalogueResult.data !== void 0 && !fullCatalogueResult.isPlaceholderData ? catalogueCacheKey : void 0;
|
|
2595
|
+
return fullCatalogueResult;
|
|
2596
|
+
};
|
|
2556
2597
|
|
|
2557
2598
|
//#endregion
|
|
2558
2599
|
//#region src/hooks/wrappers/functions/useGetWalletPolicyLayer/useGetWalletPolicyLayer.ts
|