๐ Technical Reference
Documentation on functions available in Rho SDK
setSignerAddress
Sets an address as signer
address
string
New signer address
setSigner
Sets a signer. Required for transactions writing to the blockchain
getBalance
Gets native token balance of an address
address
string
Address to get balance from
Returns:
bigint
Account's native token balance
getMarketsOraclePackages
Gets oracle packages for all active markets
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.
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
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.
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.
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.
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.
params
PaginationParams
Parameters for pagination
Returns
String[]
Array of market ids
getPortfolioMarketIds
Gets market ids linked to a user's portfolio
params
UserPaginationParams
User address and Parameters for pagination
Returns
String[]
Array of market ids
getActiveMarkets
Gets active markets data.
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
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
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
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
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
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
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
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
params
MarketUserOracleParams
Object containing market identifier, user address and oracle packages params
Returns
TransactionReceipt
Transaction details
getTradeQuote
Gets a quote for a trade
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
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
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
params
MarketFutureOracleParams
Object containing market and future identifiers, plus oracle packages params.
Returns
TransactionReceipt
Transaction details
executeTrade
Executes a trade
params
ExecuteTradeParams
Object containing trade data to execute
Returns
TransactionReceipt
Transaction details
deposit
Performs a collateral deposit
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
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
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
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
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
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