Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rewards field to top-level appconfig #1701

Merged
merged 6 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactor chainlog to makeQueryKey2
  • Loading branch information
DannyDelott committed Jan 3, 2025
commit 2e9f25d36e57e4c436d20e96178df00b6f0de9e9
11 changes: 7 additions & 4 deletions apps/hyperdrive-trading/src/ui/chainlog/FactoriesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "@tanstack/react-table";
import classNames from "classnames";
import { ReactElement } from "react";
import { makeQueryKey } from "src/base/makeQueryKey";
import { makeQueryKey2 } from "src/base/makeQueryKey";
import { getDrift } from "src/drift/getDrift";
import { Status, getStatus } from "src/registry/data";
import { useAppConfigForConnectedChain } from "src/ui/appconfig/useAppConfigForConnectedChain";
Expand Down Expand Up @@ -166,9 +166,12 @@ function useFactoriesQuery(): UseQueryResult<Factory[]> {
const chainIds = Object.keys(connectedAppConfig.registries).map(Number);

return useQuery({
queryKey: makeQueryKey("chainlog", {
tab: "factories",
chainIds,
queryKey: makeQueryKey2({
namespace: "chainlog",
queryId: "factories",
params: {
chainIds,
},
}),
placeholderData: [],
queryFn: async () => {
Expand Down
11 changes: 7 additions & 4 deletions apps/hyperdrive-trading/src/ui/chainlog/PoolsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "@tanstack/react-table";
import classNames from "classnames";
import { ReactElement } from "react";
import { makeQueryKey } from "src/base/makeQueryKey";
import { makeQueryKey2 } from "src/base/makeQueryKey";
import { getDrift } from "src/drift/getDrift";
import { getStatus, Status } from "src/registry/data";
import { useAppConfigForConnectedChain } from "src/ui/appconfig/useAppConfigForConnectedChain";
Expand Down Expand Up @@ -212,9 +212,12 @@ function usePoolsQuery(): UseQueryResult<Pool[]> {
const chainIds = Object.keys(connectedAppConfig.registries).map(Number);

return useQuery({
queryKey: makeQueryKey("chainlog", {
tab: "pools",
chainIds,
queryKey: makeQueryKey2({
namespace: "chainlog",
queryId: "pools",
params: {
chainIds,
},
}),
placeholderData: [],
queryFn: async () =>
Expand Down
16 changes: 16 additions & 0 deletions apps/hyperdrive-trading/src/ui/chainlog/queryKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "src/base/makeQueryKey";

interface ChainlogQueryKeys {
pools: {
chainIds: number[];
};
factories: {
chainIds: number[];
};
}

declare module "src/base/makeQueryKey" {
interface QueryKeys {
chainlog: ChainlogQueryKeys;
}
}