Skip to content

Commit

Permalink
sdk: filter out undefined market accounts (#406)
Browse files Browse the repository at this point in the history
* sdk: filter out undefined market accounts

* update CHANGELOG.md
  • Loading branch information
wphan committed Mar 23, 2023
1 parent 522d61f commit effea7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- sdk: fix claimable pnl ([#384](https://github.com/drift-labs/protocol-v2/pull/384))
- program: borrow liquidity check accounts for if user has borrow or deposit ([#400](https://github.com/drift-labs/protocol-v2/pull/400))
- program: slightly relax withdraw limits ([#400](https://github.com/drift-labs/protocol-v2/pull/400))
- sdk: filter undefined accounts ([#406](https://github.com/drift-labs/protocol-v2/pull/406))

### Breaking

Expand Down
2 changes: 2 additions & 0 deletions sdk/src/driftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class DriftClient {
public getPerpMarketAccounts(): PerpMarketAccount[] {
return this.accountSubscriber
.getMarketAccountsAndSlots()
.filter((value) => value !== undefined)
.map((value) => value.data);
}

Expand All @@ -383,6 +384,7 @@ export class DriftClient {
public getSpotMarketAccounts(): SpotMarketAccount[] {
return this.accountSubscriber
.getSpotMarketAccountsAndSlots()
.filter((value) => value !== undefined)
.map((value) => value.data);
}

Expand Down

0 comments on commit effea7f

Please sign in to comment.