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

Add additional props to omnipool tokens pool client #94

Merged
merged 4 commits into from
Dec 4, 2024
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
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
Loading