-
Notifications
You must be signed in to change notification settings - Fork 297
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
Support for automated market makers (CAP-38). #693
Conversation
…ce `/lib` is in stellar-base's `.gitignore`, yarn install doesn't work properly with the github module version and we need to run an extra step manually, as explained in the CHANGELOG.
* Add call builder for liquidity pools, w/ filters by reserve asset
…Liquidity Pool trades (#685)
### What Add GitHub Actions to run tests for every PR. ### Why So all AMM related PRs we're merging into [v9.0.0](https://github.com/stellar/js-stellar-sdk/tree/v9.0.0) will need to pass the CI tests.
…ounts balance response (#688) Support `/accounts?liquidity_pool={:pool_id}` and update the response from `/accounts/{:acc_id}` ### Update - A new type of trustline called `liquidity_pool_shares` was added, which is included in the account `balances` array and causes a breaking change (see below) ([#688](#688)). - Clients can now filter the results from the `/accounts` endpoint based on participation in a certain liquidity pool ([#688](#688)). ### Breaking Changes - The `balances` array from an account response now supports liquidity pool balances ([#688](#688)). - the `asset_type` field can now be `liquidity_pool_shares`. - `buying_liabilities`, `selling_liabilities`, `asset_code`, and `asset_issuer` are omitted from the response for pool shares because they are not relevant to liquidity pools. - Update the `ChangeTrustOperationResponse` interface so it can conform to a change in a liquidity pool trustline ([#688](#688)). - `asset_type` can now be `liquidity_pool_shares`. - `asset_code` and `asset_issuer` are now optional. - Added `liquidity_pool_id` as an optional field.
… pool. (#689) Co-authored-by: Marcelo Salloum dos Santos <marcelo@stellar.org>
### Add - New effect types: `DepositLiquidityEffect`, `WithdrawLiquidityEffect`, `LiquidityPoolTradeEffect`, `LiquidityPoolCreatedEffect`, `LiquidityPoolRemovedEffect` and `LiquidityPoolRevokedEffect`. ### Breaking changes - Trustline created/updated/revoked effects' asset type can now be `liquidity_pool_shares`. - Trustline sponsorship effects have been updated so the `asset` becomes optional and is replaced with `liquidity_pool_id` for liquidity pools.
### Add - Add operations `DepositLiquidityOperationResponse` and `WithdrawLiquidityOperationResponse`. ### Breaking Changes - The `trustee` attribute was made optional in the `ChangeTrustOperationResponse`.
* Provides more precise error type
One of my biggest take-aways from Google's technical writing course was "use more lists." I've tried to incorporate that here, breaking down changes into specific items. Another big change was being more specific and precise with the data structures in the SDK that have been updated. For example, we now list the effects that changed directly, specify fields that have changed more explicitly, and call out specific endpoints that we've introduced and their respective call builders. Co-authored-by: Marcelo Salloum dos Santos <marcelo@stellar.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick look, but seems fine to me.
* Update payment call builder to use helper method * Update two more builders to use helper * Simplify sequence number code since strings are strings Co-authored-by: Marcelo Salloum dos Santos <marcelo@stellar.org>
Co-authored-by: Marcelo Salloum dos Santos <marcelo@stellar.org>
last_modified_ledger: number; | ||
is_authorized: boolean; | ||
is_authorized_to_maintain_liabilities: boolean; | ||
is_clawback_enabled: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pool share trustline can be sponsored so I think we need a sponsor?: string
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, will be fixed by #702 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! I left a few comments for some issues which should be easy to fix
* Add sponsor field to pool share balances * Refactor ledger filter to always convert to a string * Drop the Horizon-deprecated offer_id field
This release adds support for Automated Market Makers. For details, you can refer to CAP-38 for XDR changes and this document for detailed changes to the Horizon API.
Add
Introduced a
LiquidityPoolCallBuilder
to make calls to a new endpoint:/liquidity_pools[?reserves=...]
- a collection of liquidity pools, optionally filtered by one or more assets (#682)/liquidity_pools/:id
- a specific liquidity pool (#687)Expanded the
TransactionCallBuilder
,OperationCallBuilder
, andEffectsCallBuilder
s to apply to specific liquidity pools (#689). This corresponds to the following new endpoints:/liquidity_pools/:id/transactions
/liquidity_pools/:id/operations
/liquidity_pools/:id/effects
Expanded the
TradesCallBuilder
to support fetching liquidity pool trades and accepts a newtrade_type
filter (#685):/trades?trade_type={orderbook,liquidity_pools}
liquidity_pool_fee_bp
: LP fee expressed in basis points, and eitherbase_liquidity_pool_id
orcounter_liquidity_pool_id
Added new effects related to liquidity pools (#690):
DepositLiquidityEffect
WithdrawLiquidityEffect
LiquidityPoolTradeEffect
LiquidityPoolCreatedEffect
LiquidityPoolRemovedEffect
LiquidityPoolRevokedEffect
Added new responses related to liquidity pool operations (#692):
DepositLiquidityOperationResponse
WithdrawLiquidityOperationResponse
Updates
Updated the underlying
stellar-base
library to v6.0.1 to include CAP-38 changes (#681).Updated
AccountResponse
to include liquidity pool shares in itsbalances
field (#688).Updated
AccountCallBuilder
to allow filtering based on participation in a certain liquidity pool (#688), corresponding to the following new filter:/accounts?reserves=[...list of assets...]
Updated
RevokeSponsorshipOperationResponse
to contain an optional attributetrustline_liquidity_pool_id
, for when a liquidity pool trustline is revoked (#690).Breaking changes
A
TradeRecord
can now correspond to two different types of trades and has changed (#685):Orderbook
(the existing structure)counter_offer_id
andbase_offer_id
only show up in these recordsLiquidityPool
(new)base_account
xorcounter_account
will appear in these recordsprice
fields changed fromnumber
s tostring
sbase
andcounter
can now point to either an account or a liquidity poolAn account's
balances
array can now include a new type (#688):asset_type
can now beliquidity_pool_shares
buying_liabilities
selling_liabilities
asset_code
asset_issue
The
ChangeTrustOperationResponse
has changed (#688, #692):asset_type
can now beliquidity_pool_shares
asset_code
,asset_issuer
, andtrustee
are now optionalliquidity_pool_id
is a new optional fieldThe trustline effects (
TrustlineCreated
,TrustlineUpdated
,TrustlineRevoked
) have changed (#690):liquidity_pool_shares
liquidity_pool_id
Trustline sponsorship effects (
TrustlineSponsorshipCreated
,TrustlineSponsorshipUpdated
,TrustlineSponsorshipRemoved
) have been updated (#690):asset
field is now optional, and is replaced byliquidity_pool_id
field for liquidity pools