@latticexyz/entrykit 2.2.22-599ea71ff11bf2f1ea15dee14514dbfa301eb977 → 2.2.22-5b0ec82a03d09e53ebf0ef0eb29682dda4c9d687
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.
|
@@ -564,7 +564,7 @@ import { twMerge as twMerge18 } from "tailwind-merge";
|
|
|
564
564
|
// src/onboarding/usePrerequisites.ts
|
|
565
565
|
import { useClient as useClient6, useConfig } from "wagmi";
|
|
566
566
|
import { getBalanceQueryOptions as getBalanceQueryOptions2 } from "wagmi/query";
|
|
567
|
-
import { queryOptions as queryOptions6,
|
|
567
|
+
import { queryOptions as queryOptions6, useQuery as useQuery7, useQueryClient } from "@tanstack/react-query";
|
|
568
568
|
|
|
569
569
|
// src/getPaymaster.ts
|
|
570
570
|
function getPaymaster(chain) {
|
|
@@ -919,7 +919,9 @@ function getPrequisitesQueryOptions({
|
|
|
919
919
|
}) {
|
|
920
920
|
return queryOptions6({
|
|
921
921
|
queryKey: ["getPrerequisites", client?.uid, userAddress],
|
|
922
|
-
queryFn:
|
|
922
|
+
queryFn: async () => {
|
|
923
|
+
if (!client) throw new Error("Viem client not ready.");
|
|
924
|
+
if (!userAddress) throw new Error("User not connected.");
|
|
923
925
|
const paymaster = getPaymaster(client.chain);
|
|
924
926
|
const {
|
|
925
927
|
account: { address: sessionAddress }
|
|
@@ -947,7 +949,7 @@ function getPrequisitesQueryOptions({
|
|
|
947
949
|
// we intentionally don't enforce an allowance/gas balance here
|
|
948
950
|
complete: isSpender && hasDelegation
|
|
949
951
|
};
|
|
950
|
-
}
|
|
952
|
+
},
|
|
951
953
|
retry: false
|
|
952
954
|
});
|
|
953
955
|
}
|
|
@@ -1458,7 +1460,6 @@ function useSetupSession({ userClient }) {
|
|
|
1458
1460
|
import { useClient as useClient9 } from "wagmi";
|
|
1459
1461
|
import {
|
|
1460
1462
|
queryOptions as queryOptions7,
|
|
1461
|
-
skipToken as skipToken7,
|
|
1462
1463
|
useQuery as useQuery9,
|
|
1463
1464
|
useQueryClient as useQueryClient4
|
|
1464
1465
|
} from "@tanstack/react-query";
|
|
@@ -1546,7 +1547,8 @@ function getSessionClientQueryOptions({
|
|
|
1546
1547
|
}) {
|
|
1547
1548
|
return queryOptions7({
|
|
1548
1549
|
queryKey: ["getSessionClient", client?.uid, userAddress, worldAddress],
|
|
1549
|
-
queryFn:
|
|
1550
|
+
queryFn: async () => {
|
|
1551
|
+
if (!userAddress) throw new Error("User not connected.");
|
|
1550
1552
|
const { account: sessionAccount, signer: sessionSigner } = await queryClient.fetchQuery(
|
|
1551
1553
|
getSessionAccountQueryOptions({ client, userAddress })
|
|
1552
1554
|
);
|
|
@@ -1556,7 +1558,7 @@ function getSessionClientQueryOptions({
|
|
|
1556
1558
|
userAddress,
|
|
1557
1559
|
worldAddress
|
|
1558
1560
|
});
|
|
1559
|
-
}
|
|
1561
|
+
},
|
|
1560
1562
|
staleTime: Infinity,
|
|
1561
1563
|
// TODO: replace with function to retry only connection errors
|
|
1562
1564
|
retry: false
|
|
@@ -2257,7 +2259,7 @@ function useRelay() {
|
|
|
2257
2259
|
// src/onboarding/deposit/useChainBalances.ts
|
|
2258
2260
|
import { useAccount, useConfig as useWagmiConfig } from "wagmi";
|
|
2259
2261
|
import { getBalance as getBalance2 } from "wagmi/actions";
|
|
2260
|
-
import { useQuery as useQuery11, skipToken as
|
|
2262
|
+
import { useQuery as useQuery11, skipToken as skipToken6 } from "@tanstack/react-query";
|
|
2261
2263
|
import { isNotNull } from "@latticexyz/common/utils";
|
|
2262
2264
|
function useChainBalances({ chains }) {
|
|
2263
2265
|
const { address: userAddress } = useAccount();
|
|
@@ -2273,7 +2275,7 @@ function useChainBalances({ chains }) {
|
|
|
2273
2275
|
})
|
|
2274
2276
|
);
|
|
2275
2277
|
return chainBalances.map((result) => result.status === "fulfilled" ? result.value : null).filter(isNotNull);
|
|
2276
|
-
} :
|
|
2278
|
+
} : skipToken6,
|
|
2277
2279
|
refetchInterval: 1e3 * 60,
|
|
2278
2280
|
retry: 1
|
|
2279
2281
|
});
|
|
@@ -3626,7 +3628,7 @@ function AccountButton() {
|
|
|
3626
3628
|
"hover:bg-orange-400",
|
|
3627
3629
|
"active:bg-orange-600"
|
|
3628
3630
|
),
|
|
3629
|
-
"aria-busy": accountModalOpen,
|
|
3631
|
+
"aria-busy": accountModalOpen || prereqs.isPending,
|
|
3630
3632
|
onClick: openAccountModal,
|
|
3631
3633
|
children: [
|
|
3632
3634
|
/* @__PURE__ */ jsxs29("span", { className: "pointer-events-none inline-grid place-items-center -ml-3", children: [
|
|
@@ -3670,8 +3672,9 @@ function useSessionClientReady() {
|
|
|
3670
3672
|
const userAddress = userClient.data?.account.address;
|
|
3671
3673
|
const prerequisites = usePrerequisites(userAddress);
|
|
3672
3674
|
const sessionClient = useSessionClient(userAddress);
|
|
3673
|
-
if (!
|
|
3674
|
-
|
|
3675
|
+
if (!prerequisites.isSuccess || !prerequisites.data.complete) {
|
|
3676
|
+
return { ...prerequisites, data: void 0 };
|
|
3677
|
+
}
|
|
3675
3678
|
return sessionClient;
|
|
3676
3679
|
}
|
|
3677
3680
|
|