-
Notifications
You must be signed in to change notification settings - Fork 2
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
Dynamic client side envs 2 #80
Merged
+298
−234
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
03179ea
Implement dynamic client side envs
JasonMHasperhoven fb644e1
Remove configConstants
JasonMHasperhoven 6e8bdf6
Fix lint issue
JasonMHasperhoven 5c197bb
docs: update readme with new env vars
conorsch a13e384
Add useEnv fetcher
JasonMHasperhoven 4a5cd3c
Refactor app to use fetchers
JasonMHasperhoven 99101c3
Remove ClientEnv type file
JasonMHasperhoven 6948ae3
Merge branch 'main' into dynamic-client-side-envs2
JasonMHasperhoven 11428fa
Fix merge conflict + view pool bug
JasonMHasperhoven a3eb862
Add defaults for client env
JasonMHasperhoven 726c0d0
Fix type import
JasonMHasperhoven 95871aa
Refactor fetchers to suffix Deprecated
JasonMHasperhoven 68a0a8e
Fix duplicate lpAssetView.tsx file
JasonMHasperhoven c9de74a
Fix lint issues
JasonMHasperhoven b014301
Fix lp asset view
JasonMHasperhoven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PENUMBRA_GRPC_ENDPOINT= | ||
PENUMBRA_INDEXER_ENDPOINT= | ||
PENUMBRA_INDEXER_CA_CERT= | ||
PENUMBRA_CHAIN_ID= | ||
PENUMBRA_CUILOA_URL= |
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
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 |
---|---|---|
|
@@ -16,7 +16,6 @@ import { BlockDetailedSummaryData } from "@/utils/types/block"; | |
import { BlockInfo, LiquidityPositionEvent } from "@/utils/indexer/types/lps"; | ||
import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; | ||
import { LoadingSpinner } from "@/components/util/loadingSpinner"; | ||
import { Constants } from "@/utils/configConstants.ts"; | ||
import { formatTimestampShort } from "@/components/blockTimestamp"; | ||
import { AddIcon, MinusIcon } from "@chakra-ui/icons"; | ||
import { innerToBech32Address } from "@/utils/math/bech32"; | ||
|
@@ -25,9 +24,11 @@ import { | |
SwapExecution_Trace, | ||
} from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; | ||
import BigNumber from "bignumber.js"; | ||
import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; | ||
import { useTokenAssets } from "@/utils/token/tokenFetch"; | ||
import { Token } from "@/utils/types/token"; | ||
import { fromBaseUnit } from "@/utils/math/hiLo"; | ||
import { getClientSideEnvs } from "@/utils/env/getClientSideEnvs"; | ||
import { useEnvContext } from "@/utils/env/context"; | ||
|
||
export const Price = ({ | ||
trace, | ||
|
@@ -438,8 +439,9 @@ export default function Block() { | |
}) => { | ||
// ! Expand default | ||
const [isExpanded, setIsExpanded] = useState(false); // EXPAND | ||
const tokenAssets = fetchAllTokenAssets(); | ||
const tokenAssets = useTokenAssets(); | ||
const metadataByAssetId: Record<string, Token> = {}; | ||
const envs = useEnvContext(); | ||
tokenAssets.forEach((asset) => { | ||
metadataByAssetId[asset.inner] = { | ||
symbol: asset.symbol, | ||
|
@@ -653,7 +655,7 @@ export default function Block() { | |
</Text> | ||
<Text> | ||
<a | ||
href={Constants.cuiloaUrl + "/block/" + blockHeight} | ||
href={envs.PENUMBRA_CUILOA_URL + "/block/" + blockHeight} | ||
target="_blank" | ||
rel="noreferrer" | ||
style={{ | ||
|
@@ -704,3 +706,13 @@ export default function Block() { | |
</Layout> | ||
); | ||
} | ||
|
||
export async function getServerSideProps() { | ||
const envs = getClientSideEnvs(); | ||
|
||
return { | ||
props: { | ||
envs, | ||
}, | ||
}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two thoughts:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meant as a placeholder until we have finalized a state manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We we anticipate this env context vars to be critical to a number of things in client side code, we should use react-query to fetch and sync its state with a mobx
EnvContextStore
.