eliza icon indicating copy to clipboard operation
eliza copied to clipboard

feat(plugin-sui): add support for swapping and transferring by domain name, and converting domain name to address

Open Vakurin opened this issue 11 months ago • 3 comments

Relates to

N/A - New feature addition

Risks

Low - new features, but there may be instances where the model could trigger incorrect actions

Background

What does this PR do?

  • Integrates swap functionality using Aftermath, one of the top DEXs on the Sui
  • Updates the transfer function to support both SuiNS domains and wallet addresses
  • Implements SuiNS domain-to-address conversion for seamless user experience
  • Fixes wallet balance display to show the correct dollar equivalent

What kind of change is this?

Bug Fixes: Resolves issues with wallet balance calculations. Feature Addition: Adds swap functionality using Aftermath and SuiNS domain-to-address conversion. Improvements: Enhances the transfer function to support both SuiNS domains and wallet addresses.

Documentation changes needed?

Testing

Where should a reviewer start?

  1. Install the new dependencies required for domain and swap functionalities.
  2. Review all files in the packages/plugin-sui/src/actions directory to verify updates to the Sui plugin actions.

Detailed Testing Steps

  1. Test Domain Conversion

    • Ask the bot to convert a domain name to an address. Example:
      "Convert maxim.sui to address"
  2. Test New Transfer Functionality

    • Verify transfers by using both SuiNS domain and wallet address. Examples:
      • "Send 0.1 SUI to maxim.sui"
      • "Send 0.1 SUI to {sui_address}"
  3. Test Swap Functionality

    • Perform a swap by providing the coin type of two tokens, the amount, and the recipient. Example:
      • "Swap 0.1 SUI (0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI) to AAA (0xd976fda9a9786cda1a36dee360013d775a5e5f206f8e20f84fad3385e99eeb2d::aaa::AAA) my wallet: 0xe6e494d014eb41edacae84bfc5893ab5616be246064d52b452ba88828a548b8b"

Discord username

max_holasui.app

Vakurin avatar Jan 11 '25 00:01 Vakurin

@coderabbitai review

wtfsayo avatar Jan 11 '25 15:01 wtfsayo

📝 Walkthrough

Walkthrough

The pull request introduces updates to the Sui blockchain plugin, including new actions for converting SUI domain names to addresses and swapping tokens. It also enhances the transfer functionality to support Sui Name Service (SuiNS) names. Additionally, several new dependencies are added, utility functions are introduced for address resolution and coin type validation, and the price calculation method is refined for improved precision.

Changes

File Change Summary
packages/plugin-sui/README.md Updated SDK reference from @mysten/sui.js to @mysten/sui
packages/plugin-sui/package.json Added dependencies: @mysten/sui.js, @mysten/suins, aftermath-ts-sdk, and bignumber
packages/plugin-sui/src/actions/convertNameToAddress.ts New action to convert SUI domain names to addresses
packages/plugin-sui/src/actions/swap.ts New action for token swapping on Sui blockchain
packages/plugin-sui/src/actions/transfer.ts Enhanced transfer functionality with SuiNS name support
packages/plugin-sui/src/index.ts Added new actions to plugin configuration
packages/plugin-sui/src/providers/wallet.ts Modified price calculation method using BigNumber
packages/plugin-sui/src/utils.ts Added utility functions for coin type validation and address resolution

Finishing Touches

  • [ ] 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

coderabbitai[bot] avatar Jan 11 '25 15:01 coderabbitai[bot]

@coderabbitai review

Vakurin avatar Jan 12 '25 13:01 Vakurin

Hello,

We are changing our plugin development strategy to be more scalable. We have moved the plugins out into their own repos and we're looking for people to either maintain those or own them on their own Github.

If you'd like to be a maintainer, file an issue in the plugin repo and join our Discord https://discord.gg/elizaos to coordinate.

If you'd like to control the plugin on your own Github, please add an issue to the plugin repo pointing to your repo, and add a modification to the registry. Submit a PR to edit the registry here: https://github.com/elizaos-plugins/registry

Closing this PR for now. Let us know if you have any questions.

shakkernerd avatar Feb 07 '25 00:02 shakkernerd