Skip to content

Commit

Permalink
Update Horizon API fields to reflect the coming post-AMM API (#702)
Browse files Browse the repository at this point in the history
* Add sponsor field to pool share balances
* Refactor ledger filter to always convert to a string
* Drop the Horizon-deprecated offer_id field
  • Loading branch information
Shaptic committed Sep 2, 2021
1 parent 9c7e5b4 commit fef254e
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 18 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ A breaking change will get clearly marked in this log.

- Updated the underlying `stellar-base` library to [v6.0.1](https://github.com/stellar/js-stellar-base/releases/tag/v6.0.1) to include CAP-38 changes ([#681](https://github.com/stellar/js-stellar-sdk/pull/681)).

- Updated various developer dependencies to secure versions ([#671](https://github.com/stellar/js-stellar-sdk/pull/671)).

- Updated `AccountResponse` to include liquidity pool shares in its `balances` field ([#688](https://github.com/stellar/js-stellar-sdk/pull/688)).

- Updated `AccountCallBuilder` to allow filtering based on participation in a certain liquidity pool ([#688](https://github.com/stellar/js-stellar-sdk/pull/688)), corresponding to the following new filter:
Expand Down Expand Up @@ -76,8 +78,7 @@ A breaking change will get clearly marked in this log.
* the `asset` field is now optional, and is replaced by
* the `liquidity_pool_id` field for liquidity pools

### Fix
- Updated various developer dependencies to secure versions ([#671](https://github.com/stellar/js-stellar-sdk/pull/671)).
- `TradeRecord`s no longer have an `offer_id` field. This field is redundant, being represented by `base_offer_id` in given an `Orderbook` trade.


## [v8.2.5](https://github.com/stellar/js-stellar-sdk/compare/v8.2.4...v8.2.5)
Expand Down
5 changes: 1 addition & 4 deletions src/effect_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ export class EffectCallBuilder extends CallBuilder<
* @returns {EffectCallBuilder} this EffectCallBuilder instance
*/
public forLedger(sequence: number | string): this {
return this.forEndpoint(
"ledgers",
typeof sequence === "number" ? sequence.toString() : sequence,
);
return this.forEndpoint("ledgers", sequence.toString());
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/horizon_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export namespace Horizon {
is_authorized: boolean;
is_authorized_to_maintain_liabilities: boolean;
is_clawback_enabled: boolean;
sponsor?: string;
}
export interface BalanceLineAsset<
T extends AssetType.credit4 | AssetType.credit12 =
Expand Down
5 changes: 1 addition & 4 deletions src/operation_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ export class OperationCallBuilder extends CallBuilder<
* @returns {OperationCallBuilder} this OperationCallBuilder instance
*/
public forLedger(sequence: number | string): this {
return this.forEndpoint(
"ledgers",
typeof sequence === "number" ? sequence.toString() : sequence,
);
return this.forEndpoint("ledgers", sequence.toString());
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/payment_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ export class PaymentCallBuilder extends CallBuilder<
* @returns {PaymentCallBuilder} this PaymentCallBuilder instance
*/
public forLedger(sequence: number | string): this {
return this.forEndpoint(
"ledgers",
sequence.toString(),
);
return this.forEndpoint("ledgers", sequence.toString());
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/server_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ export namespace ServerApi {
id: string;
paging_token: string;
ledger_close_time: string;
offer_id: string;
trade_type: TradeType;
base_account?: string;
base_amount: string;
Expand Down
4 changes: 1 addition & 3 deletions src/transaction_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ export class TransactionCallBuilder extends CallBuilder<
* @returns {TransactionCallBuilder} current TransactionCallBuilder instance
*/
public forLedger(sequence: number | string): this {
const ledgerSequence =
typeof sequence === "number" ? sequence.toString() : sequence;
return this.forEndpoint("ledgers", ledgerSequence);
return this.forEndpoint("ledgers", sequence.toString());
}

/**
Expand Down

0 comments on commit fef254e

Please sign in to comment.