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

feat: add bee desktop toolkit #311

Merged
merged 22 commits into from
Apr 21, 2022
Merged

feat: add bee desktop toolkit #311

merged 22 commits into from
Apr 21, 2022

Conversation

Cafe137
Copy link
Collaborator

@Cafe137 Cafe137 commented Mar 23, 2022

No description provided.

@bee-worker
Copy link
Collaborator

bee-worker commented Mar 23, 2022

🐝 PR preview in Swarm

Preview URL: https://bah5acgzar2i5kjm7xgwtdqrqv6ayf2jybyd5jjetznwt6xigkszrlpgozm3q.bzz.link
Swarm Hash: 8e91d5259fb9ad31c230af8182e9380e07d4a493cb6d3f5d0654b315bccecb37
Commit Hash: 669d21d
Commit Message: chore: merge

@vojtechsimetka
Copy link
Contributor

@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?

@Cafe137 Cafe137 marked this pull request as ready for review April 15, 2022 08:31
@Cafe137 Cafe137 requested a review from vojtechsimetka as a code owner April 15, 2022 08:31
@vojtechsimetka
Copy link
Contributor

@Cafe137 what is the idea now, we merge this after #339 and the following refactor ? Or do you want me to review this?

Cafe137 and others added 2 commits April 20, 2022 12:42
* 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
@Cafe137 Cafe137 changed the title feat: add light node upgrade feat: add bee desktop toolkit Apr 20, 2022
src/layout/Dashboard.tsx Outdated Show resolved Hide resolved
src/layout/Dashboard.tsx Outdated Show resolved Hide resolved
src/providers/Bee.tsx Outdated Show resolved Hide resolved
src/utils/desktop.ts Outdated Show resolved Hide resolved
src/utils/net.ts Outdated Show resolved Hide resolved
src/utils/rpc.ts Outdated Show resolved Hide resolved
Comment on lines 225 to 240
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])

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Comment on lines 21 to 24
interface RpcBalance {
bzz: string
xdai: string
}
Copy link
Contributor

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?

src/utils/desktop.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@vojtechsimetka vojtechsimetka left a 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 :)

@Cafe137 Cafe137 merged commit ecaf205 into master Apr 21, 2022
@Cafe137 Cafe137 deleted the feat/light-node-upgrade branch April 21, 2022 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants