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

chore(public): Improve Universal Router README with clearer instructions and example #119

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jfbloom22
Copy link

Description

This PR updates the README of the universal-router-sdk to provide clearer and more comprehensive installation instructions. The changes include:

  1. Added installation instructions for npm.
  2. Updated the "Note" about swapERC20CallParameters()
  3. Improved the overall structure and readability of the installation and usage sections.

These changes aim to make it easier for new users to get started with the SDK

How Has This Been Tested?

The changes in this PR are documentation updates and do not affect the codebase. However, I have:

  • Manually reviewed the changes for accuracy and clarity.
  • Ensured that the code examples in the README are consistent with the current SDK usage.

Are there any breaking changes?

No, there are no breaking changes. This PR only updates the README file.

Feedback Focus

I'd appreciate feedback on:

  1. The clarity and completeness of the new example code.
  2. The overall structure and flow of the updated README sections.
  3. Any additional information that might be helpful for new users of the SDK.

Follow Ups

Potential follow-up tasks could include:

  1. Adding more detailed examples for different use cases of the SDK.
  2. Creating a separate "Getting Started" guide for more in-depth setup instructions.

@jfbloom22 jfbloom22 requested a review from a team as a code owner September 30, 2024 12:43
@jfbloom22 jfbloom22 changed the title chore(public): Improve README with clearer instructions and example chore(public): Improve Universal Router README with clearer instructions and example Oct 1, 2024
Copy link
Contributor

@zhongeric zhongeric left a comment

Choose a reason for hiding this comment

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

thank you for the PR! left some comments

import { Trade as V2TradeSDK } from '@uniswap/v2-sdk'
import { Trade as V3TradeSDK } from '@uniswap/v3-sdk'
import { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@uniswap/router-sdk'
import { Trade as V2TradeSDK } from '@uniswap/v2-sdk'
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicated import

Copy link
Author

Choose a reason for hiding this comment

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

ooops. thanks!

// const txResponse = await wallet.sendTransaction(tx)
// await txResponse.wait()

console.log('Transaction parameters:', tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rm

Copy link
Author

Choose a reason for hiding this comment

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

removed the console.log

Comment on lines 52 to 54
// Send the transaction using your preferred method (e.g., ethers.js, web3.js)
// const txResponse = await wallet.sendTransaction(tx)
// await txResponse.wait()
Copy link
Contributor

Choose a reason for hiding this comment

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

fine to uncomment this in my opinion!

Copy link
Author

Choose a reason for hiding this comment

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

uncommented

Comment on lines 59 to 67
This example demonstrates how to:
1. Import necessary classes and functions from Uniswap SDKs
2. Define tokens for the trade
3. Create a trade object (simplified in this example)
4. Set up trade options including slippage tolerance and recipient
5. Generate the calldata and value for the swap
6. Prepare a transaction object for sending to the Universal Router

Remember to handle errors, validate inputs, and implement proper transaction sending and confirmation in your actual implementation.
Copy link
Contributor

Choose a reason for hiding this comment

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

can simplify this to:

The code above is provided strictly as an example implementation of using the SDK to build a UniversalRouter swap.

Copy link
Author

Choose a reason for hiding this comment

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

updated. thx!

Comment on lines 84 to 85
## Contributing
Contributions to improve the SDK or documentation are welcome. Please ensure you follow the existing code style and add appropriate tests for any new functionality.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove, we can create a separate CONTRIBUTING.md in the future

Copy link
Author

Choose a reason for hiding this comment

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

removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants