I have had a fairly long time studying Serum Swap. I also thought the solution from 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:

  1. The client who forms transactions for the swap
  2. UI components
  3. Hooks and all methods that collect all the necessary information

How we built it

This library is based on the synergy of three libraries:


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

  1. Mechanics of working with serum swap
  2. Anchor and its logging system
  3. unstated-next is a very nice tool for writing contexts

What's next for Swappy

  1. Calculation of commissions for a transaction, taking into account the created accounts and the transaction price
  2. Calculate price impact
  3. Add a fork of the swap contract and handle any errors that occur
  4. Consider the option of creating orders and their sharing
  5. Provide the possibility of using additional bridges
  6. Create metrics
  7. Improve UX iteratively

Built With

  • react
  • serum
  • solana
  • unstated-next
Share this project: