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(sdk): Adds BSC to RFQ #2830

Merged
merged 2 commits into from
Jul 15, 2024
Merged

feat(sdk): Adds BSC to RFQ #2830

merged 2 commits into from
Jul 15, 2024

Conversation

abtestingalpha
Copy link
Collaborator

@abtestingalpha abtestingalpha commented Jul 1, 2024

Summary by CodeRabbit

  • New Features

    • Added support for Binance Smart Chain (BSC) with a new chain ID.
  • Updates

    • Chain ID for Binance Smart Chain (BSC) added to the list of supported chain IDs.
    • Median time for RFQ on Binance Smart Chain (BSC) set to 15.
  • Tests

    • Updated test configurations to use Arbitrum instead of Binance Smart Chain (BSC).

Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

Walkthrough

The overall changes introduce support for the Binance Smart Chain (BSC) in the sdk-router package by adding its chain ID to the supported RFQ chains and setting its median time value. Additionally, the SynapseSDK test suite has been updated to replace references from BSC to Arbitrum, including updating providers and bridge quote parameters.

Changes

File Path Change Summary
.../src/constants/chainIds.ts Added SupportedChainId.BSC to RFQ_SUPPORTED_CHAIN_IDS array
.../src/constants/medianTime.ts Added a new entry for [SupportedChainId.BSC]: 15 to MEDIAN_TIME_RFQ
.../src/sdk.test.ts Changed supported chain from BSC to ARBITRUM and updated corresponding provider and token symbols

Poem

In the land of code where chains align,
Binance joins the RFQ line.
Arbitrum steps in for the test,
Both chains now at their best.
Tokens swap and bridges link,
All in sync, without a blink.
CodeRabbit hops with glee,
For seamless chains are now the key!


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Outside diff range and nitpick comments (1)
packages/sdk-router/src/constants/chainIds.ts (1)

Line range hint 35-35: Use Number.isNaN instead of isNaN.

isNaN attempts a type coercion. Use Number.isNaN for safety.

-  .filter((chainId) => !isNaN(chainId))
+  .filter((chainId) => !Number.isNaN(chainId))
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d0f1508 and 44acb5b.

Files selected for processing (2)
  • packages/sdk-router/src/constants/chainIds.ts (1 hunks)
  • packages/sdk-router/src/constants/medianTime.ts (1 hunks)
Additional context used
Biome
packages/sdk-router/src/constants/chainIds.ts

[error] 35-35: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Additional comments not posted (2)
packages/sdk-router/src/constants/medianTime.ts (1)

54-54: LGTM!

The addition of SupportedChainId.BSC to the MEDIAN_TIME_RFQ constant is correct and consistent with the format used in the file.

packages/sdk-router/src/constants/chainIds.ts (1)

64-64: LGTM!

The addition of SupportedChainId.BSC to the RFQ_SUPPORTED_CHAIN_IDS array is correct and consistent with the format used in the file.

Copy link

cloudflare-workers-and-pages bot commented Jul 1, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6fe2406
Status: ✅  Deploy successful!
Preview URL: https://72f71de1.sanguine-fe.pages.dev
Branch Preview URL: https://sdk-adds-bsc.sanguine-fe.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 44acb5b and 5630920.

Files selected for processing (1)
  • packages/sdk-router/src/sdk.test.ts (2 hunks)
Additional comments not posted (4)
packages/sdk-router/src/sdk.test.ts (4)

923-924: Verify the context of changes.

The initialization of SynapseSDK with ETH and ARBITRUM doesn't directly relate to the added BSC support. Ensure this change aligns with the overall PR objectives.


986-988: LGTM!

The test case correctly ensures that bridgeQuote throws an error when the amount is too low, maintaining the robustness of the SDK.


923-924: Verify the context of changes.

The initialization of SynapseSDK with ETH and ARBITRUM doesn't directly relate to the added BSC support. Ensure this change aligns with the overall PR objectives.


986-988: LGTM!

The test case correctly ensures that bridgeQuote throws an error when the amount is too low, maintaining the robustness of the SDK.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.57546%. Comparing base (99f3c9a) to head (6fe2406).

Additional details and impacted files
@@              Coverage Diff              @@
##              master       #2830   +/-   ##
=============================================
  Coverage   23.57546%   23.57546%           
=============================================
  Files            679         679           
  Lines          50841       50841           
  Branches          80          80           
=============================================
  Hits           11986       11986           
  Misses         37533       37533           
  Partials        1322        1322           
Flag Coverage Δ
packages 90.57540% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5630920 and 6fe2406.

Files selected for processing (3)
  • packages/sdk-router/src/constants/chainIds.ts (1 hunks)
  • packages/sdk-router/src/constants/medianTime.ts (1 hunks)
  • packages/sdk-router/src/sdk.test.ts (2 hunks)
Additional comments not posted (3)
packages/sdk-router/src/constants/medianTime.ts (1)

54-54: Addition of BSC to MEDIAN_TIME_RFQ is Correct

The addition of [SupportedChainId.BSC]: 15 follows the existing structure and is syntactically correct.

packages/sdk-router/src/constants/chainIds.ts (1)

64-64: Addition of BSC to RFQ_SUPPORTED_CHAIN_IDS is Correct

The addition of SupportedChainId.BSC follows the existing structure and is syntactically correct.

packages/sdk-router/src/sdk.test.ts (1)

923-924: Update of Supported Chain from BSC to ARBITRUM is Correct

The supported chain has been updated from SupportedChainId.BSC to SupportedChainId.ARBITRUM, and the corresponding providers have been updated accordingly. This change is syntactically correct and consistent with the test's objectives.

Copy link

codecov bot commented Jul 12, 2024

Bundle Report

Changes will decrease total bundle size by 7.17MB ⬇️

Bundle name Size Change
widget-cjs-esm 273.3kB 273.3kB ⬆️
widget-esm-cjs 275.25kB 0 bytes
synapse-interface-server-cjs 1.37MB 1 bytes ⬆️
sdk-router-@synapsecns/sdk-router-esm 252.15kB 67 bytes ⬆️
sdk-router-@synapsecns/sdk-router-cjs 116.93kB 18 bytes ⬆️
synapse-interface-edge-server-array-push 83 bytes 0 bytes
synapse-interface-client-array-push (removed) 7.44MB ⬇️

@abtestingalpha abtestingalpha marked this pull request as ready for review July 15, 2024 16:54
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Added Binance Smart Chain (BSC) to RFQ_SUPPORTED_CHAIN_IDS in /packages/sdk-router/src/constants/chainIds.ts
  • Set median RFQ transaction time for BSC to 15 seconds in /packages/sdk-router/src/constants/medianTime.ts
  • Updated test configurations to use Arbitrum instead of BSC in /packages/sdk-router/src/sdk.test.ts

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@abtestingalpha abtestingalpha merged commit 5fb5e8a into master Jul 15, 2024
51 checks passed
@abtestingalpha abtestingalpha deleted the sdk/adds-bsc branch July 15, 2024 16:58
@coderabbitai coderabbitai bot mentioned this pull request Jul 16, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 11, 2024
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.

1 participant