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

Cross Chain Helper and THEA Withdrawal fix #262

Merged
merged 6 commits into from
May 23, 2024

Conversation

ap211unitech
Copy link
Member

@ap211unitech ap211unitech commented May 23, 2024

Description

In this PR, we will be going to add these changes -

  • In current interface for cross chain transfer, we are lagging a helper function for getting all supported assets for a chain. Basically, we need to have a function getAllAssets for each chain. It's a must have function as Orderbook is using it frequently.

  • Polkadex to other chain transfer i.e. THEA withdrawal is failing as there is a change in extrinsic. We will be making change to it accordingly to match backend requirements.

Summary by CodeRabbit

  • New Features
    • Added getAllAssets() method to various blockchain classes (Sepolia, AssetHub, Astar, Bifrost, Interlay, Moonbeam, Phala, Polkadex, Polkadot, Unique) to retrieve and map all assets.
    • Enhanced BaseChainAdapter interface with the new getAllAssets() method for unified asset retrieval.

These changes provide a consistent way to access and manage all assets across different blockchain implementations, improving the user experience by simplifying asset management.

Copy link

changeset-bot bot commented May 23, 2024

🦋 Changeset detected

Latest commit: 7e435fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@polkadex/thea Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented May 23, 2024

Warning

Rate Limit Exceeded

@ap211unitech has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 51 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Commits Files that changed from the base of the PR and between 5f9a9df and 7e435fc.

Walkthrough

The recent updates across various classes in the SDK introduce a new method getAllAssets() to retrieve all supported assets from different blockchain environments. This addition enhances the SDK's functionality by providing a consistent way to access assets. Additionally, the method has been added to the BaseChainAdapter interface, ensuring uniformity in asset retrieval across different chain adapters.

Changes

Files Change Summary
.../sdk/evm/sepolia.ts Added getAllAssets() method to return ETHEREUM_ASSETS.ETH and ETHEREUM_ASSETS.LINK.
.../sdk/substrate/assetHub.ts, .../sdk/substrate/astar.ts,
.../sdk/substrate/bifrost.ts, .../sdk/substrate/interlay.ts,
.../sdk/substrate/moonbeam.ts, .../sdk/substrate/phala.ts,
.../sdk/substrate/polkadex.ts, .../sdk/substrate/polkadot.ts Added getAllAssets() method to retrieve assets from chain.assetsData and map them to Asset objects.
.../sdk/substrate/unique.ts Added getAllAssets() method to map assets from chain.assetsData to a different format using changeSubstrateToBaseAsset().
.../sdk/types.ts Updated BaseChainAdapter interface to include getAllAssets() method returning an array of Asset.

🐰
In the world of code, changes bloom,
New methods in the SDK room.
Assets gather, one and all,
From Sepolia's ETH to Polkadot's call.
Chains unite in data's dance,
Enhancing functions, seizing chance.
A rabbit's joy in every line,
Celebrating code that's truly fine. 🌸


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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

@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 UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9776bc1 and fa2e2bc.
Files selected for processing (11)
  • packages/thea/src/sdk/evm/sepolia.ts (1 hunks)
  • packages/thea/src/sdk/substrate/assetHub.ts (1 hunks)
  • packages/thea/src/sdk/substrate/astar.ts (1 hunks)
  • packages/thea/src/sdk/substrate/bifrost.ts (1 hunks)
  • packages/thea/src/sdk/substrate/interlay.ts (1 hunks)
  • packages/thea/src/sdk/substrate/moonbeam.ts (1 hunks)
  • packages/thea/src/sdk/substrate/phala.ts (1 hunks)
  • packages/thea/src/sdk/substrate/polkadex.ts (1 hunks)
  • packages/thea/src/sdk/substrate/polkadot.ts (1 hunks)
  • packages/thea/src/sdk/substrate/unique.ts (1 hunks)
  • packages/thea/src/sdk/types.ts (1 hunks)
Additional comments not posted (11)
packages/thea/src/sdk/types.ts (1)

26-28: The addition of getAllAssets method to the BaseChainAdapter interface is a good enhancement for standardizing asset retrieval across different chain adapters.

packages/thea/src/sdk/substrate/interlay.ts (1)

41-45: The implementation of getAllAssets in the Interlay class correctly utilizes changeSubstrateToBaseAsset to map substrate assets to the base asset format, enhancing the SDK's functionality.

packages/thea/src/sdk/substrate/bifrost.ts (1)

41-45: The implementation of getAllAssets in the Bifrost class correctly utilizes changeSubstrateToBaseAsset to map substrate assets to the base asset format, enhancing the SDK's functionality.

packages/thea/src/sdk/substrate/astar.ts (1)

41-45: The implementation of getAllAssets in the Astar class correctly utilizes changeSubstrateToBaseAsset to map substrate assets to the base asset format, enhancing the SDK's functionality.

packages/thea/src/sdk/substrate/phala.ts (1)

41-45: The implementation of getAllAssets in the Phala class correctly utilizes changeSubstrateToBaseAsset to map substrate assets to the base asset format, enhancing the SDK's functionality.

packages/thea/src/sdk/substrate/unique.ts (1)

41-45: The implementation of getAllAssets in the Unique class correctly utilizes changeSubstrateToBaseAsset to map substrate assets to the base asset format, enhancing the SDK's functionality.

packages/thea/src/sdk/substrate/assetHub.ts (1)

41-45: The implementation of getAllAssets method looks correct and aligns with the PR objectives.

Consider checking the performance if assetsData contains a large number of assets, as mapping over them could be computationally expensive.

packages/thea/src/sdk/substrate/moonbeam.ts (1)

41-45: The implementation of getAllAssets method in Moonbeam class is correct and consistent with the PR objectives.

Consider evaluating the performance if assetsData contains a large number of assets, as mapping over them could be computationally expensive.

packages/thea/src/sdk/substrate/polkadot.ts (1)

41-45: The implementation of getAllAssets method in Polkadot class is correct and aligns with the PR objectives.

Consider evaluating the performance if assetsData contains a large number of assets, as mapping over them could be computationally expensive.

packages/thea/src/sdk/substrate/polkadex.ts (1)

41-45: The implementation of getAllAssets method in Polkadex class is correct and consistent with the PR objectives.

Consider evaluating the performance if assetsData contains a large number of assets, as mapping over them could be computationally expensive.

packages/thea/src/sdk/evm/sepolia.ts (1)

41-43: The implementation of getAllAssets method in Sepolia class is correct and aligns with the PR objectives.

Copy link

@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 UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between fa2e2bc and 5f9a9df.
Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/*.lock
Files selected for processing (1)
  • apps/web/.gitignore (1 hunks)
Files skipped from review due to trivial changes (1)
  • apps/web/.gitignore

@ap211unitech ap211unitech self-assigned this May 23, 2024
@ap211unitech ap211unitech linked an issue May 23, 2024 that may be closed by this pull request
2 tasks
@nuel77 nuel77 merged commit bb6746c into main May 23, 2024
4 checks passed
@nuel77 nuel77 deleted the feedback/cross-chain-interface branch May 23, 2024 08:12
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.

Cross Chain Interface II
3 participants