-
Notifications
You must be signed in to change notification settings - Fork 16
fix: use getWhitelistedRoot #514
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sirpy
commented
Feb 9, 2026
Contributor
Author
sirpy
left a comment
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.
Contributor
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.
Hey - I've found 2 issues, and left some high level feedback:
- In
Web3Wallet.isConnected, the error log message still says'Error isVerified', which is misleading now that this is a separate method; update the message to referenceisConnectedinstead. - In
MultiWallet.isConnected, consider short-circuiting on the first wallet that returnstrueinstead of awaitingPromise.all, so you don't wait for all providers when an early one already confirms connectivity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `Web3Wallet.isConnected`, the error log message still says `'Error isVerified'`, which is misleading now that this is a separate method; update the message to reference `isConnected` instead.
- In `MultiWallet.isConnected`, consider short-circuiting on the first wallet that returns `true` instead of awaiting `Promise.all`, so you don't wait for all providers when an early one already confirms connectivity.
## Individual Comments
### Comment 1
<location> `src/server/blockchain/Web3Wallet.js:650-654` </location>
<code_context>
+ * @param {string} address
+ * @returns {Promise<boolean>}
+ */
+ async isConnected(address: string): Promise<boolean> {
+ const { log } = this
+
+ const tx: string = await this.identityContract.methods
+ .getWhitelistedRoot(address)
+ .call()
+ .catch(e => {
+ log.error('Error isVerified', e.message, e)
+ throw e
+ })
</code_context>
<issue_to_address>
**issue (typo):** Log message refers to `isVerified` while the function is `isConnected`, which can be confusing when debugging.
In the catch block, the log still says `Error isVerified`, likely from a previous method. Please update it to reference `isConnected` so logs remain clear and distinguishable if both methods are present.
```suggestion
.call()
.catch(e => {
log.error('Error isConnected', e.message, e)
throw e
})
```
</issue_to_address>
### Comment 2
<location> `src/server/blockchain/MultiWallet.js:122-124` </location>
<code_context>
return this.mainWallet.isVerified(account)
}
+ async isConnected(account) {
+ return (await Promise.all(this.wallets.map(wallet => wallet.isConnected(account)))).find(_ => _)
+ }
+
</code_context>
<issue_to_address>
**suggestion:** The return value of `isConnected` can be `true` or `undefined`, not strictly `boolean`, and could be made clearer and more idiomatic.
Since each `wallet.isConnected` returns a boolean, `.find(_ => _)` yields `true` or `undefined`. That’s fine for truthy checks but unintuitive for an `isConnected` method that callers will expect to return a boolean. You could make this explicit with:
```js
async isConnected(account) {
const results = await Promise.all(
this.wallets.map(wallet => wallet.isConnected(account))
)
return results.some(Boolean)
}
```
This preserves the intended semantics while guaranteeing a `boolean` return type.
```suggestion
async isConnected(account) {
const results = await Promise.all(
this.wallets.map(wallet => wallet.isConnected(account))
)
return results.some(Boolean)
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1 task
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add method to check isConnected
use that method only for gas topping related
Summary by Sourcery
Use Identity contract whitelisting to determine wallet connection status and apply it to gas-topping eligibility checks.
New Features:
Bug Fixes: