Skip to content

Commit

Permalink
Merge pull request #94 from galacticcouncil/omnipool-tokens
Browse files Browse the repository at this point in the history
Add additional props to omnipool tokens pool client
  • Loading branch information
nohaapav authored Dec 4, 2024
2 parents e0d869f + 0b2b435 commit b609df7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/sdk/src/pool/omni/OmniPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export type OmniPoolPair = PoolPair & {
export type OmniPoolToken = PoolToken & {
hubReserves: BigNumber;
shares: BigNumber;
cap: BigNumber;
protocolShares: BigNumber;
};

export type OmniPoolFees = PoolFees & {
Expand Down
15 changes: 12 additions & 3 deletions packages/sdk/src/pool/omni/OmniPoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,22 @@ export class OmniPoolClient extends PoolClient {
},
state,
]) => {
const { hubReserve, shares, tradable }: PalletOmnipoolAssetState =
state.unwrap();
const {
hubReserve,
shares,
tradable,
cap,
protocolShares,
}: PalletOmnipoolAssetState = state.unwrap();
const balance = await this.getBalance(poolAddress, id.toString());
return {
id: id.toString(),
hubReserves: bnum(hubReserve.toString()),
shares: bnum(shares.toString()),
tradeable: tradable.bits.toNumber(),
balance: balance.toString(),
cap: bnum(cap.toString()),
protocolShares: bnum(protocolShares.toString()),
} as OmniPoolToken;
}
);
Expand Down Expand Up @@ -118,11 +125,13 @@ export class OmniPoolClient extends PoolClient {
token: PoolToken,
tokenState: PalletOmnipoolAssetState
) {
const { hubReserve, shares, tradable } = tokenState;
const { hubReserve, shares, tradable, cap, protocolShares } = tokenState;
return {
...token,
hubReserves: bnum(hubReserve.toString()),
shares: bnum(shares.toString()),
cap: bnum(cap.toString()),
protocolShares: bnum(protocolShares.toString()),
tradeable: tradable.bits.toNumber(),
} as OmniPoolToken;
}
Expand Down

0 comments on commit b609df7

Please sign in to comment.