-
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
Feat/wallet integration #49
Conversation
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.
LGTM, but added some tiny comments.
* Returns a list of available wallets | ||
*/ | ||
const getWallets = async () => | ||
fetch(`${BACKEND_URL}/wallet`).then((res) => res.json()); |
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.
do you want to catch any errors?
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.
no, this is intended.
if we catch it here it will alter the promises used later on, and potentially return a "fulfilled" status.
if for example the promise uses a chained .then() after this it will execute as the catch statement will fulfill
for example:
fetch(NaN).then(()=> 1).catch(()=>2).then(()=>3)
returns 3
frontend/context/WalletProvider.tsx
Outdated
const updateBalance = useCallback(async () => { | ||
const walletsToCheck: Address[] = []; | ||
for (const wallet of wallets) { | ||
if (!getAddress || !wallet.address) continue; |
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.
it's harder to understand negative conditions, can we change it? (and for 47 line as well)
if (!getAddress || !wallet.address) continue; | |
if (getAddress && wallet.address) { | |
walletsToCheck.push(wallet.address); | |
} |
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.
i tend to use guard clauses, to exit quickly, avoid future nesting, brackets .etc
will do my best to avoid negative conditions in future
Co-authored-by: Mohan <[email protected]>
…operate-app into feat/wallet-integration
…ction in WalletProvider
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.
LGTM 🎉 thanks @truemiller for addressing all the review requests 🙌
Integrated new Wallet/Account management endpoints