-
Notifications
You must be signed in to change notification settings - Fork 22
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
refactor(getBalances): Use multicall3 to reduce numer of RPC calls #162
Conversation
Warning Rate limit exceeded@fadeev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 15 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes enhance efficiency and flexibility in multiple areas of the project. The balance retrieval logic in Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MulticallContract
participant TokenContract
Client->>MulticallContract: Request balances for multiple tokens
MulticallContract->>TokenContract: Batch request for token balances
TokenContract-->>MulticallContract: Return token balances
MulticallContract-->>Client: Return aggregated balances
Note over Client,TokenContract: If multicall fails:
Client->>TokenContract: Request individual token balances
TokenContract-->>Client: Return individual token balances
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- packages/client/src/getBalances.ts (2 hunks)
- packages/tasks/src/account.ts (1 hunks)
- packages/tasks/src/balances.ts (1 hunks)
- packages/tasks/src/bitcoinAddress.ts (1 hunks)
Additional context used
GitHub Check: build
packages/tasks/src/bitcoinAddress.ts
[failure] 5-5:
Union type members must be sortedpackages/client/src/getBalances.ts
[failure] 142-142:
Expected object keys to be in ascending order. 'callData' should be before 'target'
Additional comments not posted (3)
packages/tasks/src/account.ts (1)
73-73
: LGTM!The additional argument
"testnet"
in thebitcoinAddress
function call is correctly integrated.packages/tasks/src/balances.ts (1)
50-50
: LGTM!The additional argument based on the value of
args.mainnet
in thebitcoinAddress
function call is correctly integrated.packages/client/src/getBalances.ts (1)
Line range hint
23-248
:
LGTM!The refactor to use multicall for more efficient token balance retrieval is correctly integrated and improves efficiency.
Tools
GitHub Check: build
[failure] 142-142:
Expected object keys to be in ascending order. 'callData' should be before 'target'
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@andresaiello @lucas-janon @zeta-chain/fullstack please, review. |
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.
utACK
--mainnet
Before, 160 requests:
After, 76 requests:
Seems like a solid 2x performance improvement. We can now use public RPC endpoints for the component library and not be rate-limited.
Summary by CodeRabbit
New Features
testnet
ormainnet
).Improvements