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

Horizon v1.0.0 Compatibility #257

Closed
9 tasks done
abuiles opened this issue Jan 22, 2020 · 1 comment
Closed
9 tasks done

Horizon v1.0.0 Compatibility #257

abuiles opened this issue Jan 22, 2020 · 1 comment
Assignees

Comments

@abuiles
Copy link

abuiles commented Jan 22, 2020

The upcoming Horizon release is coming, and there are multiple breaking changes plus new features 🎉🎉🎉!

The following are the list of changes required to support this new release:

  • ➕Update /fee_stats response.

    • ✂ Remove the following fields:

      min_accepted_fee
      mode_accepted_fee
      p10_accepted_fee
      p20_accepted_fee
      p30_accepted_fee
      p40_accepted_fee
      p50_accepted_fee
      p60_accepted_fee
      p70_accepted_fee
      p80_accepted_fee
      p90_accepted_fee
      p95_accepted_fee
      p99_accepted_fee
    • ➕Add support for max_fee and fee_charged fields. Each field contains a JSON object that looks like this:

      {
        "last_ledger": "22606298",
        "last_ledger_base_fee": "100",
        "ledger_capacity_usage": "0.97",
        "fee_charged": {
          "max": "100",
          "min": "100",
          "mode": "100",
          "p10": "100",
          "p20": "100",
          "p30": "100",
          "p40": "100",
          "p50": "100",
          "p60": "100",
          "p70": "100",
          "p80": "100",
          "p90": "100",
          "p95": "100",
          "p99": "100"
        },
        "max_fee": {
          "max": "100000",
          "min": "100",
          "mode": "100",
          "p10": "100",
          "p20": "100",
          "p30": "100",
          "p40": "100",
          "p50": "100",
          "p60": "100",
          "p70": "100",
          "p80": "100",
          "p90": "15000",
          "p95": "100000",
          "p99": "100000"
        }
       }

    See Update /fee_stats documentation. stellar/go#2140 for more info.

  • ✂ Remove deprecated fee_paid field from Transaction response (replace it with the fee_charged and max_fee fields, see #1372).

  • 🚨Multiple fields changed from int64 to string. If your SDK has types, they need to be updated. If possible, we recommend implementing backward compatibility support, as we did here.

    See Decide on use of int64 in JSON responses. stellar/go#1609, protocols/horizon/effects: Add UnmarshalJSON to SequenceBumped. stellar/go#1909, and Support String or Number Unmarshalling in Int64 fields stellar/go#1912 for more info

  • 🚨 Update operation types to canonical names (if needed) (see protocols/horizon: Apply deprecation on some operation types, updating them to the correct value stellar/go#2134).

  • ➕Add support for /accounts end-point with ?signer and ?asset filters. We recommend a method like .accounts(queryParams) (see documentation for accounts).

  • ➕Add support for /offers end-point with query parameters. We recommend a method like .offers(queryParams) (see documentation for offers).

  • ➕Add support for /paths/strict-send end-point. See documentation.
    We recommend a method like

    strictSendPaths(sourceAsset, sourceAmount, [destinationAsset])
    
  • ➕ Add support for /paths/strict-receive end-point. See documentation.
    We recommend a method like:

    strictReceivePaths(sourceAssets,destinationAsset, destinationAmount)
    
  • ♻ Regenerate the XDR definitions to include MetaV2 support (also see #1902).

That's it! If you have any questions feel free to ping us on #dev-discussion in Keybase.

@overcat
Copy link
Member

overcat commented Jan 24, 2020

Done, I will release v2.2.0 as soon as possible.

overcat added a commit that referenced this issue Feb 7, 2020
Horizon v1.0.0 Compatibility.

#### Added

- Add support for top-level offers endpoint with `seller`, `selling`, and `buying` filter.
  Horizon 1.0 includes a new `/offers` end-point, which allows you to list all offers, supporting filtering by `seller`, `selling`, or `buying` asset.

  You can fetch data from this endpoint by doing `server.offers()` and use any of the following filters:

  - `seller`: `server.offers().for_seller(account_id)`
  - `buying`: `server.offers().for_buying(asset)`
  - `selling`: `server.offers().for_selling(asset)`
  - `offer detail` : `server.offers().offer(offer_id)`

  This introduced a breaking change since it modified the signature for the function `server.offers()`.

  Before, if you wanted to list all the offers for a given account, you'd do:

  ```
  server.offers(account_id)
  ```

  Starting on this version you'll need to do:

  ```
  server.offers().for_seller(account_id)
  ```

  You can do now things that were not possible before, like finding
  all offers for an account filtering by the selling or buying asset

  ```
  server.offers().for_seller(account_id).for_buying(buying_asset).for_selling(selling_asset)
  ```

- Add support for filtering accounts by `signer` or `asset`, this has been released in a previous patch version.
  Horizon 1.0 includes a new `/accounts` end-point, which allows you to list all accounts who have another account as a signer or hold a given asset.

  You can fetch data from this endpoint by doing `server.accounts()` and use any of the following filters:

  - `acount detail`: `server.accounts().account_id(account_id)`, returns a single account.
  - `for signer`: `server.accounts().for_signer(account_id)`, returns accounts where `account_id` is a signer.
  - `for asset`: `server.accounts().for_asset(asset)`, returns accounts which hold the `asset`.

#### Changed

- Regenerate the XDR definitions to include [MetaV2](https://github.com/jonjove/stellar-core/blob/b299b3a458a15f592352c67d4da69baa6e8fbb6a/src/xdr/Stellar-ledger.x#L309) support (also see [#1902](stellar/go#1902)).

#### Fixed

- Fixed some documentation errors.

#### Breaking

- Change function signature for `server.offers`.
  The signature for the function `server.offers()` was changed to bring suppport for other filters.

  Before, if you wanted to list all the offers for a given account, you'd do:

  ```
  server.offers(account_id)
  ```

  Starting on this version you'll need to do:

  ```
  server.offers().for_seller(account_id)
  ```

* `server.accounts().signer` and `server.accounts().asset` are marked as deprecated, use `server.accounts().for_signer` and `server.accounts().for_asset` instead.

There are also some changes related to the horizon's response, currently SDK has not added parse support to it,
so please refer to this [issue](#257) or
release notes of Stellar horizon 1.0.0. In addition, support for parsing the
horizon's responses will be added in the next major update.
overcat added a commit that referenced this issue Feb 7, 2020
Horizon v1.0.0 Compatibility.

#### Added

- Add support for top-level offers endpoint with `seller`, `selling`, and `buying` filter.
  Horizon 1.0 includes a new `/offers` end-point, which allows you to list all offers, supporting filtering by `seller`, `selling`, or `buying` asset.

  You can fetch data from this endpoint by doing `server.offers()` and use any of the following filters:

  - `seller`: `server.offers().for_seller(account_id)`
  - `buying`: `server.offers().for_buying(asset)`
  - `selling`: `server.offers().for_selling(asset)`
  - `offer detail` : `server.offers().offer(offer_id)`

  This introduced a breaking change since it modified the signature for the function `server.offers()`.

  Before, if you wanted to list all the offers for a given account, you'd do:

  ```
  server.offers(account_id)
  ```

  Starting on this version you'll need to do:

  ```
  server.offers().for_seller(account_id)
  ```

  You can do now things that were not possible before, like finding
  all offers for an account filtering by the selling or buying asset

  ```
  server.offers().for_seller(account_id).for_buying(buying_asset).for_selling(selling_asset)
  ```

- Add support for filtering accounts by `signer` or `asset`, this has been released in a previous patch version.
  Horizon 1.0 includes a new `/accounts` end-point, which allows you to list all accounts who have another account as a signer or hold a given asset.

  You can fetch data from this endpoint by doing `server.accounts()` and use any of the following filters:

  - `acount detail`: `server.accounts().account_id(account_id)`, returns a single account.
  - `for signer`: `server.accounts().for_signer(account_id)`, returns accounts where `account_id` is a signer.
  - `for asset`: `server.accounts().for_asset(asset)`, returns accounts which hold the `asset`.

#### Changed

- Regenerate the XDR definitions to include [MetaV2](https://github.com/jonjove/stellar-core/blob/b299b3a458a15f592352c67d4da69baa6e8fbb6a/src/xdr/Stellar-ledger.x#L309) support (also see [#1902](stellar/go#1902)).

#### Fixed

- Fixed some documentation errors.

#### Breaking

- Change function signature for `server.offers`.
  The signature for the function `server.offers()` was changed to bring support for other filters.

  Before, if you wanted to list all the offers for a given account, you'd do:

  ```
  server.offers(account_id)
  ```

  Starting on this version you'll need to do:

  ```
  server.offers().for_seller(account_id)
  ```

* `server.accounts().signer` and `server.accounts().asset` are marked as deprecated, use `server.accounts().for_signer` and `server.accounts().for_asset` instead.

There are also some changes related to the horizon's response, currently, SDK has not added parse support to it,
so please refer to this [issue](#257) or release notes of Stellar horizon 1.0.0. In addition, support for parsing the horizon's responses will be added in the next major update.
@overcat overcat closed this as completed Feb 7, 2020
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

No branches or pull requests

2 participants