@dynamic-labs-sdk/react-hooks 1.5.0 → 1.7.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 +30 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/hooks/useAcknowledgeRecoveryCodes/index.d.ts +2 -0
- package/dist/hooks/useAcknowledgeRecoveryCodes/index.d.ts.map +1 -0
- package/dist/hooks/useAcknowledgeRecoveryCodes/useAcknowledgeRecoveryCodes.d.ts +24 -0
- package/dist/hooks/useAcknowledgeRecoveryCodes/useAcknowledgeRecoveryCodes.d.ts.map +1 -0
- package/dist/hooks/useActiveNetworkData/index.d.ts +2 -0
- package/dist/hooks/useActiveNetworkData/index.d.ts.map +1 -0
- package/dist/hooks/useActiveNetworkData/useActiveNetworkData.d.ts +24 -0
- package/dist/hooks/useActiveNetworkData/useActiveNetworkData.d.ts.map +1 -0
- package/dist/hooks/useAddNetwork/index.d.ts +2 -0
- package/dist/hooks/useAddNetwork/index.d.ts.map +1 -0
- package/dist/hooks/useAddNetwork/useAddNetwork.d.ts +31 -0
- package/dist/hooks/useAddNetwork/useAddNetwork.d.ts.map +1 -0
- package/dist/hooks/useAuthenticateMfaRecoveryCode/index.d.ts +3 -0
- package/dist/hooks/useAuthenticateMfaRecoveryCode/index.d.ts.map +1 -0
- package/dist/hooks/useAuthenticateMfaRecoveryCode/useAuthenticateMfaRecoveryCode.d.ts +38 -0
- package/dist/hooks/useAuthenticateMfaRecoveryCode/useAuthenticateMfaRecoveryCode.d.ts.map +1 -0
- package/dist/hooks/useAuthenticatePasskeyMfa/index.d.ts +3 -0
- package/dist/hooks/useAuthenticatePasskeyMfa/index.d.ts.map +1 -0
- package/dist/hooks/useAuthenticatePasskeyMfa/useAuthenticatePasskeyMfa.d.ts +34 -0
- package/dist/hooks/useAuthenticatePasskeyMfa/useAuthenticatePasskeyMfa.d.ts.map +1 -0
- package/dist/hooks/useBalanceForAddress/index.d.ts +2 -0
- package/dist/hooks/useBalanceForAddress/index.d.ts.map +1 -0
- package/dist/hooks/useBalanceForAddress/useBalanceForAddress.d.ts +24 -0
- package/dist/hooks/useBalanceForAddress/useBalanceForAddress.d.ts.map +1 -0
- package/dist/hooks/useCoinbaseBuyUrl/index.d.ts +2 -0
- package/dist/hooks/useCoinbaseBuyUrl/index.d.ts.map +1 -0
- package/dist/hooks/useCoinbaseBuyUrl/useCoinbaseBuyUrl.d.ts +22 -0
- package/dist/hooks/useCoinbaseBuyUrl/useCoinbaseBuyUrl.d.ts.map +1 -0
- package/dist/hooks/useCompleteDeviceRegistration/index.d.ts +2 -0
- package/dist/hooks/useCompleteDeviceRegistration/index.d.ts.map +1 -0
- package/dist/hooks/useCompleteDeviceRegistration/useCompleteDeviceRegistration.d.ts +26 -0
- package/dist/hooks/useCompleteDeviceRegistration/useCompleteDeviceRegistration.d.ts.map +1 -0
- package/dist/hooks/useCompleteSocialRedirect/index.d.ts +2 -0
- package/dist/hooks/useCompleteSocialRedirect/index.d.ts.map +1 -0
- package/dist/hooks/useCompleteSocialRedirect/useCompleteSocialRedirect.d.ts +24 -0
- package/dist/hooks/useCompleteSocialRedirect/useCompleteSocialRedirect.d.ts.map +1 -0
- package/dist/hooks/useConfirmTransaction/index.d.ts +2 -0
- package/dist/hooks/useConfirmTransaction/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmTransaction/useConfirmTransaction.d.ts +23 -0
- package/dist/hooks/useConfirmTransaction/useConfirmTransaction.d.ts.map +1 -0
- package/dist/hooks/useConsumeMfaToken/index.d.ts +3 -0
- package/dist/hooks/useConsumeMfaToken/index.d.ts.map +1 -0
- package/dist/hooks/useConsumeMfaToken/useConsumeMfaToken.d.ts +27 -0
- package/dist/hooks/useConsumeMfaToken/useConsumeMfaToken.d.ts.map +1 -0
- package/dist/hooks/useCreateCoinbaseOnrampOrder/index.d.ts +2 -0
- package/dist/hooks/useCreateCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/dist/hooks/useCreateCoinbaseOnrampOrder/useCreateCoinbaseOnrampOrder.d.ts +23 -0
- package/dist/hooks/useCreateCoinbaseOnrampOrder/useCreateCoinbaseOnrampOrder.d.ts.map +1 -0
- package/dist/hooks/useCreateCryptoDotComPayment/index.d.ts +2 -0
- package/dist/hooks/useCreateCryptoDotComPayment/index.d.ts.map +1 -0
- package/dist/hooks/useCreateCryptoDotComPayment/useCreateCryptoDotComPayment.d.ts +24 -0
- package/dist/hooks/useCreateCryptoDotComPayment/useCreateCryptoDotComPayment.d.ts.map +1 -0
- package/dist/hooks/useDeleteUser/index.d.ts +3 -0
- package/dist/hooks/useDeleteUser/index.d.ts.map +1 -0
- package/dist/hooks/useDeleteUser/useDeleteUser.d.ts +28 -0
- package/dist/hooks/useDeleteUser/useDeleteUser.d.ts.map +1 -0
- package/dist/hooks/useExecuteSwapTransaction/index.d.ts +2 -0
- package/dist/hooks/useExecuteSwapTransaction/index.d.ts.map +1 -0
- package/dist/hooks/useExecuteSwapTransaction/useExecuteSwapTransaction.d.ts +25 -0
- package/dist/hooks/useExecuteSwapTransaction/useExecuteSwapTransaction.d.ts.map +1 -0
- package/dist/hooks/useGoogleDriveBackupReadiness/index.d.ts +2 -0
- package/dist/hooks/useGoogleDriveBackupReadiness/index.d.ts.map +1 -0
- package/dist/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.d.ts +21 -0
- package/dist/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.d.ts.map +1 -0
- package/dist/hooks/useKrakenWhitelistedAddresses/index.d.ts +2 -0
- package/dist/hooks/useKrakenWhitelistedAddresses/index.d.ts.map +1 -0
- package/dist/hooks/useKrakenWhitelistedAddresses/useKrakenWhitelistedAddresses.d.ts +21 -0
- package/dist/hooks/useKrakenWhitelistedAddresses/useKrakenWhitelistedAddresses.d.ts.map +1 -0
- package/dist/hooks/useMfaMethods/index.d.ts +3 -0
- package/dist/hooks/useMfaMethods/index.d.ts.map +1 -0
- package/dist/hooks/useMfaMethods/useMfaMethods.d.ts +24 -0
- package/dist/hooks/useMfaMethods/useMfaMethods.d.ts.map +1 -0
- package/dist/hooks/useMfaRecoveryCodes/index.d.ts +3 -0
- package/dist/hooks/useMfaRecoveryCodes/index.d.ts.map +1 -0
- package/dist/hooks/useMfaRecoveryCodes/useMfaRecoveryCodes.d.ts +23 -0
- package/dist/hooks/useMfaRecoveryCodes/useMfaRecoveryCodes.d.ts.map +1 -0
- package/dist/hooks/usePasskeys/index.d.ts +3 -0
- package/dist/hooks/usePasskeys/index.d.ts.map +1 -0
- package/dist/hooks/usePasskeys/usePasskeys.d.ts +23 -0
- package/dist/hooks/usePasskeys/usePasskeys.d.ts.map +1 -0
- package/dist/hooks/useProveWalletAccountOwnership/index.d.ts +2 -0
- package/dist/hooks/useProveWalletAccountOwnership/index.d.ts.map +1 -0
- package/dist/hooks/useProveWalletAccountOwnership/useProveWalletAccountOwnership.d.ts +29 -0
- package/dist/hooks/useProveWalletAccountOwnership/useProveWalletAccountOwnership.d.ts.map +1 -0
- package/dist/hooks/useRefreshAuth/index.d.ts +2 -0
- package/dist/hooks/useRefreshAuth/index.d.ts.map +1 -0
- package/dist/hooks/useRefreshAuth/useRefreshAuth.d.ts +24 -0
- package/dist/hooks/useRefreshAuth/useRefreshAuth.d.ts.map +1 -0
- package/dist/hooks/useRequestExternalAuthElevatedToken/index.d.ts +2 -0
- package/dist/hooks/useRequestExternalAuthElevatedToken/index.d.ts.map +1 -0
- package/dist/hooks/useRequestExternalAuthElevatedToken/useRequestExternalAuthElevatedToken.d.ts +26 -0
- package/dist/hooks/useRequestExternalAuthElevatedToken/useRequestExternalAuthElevatedToken.d.ts.map +1 -0
- package/dist/hooks/useRevokeAllRegisteredDevices/index.d.ts +2 -0
- package/dist/hooks/useRevokeAllRegisteredDevices/index.d.ts.map +1 -0
- package/dist/hooks/useRevokeAllRegisteredDevices/useRevokeAllRegisteredDevices.d.ts +25 -0
- package/dist/hooks/useRevokeAllRegisteredDevices/useRevokeAllRegisteredDevices.d.ts.map +1 -0
- package/dist/hooks/useSignInWithExternalJwt/index.d.ts +2 -0
- package/dist/hooks/useSignInWithExternalJwt/index.d.ts.map +1 -0
- package/dist/hooks/useSignInWithExternalJwt/useSignInWithExternalJwt.d.ts +26 -0
- package/dist/hooks/useSignInWithExternalJwt/useSignInWithExternalJwt.d.ts.map +1 -0
- package/dist/hooks/useSignInWithSocialPopUp/index.d.ts +2 -0
- package/dist/hooks/useSignInWithSocialPopUp/index.d.ts.map +1 -0
- package/dist/hooks/useSignInWithSocialPopUp/useSignInWithSocialPopUp.d.ts +24 -0
- package/dist/hooks/useSignInWithSocialPopUp/useSignInWithSocialPopUp.d.ts.map +1 -0
- package/dist/hooks/useSignInWithSocialRedirect/index.d.ts +2 -0
- package/dist/hooks/useSignInWithSocialRedirect/index.d.ts.map +1 -0
- package/dist/hooks/useSignInWithSocialRedirect/useSignInWithSocialRedirect.d.ts +23 -0
- package/dist/hooks/useSignInWithSocialRedirect/useSignInWithSocialRedirect.d.ts.map +1 -0
- package/dist/hooks/useTransferAmount/index.d.ts +2 -0
- package/dist/hooks/useTransferAmount/index.d.ts.map +1 -0
- package/dist/hooks/useTransferAmount/useTransferAmount.d.ts +25 -0
- package/dist/hooks/useTransferAmount/useTransferAmount.d.ts.map +1 -0
- package/dist/hooks/useTransferWalletAccount/index.d.ts +2 -0
- package/dist/hooks/useTransferWalletAccount/index.d.ts.map +1 -0
- package/dist/hooks/useTransferWalletAccount/useTransferWalletAccount.d.ts +26 -0
- package/dist/hooks/useTransferWalletAccount/useTransferWalletAccount.d.ts.map +1 -0
- package/dist/index.cjs +583 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +556 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
2
|
-
import { BaseError, authenticateTotpMfaDevice, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, getAvailableWalletProvidersData, getMfaDevices, getMultichainTokenBalances, getNativeBalance, getNetworksData, getRegisteredDevices, getTokenBalances, getTransactionHistory, getUserSocialAccounts, getWalletAccounts, isCaptchaRequired, isUserMissingMfaAuth, isUserOnboardingComplete, logout, onEvent, registerPasskey, registerTotpMfaDevice, removeWalletAccount, revokeRegisteredDevice, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithPasskey, signMessage, switchActiveNetwork, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized } from "@dynamic-labs-sdk/client";
|
|
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";
|
|
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.7.0";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/modules/DynamicContext/DynamicContext.ts
|
|
@@ -85,6 +85,145 @@ const useBaseMutation = ({ mutationFn, mutateParams }) => {
|
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/hooks/useAcknowledgeRecoveryCodes/useAcknowledgeRecoveryCodes.ts
|
|
90
|
+
/**
|
|
91
|
+
* Marks the current user's MFA recovery codes as acknowledged. Takes no arguments — call `mutate()` after the user confirms they have stored the codes shown by {@link useMfaRecoveryCodes}.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* const { mutate: acknowledge, isPending } = useAcknowledgeRecoveryCodes();
|
|
96
|
+
* <button onClick={() => acknowledge()} disabled={isPending}>
|
|
97
|
+
* I've saved my recovery codes
|
|
98
|
+
* </button>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
const useAcknowledgeRecoveryCodes = ({ mutateParams } = {}) => useBaseMutation({
|
|
102
|
+
mutateParams,
|
|
103
|
+
mutationFn: ({ client }) => acknowledgeRecoveryCodes(client)
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/foundation/useBaseQuery/useBaseQuery.ts
|
|
108
|
+
/**
|
|
109
|
+
* Internal hook that wraps a react-query `useQuery` with the conventions used
|
|
110
|
+
* by every async-read hook in this package:
|
|
111
|
+
*
|
|
112
|
+
* - `queryFn` receives the resolved `DynamicClient` from context, and is
|
|
113
|
+
* gated behind `waitForClientInitialized` so customers never see "client
|
|
114
|
+
* not ready" errors on first render.
|
|
115
|
+
* - Callers pass `queryParams` to override any default `UseQueryOptions`,
|
|
116
|
+
* so consumers can opt into retries / custom staleTime / etc.
|
|
117
|
+
* - Callers pass `enabled: false` (typically derived from whether their
|
|
118
|
+
* pseudo-required arguments are present) to short-circuit fetches.
|
|
119
|
+
*
|
|
120
|
+
* Returns the full `useQuery` result — `data`, `error`, `isLoading`,
|
|
121
|
+
* `isFetching`, `isSuccess`, `refetch`, `status`, etc.
|
|
122
|
+
*/
|
|
123
|
+
const useBaseQuery = ({ queryFn, queryKey, queryParams, enabled = true }) => {
|
|
124
|
+
const client = useDynamicClient();
|
|
125
|
+
return useQuery({
|
|
126
|
+
queryFn: async () => {
|
|
127
|
+
await waitForClientInitialized(client);
|
|
128
|
+
return queryFn(client);
|
|
129
|
+
},
|
|
130
|
+
queryKey: useMemo(() => [
|
|
131
|
+
"@dynamic-labs-sdk/react-hooks",
|
|
132
|
+
"query",
|
|
133
|
+
...queryKey
|
|
134
|
+
], [queryKey]),
|
|
135
|
+
...queryParams,
|
|
136
|
+
enabled: enabled && queryParams?.enabled !== false
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/hooks/useActiveNetworkData/useActiveNetworkData.ts
|
|
142
|
+
/**
|
|
143
|
+
* Wraps `getActiveNetworkData` from `@dynamic-labs-sdk/client`. Returns the network the given wallet account is currently on.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```tsx
|
|
147
|
+
* const { data: network, isLoading } = useActiveNetworkData({ walletAccount });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
const useActiveNetworkData = ({ queryParams, ...args }) => useBaseQuery({
|
|
151
|
+
queryFn: (client) => getActiveNetworkData(args, client),
|
|
152
|
+
queryKey: ["useActiveNetworkData", args],
|
|
153
|
+
queryParams
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/hooks/useAddNetwork/useAddNetwork.ts
|
|
158
|
+
/**
|
|
159
|
+
* Wraps `addNetwork` from `@dynamic-labs-sdk/client`. Call `mutate({ networkData, walletAccount })` to register a custom network on the given wallet account.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```tsx
|
|
163
|
+
* const { mutate: addNetwork, isPending } = useAddNetwork();
|
|
164
|
+
* <button
|
|
165
|
+
* onClick={() => addNetwork({ networkData, walletAccount })}
|
|
166
|
+
* disabled={isPending}
|
|
167
|
+
* >
|
|
168
|
+
* Add network
|
|
169
|
+
* </button>
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
const useAddNetwork = ({ mutateParams } = {}) => useBaseMutation({
|
|
173
|
+
mutateParams,
|
|
174
|
+
mutationFn: ({ client, variables }) => addNetwork(variables, client)
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/hooks/useAuthenticateMfaRecoveryCode/useAuthenticateMfaRecoveryCode.ts
|
|
179
|
+
/**
|
|
180
|
+
* Authenticates the current user with one of their MFA recovery codes.
|
|
181
|
+
*
|
|
182
|
+
* Wraps `authenticateMfaRecoveryCode` from `@dynamic-labs-sdk/client`. Call
|
|
183
|
+
* `mutate({ code })` with a backup recovery code when no registered MFA
|
|
184
|
+
* method is available; the resolved `data` is the MFA authentication
|
|
185
|
+
* response.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```tsx
|
|
189
|
+
* const { mutate: authenticateRecoveryCode, isPending } =
|
|
190
|
+
* useAuthenticateMfaRecoveryCode();
|
|
191
|
+
* <button
|
|
192
|
+
* onClick={() => authenticateRecoveryCode({ code })}
|
|
193
|
+
* disabled={isPending}
|
|
194
|
+
* >
|
|
195
|
+
* Use recovery code
|
|
196
|
+
* </button>
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
const useAuthenticateMfaRecoveryCode = ({ mutateParams } = {}) => useBaseMutation({
|
|
200
|
+
mutateParams,
|
|
201
|
+
mutationFn: ({ client, variables }) => authenticateMfaRecoveryCode(variables, client)
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/hooks/useAuthenticatePasskeyMfa/useAuthenticatePasskeyMfa.ts
|
|
206
|
+
/**
|
|
207
|
+
* Completes an MFA challenge using the current user's passkey.
|
|
208
|
+
*
|
|
209
|
+
* Wraps `authenticatePasskeyMFA` from `@dynamic-labs-sdk/client`. Call
|
|
210
|
+
* `mutate()` to satisfy an MFA step-up with a passkey; the resolved `data`
|
|
211
|
+
* is the MFA verification response.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```tsx
|
|
215
|
+
* const { mutate: authenticatePasskeyMfa, isPending } =
|
|
216
|
+
* useAuthenticatePasskeyMfa();
|
|
217
|
+
* <button onClick={() => authenticatePasskeyMfa()} disabled={isPending}>
|
|
218
|
+
* Verify with passkey
|
|
219
|
+
* </button>
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
const useAuthenticatePasskeyMfa = ({ mutateParams } = {}) => useBaseMutation({
|
|
223
|
+
mutateParams,
|
|
224
|
+
mutationFn: ({ client, variables }) => authenticatePasskeyMFA(variables, client)
|
|
225
|
+
});
|
|
226
|
+
|
|
88
227
|
//#endregion
|
|
89
228
|
//#region src/hooks/useAuthenticateTotpMfaDevice/useAuthenticateTotpMfaDevice.ts
|
|
90
229
|
/**
|
|
@@ -230,6 +369,142 @@ const useAvailableWalletProvidersData = () => useBaseState({
|
|
|
230
369
|
selector: (client) => getAvailableWalletProvidersData(client)
|
|
231
370
|
});
|
|
232
371
|
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/hooks/useBalanceForAddress/useBalanceForAddress.ts
|
|
374
|
+
/**
|
|
375
|
+
* Wraps `getBalanceForAddress` from `@dynamic-labs-sdk/client`. Returns the native-token balance for an arbitrary address on the given chain/network.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```tsx
|
|
379
|
+
* const { data, isLoading } = useBalanceForAddress({ address, chain, networkId });
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
const useBalanceForAddress = ({ queryParams, ...args }) => useBaseQuery({
|
|
383
|
+
queryFn: (client) => getBalanceForAddress(args, client),
|
|
384
|
+
queryKey: ["useBalanceForAddress", args],
|
|
385
|
+
queryParams
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/hooks/useCoinbaseBuyUrl/useCoinbaseBuyUrl.ts
|
|
390
|
+
/**
|
|
391
|
+
* Wraps `getCoinbaseBuyUrl` from `@dynamic-labs-sdk/client`. Returns a Coinbase onramp buy URL for the given parameters.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```tsx
|
|
395
|
+
* const { data: buyUrl, isLoading } = useCoinbaseBuyUrl(buyUrlParams);
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
const useCoinbaseBuyUrl = ({ queryParams, ...args }) => useBaseQuery({
|
|
399
|
+
queryFn: (client) => getCoinbaseBuyUrl(args, client),
|
|
400
|
+
queryKey: ["useCoinbaseBuyUrl", args],
|
|
401
|
+
queryParams
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/hooks/useCompleteDeviceRegistration/useCompleteDeviceRegistration.ts
|
|
406
|
+
/**
|
|
407
|
+
* Wraps `completeDeviceRegistration` from `@dynamic-labs-sdk/client`. Call `mutate({ deviceToken })` with the device token parsed from the redirect URL; the resolved `data` is a `VerifyResponse`.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```tsx
|
|
411
|
+
* const { mutate: completeRegistration, isPending } =
|
|
412
|
+
* useCompleteDeviceRegistration();
|
|
413
|
+
* completeRegistration({ deviceToken });
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
const useCompleteDeviceRegistration = ({ mutateParams } = {}) => useBaseMutation({
|
|
417
|
+
mutateParams,
|
|
418
|
+
mutationFn: ({ client, variables }) => completeDeviceRegistration(variables, client)
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/hooks/useCompleteSocialRedirect/useCompleteSocialRedirect.ts
|
|
423
|
+
/**
|
|
424
|
+
* Wraps `completeSocialRedirect` from `@dynamic-labs-sdk/client`. Call `mutate(params)` with the OAuth callback URL once the provider has redirected back to finish the sign-in; the resolved `data` is the signed-in `User` (or `null`).
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```tsx
|
|
428
|
+
* const { mutate: completeSocialRedirect, data: user } =
|
|
429
|
+
* useCompleteSocialRedirect();
|
|
430
|
+
* completeSocialRedirect({ url: new URL(window.location.href) });
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
const useCompleteSocialRedirect = ({ mutateParams } = {}) => useBaseMutation({
|
|
434
|
+
mutateParams,
|
|
435
|
+
mutationFn: ({ client, variables }) => completeSocialRedirect(variables, client)
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/hooks/useConfirmTransaction/useConfirmTransaction.ts
|
|
440
|
+
/**
|
|
441
|
+
* Wraps `confirmTransaction` from `@dynamic-labs-sdk/client`. Call `mutate({ walletAccount, transactionHash })` to await confirmation of a submitted transaction; the resolved `data` is `void`.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```tsx
|
|
445
|
+
* const { mutate: confirmTransaction, isPending } = useConfirmTransaction();
|
|
446
|
+
* confirmTransaction({ walletAccount, transactionHash });
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
const useConfirmTransaction = ({ mutateParams } = {}) => useBaseMutation({
|
|
450
|
+
mutateParams,
|
|
451
|
+
mutationFn: ({ client, variables }) => confirmTransaction(variables, client)
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/hooks/useConsumeMfaToken/useConsumeMfaToken.ts
|
|
456
|
+
/**
|
|
457
|
+
* Consumes and clears the current MFA token from client state.
|
|
458
|
+
*
|
|
459
|
+
* Wraps `consumeMfaToken` from `@dynamic-labs-sdk/client`. Takes no
|
|
460
|
+
* arguments — call `mutate()` to read the token from a successful MFA
|
|
461
|
+
* authentication and remove it so it can't be reused; the resolved `data`
|
|
462
|
+
* is the consumed token.
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```tsx
|
|
466
|
+
* const { mutate: consumeMfaToken, data: mfaToken } = useConsumeMfaToken();
|
|
467
|
+
* <button onClick={() => consumeMfaToken()}>Consume MFA token</button>
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
const useConsumeMfaToken = ({ mutateParams } = {}) => useBaseMutation({
|
|
471
|
+
mutateParams,
|
|
472
|
+
mutationFn: ({ client }) => Promise.resolve(consumeMfaToken(client))
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/hooks/useCreateCoinbaseOnrampOrder/useCreateCoinbaseOnrampOrder.ts
|
|
477
|
+
/**
|
|
478
|
+
* Wraps `createCoinbaseOnrampOrder` from `@dynamic-labs-sdk/client`. Call `mutate(orderParams)` to create a Coinbase onramp order; the resolved `data` is the order response.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* ```tsx
|
|
482
|
+
* const { mutate: createOrder, data: order } = useCreateCoinbaseOnrampOrder();
|
|
483
|
+
* createOrder(orderParams);
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
const useCreateCoinbaseOnrampOrder = ({ mutateParams } = {}) => useBaseMutation({
|
|
487
|
+
mutateParams,
|
|
488
|
+
mutationFn: ({ client, variables }) => createCoinbaseOnrampOrder(variables, client)
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/hooks/useCreateCryptoDotComPayment/useCreateCryptoDotComPayment.ts
|
|
493
|
+
/**
|
|
494
|
+
* Wraps `createCryptoDotComPayment` from `@dynamic-labs-sdk/client`. Call `mutate(paymentParams)` to create a Crypto.com Pay payment; the resolved `data` is the payment response.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```tsx
|
|
498
|
+
* const { mutate: createPayment, data: payment } =
|
|
499
|
+
* useCreateCryptoDotComPayment();
|
|
500
|
+
* createPayment(paymentParams);
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
const useCreateCryptoDotComPayment = ({ mutateParams } = {}) => useBaseMutation({
|
|
504
|
+
mutateParams,
|
|
505
|
+
mutationFn: ({ client, variables }) => createCryptoDotComPayment(variables, client)
|
|
506
|
+
});
|
|
507
|
+
|
|
233
508
|
//#endregion
|
|
234
509
|
//#region src/hooks/useCreateNewMfaRecoveryCodes/useCreateNewMfaRecoveryCodes.ts
|
|
235
510
|
/**
|
|
@@ -297,6 +572,28 @@ const useDeletePasskey = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
297
572
|
mutationFn: ({ client, variables }) => deletePasskey(variables, client)
|
|
298
573
|
});
|
|
299
574
|
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/hooks/useDeleteUser/useDeleteUser.ts
|
|
577
|
+
/**
|
|
578
|
+
* Permanently deletes the current user's account and logs them out.
|
|
579
|
+
*
|
|
580
|
+
* Wraps `deleteUser` from `@dynamic-labs-sdk/client`. Takes no arguments —
|
|
581
|
+
* call `mutate()` to hard-delete the account; the resolved `data` is `void`.
|
|
582
|
+
* This is destructive and irreversible.
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```tsx
|
|
586
|
+
* const { mutate: deleteUser, isPending } = useDeleteUser();
|
|
587
|
+
* <button onClick={() => deleteUser()} disabled={isPending}>
|
|
588
|
+
* Delete my account
|
|
589
|
+
* </button>
|
|
590
|
+
* ```
|
|
591
|
+
*/
|
|
592
|
+
const useDeleteUser = ({ mutateParams } = {}) => useBaseMutation({
|
|
593
|
+
mutateParams,
|
|
594
|
+
mutationFn: ({ client }) => deleteUser(client)
|
|
595
|
+
});
|
|
596
|
+
|
|
300
597
|
//#endregion
|
|
301
598
|
//#region src/hooks/useEvent/useEvent.ts
|
|
302
599
|
/**
|
|
@@ -317,6 +614,38 @@ const useEvent = ({ event, listener }) => {
|
|
|
317
614
|
}, client), [event, client]);
|
|
318
615
|
};
|
|
319
616
|
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/hooks/useExecuteSwapTransaction/useExecuteSwapTransaction.ts
|
|
619
|
+
/**
|
|
620
|
+
* Wraps `executeSwapTransaction` from `@dynamic-labs-sdk/client`. Call `mutate({ walletAccount, signingPayload })` (using a payload from {@link useSwapQuote}) to execute a swap; the resolved `data` is `{ transactionHash }`.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```tsx
|
|
624
|
+
* const { mutate: executeSwap, data } = useExecuteSwapTransaction();
|
|
625
|
+
* executeSwap({ walletAccount, signingPayload });
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
628
|
+
const useExecuteSwapTransaction = ({ mutateParams } = {}) => useBaseMutation({
|
|
629
|
+
mutateParams,
|
|
630
|
+
mutationFn: ({ client, variables }) => executeSwapTransaction(variables, client)
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/hooks/useGoogleDriveBackupReadiness/useGoogleDriveBackupReadiness.ts
|
|
635
|
+
/**
|
|
636
|
+
* Wraps `getGoogleDriveBackupReadiness` from `@dynamic-labs-sdk/client`. Reports whether the user's Google Drive backup is set up and available.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```tsx
|
|
640
|
+
* const { data: readiness, isLoading } = useGoogleDriveBackupReadiness();
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
const useGoogleDriveBackupReadiness = ({ queryParams } = {}) => useBaseQuery({
|
|
644
|
+
queryFn: (client) => getGoogleDriveBackupReadiness(client),
|
|
645
|
+
queryKey: ["useGoogleDriveBackupReadiness"],
|
|
646
|
+
queryParams
|
|
647
|
+
});
|
|
648
|
+
|
|
320
649
|
//#endregion
|
|
321
650
|
//#region src/hooks/useInitStatus/useInitStatus.ts
|
|
322
651
|
/**
|
|
@@ -396,6 +725,22 @@ const useIsUserOnboardingComplete = () => useBaseState({
|
|
|
396
725
|
selector: (client) => client.user === null ? false : isUserOnboardingComplete(client)
|
|
397
726
|
});
|
|
398
727
|
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/hooks/useKrakenWhitelistedAddresses/useKrakenWhitelistedAddresses.ts
|
|
730
|
+
/**
|
|
731
|
+
* Wraps `getKrakenWhitelistedAddresses` from `@dynamic-labs-sdk/client`. Returns the destination addresses whitelisted for Kraken withdrawals.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```tsx
|
|
735
|
+
* const { data: addresses, isLoading } = useKrakenWhitelistedAddresses();
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
738
|
+
const useKrakenWhitelistedAddresses = ({ queryParams } = {}) => useBaseQuery({
|
|
739
|
+
queryFn: (client) => getKrakenWhitelistedAddresses(client),
|
|
740
|
+
queryKey: ["useKrakenWhitelistedAddresses"],
|
|
741
|
+
queryParams
|
|
742
|
+
});
|
|
743
|
+
|
|
399
744
|
//#endregion
|
|
400
745
|
//#region src/hooks/useLogout/useLogout.ts
|
|
401
746
|
/**
|
|
@@ -415,40 +760,6 @@ const useLogout = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
415
760
|
mutationFn: ({ client }) => logout(client)
|
|
416
761
|
});
|
|
417
762
|
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/foundation/useBaseQuery/useBaseQuery.ts
|
|
420
|
-
/**
|
|
421
|
-
* Internal hook that wraps a react-query `useQuery` with the conventions used
|
|
422
|
-
* by every async-read hook in this package:
|
|
423
|
-
*
|
|
424
|
-
* - `queryFn` receives the resolved `DynamicClient` from context, and is
|
|
425
|
-
* gated behind `waitForClientInitialized` so customers never see "client
|
|
426
|
-
* not ready" errors on first render.
|
|
427
|
-
* - Callers pass `queryParams` to override any default `UseQueryOptions`,
|
|
428
|
-
* so consumers can opt into retries / custom staleTime / etc.
|
|
429
|
-
* - Callers pass `enabled: false` (typically derived from whether their
|
|
430
|
-
* pseudo-required arguments are present) to short-circuit fetches.
|
|
431
|
-
*
|
|
432
|
-
* Returns the full `useQuery` result — `data`, `error`, `isLoading`,
|
|
433
|
-
* `isFetching`, `isSuccess`, `refetch`, `status`, etc.
|
|
434
|
-
*/
|
|
435
|
-
const useBaseQuery = ({ queryFn, queryKey, queryParams, enabled = true }) => {
|
|
436
|
-
const client = useDynamicClient();
|
|
437
|
-
return useQuery({
|
|
438
|
-
queryFn: async () => {
|
|
439
|
-
await waitForClientInitialized(client);
|
|
440
|
-
return queryFn(client);
|
|
441
|
-
},
|
|
442
|
-
queryKey: useMemo(() => [
|
|
443
|
-
"@dynamic-labs-sdk/react-hooks",
|
|
444
|
-
"query",
|
|
445
|
-
...queryKey
|
|
446
|
-
], [queryKey]),
|
|
447
|
-
...queryParams,
|
|
448
|
-
enabled: enabled && queryParams?.enabled !== false
|
|
449
|
-
});
|
|
450
|
-
};
|
|
451
|
-
|
|
452
763
|
//#endregion
|
|
453
764
|
//#region src/hooks/useMfaDevices/useMfaDevices.ts
|
|
454
765
|
/**
|
|
@@ -468,6 +779,43 @@ const useMfaDevices = ({ queryParams } = {}) => useBaseQuery({
|
|
|
468
779
|
queryParams
|
|
469
780
|
});
|
|
470
781
|
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/hooks/useMfaMethods/useMfaMethods.ts
|
|
784
|
+
/**
|
|
785
|
+
* Returns the multi-factor authentication methods available to the current
|
|
786
|
+
* user.
|
|
787
|
+
*
|
|
788
|
+
* Wraps `getMfaMethods` from `@dynamic-labs-sdk/client`.
|
|
789
|
+
*
|
|
790
|
+
* @example
|
|
791
|
+
* ```tsx
|
|
792
|
+
* const { data: mfaMethods, isLoading, refetch } = useMfaMethods();
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
const useMfaMethods = ({ queryParams } = {}) => useBaseQuery({
|
|
796
|
+
queryFn: (client) => getMfaMethods(client),
|
|
797
|
+
queryKey: ["useMfaMethods"],
|
|
798
|
+
queryParams
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region src/hooks/useMfaRecoveryCodes/useMfaRecoveryCodes.ts
|
|
803
|
+
/**
|
|
804
|
+
* Returns the current user's MFA recovery codes.
|
|
805
|
+
*
|
|
806
|
+
* Wraps `getMfaRecoveryCodes` from `@dynamic-labs-sdk/client`.
|
|
807
|
+
*
|
|
808
|
+
* @example
|
|
809
|
+
* ```tsx
|
|
810
|
+
* const { data: recoveryCodes, isLoading, refetch } = useMfaRecoveryCodes();
|
|
811
|
+
* ```
|
|
812
|
+
*/
|
|
813
|
+
const useMfaRecoveryCodes = ({ queryParams } = {}) => useBaseQuery({
|
|
814
|
+
queryFn: (client) => getMfaRecoveryCodes(client),
|
|
815
|
+
queryKey: ["useMfaRecoveryCodes"],
|
|
816
|
+
queryParams
|
|
817
|
+
});
|
|
818
|
+
|
|
471
819
|
//#endregion
|
|
472
820
|
//#region src/hooks/useMultichainTokenBalances/useMultichainTokenBalances.ts
|
|
473
821
|
/**
|
|
@@ -527,6 +875,59 @@ const useNetworksData = () => useBaseState({
|
|
|
527
875
|
selector: (client) => getNetworksData(client)
|
|
528
876
|
});
|
|
529
877
|
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/hooks/usePasskeys/usePasskeys.ts
|
|
880
|
+
/**
|
|
881
|
+
* Returns the passkeys registered for the current user.
|
|
882
|
+
*
|
|
883
|
+
* Wraps `getPasskeys` from `@dynamic-labs-sdk/client`.
|
|
884
|
+
*
|
|
885
|
+
* @example
|
|
886
|
+
* ```tsx
|
|
887
|
+
* const { data: passkeys, isLoading, refetch } = usePasskeys();
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
const usePasskeys = ({ queryParams } = {}) => useBaseQuery({
|
|
891
|
+
queryFn: (client) => getPasskeys(client),
|
|
892
|
+
queryKey: ["usePasskeys"],
|
|
893
|
+
queryParams
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/hooks/useProveWalletAccountOwnership/useProveWalletAccountOwnership.ts
|
|
898
|
+
/**
|
|
899
|
+
* Wraps `proveWalletAccountOwnership` from `@dynamic-labs-sdk/client`. Call `mutate({ walletAccount })` to prove ownership of a connected wallet account by signing a challenge.
|
|
900
|
+
*
|
|
901
|
+
* @example
|
|
902
|
+
* ```tsx
|
|
903
|
+
* const { mutate: proveOwnership, isPending } =
|
|
904
|
+
* useProveWalletAccountOwnership();
|
|
905
|
+
* proveOwnership({ walletAccount });
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
const useProveWalletAccountOwnership = ({ mutateParams } = {}) => useBaseMutation({
|
|
909
|
+
mutateParams,
|
|
910
|
+
mutationFn: ({ client, variables }) => proveWalletAccountOwnership(variables, client)
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
//#endregion
|
|
914
|
+
//#region src/hooks/useRefreshAuth/useRefreshAuth.ts
|
|
915
|
+
/**
|
|
916
|
+
* Wraps `refreshAuth` from `@dynamic-labs-sdk/client`. Takes no arguments — call `mutate()` to refresh the session/JWT; the resolved `data` is a `VerifyResponse`.
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```tsx
|
|
920
|
+
* const { mutate: refreshAuth, isPending } = useRefreshAuth();
|
|
921
|
+
* <button onClick={() => refreshAuth()} disabled={isPending}>
|
|
922
|
+
* Refresh session
|
|
923
|
+
* </button>
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
const useRefreshAuth = ({ mutateParams } = {}) => useBaseMutation({
|
|
927
|
+
mutateParams,
|
|
928
|
+
mutationFn: ({ client }) => refreshAuth(client)
|
|
929
|
+
});
|
|
930
|
+
|
|
530
931
|
//#endregion
|
|
531
932
|
//#region src/hooks/useRegisteredDevices/useRegisteredDevices.ts
|
|
532
933
|
/**
|
|
@@ -616,6 +1017,42 @@ const useRemoveWalletAccount = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
616
1017
|
mutationFn: ({ client, variables }) => removeWalletAccount(variables, client)
|
|
617
1018
|
});
|
|
618
1019
|
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region src/hooks/useRequestExternalAuthElevatedToken/useRequestExternalAuthElevatedToken.ts
|
|
1022
|
+
/**
|
|
1023
|
+
* Wraps `requestExternalAuthElevatedToken` from `@dynamic-labs-sdk/client`. Call `mutate({ externalJwt })` to exchange an externally issued JWT for an elevated-access token.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* ```tsx
|
|
1027
|
+
* const { mutate: requestElevatedToken } =
|
|
1028
|
+
* useRequestExternalAuthElevatedToken();
|
|
1029
|
+
* requestElevatedToken({ externalJwt });
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
const useRequestExternalAuthElevatedToken = ({ mutateParams } = {}) => useBaseMutation({
|
|
1033
|
+
mutateParams,
|
|
1034
|
+
mutationFn: ({ client, variables }) => requestExternalAuthElevatedToken(variables, client)
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
//#endregion
|
|
1038
|
+
//#region src/hooks/useRevokeAllRegisteredDevices/useRevokeAllRegisteredDevices.ts
|
|
1039
|
+
/**
|
|
1040
|
+
* Wraps `revokeAllRegisteredDevices` from `@dynamic-labs-sdk/client`. Takes no arguments — call `mutate()` to revoke every device registered to the current user; the resolved `data` is `void`.
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* ```tsx
|
|
1044
|
+
* const { mutate: revokeAllDevices, isPending } =
|
|
1045
|
+
* useRevokeAllRegisteredDevices();
|
|
1046
|
+
* <button onClick={() => revokeAllDevices()} disabled={isPending}>
|
|
1047
|
+
* Revoke all devices
|
|
1048
|
+
* </button>
|
|
1049
|
+
* ```
|
|
1050
|
+
*/
|
|
1051
|
+
const useRevokeAllRegisteredDevices = ({ mutateParams } = {}) => useBaseMutation({
|
|
1052
|
+
mutateParams,
|
|
1053
|
+
mutationFn: ({ client }) => revokeAllRegisteredDevices(client)
|
|
1054
|
+
});
|
|
1055
|
+
|
|
619
1056
|
//#endregion
|
|
620
1057
|
//#region src/hooks/useRevokeRegisteredDevice/useRevokeRegisteredDevice.ts
|
|
621
1058
|
/**
|
|
@@ -733,6 +1170,22 @@ const useSetDefaultMfaDevice = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
733
1170
|
mutationFn: ({ client, variables }) => setDefaultMfaDevice(variables, client)
|
|
734
1171
|
});
|
|
735
1172
|
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region src/hooks/useSignInWithExternalJwt/useSignInWithExternalJwt.ts
|
|
1175
|
+
/**
|
|
1176
|
+
* Wraps `signInWithExternalJwt` from `@dynamic-labs-sdk/client`. Call `mutate({ externalJwt })` to authenticate the user with a JWT issued by an external auth provider.
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```tsx
|
|
1180
|
+
* const { mutate: signInWithJwt, isPending } = useSignInWithExternalJwt();
|
|
1181
|
+
* signInWithJwt({ externalJwt });
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
const useSignInWithExternalJwt = ({ mutateParams } = {}) => useBaseMutation({
|
|
1185
|
+
mutateParams,
|
|
1186
|
+
mutationFn: ({ client, variables }) => signInWithExternalJwt(variables, client)
|
|
1187
|
+
});
|
|
1188
|
+
|
|
736
1189
|
//#endregion
|
|
737
1190
|
//#region src/hooks/useSignInWithPasskey/useSignInWithPasskey.ts
|
|
738
1191
|
/**
|
|
@@ -755,6 +1208,39 @@ const useSignInWithPasskey = ({ mutateParams } = {}) => useBaseMutation({
|
|
|
755
1208
|
mutationFn: ({ client, variables }) => signInWithPasskey(variables, client)
|
|
756
1209
|
});
|
|
757
1210
|
|
|
1211
|
+
//#endregion
|
|
1212
|
+
//#region src/hooks/useSignInWithSocialPopUp/useSignInWithSocialPopUp.ts
|
|
1213
|
+
/**
|
|
1214
|
+
* Wraps `signInWithSocialPopUp` from `@dynamic-labs-sdk/client`. Call `mutate({ provider })` to open the provider's OAuth popup; the resolved `data` is the signed-in `User` (or `null`).
|
|
1215
|
+
*
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```tsx
|
|
1218
|
+
* const { mutate: signInWithPopUp, data: user } =
|
|
1219
|
+
* useSignInWithSocialPopUp();
|
|
1220
|
+
* signInWithPopUp({ provider: 'google' });
|
|
1221
|
+
* ```
|
|
1222
|
+
*/
|
|
1223
|
+
const useSignInWithSocialPopUp = ({ mutateParams } = {}) => useBaseMutation({
|
|
1224
|
+
mutateParams,
|
|
1225
|
+
mutationFn: ({ client, variables }) => signInWithSocialPopUp(variables, client)
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
//#endregion
|
|
1229
|
+
//#region src/hooks/useSignInWithSocialRedirect/useSignInWithSocialRedirect.ts
|
|
1230
|
+
/**
|
|
1231
|
+
* Wraps `signInWithSocialRedirect` from `@dynamic-labs-sdk/client`. Call `mutate({ provider, redirectUrl })` to redirect the user to the provider's OAuth page; complete the flow with {@link useCompleteSocialAuthentication}.
|
|
1232
|
+
*
|
|
1233
|
+
* @example
|
|
1234
|
+
* ```tsx
|
|
1235
|
+
* const { mutate: signInWithRedirect } = useSignInWithSocialRedirect();
|
|
1236
|
+
* signInWithRedirect({ provider: 'google', redirectUrl });
|
|
1237
|
+
* ```
|
|
1238
|
+
*/
|
|
1239
|
+
const useSignInWithSocialRedirect = ({ mutateParams } = {}) => useBaseMutation({
|
|
1240
|
+
mutateParams,
|
|
1241
|
+
mutationFn: ({ client, variables }) => signInWithSocialRedirect(variables, client)
|
|
1242
|
+
});
|
|
1243
|
+
|
|
758
1244
|
//#endregion
|
|
759
1245
|
//#region src/hooks/useSignMessage/useSignMessage.ts
|
|
760
1246
|
/**
|
|
@@ -876,6 +1362,39 @@ const useTransactionHistory = ({ address, chain, networkId, queryParams, ...rest
|
|
|
876
1362
|
queryParams
|
|
877
1363
|
});
|
|
878
1364
|
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region src/hooks/useTransferAmount/useTransferAmount.ts
|
|
1367
|
+
/**
|
|
1368
|
+
* Wraps `transferAmount` from `@dynamic-labs-sdk/client`. Call `mutate({ walletAccount, amount, recipient, token })` to send tokens; the resolved `data` is `{ transactionHash }`.
|
|
1369
|
+
*
|
|
1370
|
+
* @example
|
|
1371
|
+
* ```tsx
|
|
1372
|
+
* const { mutate: transfer, data } = useTransferAmount();
|
|
1373
|
+
* transfer({ walletAccount, amount, recipient, token });
|
|
1374
|
+
* ```
|
|
1375
|
+
*/
|
|
1376
|
+
const useTransferAmount = ({ mutateParams } = {}) => useBaseMutation({
|
|
1377
|
+
mutateParams,
|
|
1378
|
+
mutationFn: ({ client, variables }) => transferAmount(variables, client)
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
//#endregion
|
|
1382
|
+
//#region src/hooks/useTransferWalletAccount/useTransferWalletAccount.ts
|
|
1383
|
+
/**
|
|
1384
|
+
* Wraps `transferWalletAccount` from `@dynamic-labs-sdk/client`. Call `mutate({ walletProviderKey })` to transfer (hand off) a wallet account to the given provider.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```tsx
|
|
1388
|
+
* const { mutate: transferWalletAccount, isPending } =
|
|
1389
|
+
* useTransferWalletAccount();
|
|
1390
|
+
* transferWalletAccount({ walletProviderKey });
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
const useTransferWalletAccount = ({ mutateParams } = {}) => useBaseMutation({
|
|
1394
|
+
mutateParams,
|
|
1395
|
+
mutationFn: ({ client, variables }) => transferWalletAccount(variables, client)
|
|
1396
|
+
});
|
|
1397
|
+
|
|
879
1398
|
//#endregion
|
|
880
1399
|
//#region src/hooks/useUnlinkSocialAccount/useUnlinkSocialAccount.ts
|
|
881
1400
|
/**
|
|
@@ -1038,5 +1557,5 @@ const useWalletAccounts = () => useBaseState({
|
|
|
1038
1557
|
assertPackageVersion(name, version);
|
|
1039
1558
|
|
|
1040
1559
|
//#endregion
|
|
1041
|
-
export { DynamicProvider, useAuthenticateTotpMfaDevice, useAvailableWalletProvidersData, useCreateNewMfaRecoveryCodes, useDeleteMfaDevice, useDeletePasskey, useDynamicClient, useEvent, useInitStatus, useIsCaptchaRequired, useIsUserMissingMfaAuth, useIsUserOnboardingComplete, useLogout, useMfaDevices, useMultichainTokenBalances, useNativeBalance, useNetworksData, useRegisterPasskey, useRegisterTotpMfaDevice, useRegisteredDevices, useRemoveWalletAccount, useRevokeRegisteredDevice, useSendEmailOtp, useSendSmsOtp, useSessionExpiresAt, useSetDefaultMfaDevice, useSignInWithPasskey, useSignMessage, useSwitchActiveNetwork, useTokenBalances, useTransactionHistory, useUnlinkSocialAccount, useUpdateUser, useUser, useUserSocialAccounts, useVerifyOtp, useVerifyWalletAccount, useWalletAccounts };
|
|
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 };
|
|
1042
1561
|
//# sourceMappingURL=index.esm.js.map
|