-
Notifications
You must be signed in to change notification settings - Fork 176
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: update 0x api to reflect new changes #632
base: develop
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@gamalielhere has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 56 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. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
WalkthroughThe changes update the fee-handling logic in the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant Z as ZeroX.getZeroXSwap
participant API as API Request
C->>Z: Call getZeroXSwap(feeConfig, toToken, ...)
Z->>Z: Compute bpsFee from feeConfig fee value
Z->>Z: Set feeContract using toToken address
Z->>Z: Assemble params with swapFeeBps, swapFeeToken, swapFeeRecipient
Z->>API: Send API request with updated parameters
API-->>Z: Return swap response
Z-->>C: Return swap quote
🪧 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
💼 Build Files |
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: 0
🧹 Nitpick comments (2)
packages/swap/src/providers/zerox/index.ts (2)
153-154
: Add semicolon and consider clarifying fee calculationI noticed a missing semicolon at the end of line 154 which should be added for consistency. Additionally, the fee calculation on line 153 is quite complex - it's converting a percentage to basis points (BPS) with specific formatting. Consider adding a comment explaining this conversion logic for clarity.
const bpsFee = parseFloat((feeConfig.fee * 100).toFixed(4)) * 100; -const feeContract = options.toToken.address +const feeContract = options.toToken.address;
159-162
: LGTM: Updated fee parameters for 0x APIThe changes correctly implement the updated fee parameter structure required by the 0x API. The code now uses
swapFeeBps
,swapFeeToken
, andswapFeeRecipient
instead of the previous parameters.There's some inconsistency in how
feeConfig
is null-checked though - line 153 uses it directly while line 161 performs a conditional check. Consider standardizing this approach.swapFeeBps: bpsFee.toString(), swapFeeToken: feeContract, -swapFeeRecipient: feeConfig ? feeConfig.referrer : "", +swapFeeRecipient: feeConfig.referrer,
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/swap/src/providers/zerox/index.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: buildAll
- GitHub Check: test
…into feat/update-0x
Summary by CodeRabbit