-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ECO-2104] Update market registration components (#234)
- Loading branch information
Showing
9 changed files
with
192 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/typescript/frontend/src/lib/hooks/queries/use-num-markets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { RegistryView } from "@sdk/emojicoin_dot_fun/emojicoin-dot-fun"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { getAptos } from "lib/utils/aptos-client"; | ||
import { useEventStore } from "context/state-store-context"; | ||
|
||
async function getNumMarkets(): Promise<number> { | ||
const aptos = getAptos(); | ||
return RegistryView.view({ aptos }).then((res) => Number(res.n_markets)); | ||
} | ||
|
||
export const useNumMarkets = () => { | ||
const numMarkets = useEventStore((s) => s.symbols.size); | ||
const res = useQuery({ | ||
queryKey: ["num-markets", numMarkets], | ||
queryFn: () => { | ||
return getNumMarkets(); | ||
}, | ||
staleTime: 15000, | ||
}); | ||
|
||
return res; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters