-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Query Pindexer db for candles * Add symbol hook * working candles w/ buttons * Remove old candle api route * remove more * docs: update database reqs to pindexer * Review updates --------- Co-authored-by: Conor Schaefer <[email protected]>
- Loading branch information
Showing
31 changed files
with
388 additions
and
840 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
1 change: 0 additions & 1 deletion
1
app/api/candles/[symbol1]/[symbol2]/[startHeight]/[limit]/route.ts
This file was deleted.
Oops, something went wrong.
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 @@ | ||
export { GET } from '@/shared/api/server/candles/index.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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { redirect } from 'next/navigation'; | ||
import { RedirectToPair } from '@/pages/trade/redirect.tsx'; | ||
|
||
export default function RedirectPage() { | ||
redirect('/trade/UM/GM'); | ||
} | ||
export default RedirectToPair; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client'; | ||
|
||
import { redirect } from 'next/navigation'; | ||
import { ChainRegistryClient } from '@penumbra-labs/registry'; | ||
import { envQueryFn } from '@/shared/api/env/env.ts'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { assetPatterns } from '@penumbra-zone/types/assets'; | ||
|
||
const redirectSymbolsQueryFn = async () => { | ||
const { PENUMBRA_CHAIN_ID } = await envQueryFn(); | ||
const chainRegistryClient = new ChainRegistryClient(); | ||
const registry = await chainRegistryClient.remote.get(PENUMBRA_CHAIN_ID); | ||
const allAssets = registry | ||
.getAllAssets() | ||
.filter(m => !assetPatterns.delegationToken.matches(m.display)) | ||
.toSorted((a, b) => Number(b.priorityScore - a.priorityScore)); | ||
|
||
const baseAsset = allAssets[0]?.symbol; | ||
const quoteAsset = allAssets[1]?.symbol; | ||
if (!baseAsset || !quoteAsset) { | ||
throw new Error('Could not find symbols in registry'); | ||
} | ||
|
||
return { baseAsset, quoteAsset }; | ||
}; | ||
|
||
export const RedirectToPair = () => { | ||
const { data, isLoading, error } = useQuery({ | ||
queryKey: ['redirectSymbols'], | ||
retry: 1, | ||
queryFn: redirectSymbolsQueryFn, | ||
}); | ||
|
||
if (error) { | ||
return <div className='text-red-600'>{String(error)}</div>; | ||
} else if (isLoading || !data) { | ||
return <div className='text-white'>Loading...</div>; | ||
} else { | ||
redirect(`/trade/${data.baseAsset}/${data.quoteAsset}`); | ||
} | ||
}; |
Oops, something went wrong.