Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

feat: combine mint token function, remove - as it was confusing #13

Merged
merged 8 commits into from
Feb 22, 2024

Conversation

R-K-H
Copy link
Member

@R-K-H R-K-H commented Feb 20, 2024

There may be a few errors with type checking and assuming tokens which need review. However I believe this simplifies a component so that we don't have a ton of information which isn't always relevant to the user.


if (!markets) return null;

const [mintAmount, setMintAmount] = useState<number>();
const fromBase = markets.baseVault.underlyingTokenMint.equals(token.publicKey);
const [token, setToken] = useState<string>('meta');
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could use selectedTokenName and token, might be a bit more clear

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, what's the point of using two variables instead of only storing a token and using its name attributes when needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Totally, I think it was because I couldn't get typing to work and I revert back to "how can I get this to work" vs "this is the right way to do it" but yep will circle back on this.

}, [token]);

// TODO: Fetch the two tokens
const fromBase = markets.baseVault.underlyingTokenMint.equals(_token.publicKey);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could memoize fromFail, fromPass, vaultFail & vaultPass, then set fromBase and vault on _token change. Do we want to do that in that PR ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Anything that reduces overhead is best effort. So moving towards that is critical.

@R-K-H
Copy link
Member Author

R-K-H commented Feb 21, 2024

Looking for some feedback where and what to put in useMemo as when I toss the balances in there it fails.

@swaggymarie swaggymarie merged commit 57aa022 into master Feb 22, 2024
1 check passed
@R-K-H R-K-H deleted the feat/mint-combine branch March 5, 2024 21:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants