@dynamic-labs-sdk/react-hooks 1.30.3 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +1 -1
- package/dist/core.esm.js +1 -1
- package/dist/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.d.ts +21 -1
- package/dist/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/index.cjs +52 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +53 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{useBaseState-CI69lvc_.cjs → useBaseState-CG4VKkZG.cjs} +2 -2
- package/dist/{useBaseState-CI69lvc_.cjs.map → useBaseState-CG4VKkZG.cjs.map} +1 -1
- package/dist/{useBaseState-dkF7NJuA.esm.js → useBaseState-Dpb-P_Py.esm.js} +2 -2
- package/dist/{useBaseState-dkF7NJuA.esm.js.map → useBaseState-Dpb-P_Py.esm.js.map} +1 -1
- package/package.json +4 -4
package/dist/core.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_useBaseState = require('./useBaseState-
|
|
1
|
+
const require_useBaseState = require('./useBaseState-CG4VKkZG.cjs');
|
|
2
2
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
3
|
|
|
4
4
|
//#region src/exports/core.ts
|
package/dist/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as useDynamicClient, c as version, i as useBaseMutation, n as useBaseQuery, s as name, t as useBaseState } from "./useBaseState-
|
|
1
|
+
import { a as useDynamicClient, c as version, i as useBaseMutation, n as useBaseQuery, s as name, t as useBaseState } from "./useBaseState-Dpb-P_Py.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
|
|
4
4
|
//#region src/exports/core.ts
|
package/dist/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.d.ts
CHANGED
|
@@ -10,6 +10,16 @@ export type UseGetWalletOptionsCatalogueParams = GetWalletOptionsCatalogueArgs &
|
|
|
10
10
|
* hook's CDN-aware defaults.
|
|
11
11
|
*/
|
|
12
12
|
queryParams?: UseBaseQueryParams<GetWalletOptionsCatalogueResult>['queryParams'];
|
|
13
|
+
/**
|
|
14
|
+
* When `includeMobileOptions` is true, returns the installed wallets
|
|
15
|
+
* immediately while the full catalogue loads, then swaps in the full
|
|
16
|
+
* result once it's ready. Defaults to `true`.
|
|
17
|
+
*
|
|
18
|
+
* While the installed wallets stand in for the full catalogue, `status` is
|
|
19
|
+
* already `'success'` and `isLoading` is false — read `isPlaceholderData`
|
|
20
|
+
* to tell the two apart.
|
|
21
|
+
*/
|
|
22
|
+
returnInstalledOptionsWhileLoading?: boolean;
|
|
13
23
|
};
|
|
14
24
|
/**
|
|
15
25
|
* Wraps `getWalletOptionsCatalogue` from `@dynamic-labs-sdk/client`. Returns the catalogue of wallet options the project supports.
|
|
@@ -20,11 +30,21 @@ export type UseGetWalletOptionsCatalogueParams = GetWalletOptionsCatalogueArgs &
|
|
|
20
30
|
* `walletProviderUnregistered` (on removal). Wiring both keeps the catalogue in
|
|
21
31
|
* sync without consumers pairing the hook with a manual listener.
|
|
22
32
|
*
|
|
33
|
+
* Also refetches on `networkProviderBuilderRegistered`: the catalogue is scoped
|
|
34
|
+
* to the chains the client has an extension for, and an extension added after
|
|
35
|
+
* the first fetch emits no wallet provider event of its own.
|
|
36
|
+
*
|
|
37
|
+
* With `includeMobileOptions: true` the installed wallets are returned as
|
|
38
|
+
* react-query placeholder data while the wallet book loads, so `data` is
|
|
39
|
+
* populated before the full catalogue resolves and `status` is `'success'`
|
|
40
|
+
* from the start — `isPlaceholderData` is what tells a partial catalogue from
|
|
41
|
+
* the complete one.
|
|
42
|
+
*
|
|
23
43
|
* @example
|
|
24
44
|
* ```tsx
|
|
25
45
|
* const { data: catalogue, isLoading } = useGetWalletOptionsCatalogue();
|
|
26
46
|
* ```
|
|
27
47
|
*/
|
|
28
|
-
export declare const useGetWalletOptionsCatalogue: ({ queryParams, ...args }?: UseGetWalletOptionsCatalogueParams) => UseQueryResult<GetWalletOptionsCatalogueResult, Error>;
|
|
48
|
+
export declare const useGetWalletOptionsCatalogue: ({ queryParams, returnInstalledOptionsWhileLoading, ...args }?: UseGetWalletOptionsCatalogueParams) => UseQueryResult<GetWalletOptionsCatalogueResult, Error>;
|
|
29
49
|
export {};
|
|
30
50
|
//# sourceMappingURL=useGetWalletOptionsCatalogue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetWalletOptionsCatalogue.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useGetWalletOptionsCatalogue.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/wrappers/functions/useGetWalletOptionsCatalogue/useGetWalletOptionsCatalogue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,KAAK,+BAA+B,GAAG,OAAO,CAC5C,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAC7C,CAAC;AACF,KAAK,6BAA6B,GAAG,WAAW,CAC9C,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAChD,CAAC;AAgBF,MAAM,MAAM,kCAAkC,GAC5C,6BAA6B,GAAG;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,CAAC,aAAa,CAAC,CAAC;IACjF;;;;;;;;OAQG;IACH,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,4BAA4B,kEAItC,kCAAkC,KAAQ,cAAc,CACzD,+BAA+B,EAC/B,KAAK,CA2EN,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_useBaseState = require('./useBaseState-
|
|
1
|
+
const require_useBaseState = require('./useBaseState-CG4VKkZG.cjs');
|
|
2
2
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
3
|
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
4
4
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
@@ -2538,21 +2538,62 @@ const CATALOGUE_STALE_TIME_MS = 36e5;
|
|
|
2538
2538
|
* `walletProviderUnregistered` (on removal). Wiring both keeps the catalogue in
|
|
2539
2539
|
* sync without consumers pairing the hook with a manual listener.
|
|
2540
2540
|
*
|
|
2541
|
+
* Also refetches on `networkProviderBuilderRegistered`: the catalogue is scoped
|
|
2542
|
+
* to the chains the client has an extension for, and an extension added after
|
|
2543
|
+
* the first fetch emits no wallet provider event of its own.
|
|
2544
|
+
*
|
|
2545
|
+
* With `includeMobileOptions: true` the installed wallets are returned as
|
|
2546
|
+
* react-query placeholder data while the wallet book loads, so `data` is
|
|
2547
|
+
* populated before the full catalogue resolves and `status` is `'success'`
|
|
2548
|
+
* from the start — `isPlaceholderData` is what tells a partial catalogue from
|
|
2549
|
+
* the complete one.
|
|
2550
|
+
*
|
|
2541
2551
|
* @example
|
|
2542
2552
|
* ```tsx
|
|
2543
2553
|
* const { data: catalogue, isLoading } = useGetWalletOptionsCatalogue();
|
|
2544
2554
|
* ```
|
|
2545
2555
|
*/
|
|
2546
|
-
const useGetWalletOptionsCatalogue = ({ queryParams, ...args } = {}) =>
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
+
const useGetWalletOptionsCatalogue = ({ queryParams, returnInstalledOptionsWhileLoading = true, ...args } = {}) => {
|
|
2557
|
+
const wantsInstalledPlaceholder = (args.includeMobileOptions ?? false) && returnInstalledOptionsWhileLoading && queryParams?.enabled !== false;
|
|
2558
|
+
const middlewares = [
|
|
2559
|
+
invalidateOnEvent({ event: "walletProviderChanged" }),
|
|
2560
|
+
invalidateOnEvent({ event: "walletProviderUnregistered" }),
|
|
2561
|
+
invalidateOnEvent({ event: "networkProviderBuilderRegistered" })
|
|
2562
|
+
];
|
|
2563
|
+
const catalogueArgs = {
|
|
2564
|
+
...args,
|
|
2565
|
+
includeMobileOptions: args.includeMobileOptions ?? false
|
|
2566
|
+
};
|
|
2567
|
+
const installedOnlyArgs = {
|
|
2568
|
+
...args,
|
|
2569
|
+
includeMobileOptions: false
|
|
2570
|
+
};
|
|
2571
|
+
const catalogueCacheKey = (0, _tanstack_react_query.hashKey)([catalogueArgs]);
|
|
2572
|
+
const loadedCatalogueCacheKeyRef = (0, react.useRef)(void 0);
|
|
2573
|
+
const installedOnlyResult = require_useBaseState.useBaseQuery({
|
|
2574
|
+
enabled: wantsInstalledPlaceholder && loadedCatalogueCacheKeyRef.current !== catalogueCacheKey,
|
|
2575
|
+
middlewares,
|
|
2576
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getWalletOptionsCatalogue)(installedOnlyArgs, client),
|
|
2577
|
+
queryKey: ["useGetWalletOptionsCatalogue", installedOnlyArgs],
|
|
2578
|
+
queryParams: {
|
|
2579
|
+
retry: false,
|
|
2580
|
+
staleTime: CATALOGUE_STALE_TIME_MS
|
|
2581
|
+
}
|
|
2582
|
+
});
|
|
2583
|
+
const fullCatalogueResult = require_useBaseState.useBaseQuery({
|
|
2584
|
+
middlewares,
|
|
2585
|
+
queryFn: (client) => (0, _dynamic_labs_sdk_client.getWalletOptionsCatalogue)(catalogueArgs, client),
|
|
2586
|
+
queryKey: ["useGetWalletOptionsCatalogue", catalogueArgs],
|
|
2587
|
+
queryParams: {
|
|
2588
|
+
retry: false,
|
|
2589
|
+
staleTime: CATALOGUE_STALE_TIME_MS,
|
|
2590
|
+
...wantsInstalledPlaceholder ? { placeholderData: () => installedOnlyResult.data } : {},
|
|
2591
|
+
...queryParams
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
loadedCatalogueCacheKeyRef.current = fullCatalogueResult.data !== void 0 && !fullCatalogueResult.isPlaceholderData ? catalogueCacheKey : void 0;
|
|
2595
|
+
return fullCatalogueResult;
|
|
2596
|
+
};
|
|
2556
2597
|
|
|
2557
2598
|
//#endregion
|
|
2558
2599
|
//#region src/hooks/wrappers/functions/useGetWalletPolicyLayer/useGetWalletPolicyLayer.ts
|