Inspiration
I have had a fairly long time studying Serum Swap. I also thought the solution from https://github.com/GokiProtocol/walletkit for wallets is quite convenient as a tool for users and developers, and the current Serum Swap has many shortcomings. Then I decided that I would do something that would fix it, as well as expand the functionality.
What it does
This is a library that allows you to easily integrate Swap into your site via Serum. Within the framework of this library, implemented:
- The client who forms transactions for the swap
- UI components
- Hooks and all methods that collect all the necessary information
How we built it
This library is based on the synergy of three libraries:
- https://github.com/project-serum/swap-ui
- https://github.com/project-serum/swap
- https://github.com/GokiProtocol/walletkit
And my vision of how it should be decomposed is written, with the necessary additional functionality that I plan to add
Challenges we ran into
I didn't immediately figure out in which branches of the repositories Armani stores the code that is relevant for swap. I had to deal with anchor in order to display specific errors in the contract. I wrote my own version of the library for serum swap, which required understanding the details of how direct and transitive swap work.
Accomplishments that we're proud of
It turns out to be a good tool, easy to integrate, split into the right packages with new tools inside
What we learned
- Mechanics of working with serum swap
- Anchor and its logging system
- unstated-next is a very nice tool for writing contexts
What's next for Swappy
- Calculation of commissions for a transaction, taking into account the created accounts and the transaction price
- Calculate price impact
- Add a fork of the swap contract and handle any errors that occur
- Consider the option of creating orders and their sharing
- Provide the possibility of using additional bridges
- Create metrics
- Improve UX iteratively
Built With
- react
- serum
- solana
- unstated-next
Log in or sign up for Devpost to join the conversation.