java-stellar-sdk icon indicating copy to clipboard operation
java-stellar-sdk copied to clipboard

CAP-38 AMM Changes

Open paulbellamy opened this issue 3 years ago • 1 comments

We've just released v6.0.1, of the SDF Javascript base library.

It includes changes to implement CAP-38, supporting automated market makers.

These changes will be released with the protocol v18 upgrade.

There are some further notes on the changes API endpoints, with mock responses, on this APIary. Further notes on the API changes are available in this document.

  • Each SDK must update to enable depositing, and withdrawing from liquidity pools.
  • SDKs must also update to include the new effect types, as well as new fields on Accounts.
  • SDKs should also include methods to query liquidity pool information.

Because the order of the assets must be sorted in the pool ID, as well as in the depositing and withdrawing operations, SDKs should either:

  • error when creating a pool ID with assets in the wrong order
  • or, automatically sort the assets when generating a pool ID and structure the SDK to help users avoid making this mistake. For example, in the Go SDK, we pass in each asset and amount as a tuple, so that they are associated.

Asset ordering is determined by: Native < AlphaNum4 < AlphaNum12, then by Code, then by Issuer, using lexicographic ordering.

If your SDK has implemented and released these changes, reference the release in a closing comment.

paulbellamy avatar Sep 01 '21 15:09 paulbellamy

There were a couple of missed points in the initial version of the linked docs sent out.\n\nFirst, there is also a /liquidity_pools/:pool_id/trades api endpoint for retrieving the trades which have taken place in a pool.\n\nSecond, the numerator and denominator in the price field of trades, will be serialized as strings. This is because they can now be 64-bit integers.\n\nBoth changes are now reflected in the updated apiary docs at https://ammmock.docs.apiary.io/

paulbellamy avatar Sep 20 '21 17:09 paulbellamy