@rholabs/rho-sdk
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -364,2 +364,3 @@ import { BrowserProvider, JsonRpcSigner, JsonRpcProvider, TransactionReceipt, Wallet } from "ethers"; | ||
getMarginDetails(params: MarginDetailsParams): Promise<MarginState>; | ||
getWithdrawableMargin(params: MarginDetailsParams): Promise<BigInt>; | ||
getPoolLiquidityDistribution(params: PoolLiquidityDistributionParams): Promise<LiquidityDistribution>; | ||
@@ -366,0 +367,0 @@ isLiquidatable(params: IsLiquidatableParams): Promise<boolean>; |
{ | ||
"name": "@rholabs/rho-sdk", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Rho Protocol SDK", | ||
@@ -5,0 +5,0 @@ "source": "src/index.ts", |
@@ -208,5 +208,3 @@ import {RouterABI, ViewABI, QuoterABI, ERC20ABI} from './abi' | ||
public async getMarginDetails( | ||
params: MarginDetailsParams | ||
): Promise<MarginState> { | ||
public async getMarginDetails(params: MarginDetailsParams): Promise<MarginState> { | ||
const { marketId, userAddress } = params | ||
@@ -219,2 +217,10 @@ const oraclePackages = params.oraclePackages | ||
public async getWithdrawableMargin(params: MarginDetailsParams): Promise<BigInt> { | ||
const { marketId, userAddress } = params | ||
const oraclePackages = params.oraclePackages | ||
|| [await this.getOraclePackage(marketId)] | ||
return await this.view.withdrawableMargin(marketId, userAddress, oraclePackages) | ||
} | ||
public async getPoolLiquidityDistribution(params: PoolLiquidityDistributionParams): Promise<LiquidityDistribution> { | ||
@@ -221,0 +227,0 @@ const { marketId, futureId, offset = 0, limit = 500 } = params |
@@ -107,2 +107,10 @@ import * as dotenv from 'dotenv' | ||
test('getWithdrawableMargin', async () => { | ||
const margin = await sdk.getWithdrawableMargin({ | ||
marketId: markets[0].descriptor.id, | ||
userAddress: testAddress | ||
}) | ||
expect(margin).toBeGreaterThanOrEqual(0n) | ||
}, waitTimeout); | ||
test('getLiquidityDistribution', async () => { | ||
@@ -109,0 +117,0 @@ const liquidityDistribution = await sdk.getPoolLiquidityDistribution({ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5082952
13598