Pooling solution
- getVaultDetails
- getTransactionsHistory
- buildStakeTransaction
- buildUnstakeTransaction
- getUnstakeQueueForVault
- buildWithdrawUnstakedTransaction
- getRewardsHistory
- buildMintTransaction
- getMaxMintForVault
- getHealthFactorForUser
- getStakeBalanceForUser
- getOsTokenPositionForVault
- getMaxUnstakeForUserForVault
- buildBurnTransaction
• userAccount: `0x${string}`
Currently connected Ethereum address
• new OpusPool(params
): OpusPool
Instantiates pooling solution facade that provides convenience methods to allow staking for individual user.
Name | Type | Description |
---|---|---|
params |
Object |
Parameters to configure the pooling solution interface. |
params.address |
`0x${string}` | An address of currently connected user wallet. If user connects different wallet, pooling solution implementation must be re-instantiated with a new user address. |
params.network |
Networks |
One of holesky, ethereum, hardhat |
params.rpcUrl? |
string |
RPC Url to interact with If not defined, either public node |
▸ getVaultDetails(vaults
): Promise
<VaultDetails
[]>
Exposes information regarding vault details such as TVL, APY, description and logotype, and also balance of connected customer in that Vault.
Name | Type | Description |
---|---|---|
vaults |
`0x${string}`[] | an array of vault addresses to query the details for |
Promise
<VaultDetails
[]>
An array of OpusVaultDetails
corresponding to given details
▸ getTransactionsHistory(vaults
): Promise
<VaultTransaction
[]>
Returns up to 1000 Stake or Unstake interactions of current user with given Vault.
Name | Type | Description |
---|---|---|
vaults |
`0x${string}`[] | an array of vault addresses to query the interactions for |
Promise
<VaultTransaction
[]>
An array of OpusVaultDetails
corresponding to given details
▸ buildStakeTransaction(params
): Promise
<StakeTransactionData
>
Generates stake transaction to deposit into chosen Vault
Integrations should utilize wallet interface of their own choosing to broadcast the transaction via RPC nodes of their preference. This method is stateless and only generates transaction bytes, leaving sign and broadcast up to the code integrating SDK.
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.vault |
`0x${string}` | A vault address |
params.amount |
bigint |
Amount of Eth to deposit, denominated in wei |
params.referrer? |
`0x${string}` | Address of the referrer. Optional. |
Promise
<StakeTransactionData
>
-
StakeTransactionData
-
StakeTransactionData.transaction
- Transaction to sign and broadcast -
StakeTransactionData.amount
- Amount of Eth to deposit, denominated in wei -
StakeTransactionData.gasEstimation
- Gas estimation in wei -
StakeTransactionData.maxPriorityFeePerGas
- Max priority fee per gas to use for network -
StakeTransactionData.maxFeePerGas
- Max fee per gas to use for network
▸ buildUnstakeTransaction(params
): Promise
<UnstakeTransactionData
>
Generates unstake transaction to withdraw from chosen Vault.
Integrations should utilize wallet interface of their own choosing to broadcast the transaction via RPC nodes of their preference. This method is stateless and only generates transaction bytes, leaving sign and broadcast up to the code integrating SDK.
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.vault |
`0x${string}` | A vault address |
params.amount |
bigint |
Amount of Eth to deposit, denominated in wei |
Promise
<UnstakeTransactionData
>
UnstakeTransactionData
for transaction to sign and broadcast
▸ getUnstakeQueueForVault(vault
): Promise
<UnstakeQueueItem
[]>
Retrieves the unstake queue for the vault, including the user's position in the queue and shares waiting to be unstaked
Name | Type | Description |
---|---|---|
vault |
`0x${string}` | A vault address |
Promise
<UnstakeQueueItem
[]>
Array of UnstakeQueueItem
objects corresponding to the queue, which are needed to withdraw from the queue
▸ buildWithdrawUnstakedTransaction(params
): Promise
<UnstakeQueueTransactionData
>
Generates transaction to withdraw from the unstake queue.
Integrations should utilize wallet interface of their own choosing to broadcast the transaction via RPC nodes of their preference. This method is stateless and only generates transaction bytes, leaving sign and broadcast up to the code integrating SDK.
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.vault |
`0x${string}` | A vault address |
params.queueItems |
UnstakeQueueItem [] |
Array of UnstakeQueueItem objects corresponding to the queue(see getUnstakeQueueForVault ) |
Promise
<UnstakeQueueTransactionData
>
UnstakeQueueTransactionData
for transaction to sign and broadcast
▸ getRewardsHistory(params
): Promise
<RewardsDataPoint
[]>
Retrieves rewards history for customer, earned via specific Vaults
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.from |
Date |
Starting date for the rewards retrieval query |
params.to |
Date |
End date for the rewards retrieval query |
params.vault |
`0x${string}` | Address of the vault to retrieve rewards for |
Promise
<RewardsDataPoint
[]>
Array of daily rewards amount data points
▸ buildMintTransaction(params
): Promise
<MintTransactionData
>
Generates mint transaction to mint osTokens from chosen Vault.
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.shares |
bigint |
Amount of osTokens to mint |
params.vault |
`0x${string}` | A vault address |
params.referrer? |
`0x${string}` | Address of the referrer. Optional. |
Promise
<MintTransactionData
>
MintTransactionData
for transaction to sign and broadcast
▸ getMaxMintForVault(vault
): Promise
<bigint
>
Retrieves maximum amount of osTokens that can be minted by the user
Name | Type | Description |
---|---|---|
vault |
`0x${string}` | A vault address |
Promise
<bigint
>
Max amount of osTokens that can be minted
▸ getHealthFactorForUser(mintedAssets
, stakedAssets
): Promise
<OsTokenPositionHealth
>
Retrieves health factor for the user
Name | Type | Description |
---|---|---|
mintedAssets |
bigint |
Amount of osTokens minted by the user |
stakedAssets |
bigint |
Amount of ETH staked by the user |
Promise
<OsTokenPositionHealth
>
Position Health (enum)
▸ getStakeBalanceForUser(vault
): Promise
<StakeBalanceReturnType
>
Retrieves stake balance for user in the vault
Name | Type | Description |
---|---|---|
vault |
`0x${string}` | A vault address |
Promise
<StakeBalanceReturnType
>
-
StakeBalanceReturnType.assets
- Balance in ETH -
StakeBalanceReturnType.shares
- Balance in vault tokens
▸ getOsTokenPositionForVault(vault
): Promise
<OsTokenPositionReturnType
>
Retrieves osToken position for the vault
Name | Type | Description |
---|---|---|
vault |
`0x${string}` | A vault address |
Promise
<OsTokenPositionReturnType
>
-
OsTokenPositionReturnType.minted
-
OsTokenPositionReturnType.minted.assets
- Balance in ETH -
OsTokenPositionReturnType.minted.shares
- Balance -
OsTokenPositionReturnType.minted.fee
- Usage fee amount -
OsTokenPositionReturnType.health
- Position Health (enum) -
OsTokenPositionReturnType.protocolFeePercent
- Usage fee percent
▸ getMaxUnstakeForUserForVault(vault
): Promise
<bigint
>
Retrieves the max amount of ETH that can be unstaked
Name | Type | Description |
---|---|---|
vault |
`0x${string}` | A vault address |
Promise
<bigint
>
Max amount of ETH that can be unstaked
▸ buildBurnTransaction(params
): Promise
<BurnTransactionData
>
Generates burn transaction to burn osTokens from chosen Vault.
Name | Type | Description |
---|---|---|
params |
Object |
params for request |
params.shares |
bigint |
Amount of osTokens to burn |
params.vault |
`0x${string}` | A vault address |
Promise
<BurnTransactionData
>
BurnTransactionData
for transaction to sign and broadcast