Skip to content

Commit

Permalink
Add support for effects coming in Protocol 20. (#842)
Browse files Browse the repository at this point in the history
* Add effects (LPs were missing too!) to API type union
* Apparently another effect (CB clawed back) was missing too
  • Loading branch information
Shaptic committed Jul 12, 2023
1 parent 1185b59 commit 968c121
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +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
| Trade;

export type EffectRecord = BaseEffectRecordFromTypes & EffectRecordMethods;
Expand Down
19 changes: 19 additions & 0 deletions src/types/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export enum EffectType {
liquidity_pool_created = 93,
liquidity_pool_removed = 94,
liquidity_pool_revoked = 95,
// contract effects
contract_credited = 96,
contract_debited = 97
}
export interface BaseEffectRecord extends Horizon.BaseResponse {
id: string;
Expand Down Expand Up @@ -259,6 +262,11 @@ export type SignerSponsorshipRemoved = Omit<
SignerSponsorshipEvents,
"new_sponsor" | "sponsor"
> & { type_i: EffectType.signer_sponsorship_removed };

export interface ClaimableBalanceClawedBack extends Horizon.BaseResponse {
balance_id: string
}

export interface LiquidityPoolEffectRecord extends Horizon.BaseResponse {
id: string;
fee_bp: number;
Expand Down Expand Up @@ -305,3 +313,14 @@ export interface LiquidityPoolRevokedEffect extends BaseEffectRecord {
];
shares_revoked: string;
}

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

0 comments on commit 968c121

Please sign in to comment.