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

Coalesce effect record naming to match the actual effect type. #844

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ A breaking change will get clearly marked in this log.
## Unreleased


### Breaking Changes

- Certain effects have been renamed to align better with the "tense" that other structures have ([#844](https://github.com/stellar/js-stellar-sdk/pull/844)):
* `DepositLiquidityEffect` -> `LiquidityPoolDeposited`
* `WithdrawLiquidityEffect` -> `LiquidityPoolWithdrew`
* `LiquidityPoolTradeEffect` -> `LiquidityPoolTrade`
* `LiquidityPoolCreatedEffect` -> `LiquidityPoolCreated`
* `LiquidityPoolRevokedEffect` -> `LiquidityPoolRevoked`
* `LiquidityPoolRemovedEffect` -> `LiquidityPoolRemoved`

### Add

- New effects have been added to support Protocol 20 (Soroban) ([#842](https://github.com/stellar/js-stellar-sdk/pull/842)):
* `ContractCredited` occurs when a Stellar asset moves **into** its corresponding Stellar Asset Contract instance
* `ContractDebited` occurs when a Stellar asset moves **out of** its corresponding Stellar Asset Contract instance
- Asset stat records (`ServerApi.AssetRecord`) contain two new fields to support the Protocol 20 (Soroban) release ([#TODO](https://github.com/stellar/js-stellar-sdk/pulls/)):
* `num_contracts` - the integer quantity of contracts that hold this asset
* `contracts_amount` - the total units of that asset held by contracts

### Fixed

- Some effect definitions that were missing have been added ([#842](https://github.com/stellar/js-stellar-sdk/pull/842)):
* `ClaimableBalanceClawedBack` is now defined
* `type EffectRecord` now has all of the effect types


## [v11.0.0-beta.1](https://github.com/stellar/js-stellar-sdk/compare/v11.0.0-beta.0...v11.0.0-beta.1)

### Update
Expand All @@ -21,7 +47,6 @@ This version is marked by a major version bump because of the significant upgrad
### Update

- Build system has been overhauled to support Webpack 5 ([#814](https://github.com/stellar/js-stellar-sdk/pull/814)).

- `stellar-base` has been updated to its corresponding overhaul ([#818](https://github.com/stellar/js-stellar-sdk/pull/818)).

### Fix
Expand All @@ -41,7 +66,6 @@ This version is marked by a major version bump because of the significant upgrad
### Add

- Add [SEP-1](https://stellar.org/protocol/sep-1) fields to `StellarTomlResolver` for type checks ([#794](https://github.com/stellar/js-stellar-sdk/pull/794)).

- Add support for passing `X-Auth-Token` as a custom header ([#795](https://github.com/stellar/js-stellar-sdk/pull/795)).

### Update
Expand Down Expand Up @@ -83,7 +107,6 @@ This version is marked by a major version bump because of the significant upgrad
### Fix

- Reverts a change from [v10.1.0](#v10.1.0) which caused streams to die prematurely ([#780](https://github.com/stellar/js-stellar-sdk/pull/780)).

- Bumps `stellar-base` version to [v8.0.1](https://github.com/stellar/js-stellar-base/releases/tag/v8.0.1) to include latest bugfixes.


Expand All @@ -101,17 +124,14 @@ This is a promotion from the beta version without changes, besides upgrading the
### Add

- Support for Protocol 19 ([#775](https://github.com/stellar/js-stellar-sdk/pull/775)):

* new precondition fields on a `TransactionResponse`
* new account fields on `AccountResponse` and `AccountRecord`
* bumping `stellar-base` to the latest beta version

### Fix

- Add missing field to account responses: `last_modified_time` which is the time equivalent of the existing `last_modified_ledger` ([#770](https://github.com/stellar/js-stellar-sdk/pull/770)).

- Stop opening extra connections when SSE streams receive `event: close` events ([#772](https://github.com/stellar/js-stellar-sdk/pull/772)).

- Fix SSE streams not loading under React Native (thank you, @hunterpetersen!) ([#761](https://github.com/stellar/js-stellar-sdk/pull/761)).


Expand All @@ -120,16 +140,14 @@ This is a promotion from the beta version without changes, besides upgrading the
### Fix

- Add missing fields to the `LedgerRecord`: `successful_transaction_count` and `failed_transaction_count` ([#740](https://github.com/stellar/js-stellar-sdk/pull/740)). Note that this also marks several fields as _deprecated_ because they don't actually exist in the Horizon API response:

- `transaction_count`: superceded by the sum of the aforementioned fields
- `base_fee`: superceded by the `base_fee_in_stroops` field
- `base_reserve`: superceded by the `base_reserve_in_stroops` field
* `transaction_count`: superceded by the sum of the aforementioned fields
* `base_fee`: superceded by the `base_fee_in_stroops` field
* `base_reserve`: superceded by the `base_reserve_in_stroops` field

These deprecated fields will be removed in the next major version. It's unlikely that this breaking change should affect anyone, as these fields have likely been missing/invalid for some time.

### Update
- Update a number of dependencies that needed various security updates:

* several dependencies bumped their patch version ([#736](https://github.com/stellar/js-stellar-sdk/pull/736), [#684](https://github.com/stellar/js-stellar-sdk/pull/684), [#672](https://github.com/stellar/js-stellar-sdk/pull/672), [#666](https://github.com/stellar/js-stellar-sdk/pull/666), [#644](https://github.com/stellar/js-stellar-sdk/pull/644), [#622](https://github.com/stellar/js-stellar-sdk/pull/622))
* axios has been bumped to 0.25.0 without causing breaking changes ([#742](https://github.com/stellar/js-stellar-sdk/pull/742))
* the `karma` suite of packages has been updated to the latest major version ([#743](https://github.com/stellar/js-stellar-sdk/pull/743))
Expand Down
16 changes: 8 additions & 8 deletions src/server_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ export namespace ServerApi {
| Effects.SignerSponsorshipCreated
| Effects.SignerSponsorshipUpdated
| Effects.SignerSponsorshipRemoved
| Effects.DepositLiquidityEffect
| Effects.WithdrawLiquidityEffect
| Effects.LiquidityPoolCreatedEffect
| Effects.LiquidityPoolRemovedEffect
| Effects.LiquidityPoolRevokedEffect
| Effects.LiquidityPoolTradeEffect
| Effects.ContractCreditedEffect
| Effects.ContractDebitedEffect
| Effects.LiquidityPoolDeposited
| Effects.LiquidityPoolWithdrew
| Effects.LiquidityPoolCreated
| Effects.LiquidityPoolRemoved
| Effects.LiquidityPoolRevoked
| Effects.LiquidityPoolTrade
| Effects.ContractCredited
| Effects.ContractDebited
| Trade;

export type EffectRecord = BaseEffectRecordFromTypes & EffectRecordMethods;
Expand Down
16 changes: 8 additions & 8 deletions src/types/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,33 +275,33 @@ export interface LiquidityPoolEffectRecord extends Horizon.BaseResponse {
total_shares: string;
reserves: Horizon.Reserve[];
}
export interface DepositLiquidityEffect extends BaseEffectRecord {
export interface LiquidityPoolDeposited extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_deposited;
liquidity_pool: LiquidityPoolEffectRecord;
reserves_deposited: Horizon.Reserve[];
shares_received: string;
}
export interface WithdrawLiquidityEffect extends BaseEffectRecord {
export interface LiquidityPoolWithdrew extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_withdrew;
liquidity_pool: LiquidityPoolEffectRecord;
reserves_received: Horizon.Reserve[];
shares_redeemed: string;
}
export interface LiquidityPoolTradeEffect extends BaseEffectRecord {
export interface LiquidityPoolTrade extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_trade;
liquidity_pool: LiquidityPoolEffectRecord;
sold: Horizon.Reserve;
bought: Horizon.Reserve;
}
export interface LiquidityPoolCreatedEffect extends BaseEffectRecord {
export interface LiquidityPoolCreated extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_created;
liquidity_pool: LiquidityPoolEffectRecord;
}
export interface LiquidityPoolRemovedEffect extends BaseEffectRecord {
export interface LiquidityPoolRemoved extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_removed;
liquidity_pool_id: string;
}
export interface LiquidityPoolRevokedEffect extends BaseEffectRecord {
export interface LiquidityPoolRevoked extends BaseEffectRecord {
type_i: EffectType.liquidity_pool_revoked;
liquidity_pool: LiquidityPoolEffectRecord;
reserves_revoked: [
Expand All @@ -314,12 +314,12 @@ export interface LiquidityPoolRevokedEffect extends BaseEffectRecord {
shares_revoked: string;
}

export interface ContractCreditedEffect extends BaseEffectRecord, OfferAsset {
export interface ContractCredited extends BaseEffectRecord, OfferAsset {
type_i: EffectType.contract_credited;
contract: string;
amount: string;
}
export interface ContractDebitedEffect extends BaseEffectRecord, OfferAsset {
export interface ContractDebited extends BaseEffectRecord, OfferAsset {
type_i: EffectType.contract_debited;
contract: string;
amount: string;
Expand Down