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

Portfolio Onboarding Section #391

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Portfolio Onboarding Section #391

wants to merge 6 commits into from

Conversation

JasonMHasperhoven
Copy link
Contributor

@JasonMHasperhoven JasonMHasperhoven commented Mar 14, 2025

Implements #387

image image image

@JasonMHasperhoven JasonMHasperhoven marked this pull request as ready for review March 14, 2025 17:03
@JasonMHasperhoven JasonMHasperhoven requested a review from a team March 14, 2025 17:03
Copy link
Contributor

@TalDerei TalDerei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work on the onboarding section 👍

I left some observations and suggested changes to minimize the diff.

const [isOpen, setIsOpen] = useState(false);
const { data: providerManifests } = useProviderManifests();
const providerOrigins = useMemo(() => Object.keys(PenumbraClient.getProviders()), []);
const { isPenumbraConnected, isCosmosConnected } = useUnifiedAssets();
Copy link
Contributor

@TalDerei TalDerei Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: can we refactor the cosmos connection status logic in useUnifiedAssets into a separate hook (eg. useConnectionStatus.tsx) to reduce scope? useUnifiedAssets definitionally is more focused on asset management, which includes other expensive computations like balance aggregation and price fetching.

#380 can then modify useUnifiedAssets to use that hook accordingly. That way, we can remove all direct references to use-unified-assets.tsx and use-augmented-balances.tsx here. cc @vacekj

const providerOrigins = useMemo(() => Object.keys(PenumbraClient.getProviders()), []);
const { isPenumbraConnected, isCosmosConnected } = useUnifiedAssets();

const onConnectClick = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: experiencing CORS, 401 unauthorized, and 404 not found errors in the dev logs when connecting to the keplr wallet – could this be due to it attempting to connect on localhost?


Screen.Recording.2025-03-14.at.2.31.54.PM.mov

* Uses the same summaries API that the explore page uses
* Only returns prices denominated in USDC
*/
export const useAssetPrices = (assets: Metadata[] = []) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const onConnectClick = () => {
if (providerOrigins.length > 1) {
setIsOpen(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: we should avoid potentially triggering a state update during rendering – I think this violates React rules and should use useEffect instead?

if (priceData?.quoteSymbol === 'USDC' && !isNaN(priceData.price)) {
// Use price data if available
assetValue = numericAmount * priceData.price;
} else if (isStablecoinSymbol(metadata.symbol)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: check if metadata is undefined

if (metadata && isStablecoinSymbol(metadata.symbol)) { ... }

Comment on lines +20 to +21
// @ts-expect-error type error, but it works.
import '@interchain-ui/react/styles';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: unused import?

durationWindow: '1d', // Use 1-day window
});
},
staleTime: 60000, // 1 minute
Copy link
Contributor

@TalDerei TalDerei Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: should we fetch prices more frequently? I think it may be fine for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants