@dynamic-labs-sdk/react-hooks 1.7.0 → 1.8.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/dist/exports/index.d.ts +12 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/hooks/useCheckStepUpAuth/index.d.ts +3 -0
- package/dist/hooks/useCheckStepUpAuth/index.d.ts.map +1 -0
- package/dist/hooks/useCheckStepUpAuth/useCheckStepUpAuth.d.ts +30 -0
- package/dist/hooks/useCheckStepUpAuth/useCheckStepUpAuth.d.ts.map +1 -0
- package/dist/hooks/useCoinbaseOnrampOrderEventListener/index.d.ts +3 -0
- package/dist/hooks/useCoinbaseOnrampOrderEventListener/index.d.ts.map +1 -0
- package/dist/hooks/useCoinbaseOnrampOrderEventListener/useCoinbaseOnrampOrderEventListener.d.ts +26 -0
- package/dist/hooks/useCoinbaseOnrampOrderEventListener/useCoinbaseOnrampOrderEventListener.d.ts.map +1 -0
- package/dist/hooks/useConnectAndVerifyWithWalletProvider/index.d.ts +3 -0
- package/dist/hooks/useConnectAndVerifyWithWalletProvider/index.d.ts.map +1 -0
- package/dist/hooks/useConnectAndVerifyWithWalletProvider/useConnectAndVerifyWithWalletProvider.d.ts +40 -0
- package/dist/hooks/useConnectAndVerifyWithWalletProvider/useConnectAndVerifyWithWalletProvider.d.ts.map +1 -0
- package/dist/hooks/useConnectWithWalletProvider/index.d.ts +3 -0
- package/dist/hooks/useConnectWithWalletProvider/index.d.ts.map +1 -0
- package/dist/hooks/useConnectWithWalletProvider/useConnectWithWalletProvider.d.ts +38 -0
- package/dist/hooks/useConnectWithWalletProvider/useConnectWithWalletProvider.d.ts.map +1 -0
- package/dist/hooks/useMoonPayCurrencies/index.d.ts +2 -0
- package/dist/hooks/useMoonPayCurrencies/index.d.ts.map +1 -0
- package/dist/hooks/useMoonPayCurrencies/useMoonPayCurrencies.d.ts +22 -0
- package/dist/hooks/useMoonPayCurrencies/useMoonPayCurrencies.d.ts.map +1 -0
- package/dist/hooks/useMoonPayUrl/index.d.ts +2 -0
- package/dist/hooks/useMoonPayUrl/index.d.ts.map +1 -0
- package/dist/hooks/useMoonPayUrl/useMoonPayUrl.d.ts +22 -0
- package/dist/hooks/useMoonPayUrl/useMoonPayUrl.d.ts.map +1 -0
- package/dist/hooks/useOnceEvent/index.d.ts +2 -0
- package/dist/hooks/useOnceEvent/index.d.ts.map +1 -0
- package/dist/hooks/useOnceEvent/useOnceEvent.d.ts +18 -0
- package/dist/hooks/useOnceEvent/useOnceEvent.d.ts.map +1 -0
- package/dist/hooks/useSwapQuote/index.d.ts +2 -0
- package/dist/hooks/useSwapQuote/index.d.ts.map +1 -0
- package/dist/hooks/useSwapQuote/useSwapQuote.d.ts +22 -0
- package/dist/hooks/useSwapQuote/useSwapQuote.d.ts.map +1 -0
- package/dist/hooks/useSwapStatus/index.d.ts +2 -0
- package/dist/hooks/useSwapStatus/index.d.ts.map +1 -0
- package/dist/hooks/useSwapStatus/useSwapStatus.d.ts +22 -0
- package/dist/hooks/useSwapStatus/useSwapStatus.d.ts.map +1 -0
- package/dist/hooks/useWalletConnectCatalog/index.d.ts +3 -0
- package/dist/hooks/useWalletConnectCatalog/index.d.ts.map +1 -0
- package/dist/hooks/useWalletConnectCatalog/useWalletConnectCatalog.d.ts +24 -0
- package/dist/hooks/useWalletConnectCatalog/useWalletConnectCatalog.d.ts.map +1 -0
- package/dist/hooks/useWalletOptionsCatalogue/index.d.ts +2 -0
- package/dist/hooks/useWalletOptionsCatalogue/index.d.ts.map +1 -0
- package/dist/hooks/useWalletOptionsCatalogue/useWalletOptionsCatalogue.d.ts +22 -0
- package/dist/hooks/useWalletOptionsCatalogue/useWalletOptionsCatalogue.d.ts.map +1 -0
- package/dist/hooks/useWalletProviderEvent/index.d.ts +2 -0
- package/dist/hooks/useWalletProviderEvent/index.d.ts.map +1 -0
- package/dist/hooks/useWalletProviderEvent/useWalletProviderEvent.d.ts +19 -0
- package/dist/hooks/useWalletProviderEvent/useWalletProviderEvent.d.ts.map +1 -0
- package/dist/index.cjs +282 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +272 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
2
|
-
import { BaseError, acknowledgeRecoveryCodes, addNetwork, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, completeDeviceRegistration, completeSocialRedirect, confirmTransaction, consumeMfaToken, createCoinbaseOnrampOrder, createCryptoDotComPayment, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, executeSwapTransaction, getActiveNetworkData, getAvailableWalletProvidersData, getBalanceForAddress, getCoinbaseBuyUrl, getGoogleDriveBackupReadiness, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMultichainTokenBalances, getNativeBalance, getNetworksData, getPasskeys, getRegisteredDevices, getTokenBalances, getTransactionHistory, getUserSocialAccounts, getWalletAccounts, isCaptchaRequired, isUserMissingMfaAuth, isUserOnboardingComplete, logout, onEvent, proveWalletAccountOwnership, refreshAuth, registerPasskey, registerTotpMfaDevice, removeWalletAccount, requestExternalAuthElevatedToken, revokeAllRegisteredDevices, revokeRegisteredDevice, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signInWithSocialPopUp, signInWithSocialRedirect, signMessage, switchActiveNetwork, transferAmount, transferWalletAccount, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized } from "@dynamic-labs-sdk/client";
|
|
2
|
+
import { BaseError, acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, addNetwork, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, checkStepUpAuth, completeDeviceRegistration, completeSocialRedirect, confirmTransaction, connectAndVerifyWithWalletProvider, connectWithWalletProvider, consumeMfaToken, createCoinbaseOnrampOrder, createCryptoDotComPayment, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, executeSwapTransaction, getActiveNetworkData, getAvailableWalletProvidersData, getBalanceForAddress, getCoinbaseBuyUrl, getGoogleDriveBackupReadiness, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMoonPayCurrencies, getMoonPayUrl, getMultichainTokenBalances, getNativeBalance, getNetworksData, getPasskeys, getRegisteredDevices, getSwapQuote, getSwapStatus, getTokenBalances, getTransactionHistory, getUserSocialAccounts, getWalletAccounts, getWalletConnectCatalog, getWalletOptionsCatalogue, isCaptchaRequired, isUserMissingMfaAuth, isUserOnboardingComplete, logout, onEvent, onWalletProviderEvent, onceEvent, proveWalletAccountOwnership, refreshAuth, registerPasskey, registerTotpMfaDevice, removeWalletAccount, requestExternalAuthElevatedToken, revokeAllRegisteredDevices, revokeRegisteredDevice, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signInWithSocialPopUp, signInWithSocialRedirect, signMessage, switchActiveNetwork, transferAmount, transferWalletAccount, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized } from "@dynamic-labs-sdk/client";
|
|
3
3
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { createContext, useContext, useEffect, useMemo, useRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -7,7 +7,7 @@ import { getCore } from "@dynamic-labs-sdk/client/core";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "@dynamic-labs-sdk/react-hooks";
|
|
10
|
-
var version = "1.
|
|
10
|
+
var version = "1.8.0";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/modules/DynamicContext/DynamicContext.ts
|
|
@@ -385,6 +385,30 @@ const useBalanceForAddress = ({ queryParams, ...args }) => useBaseQuery({
|
|
|
385
385
|
queryParams
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/hooks/useCheckStepUpAuth/useCheckStepUpAuth.ts
|
|
390
|
+
/**
|
|
391
|
+
* Checks whether step-up authentication is required for a given scope and
|
|
392
|
+
* returns the credentials available to satisfy it.
|
|
393
|
+
*
|
|
394
|
+
* Wraps `checkStepUpAuth` from `@dynamic-labs-sdk/client`. Use the returned
|
|
395
|
+
* `isRequired` to decide whether to show a step-up UI before a sensitive
|
|
396
|
+
* action (e.g. exporting a wallet).
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```tsx
|
|
400
|
+
* const { data } = useCheckStepUpAuth({ scope: TokenScope.Walletexport });
|
|
401
|
+
* if (data?.isRequired) {
|
|
402
|
+
* // render step-up UI using data.credentials
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
const useCheckStepUpAuth = ({ queryParams, ...args }) => useBaseQuery({
|
|
407
|
+
queryFn: (client) => checkStepUpAuth(args, client),
|
|
408
|
+
queryKey: ["useCheckStepUpAuth", args],
|
|
409
|
+
queryParams
|
|
410
|
+
});
|
|
411
|
+
|
|
388
412
|
//#endregion
|
|
389
413
|
//#region src/hooks/useCoinbaseBuyUrl/useCoinbaseBuyUrl.ts
|
|
390
414
|
/**
|
|
@@ -401,6 +425,31 @@ const useCoinbaseBuyUrl = ({ queryParams, ...args }) => useBaseQuery({
|
|
|
401
425
|
queryParams
|
|
402
426
|
});
|
|
403
427
|
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/hooks/useCoinbaseOnrampOrderEventListener/useCoinbaseOnrampOrderEventListener.ts
|
|
430
|
+
/**
|
|
431
|
+
* Subscribes to Coinbase onramp order events for the duration of the component.
|
|
432
|
+
*
|
|
433
|
+
* Wraps `addCoinbaseOnrampOrderEventListener` from `@dynamic-labs-sdk/client`.
|
|
434
|
+
* Uses a ref to always call the latest listener without re-subscribing, and
|
|
435
|
+
* removes the listener on unmount.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```tsx
|
|
439
|
+
* useCoinbaseOnrampOrderEventListener({
|
|
440
|
+
* listener: ({ eventName, data }) => console.log(eventName, data),
|
|
441
|
+
* });
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
const useCoinbaseOnrampOrderEventListener = ({ listener }) => {
|
|
445
|
+
const client = useDynamicClient();
|
|
446
|
+
const callbackRef = useRef(listener);
|
|
447
|
+
callbackRef.current = listener;
|
|
448
|
+
useEffect(() => addCoinbaseOnrampOrderEventListener({ listener: (...args) => {
|
|
449
|
+
callbackRef.current(...args);
|
|
450
|
+
} }, client), [client]);
|
|
451
|
+
};
|
|
452
|
+
|
|
404
453
|
//#endregion
|
|
405
454
|
//#region src/hooks/useCompleteDeviceRegistration/useCompleteDeviceRegistration.ts
|
|
406
455
|
/**
|
|
@@ -451,6 +500,63 @@ const useConfirmTransaction = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
451
500
|
mutationFn: ({ client, variables }) => confirmTransaction(variables, client)
|
|
452
501
|
});
|
|
453
502
|
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/hooks/useConnectAndVerifyWithWalletProvider/useConnectAndVerifyWithWalletProvider.ts
|
|
505
|
+
/**
|
|
506
|
+
* Connects to a wallet provider and verifies ownership in a single step.
|
|
507
|
+
*
|
|
508
|
+
* Wraps `connectAndVerifyWithWalletProvider` from `@dynamic-labs-sdk/client`.
|
|
509
|
+
* Call `mutate({ walletProviderKey })` to connect and prompt the user to sign
|
|
510
|
+
* a verification message, adding the verified account to their profile.
|
|
511
|
+
*
|
|
512
|
+
* Throws `DeeplinkConnectAndVerifyUnsupportedError` on mobile with deeplink
|
|
513
|
+
* wallet providers — there, use `useConnectWithWalletProvider` followed by
|
|
514
|
+
* `useVerifyWalletAccount` from a fresh user gesture instead.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```tsx
|
|
518
|
+
* const { mutate: connectAndVerify, isPending } =
|
|
519
|
+
* useConnectAndVerifyWithWalletProvider();
|
|
520
|
+
* <button
|
|
521
|
+
* onClick={() => connectAndVerify({ walletProviderKey: 'metamaskevm' })}
|
|
522
|
+
* disabled={isPending}
|
|
523
|
+
* >
|
|
524
|
+
* Connect & verify
|
|
525
|
+
* </button>
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
const useConnectAndVerifyWithWalletProvider = ({ mutateParams } = {}) => useBaseMutation({
|
|
529
|
+
mutateParams,
|
|
530
|
+
mutationFn: ({ client, variables }) => connectAndVerifyWithWalletProvider(variables, client)
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/hooks/useConnectWithWalletProvider/useConnectWithWalletProvider.ts
|
|
535
|
+
/**
|
|
536
|
+
* Connects to a wallet provider and returns the connected wallet account.
|
|
537
|
+
*
|
|
538
|
+
* Wraps `connectWithWalletProvider` from `@dynamic-labs-sdk/client`. Call
|
|
539
|
+
* `mutate({ walletProviderKey })` to trigger the connection — the wallet
|
|
540
|
+
* provider will prompt the user via its native UI. The connected account is
|
|
541
|
+
* not verified; pair with `useVerifyWalletAccount`, or use
|
|
542
|
+
* `useConnectAndVerifyWithWalletProvider` to do both in one step.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```tsx
|
|
546
|
+
* const { mutate: connect, data, isPending } = useConnectWithWalletProvider();
|
|
547
|
+
* <button
|
|
548
|
+
* onClick={() => connect({ walletProviderKey: 'metamaskevm' })}
|
|
549
|
+
* disabled={isPending}
|
|
550
|
+
* >
|
|
551
|
+
* Connect
|
|
552
|
+
* </button>
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
const useConnectWithWalletProvider = ({ mutateParams } = {}) => useBaseMutation({
|
|
556
|
+
mutateParams,
|
|
557
|
+
mutationFn: ({ client, variables }) => connectWithWalletProvider(variables, client)
|
|
558
|
+
});
|
|
559
|
+
|
|
454
560
|
//#endregion
|
|
455
561
|
//#region src/hooks/useConsumeMfaToken/useConsumeMfaToken.ts
|
|
456
562
|
/**
|
|
@@ -816,6 +922,38 @@ const useMfaRecoveryCodes = ({ queryParams } = {}) => useBaseQuery({
|
|
|
816
922
|
queryParams
|
|
817
923
|
});
|
|
818
924
|
|
|
925
|
+
//#endregion
|
|
926
|
+
//#region src/hooks/useMoonPayCurrencies/useMoonPayCurrencies.ts
|
|
927
|
+
/**
|
|
928
|
+
* Wraps `getMoonPayCurrencies` from `@dynamic-labs-sdk/client`. Returns the list of currencies MoonPay supports for the given parameters.
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* ```tsx
|
|
932
|
+
* const { data: currencies, isLoading } = useMoonPayCurrencies(params);
|
|
933
|
+
* ```
|
|
934
|
+
*/
|
|
935
|
+
const useMoonPayCurrencies = ({ queryParams, ...args }) => useBaseQuery({
|
|
936
|
+
queryFn: (client) => getMoonPayCurrencies(args, client),
|
|
937
|
+
queryKey: ["useMoonPayCurrencies", args],
|
|
938
|
+
queryParams
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/hooks/useMoonPayUrl/useMoonPayUrl.ts
|
|
943
|
+
/**
|
|
944
|
+
* Wraps `getMoonPayUrl` from `@dynamic-labs-sdk/client`. Returns a MoonPay widget URL for the given parameters.
|
|
945
|
+
*
|
|
946
|
+
* @example
|
|
947
|
+
* ```tsx
|
|
948
|
+
* const { data: moonPayUrl, isLoading } = useMoonPayUrl(params);
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
const useMoonPayUrl = ({ queryParams, ...args }) => useBaseQuery({
|
|
952
|
+
queryFn: (client) => getMoonPayUrl(args, client),
|
|
953
|
+
queryKey: ["useMoonPayUrl", args],
|
|
954
|
+
queryParams
|
|
955
|
+
});
|
|
956
|
+
|
|
819
957
|
//#endregion
|
|
820
958
|
//#region src/hooks/useMultichainTokenBalances/useMultichainTokenBalances.ts
|
|
821
959
|
/**
|
|
@@ -875,6 +1013,35 @@ const useNetworksData = () => useBaseState({
|
|
|
875
1013
|
selector: (client) => getNetworksData(client)
|
|
876
1014
|
});
|
|
877
1015
|
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region src/hooks/useOnceEvent/useOnceEvent.ts
|
|
1018
|
+
/**
|
|
1019
|
+
* Subscribes to a Dynamic client event for a single occurrence.
|
|
1020
|
+
*
|
|
1021
|
+
* Wraps `onceEvent` from `@dynamic-labs-sdk/client` — the one-shot sibling of
|
|
1022
|
+
* `useEvent`. The listener fires at most once. Uses a ref to always call the
|
|
1023
|
+
* latest listener, and cleans up the subscription on unmount or event change.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* ```tsx
|
|
1027
|
+
* useOnceEvent({
|
|
1028
|
+
* event: 'authFlowCancelled',
|
|
1029
|
+
* listener: () => console.log('auth flow cancelled'),
|
|
1030
|
+
* });
|
|
1031
|
+
* ```
|
|
1032
|
+
*/
|
|
1033
|
+
const useOnceEvent = ({ event, listener }) => {
|
|
1034
|
+
const client = useDynamicClient();
|
|
1035
|
+
const callbackRef = useRef(listener);
|
|
1036
|
+
callbackRef.current = listener;
|
|
1037
|
+
useEffect(() => onceEvent({
|
|
1038
|
+
event,
|
|
1039
|
+
listener: (...args) => {
|
|
1040
|
+
callbackRef.current(...args);
|
|
1041
|
+
}
|
|
1042
|
+
}, client), [event, client]);
|
|
1043
|
+
};
|
|
1044
|
+
|
|
878
1045
|
//#endregion
|
|
879
1046
|
//#region src/hooks/usePasskeys/usePasskeys.ts
|
|
880
1047
|
/**
|
|
@@ -1266,6 +1433,38 @@ const useSignMessage = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
1266
1433
|
mutationFn: ({ client, variables }) => signMessage(variables, client)
|
|
1267
1434
|
});
|
|
1268
1435
|
|
|
1436
|
+
//#endregion
|
|
1437
|
+
//#region src/hooks/useSwapQuote/useSwapQuote.ts
|
|
1438
|
+
/**
|
|
1439
|
+
* Wraps `getSwapQuote` from `@dynamic-labs-sdk/client`. Returns a swap quote (including the signing payload consumed by {@link useExecuteSwapTransaction}).
|
|
1440
|
+
*
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```tsx
|
|
1443
|
+
* const { data: quote, isLoading } = useSwapQuote(params);
|
|
1444
|
+
* ```
|
|
1445
|
+
*/
|
|
1446
|
+
const useSwapQuote = ({ queryParams, ...args }) => useBaseQuery({
|
|
1447
|
+
queryFn: (client) => getSwapQuote(args, client),
|
|
1448
|
+
queryKey: ["useSwapQuote", args],
|
|
1449
|
+
queryParams
|
|
1450
|
+
});
|
|
1451
|
+
|
|
1452
|
+
//#endregion
|
|
1453
|
+
//#region src/hooks/useSwapStatus/useSwapStatus.ts
|
|
1454
|
+
/**
|
|
1455
|
+
* Wraps `getSwapStatus` from `@dynamic-labs-sdk/client`. Returns the current status of a previously submitted swap.
|
|
1456
|
+
*
|
|
1457
|
+
* @example
|
|
1458
|
+
* ```tsx
|
|
1459
|
+
* const { data: status, isLoading } = useSwapStatus(params);
|
|
1460
|
+
* ```
|
|
1461
|
+
*/
|
|
1462
|
+
const useSwapStatus = ({ queryParams, ...args }) => useBaseQuery({
|
|
1463
|
+
queryFn: (client) => getSwapStatus(args, client),
|
|
1464
|
+
queryKey: ["useSwapStatus", args],
|
|
1465
|
+
queryParams
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1269
1468
|
//#endregion
|
|
1270
1469
|
//#region src/hooks/useSwitchActiveNetwork/useSwitchActiveNetwork.ts
|
|
1271
1470
|
/**
|
|
@@ -1552,10 +1751,80 @@ const useWalletAccounts = () => useBaseState({
|
|
|
1552
1751
|
selector: (client) => getWalletAccounts(client)
|
|
1553
1752
|
});
|
|
1554
1753
|
|
|
1754
|
+
//#endregion
|
|
1755
|
+
//#region src/hooks/useWalletConnectCatalog/useWalletConnectCatalog.ts
|
|
1756
|
+
/**
|
|
1757
|
+
* Returns the WalletConnect catalog (groups and wallets) used for displaying
|
|
1758
|
+
* wallet information and building mobile wallet deeplinks.
|
|
1759
|
+
*
|
|
1760
|
+
* Wraps `getWalletConnectCatalog` from `@dynamic-labs-sdk/client`.
|
|
1761
|
+
*
|
|
1762
|
+
* @example
|
|
1763
|
+
* ```tsx
|
|
1764
|
+
* const { data: catalog, isLoading } = useWalletConnectCatalog();
|
|
1765
|
+
* ```
|
|
1766
|
+
*/
|
|
1767
|
+
const useWalletConnectCatalog = ({ queryParams } = {}) => useBaseQuery({
|
|
1768
|
+
queryFn: (client) => getWalletConnectCatalog(client),
|
|
1769
|
+
queryKey: ["useWalletConnectCatalog"],
|
|
1770
|
+
queryParams
|
|
1771
|
+
});
|
|
1772
|
+
|
|
1773
|
+
//#endregion
|
|
1774
|
+
//#region src/hooks/useWalletOptionsCatalogue/useWalletOptionsCatalogue.ts
|
|
1775
|
+
/**
|
|
1776
|
+
* Wraps `getWalletOptionsCatalogue` from `@dynamic-labs-sdk/client`. Returns the catalogue of wallet options the project supports.
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* ```tsx
|
|
1780
|
+
* const { data: catalogue, isLoading } = useWalletOptionsCatalogue();
|
|
1781
|
+
* ```
|
|
1782
|
+
*/
|
|
1783
|
+
const useWalletOptionsCatalogue = ({ queryParams, ...args } = {}) => useBaseQuery({
|
|
1784
|
+
queryFn: (client) => getWalletOptionsCatalogue(args, client),
|
|
1785
|
+
queryKey: ["useWalletOptionsCatalogue", args],
|
|
1786
|
+
queryParams
|
|
1787
|
+
});
|
|
1788
|
+
|
|
1789
|
+
//#endregion
|
|
1790
|
+
//#region src/hooks/useWalletProviderEvent/useWalletProviderEvent.ts
|
|
1791
|
+
/**
|
|
1792
|
+
* Subscribes to an event emitted by a specific wallet provider.
|
|
1793
|
+
*
|
|
1794
|
+
* Wraps `onWalletProviderEvent` from `@dynamic-labs-sdk/client`. Uses a ref to
|
|
1795
|
+
* always call the latest callback without re-subscribing, and cleans up the
|
|
1796
|
+
* subscription on unmount or when `event` / `walletProviderKey` change.
|
|
1797
|
+
*
|
|
1798
|
+
* @example
|
|
1799
|
+
* ```tsx
|
|
1800
|
+
* useWalletProviderEvent({
|
|
1801
|
+
* walletProviderKey: 'metamaskevm',
|
|
1802
|
+
* event: 'accountsChanged',
|
|
1803
|
+
* callback: ({ addresses }) => console.log(addresses),
|
|
1804
|
+
* });
|
|
1805
|
+
* ```
|
|
1806
|
+
*/
|
|
1807
|
+
const useWalletProviderEvent = ({ callback, event, walletProviderKey }) => {
|
|
1808
|
+
const client = useDynamicClient();
|
|
1809
|
+
const callbackRef = useRef(callback);
|
|
1810
|
+
callbackRef.current = callback;
|
|
1811
|
+
useEffect(() => onWalletProviderEvent({
|
|
1812
|
+
callback: ((...args) => {
|
|
1813
|
+
callbackRef.current(...args);
|
|
1814
|
+
}),
|
|
1815
|
+
event,
|
|
1816
|
+
walletProviderKey
|
|
1817
|
+
}, client), [
|
|
1818
|
+
event,
|
|
1819
|
+
walletProviderKey,
|
|
1820
|
+
client
|
|
1821
|
+
]);
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1555
1824
|
//#endregion
|
|
1556
1825
|
//#region src/exports/index.ts
|
|
1557
1826
|
assertPackageVersion(name, version);
|
|
1558
1827
|
|
|
1559
1828
|
//#endregion
|
|
1560
|
-
export { DynamicProvider, useAcknowledgeRecoveryCodes, useActiveNetworkData, useAddNetwork, useAuthenticateMfaRecoveryCode, useAuthenticatePasskeyMfa, useAuthenticateTotpMfaDevice, useAvailableWalletProvidersData, useBalanceForAddress, useCoinbaseBuyUrl, useCompleteDeviceRegistration, useCompleteSocialRedirect, useConfirmTransaction, useConsumeMfaToken, useCreateCoinbaseOnrampOrder, useCreateCryptoDotComPayment, useCreateNewMfaRecoveryCodes, useDeleteMfaDevice, useDeletePasskey, useDeleteUser, useDynamicClient, useEvent, useExecuteSwapTransaction, useGoogleDriveBackupReadiness, useInitStatus, useIsCaptchaRequired, useIsUserMissingMfaAuth, useIsUserOnboardingComplete, useKrakenWhitelistedAddresses, useLogout, useMfaDevices, useMfaMethods, useMfaRecoveryCodes, useMultichainTokenBalances, useNativeBalance, useNetworksData, usePasskeys, useProveWalletAccountOwnership, useRefreshAuth, useRegisterPasskey, useRegisterTotpMfaDevice, useRegisteredDevices, useRemoveWalletAccount, useRequestExternalAuthElevatedToken, useRevokeAllRegisteredDevices, useRevokeRegisteredDevice, useSendEmailOtp, useSendSmsOtp, useSessionExpiresAt, useSetDefaultMfaDevice, useSignInWithExternalJwt, useSignInWithPasskey, useSignInWithSocialPopUp, useSignInWithSocialRedirect, useSignMessage, useSwitchActiveNetwork, useTokenBalances, useTransactionHistory, useTransferAmount, useTransferWalletAccount, useUnlinkSocialAccount, useUpdateUser, useUser, useUserSocialAccounts, useVerifyOtp, useVerifyWalletAccount, useWalletAccounts };
|
|
1829
|
+
export { DynamicProvider, useAcknowledgeRecoveryCodes, useActiveNetworkData, useAddNetwork, useAuthenticateMfaRecoveryCode, useAuthenticatePasskeyMfa, useAuthenticateTotpMfaDevice, useAvailableWalletProvidersData, useBalanceForAddress, useCheckStepUpAuth, useCoinbaseBuyUrl, useCoinbaseOnrampOrderEventListener, useCompleteDeviceRegistration, useCompleteSocialRedirect, useConfirmTransaction, useConnectAndVerifyWithWalletProvider, useConnectWithWalletProvider, useConsumeMfaToken, useCreateCoinbaseOnrampOrder, useCreateCryptoDotComPayment, useCreateNewMfaRecoveryCodes, useDeleteMfaDevice, useDeletePasskey, useDeleteUser, useDynamicClient, useEvent, useExecuteSwapTransaction, useGoogleDriveBackupReadiness, useInitStatus, useIsCaptchaRequired, useIsUserMissingMfaAuth, useIsUserOnboardingComplete, useKrakenWhitelistedAddresses, useLogout, useMfaDevices, useMfaMethods, useMfaRecoveryCodes, useMoonPayCurrencies, useMoonPayUrl, useMultichainTokenBalances, useNativeBalance, useNetworksData, useOnceEvent, usePasskeys, useProveWalletAccountOwnership, useRefreshAuth, useRegisterPasskey, useRegisterTotpMfaDevice, useRegisteredDevices, useRemoveWalletAccount, useRequestExternalAuthElevatedToken, useRevokeAllRegisteredDevices, useRevokeRegisteredDevice, useSendEmailOtp, useSendSmsOtp, useSessionExpiresAt, useSetDefaultMfaDevice, useSignInWithExternalJwt, useSignInWithPasskey, useSignInWithSocialPopUp, useSignInWithSocialRedirect, useSignMessage, useSwapQuote, useSwapStatus, useSwitchActiveNetwork, useTokenBalances, useTransactionHistory, useTransferAmount, useTransferWalletAccount, useUnlinkSocialAccount, useUpdateUser, useUser, useUserSocialAccounts, useVerifyOtp, useVerifyWalletAccount, useWalletAccounts, useWalletConnectCatalog, useWalletOptionsCatalogue, useWalletProviderEvent };
|
|
1561
1830
|
//# sourceMappingURL=index.esm.js.map
|