Skip to content

Commit

Permalink
Coalesce effect record naming to match the actual effect type. (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Aug 22, 2023
1 parent fc9ba11 commit a32a450
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 27 deletions.
40 changes: 29 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ interface RestoreFootprintOperationResponse {};
```


### 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 @@ -53,7 +79,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 @@ -73,7 +98,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 @@ -115,7 +139,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 @@ -133,17 +156,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 @@ -152,16 +172,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

0 comments on commit a32a450

Please sign in to comment.