๐ Technical Reference
Documentation on functions available in Rho SDK
setSignerAddress
Sets an address as signer
Parameter Name | Type | Description |
---|---|---|
address | string | New signer address |
setSigner
Sets a signer. Required for transactions writing to the blockchain
Parameter Name | Type | Description |
---|---|---|
signer | Wallet | JsonRpcSigner | Instance of Wallet or JsonRpcSigner |
getBalance
Gets native token balance of an address
Parameter Name | Type | Description |
---|---|---|
address | string | Address to get balance from |
Returns:
bigint
Account's native token balance
getMarketsOraclePackages
Gets oracle packages for all active markets
Parameter Name | Type | Description |
---|---|---|
address | string | Address to get balance from |
Returns:
MarketOraclePackages[]
array containing market ids and their latest rate coming from the oracle
getOraclePackage
Gets latest index from the oracle for a market id.
Parameter Name | Type | Description |
---|---|---|
address | string | Address to get balance from |
Returns:
OraclePackage
Contains latest market index from the oracle. Returns undefined if not found.
getPortfolioOraclePackages
Gets oracle packages for all markets in a user's portfolio
Parameter Name | Type | Description |
---|---|---|
userAddress | string | Portfolio's user address |
Returns:
MarketOraclePackages[]
array containing market ids and their latest rate coming from the oracle
getBalanceOf
Returns user's balance of an ERC20 token.
Parameter Name | Type | Description |
---|---|---|
contractAddress | string | ERC20 token address |
userAddress | string | User address |
Returns:
bigint
user's ERC20 balance
getAllowance
Returns an user's allowance for a given spender
of an ERC20 token.
Parameter Name | Type | Description |
---|---|---|
contractAddress | string | ERC20 token address |
userAddress | string | User address |
spenderAddress | string | Spender address |
Returns:
bigint
user's ERC20 allowance tospender
setAllowance
Does an ERC20 approval for the current signer.
Parameter Name | Type | Description |
---|---|---|
contractAddress | string | ERC20 token address |
spenderAddress | string | Spender address |
amount | bigint | Amount to be approved |
Returns:
TransactionReceipt
Transaction details
getActiveMarketIds
Gets active market ids. Supports params for pagination.
Parameter Name | Type | Description |
---|---|---|
params | PaginationParams | Parameters for pagination |
Returns
String[]
Array of market ids
getPortfolioMarketIds
Gets market ids linked to a user's portfolio
Parameter Name | Type | Description |
---|---|---|
params | UserPaginationParams | User address and Parameters for pagination |
Returns
String[]
Array of market ids
getActiveMarkets
Gets active markets data.
Parameter Name | Type | Description |
---|---|---|
params | OraclePaginationParams | Object containing both oracle packages and pagination params |
Returns
MarketInfo[]
Array of market info objects
getPortfolio
Gets detailed user portfolio in different markets
Parameter Name | Type | Description |
---|---|---|
params | UserOraclePaginationParams | Object containing user address, oracle packages and pagination params |
Returns
MarketPortfolio[]
Array of MarketPortfolio object for each market of the given user
getMarketPortfolio
Gets detailed user portfolio in a specified market
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
MarketPortfolio
MarketPortfolio with detailed user state on that market
getMarginDetails
Gets detailed user portfolio in a specified market
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
MarginState
User's margin details on that market
getWithdrawableMargin
Gets withdrawable margin of an user
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
BigInt
Amount that can be withdrawn
getPoolLiquidityDistribution
Gets liquidity distribution of a future
Parameter Name | Type | Description |
---|---|---|
params | MarketFutureOraclePaginationParams | Object containing market and future identifiers, oracle packages and pagination params |
Returns
LiquidityDistribution
Object containing total provision distribution, current future rate and array of liquidity provisions
isLiquidatable
Check is a user is liquidatable
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
boolean
True if user is liquidatable
isProvisionCancellable
Check is a user's provisions are cancellable
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
boolean
True if user's provisions are cancellable
cancelProvisions
Check is a user's provisions are cancellable
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, user address and oracle packages params |
Returns
TransactionReceipt
Transaction details
getTradeQuote
Gets a quote for a trade
Parameter Name | Type | Description |
---|---|---|
params | TradeQuoteParams | Object containing market and identifiers, participant address, notional amount and oracle packages params. |
Returns
TradeQuote
Object containing quote details for a trade
getLiquidityProvisionQuote
Gets a quote for a liquidity provision
Parameter Name | Type | Description |
---|---|---|
params | LiquidityProvisionQuoteParams | Object containing market and future identifiers, participant address, notional amount, rate bounds, operation type and oracle packages params. |
Returns
TradeQuote
Object containing quote details for a liquidity provision
liquidatePositions
Gets a quote for a liquidity provision
Parameter Name | Type | Description |
---|---|---|
params | LiquidatePositionParams | Object containing market and future identifiers, owner address, array of position percentages and oracle packages params. |
Returns
TransactionReceipt
Transaction details
persistIndexAtMaturity
Sets an index value for a future at maturity
Parameter Name | Type | Description |
---|---|---|
params | MarketFutureOracleParams | Object containing market and future identifiers, plus oracle packages params. |
Returns
TransactionReceipt
Transaction details
executeTrade
Executes a trade
Parameter Name | Type | Description |
---|---|---|
params | ExecuteTradeParams | Object containing trade data to execute |
Returns
TransactionReceipt
Transaction details
deposit
Performs a collateral deposit
Parameter Name | Type | Description |
---|---|---|
params | DepositParams | Object containing market identifier, recipient address, amount to be deposited, boolean to settle matured positions and oracle packages. |
Returns
TransactionReceipt
Transaction details
withdraw
Performs a collateral withdraw
Parameter Name | Type | Description |
---|---|---|
params | WithdrawParams | Object containing market identifier, amount to be withdrawn, boolean to unwrap as native token, boolean to settle matured positions and oracle packages. |
Returns
TransactionReceipt
Transaction details
provideLiquidity
Provides liquidity to a future
Parameter Name | Type | Description |
---|---|---|
params | LiquidityOperationParams | Object containing market and future identifiers, notional amount relative to this provision, collateral amount to be deposited, rate bounds for the provision, deadline for the transaction to be mined, a boolean to settle matured positions and oracle packages |
Returns
TransactionReceipt
Transaction details
removeLiquidity
Removes liquidity from a future
Parameter Name | Type | Description |
---|---|---|
params | LiquidityOperationParams | Object containing market and future identifiers, notional amount relative to this provision, collateral amount to be deposited, rate bounds for the provision, deadline for the transaction to be mined, a boolean to settle matured positions and oracle packages |
Returns
TransactionReceipt
Transaction details
quoteTransferOwnership
Gets a quote for liquidating a user by novation
Parameter Name | Type | Description |
---|---|---|
params | MarketUserOracleParams | Object containing market identifier, address of user to be liquidated and oracle packages |
Returns
number
transferAmount - amount of tokens rewarded to liquidatornumber
depositAmount - amount of tokens to be deposited as collateral by liquidator
transferPositionOwnership
Performs a liquidation by novation
Parameter Name | Type | Description |
---|---|---|
params | TransferPositionsOwnershipParams | Object containing market identifier, address of user to be liquidated, a boolean indicating to settle matured positions and oracle packages |
Returns
TransactionReceipt
Transaction details
Last updated