-
Notifications
You must be signed in to change notification settings - Fork 53
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: add bee desktop toolkit #311
Conversation
🐝 PR preview in SwarmPreview URL: https://bah5acgzar2i5kjm7xgwtdqrqv6ayf2jybyd5jjetznwt6xigkszrlpgozm3q.bzz.link |
@Cafe137 what is your idea about this? Should we be rebasing this on master continuously (maybe after we shave off some of the already implemented functionality)? Or do you want to merge this? |
…dashboard into feat/light-node-upgrade
…at/light-node-upgrade
…at/light-node-upgrade
* refactor: extract desktop utils module * fix: add 0x prefix if it missing from address * refactor: extract BalanceProvider * fix: remove double finally * fix: remove token fallbacks * fix: reuse address and handle balance errors * chore: disable eslint for any
src/providers/Bee.tsx
Outdated
useEffect(() => { | ||
if (nodeAddresses?.ethereum) { | ||
// debounced calls | ||
const xdai = Rpc.eth_getBalance(nodeAddresses.ethereum) | ||
const bzz = Rpc.eth_getBalanceERC20(nodeAddresses.ethereum) | ||
|
||
if (xdai?.then) { | ||
xdai.then(balance => setXdai(balance)) | ||
} | ||
|
||
if (bzz?.then) { | ||
bzz.then(balance => setBzz(balance)) | ||
} | ||
} | ||
}, [nodeAddresses]) | ||
|
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.
@vojtechsimetka It seemed a good idea to put the RPC balance checks in a useEffect
hook depending on nodeAddresses
. However that triggered many duplicate requests at the same time, so I had to introduce debouncing. Lmk what you think of this approach.
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.
Yeah this is good. But I think even putting [nodeAddresses?.ethereum]
in the hook could solve it (so at the beginning it is null and then always the same address. But I am also ok with what you implemented.
src/providers/Bee.tsx
Outdated
interface RpcBalance { | ||
bzz: string | ||
xdai: string | ||
} |
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.
Can these be instances of Token already?
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.
Thanks, this looks very good :)
No description provided.