@dynamic-labs-sdk/react-hooks 1.7.0 → 1.8.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/exports/index.d.ts +14 -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/useKrakenAccounts/index.d.ts +2 -0
- package/dist/hooks/useKrakenAccounts/index.d.ts.map +1 -0
- package/dist/hooks/useKrakenAccounts/useKrakenAccounts.d.ts +22 -0
- package/dist/hooks/useKrakenAccounts/useKrakenAccounts.d.ts.map +1 -0
- package/dist/hooks/useKrakenExchangeTransfer/index.d.ts +2 -0
- package/dist/hooks/useKrakenExchangeTransfer/index.d.ts.map +1 -0
- package/dist/hooks/useKrakenExchangeTransfer/useKrakenExchangeTransfer.d.ts +23 -0
- package/dist/hooks/useKrakenExchangeTransfer/useKrakenExchangeTransfer.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 +316 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +304 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type OnWalletProviderEventParams, type WalletProviderEvents } from '@dynamic-labs-sdk/client';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to an event emitted by a specific wallet provider.
|
|
4
|
+
*
|
|
5
|
+
* Wraps `onWalletProviderEvent` from `@dynamic-labs-sdk/client`. Uses a ref to
|
|
6
|
+
* always call the latest callback without re-subscribing, and cleans up the
|
|
7
|
+
* subscription on unmount or when `event` / `walletProviderKey` change.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* useWalletProviderEvent({
|
|
12
|
+
* walletProviderKey: 'metamaskevm',
|
|
13
|
+
* event: 'accountsChanged',
|
|
14
|
+
* callback: ({ addresses }) => console.log(addresses),
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const useWalletProviderEvent: <E extends Extract<keyof WalletProviderEvents, string>>({ callback, event, walletProviderKey, }: OnWalletProviderEventParams<E>) => void;
|
|
19
|
+
//# sourceMappingURL=useWalletProviderEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWalletProviderEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletProviderEvent/useWalletProviderEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAE1B,MAAM,0BAA0B,CAAC;AAKlC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,OAAO,CAAC,MAAM,oBAAoB,EAAE,MAAM,CAAC,2CAKpD,2BAA2B,CAAC,CAAC,CAAC,SAqBhC,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ let _dynamic_labs_sdk_client_core = require("@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.1";
|
|
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) => (0, _dynamic_labs_sdk_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 = (0, react.useRef)(listener);
|
|
447
|
+
callbackRef.current = listener;
|
|
448
|
+
(0, react.useEffect)(() => (0, _dynamic_labs_sdk_client.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 }) => (0, _dynamic_labs_sdk_client.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 }) => (0, _dynamic_labs_sdk_client.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 }) => (0, _dynamic_labs_sdk_client.connectWithWalletProvider)(variables, client)
|
|
558
|
+
});
|
|
559
|
+
|
|
454
560
|
//#endregion
|
|
455
561
|
//#region src/hooks/useConsumeMfaToken/useConsumeMfaToken.ts
|
|
456
562
|
/**
|
|
@@ -725,6 +831,38 @@ const useIsUserOnboardingComplete = () => useBaseState({
|
|
|
725
831
|
selector: (client) => client.user === null ? false : (0, _dynamic_labs_sdk_client.isUserOnboardingComplete)(client)
|
|
726
832
|
});
|
|
727
833
|
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/hooks/useKrakenAccounts/useKrakenAccounts.ts
|
|
836
|
+
/**
|
|
837
|
+
* Wraps `getKrakenAccounts` from `@dynamic-labs-sdk/client`. Returns the authenticated user's Kraken accounts (with balances), optionally filtered by chain/network.
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```tsx
|
|
841
|
+
* const { data: accounts, isLoading } = useKrakenAccounts();
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
const useKrakenAccounts = ({ queryParams, ...args } = {}) => useBaseQuery({
|
|
845
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getKrakenAccounts)(args, client),
|
|
846
|
+
queryKey: ["useKrakenAccounts", args],
|
|
847
|
+
queryParams
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/hooks/useKrakenExchangeTransfer/useKrakenExchangeTransfer.ts
|
|
852
|
+
/**
|
|
853
|
+
* Wraps `createKrakenExchangeTransfer` from `@dynamic-labs-sdk/client`. Call `mutate({ accountId, ... })` to send crypto from a Kraken account (see `useKrakenAccounts`) to a whitelisted address (see `useKrakenWhitelistedAddresses`); the resolved `data` is the created transfer.
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* ```tsx
|
|
857
|
+
* const { mutate: transfer, data } = useKrakenExchangeTransfer();
|
|
858
|
+
* transfer({ accountId, asset, amount, address });
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
861
|
+
const useKrakenExchangeTransfer = ({ mutateParams } = {}) => useBaseMutation({
|
|
862
|
+
mutateParams,
|
|
863
|
+
mutationFn: ({ client, variables }) => (0, _dynamic_labs_sdk_client.createKrakenExchangeTransfer)(variables, client)
|
|
864
|
+
});
|
|
865
|
+
|
|
728
866
|
//#endregion
|
|
729
867
|
//#region src/hooks/useKrakenWhitelistedAddresses/useKrakenWhitelistedAddresses.ts
|
|
730
868
|
/**
|
|
@@ -816,6 +954,38 @@ const useMfaRecoveryCodes = ({ queryParams } = {}) => useBaseQuery({
|
|
|
816
954
|
queryParams
|
|
817
955
|
});
|
|
818
956
|
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/hooks/useMoonPayCurrencies/useMoonPayCurrencies.ts
|
|
959
|
+
/**
|
|
960
|
+
* Wraps `getMoonPayCurrencies` from `@dynamic-labs-sdk/client`. Returns the list of currencies MoonPay supports for the given parameters.
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* ```tsx
|
|
964
|
+
* const { data: currencies, isLoading } = useMoonPayCurrencies(params);
|
|
965
|
+
* ```
|
|
966
|
+
*/
|
|
967
|
+
const useMoonPayCurrencies = ({ queryParams, ...args }) => useBaseQuery({
|
|
968
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getMoonPayCurrencies)(args, client),
|
|
969
|
+
queryKey: ["useMoonPayCurrencies", args],
|
|
970
|
+
queryParams
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/hooks/useMoonPayUrl/useMoonPayUrl.ts
|
|
975
|
+
/**
|
|
976
|
+
* Wraps `getMoonPayUrl` from `@dynamic-labs-sdk/client`. Returns a MoonPay widget URL for the given parameters.
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* ```tsx
|
|
980
|
+
* const { data: moonPayUrl, isLoading } = useMoonPayUrl(params);
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
const useMoonPayUrl = ({ queryParams, ...args }) => useBaseQuery({
|
|
984
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getMoonPayUrl)(args, client),
|
|
985
|
+
queryKey: ["useMoonPayUrl", args],
|
|
986
|
+
queryParams
|
|
987
|
+
});
|
|
988
|
+
|
|
819
989
|
//#endregion
|
|
820
990
|
//#region src/hooks/useMultichainTokenBalances/useMultichainTokenBalances.ts
|
|
821
991
|
/**
|
|
@@ -875,6 +1045,35 @@ const useNetworksData = () => useBaseState({
|
|
|
875
1045
|
selector: (client) => (0, _dynamic_labs_sdk_client.getNetworksData)(client)
|
|
876
1046
|
});
|
|
877
1047
|
|
|
1048
|
+
//#endregion
|
|
1049
|
+
//#region src/hooks/useOnceEvent/useOnceEvent.ts
|
|
1050
|
+
/**
|
|
1051
|
+
* Subscribes to a Dynamic client event for a single occurrence.
|
|
1052
|
+
*
|
|
1053
|
+
* Wraps `onceEvent` from `@dynamic-labs-sdk/client` — the one-shot sibling of
|
|
1054
|
+
* `useEvent`. The listener fires at most once. Uses a ref to always call the
|
|
1055
|
+
* latest listener, and cleans up the subscription on unmount or event change.
|
|
1056
|
+
*
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```tsx
|
|
1059
|
+
* useOnceEvent({
|
|
1060
|
+
* event: 'authFlowCancelled',
|
|
1061
|
+
* listener: () => console.log('auth flow cancelled'),
|
|
1062
|
+
* });
|
|
1063
|
+
* ```
|
|
1064
|
+
*/
|
|
1065
|
+
const useOnceEvent = ({ event, listener }) => {
|
|
1066
|
+
const client = useDynamicClient();
|
|
1067
|
+
const callbackRef = (0, react.useRef)(listener);
|
|
1068
|
+
callbackRef.current = listener;
|
|
1069
|
+
(0, react.useEffect)(() => (0, _dynamic_labs_sdk_client.onceEvent)({
|
|
1070
|
+
event,
|
|
1071
|
+
listener: (...args) => {
|
|
1072
|
+
callbackRef.current(...args);
|
|
1073
|
+
}
|
|
1074
|
+
}, client), [event, client]);
|
|
1075
|
+
};
|
|
1076
|
+
|
|
878
1077
|
//#endregion
|
|
879
1078
|
//#region src/hooks/usePasskeys/usePasskeys.ts
|
|
880
1079
|
/**
|
|
@@ -1266,6 +1465,38 @@ const useSignMessage = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
1266
1465
|
mutationFn: ({ client, variables }) => (0, _dynamic_labs_sdk_client.signMessage)(variables, client)
|
|
1267
1466
|
});
|
|
1268
1467
|
|
|
1468
|
+
//#endregion
|
|
1469
|
+
//#region src/hooks/useSwapQuote/useSwapQuote.ts
|
|
1470
|
+
/**
|
|
1471
|
+
* Wraps `getSwapQuote` from `@dynamic-labs-sdk/client`. Returns a swap quote (including the signing payload consumed by {@link useExecuteSwapTransaction}).
|
|
1472
|
+
*
|
|
1473
|
+
* @example
|
|
1474
|
+
* ```tsx
|
|
1475
|
+
* const { data: quote, isLoading } = useSwapQuote(params);
|
|
1476
|
+
* ```
|
|
1477
|
+
*/
|
|
1478
|
+
const useSwapQuote = ({ queryParams, ...args }) => useBaseQuery({
|
|
1479
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getSwapQuote)(args, client),
|
|
1480
|
+
queryKey: ["useSwapQuote", args],
|
|
1481
|
+
queryParams
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1484
|
+
//#endregion
|
|
1485
|
+
//#region src/hooks/useSwapStatus/useSwapStatus.ts
|
|
1486
|
+
/**
|
|
1487
|
+
* Wraps `getSwapStatus` from `@dynamic-labs-sdk/client`. Returns the current status of a previously submitted swap.
|
|
1488
|
+
*
|
|
1489
|
+
* @example
|
|
1490
|
+
* ```tsx
|
|
1491
|
+
* const { data: status, isLoading } = useSwapStatus(params);
|
|
1492
|
+
* ```
|
|
1493
|
+
*/
|
|
1494
|
+
const useSwapStatus = ({ queryParams, ...args }) => useBaseQuery({
|
|
1495
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getSwapStatus)(args, client),
|
|
1496
|
+
queryKey: ["useSwapStatus", args],
|
|
1497
|
+
queryParams
|
|
1498
|
+
});
|
|
1499
|
+
|
|
1269
1500
|
//#endregion
|
|
1270
1501
|
//#region src/hooks/useSwitchActiveNetwork/useSwitchActiveNetwork.ts
|
|
1271
1502
|
/**
|
|
@@ -1552,6 +1783,76 @@ const useWalletAccounts = () => useBaseState({
|
|
|
1552
1783
|
selector: (client) => (0, _dynamic_labs_sdk_client.getWalletAccounts)(client)
|
|
1553
1784
|
});
|
|
1554
1785
|
|
|
1786
|
+
//#endregion
|
|
1787
|
+
//#region src/hooks/useWalletConnectCatalog/useWalletConnectCatalog.ts
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns the WalletConnect catalog (groups and wallets) used for displaying
|
|
1790
|
+
* wallet information and building mobile wallet deeplinks.
|
|
1791
|
+
*
|
|
1792
|
+
* Wraps `getWalletConnectCatalog` from `@dynamic-labs-sdk/client`.
|
|
1793
|
+
*
|
|
1794
|
+
* @example
|
|
1795
|
+
* ```tsx
|
|
1796
|
+
* const { data: catalog, isLoading } = useWalletConnectCatalog();
|
|
1797
|
+
* ```
|
|
1798
|
+
*/
|
|
1799
|
+
const useWalletConnectCatalog = ({ queryParams } = {}) => useBaseQuery({
|
|
1800
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getWalletConnectCatalog)(client),
|
|
1801
|
+
queryKey: ["useWalletConnectCatalog"],
|
|
1802
|
+
queryParams
|
|
1803
|
+
});
|
|
1804
|
+
|
|
1805
|
+
//#endregion
|
|
1806
|
+
//#region src/hooks/useWalletOptionsCatalogue/useWalletOptionsCatalogue.ts
|
|
1807
|
+
/**
|
|
1808
|
+
* Wraps `getWalletOptionsCatalogue` from `@dynamic-labs-sdk/client`. Returns the catalogue of wallet options the project supports.
|
|
1809
|
+
*
|
|
1810
|
+
* @example
|
|
1811
|
+
* ```tsx
|
|
1812
|
+
* const { data: catalogue, isLoading } = useWalletOptionsCatalogue();
|
|
1813
|
+
* ```
|
|
1814
|
+
*/
|
|
1815
|
+
const useWalletOptionsCatalogue = ({ queryParams, ...args } = {}) => useBaseQuery({
|
|
1816
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getWalletOptionsCatalogue)(args, client),
|
|
1817
|
+
queryKey: ["useWalletOptionsCatalogue", args],
|
|
1818
|
+
queryParams
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
//#endregion
|
|
1822
|
+
//#region src/hooks/useWalletProviderEvent/useWalletProviderEvent.ts
|
|
1823
|
+
/**
|
|
1824
|
+
* Subscribes to an event emitted by a specific wallet provider.
|
|
1825
|
+
*
|
|
1826
|
+
* Wraps `onWalletProviderEvent` from `@dynamic-labs-sdk/client`. Uses a ref to
|
|
1827
|
+
* always call the latest callback without re-subscribing, and cleans up the
|
|
1828
|
+
* subscription on unmount or when `event` / `walletProviderKey` change.
|
|
1829
|
+
*
|
|
1830
|
+
* @example
|
|
1831
|
+
* ```tsx
|
|
1832
|
+
* useWalletProviderEvent({
|
|
1833
|
+
* walletProviderKey: 'metamaskevm',
|
|
1834
|
+
* event: 'accountsChanged',
|
|
1835
|
+
* callback: ({ addresses }) => console.log(addresses),
|
|
1836
|
+
* });
|
|
1837
|
+
* ```
|
|
1838
|
+
*/
|
|
1839
|
+
const useWalletProviderEvent = ({ callback, event, walletProviderKey }) => {
|
|
1840
|
+
const client = useDynamicClient();
|
|
1841
|
+
const callbackRef = (0, react.useRef)(callback);
|
|
1842
|
+
callbackRef.current = callback;
|
|
1843
|
+
(0, react.useEffect)(() => (0, _dynamic_labs_sdk_client.onWalletProviderEvent)({
|
|
1844
|
+
callback: ((...args) => {
|
|
1845
|
+
callbackRef.current(...args);
|
|
1846
|
+
}),
|
|
1847
|
+
event,
|
|
1848
|
+
walletProviderKey
|
|
1849
|
+
}, client), [
|
|
1850
|
+
event,
|
|
1851
|
+
walletProviderKey,
|
|
1852
|
+
client
|
|
1853
|
+
]);
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1555
1856
|
//#endregion
|
|
1556
1857
|
//#region src/exports/index.ts
|
|
1557
1858
|
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(name, version);
|
|
@@ -1566,10 +1867,14 @@ exports.useAuthenticatePasskeyMfa = useAuthenticatePasskeyMfa;
|
|
|
1566
1867
|
exports.useAuthenticateTotpMfaDevice = useAuthenticateTotpMfaDevice;
|
|
1567
1868
|
exports.useAvailableWalletProvidersData = useAvailableWalletProvidersData;
|
|
1568
1869
|
exports.useBalanceForAddress = useBalanceForAddress;
|
|
1870
|
+
exports.useCheckStepUpAuth = useCheckStepUpAuth;
|
|
1569
1871
|
exports.useCoinbaseBuyUrl = useCoinbaseBuyUrl;
|
|
1872
|
+
exports.useCoinbaseOnrampOrderEventListener = useCoinbaseOnrampOrderEventListener;
|
|
1570
1873
|
exports.useCompleteDeviceRegistration = useCompleteDeviceRegistration;
|
|
1571
1874
|
exports.useCompleteSocialRedirect = useCompleteSocialRedirect;
|
|
1572
1875
|
exports.useConfirmTransaction = useConfirmTransaction;
|
|
1876
|
+
exports.useConnectAndVerifyWithWalletProvider = useConnectAndVerifyWithWalletProvider;
|
|
1877
|
+
exports.useConnectWithWalletProvider = useConnectWithWalletProvider;
|
|
1573
1878
|
exports.useConsumeMfaToken = useConsumeMfaToken;
|
|
1574
1879
|
exports.useCreateCoinbaseOnrampOrder = useCreateCoinbaseOnrampOrder;
|
|
1575
1880
|
exports.useCreateCryptoDotComPayment = useCreateCryptoDotComPayment;
|
|
@@ -1585,14 +1890,19 @@ exports.useInitStatus = useInitStatus;
|
|
|
1585
1890
|
exports.useIsCaptchaRequired = useIsCaptchaRequired;
|
|
1586
1891
|
exports.useIsUserMissingMfaAuth = useIsUserMissingMfaAuth;
|
|
1587
1892
|
exports.useIsUserOnboardingComplete = useIsUserOnboardingComplete;
|
|
1893
|
+
exports.useKrakenAccounts = useKrakenAccounts;
|
|
1894
|
+
exports.useKrakenExchangeTransfer = useKrakenExchangeTransfer;
|
|
1588
1895
|
exports.useKrakenWhitelistedAddresses = useKrakenWhitelistedAddresses;
|
|
1589
1896
|
exports.useLogout = useLogout;
|
|
1590
1897
|
exports.useMfaDevices = useMfaDevices;
|
|
1591
1898
|
exports.useMfaMethods = useMfaMethods;
|
|
1592
1899
|
exports.useMfaRecoveryCodes = useMfaRecoveryCodes;
|
|
1900
|
+
exports.useMoonPayCurrencies = useMoonPayCurrencies;
|
|
1901
|
+
exports.useMoonPayUrl = useMoonPayUrl;
|
|
1593
1902
|
exports.useMultichainTokenBalances = useMultichainTokenBalances;
|
|
1594
1903
|
exports.useNativeBalance = useNativeBalance;
|
|
1595
1904
|
exports.useNetworksData = useNetworksData;
|
|
1905
|
+
exports.useOnceEvent = useOnceEvent;
|
|
1596
1906
|
exports.usePasskeys = usePasskeys;
|
|
1597
1907
|
exports.useProveWalletAccountOwnership = useProveWalletAccountOwnership;
|
|
1598
1908
|
exports.useRefreshAuth = useRefreshAuth;
|
|
@@ -1612,6 +1922,8 @@ exports.useSignInWithPasskey = useSignInWithPasskey;
|
|
|
1612
1922
|
exports.useSignInWithSocialPopUp = useSignInWithSocialPopUp;
|
|
1613
1923
|
exports.useSignInWithSocialRedirect = useSignInWithSocialRedirect;
|
|
1614
1924
|
exports.useSignMessage = useSignMessage;
|
|
1925
|
+
exports.useSwapQuote = useSwapQuote;
|
|
1926
|
+
exports.useSwapStatus = useSwapStatus;
|
|
1615
1927
|
exports.useSwitchActiveNetwork = useSwitchActiveNetwork;
|
|
1616
1928
|
exports.useTokenBalances = useTokenBalances;
|
|
1617
1929
|
exports.useTransactionHistory = useTransactionHistory;
|
|
@@ -1624,4 +1936,7 @@ exports.useUserSocialAccounts = useUserSocialAccounts;
|
|
|
1624
1936
|
exports.useVerifyOtp = useVerifyOtp;
|
|
1625
1937
|
exports.useVerifyWalletAccount = useVerifyWalletAccount;
|
|
1626
1938
|
exports.useWalletAccounts = useWalletAccounts;
|
|
1939
|
+
exports.useWalletConnectCatalog = useWalletConnectCatalog;
|
|
1940
|
+
exports.useWalletOptionsCatalogue = useWalletOptionsCatalogue;
|
|
1941
|
+
exports.useWalletProviderEvent = useWalletProviderEvent;
|
|
1627
1942
|
//# sourceMappingURL=index.cjs.map
|