Releases: stakewise/v3-sdk
3.0.1
What's Changed
- Publish 3.0.0 by @Cast0001 in #239
- [docs update] update by @mike-diamond in #237
- gql build by @Cast0001 in #240
- [limit] add limit to vault & user stats by @dfkadyr-stakewise in #241
- Always add exit requests by @tsudmi in #242
- Safe wallet by @mike-diamond in #243
- Fix export rewards by @Cast0001 in #244
Full Changelog: 3.0.0...3.0.1
3.0.0
Migrate from 2.x to 3.x
https://sdk.stakewise.io/setup/migration
Updates
1. sdk.vault.getVault
New output field:
type AddedOutput = {
osTokenConfig: {
ltvPercent: string
liqThresholdPercent: string
}
queuedShares: string
allocatorMaxBoostApy: number
osTokenHolderMaxBoostApy: number
isGenesis: boolean
}
Name | Description |
---|---|
osTokenConfig |
contains the ltvPercent , which is the percentage used to calculate how much a user can mint in OsToken shares, and liqThresholdPercent , which is the liquidation threshold percentage used to calculate the health factor for the OsToken position |
isGenesis |
This vault is owned by stakewise |
allocatorMaxBoostApy |
The average max boost APY earned in this vault by the allocator |
osTokenHolderMaxBoostApy |
The average max boost APY earned in this vault by the osToken holder |
queuedShares |
The total number of queued shares |
2. sdk.vault.getHarvestParams
New output format:
type Output = {
canHarvest: boolean // NEW
params: {
reward: string
proof: Array<string>
rewardsRoot: string
unlockedMevReward: string
}
}
3. Removed method
sdk.osToken.getAvgRewardsPerSecond
4. Removed output field
sdk.osToken.getPosition
Removed fee
type RemovedOutput = {
minted: {
fee: bigint
}
}
Name | Description |
---|---|
boost.shares |
Count of osToken tokens with boost |
5. Added method getStakewiseStats
sdk.utils.getStakewiseStats
Getting common stakewise data for the network
6. Added optional input field
sdk.vault.getExitQueuePositions
Added Argument:
Name | Type | Required |
---|---|---|
isClaimed | boolean |
No |
7. Removed output field
sdk.vault.getStakeBalance
type RemovedOutput = {
shares: bigint
}
8. Deprecated method sdk.osToken.getConfig
Use sdk.vault.getVault
instead to get the result in osTokenConfig
field.
9. Added methods
sdk.vault.getVaultStats
& sdk.vault.getUserStats
With the help of this data it is possible to build a chart.
10. Removed method sdk.vault.getSnapshots
Use sdk.vault.getVaultStats
instead
11. Updated method sdk.vault.getUserRewards
Updated output format:
type Output = Array<{
date: number
dailyRewards: number
dailyRewardsEur: number
dailyRewardsGbp: number
dailyRewardsUsd: number
}>
New arguments:
Name | Type | Type | Description |
---|---|---|---|
dateFrom | number |
Yes | Time to start in milliseconds |
dateTo | number |
Yes | Time to end in milliseconds |
userAddress | string |
Yes | The user address |
vaultAddress | string |
Yes | The address of the vault |
12. Added method getFiatRates
sdk.utils.getFiatRates
Getting fiat values for the network
13. Removed input field
sdk.vault.operate
Removed depositDataRoot use vault.setDepositDataRoot
instead
Removed depositDataManager use vault.setDepositDataManager
instead
type RemovedInput = {
depositDataManager: string
depositDataRoot: string
}
14. Removed method sdk.vault.getScorePercentiles
15. Added method
sdk.boost.getData
Get the address of the leverage strategy proxy contract
16. Added method
sdk.boost.getLeverageStrategyProxy
Get the address of the leverage strategy proxy contract
17. Added method
sdk.utils.getPermitSignature
Get permit signature for ERC20 token
18. Added method
sdk.boost.lock
Boost your osToken apy using leverage staking
19. Added method
sdk.boost.unlock
Unboost your boosted osToken
20. Added method
sdk.boost.claimQueue
Claim user unboost queue
20. Changed output field
sdk.vault.getExitQueuePositions
// Output changed type from bigint to string
positions[number]['exitQueueIndex']
21. Added method
sdk.utils.getFiatRatesByDay
Get fiat data by day
22. sdk.osToken.getAPY
New output field:
type Output = {
apy: string
feePercent: number
}
23. Added input field referrerAddress
sdk.vault.deposit
sdk.osToken.mint
24. sdk.utils.getFiatRates
New output fields:
type AddedOutput = {
'USD/CNY': number
'USD/JPY': number
'USD/KRW': number
'USD/AUD': number
}
25. sdk.vault.getUserRewards
New output fields:
type AddedOutput = {
dailyRewardsCny: number
dailyRewardsJpy: number
dailyRewardsKrw: number
dailyRewardsAud: number
}
26. sdk.utils.getFiatRatesByDay
New output fields:
type AddedOutput = {
usdToCnyRate: string
usdToJpyRate: string
usdToKrwRate: string
usdToAudRate: string
}
2.1.0
- Breaking change: Removed default rpc urls from the SDK. When creating a new SDK instance, you must provide the rpc urls or provider.
What's Changed
- Release sdk by @mike-diamond in #158
- [wormhole update] update wormhole script by @mike-diamond in #159
- remove husky by @dfkadyr in #160
- [rpc urls] removed default rpc urls by @mike-diamond in #161
Full Changelog: 2.0.3...2.1.0
2.0.3
- npm packages upgrade
- enabled restake logic
- improved reward splitter methods
What's Changed
- [aave data] remove abis by @mike-diamond in #149
- [publish build] add publish build by @mike-diamond in #150
- [packages] up packages by @mike-diamond in #151
- Enable restake logic by @dfkadyr in #152
- update addresses for mainet by @dfkadyr in #153
- Fix reward splitters by @Cast0001 in #154
- update README by @dfkadyr in #156
- [fee splitter fix] update call static methods to remove by @mike-diamond in #157
Full Changelog: 2.0.2...2.0.3
2.0.2
What's Changed
Fixed 2.0.1 version (type error)
- Release 2.0.1 by @mike-diamond in #146
- [gnosis stake] add gnosis balancer pool by @mike-diamond in #147
- Fix 2.0.1 by @Cast0001 in #148
Full Changelog: 2.0.1...2.0.2
2.0.1
- Add the sdk.vault.create method
- Add a getVaultFactory helper to retrieve the vault factory contract based on the provided vault type and ERC20 token availability
- Update the sdk.vault.operate method to accept
image
,displayName
, anddescription
instead ofmetadataIpfsHash
Updates
sdk.vault.operate
Removed arguments:
Name | Type | Required | Access | Description |
---|---|---|---|---|
metadataIpfsHash | string |
No | Admin | The vault metadata IPFS hash |
New arguments:
Name | Type | Required | Access | Description |
---|---|---|---|---|
image | string |
No | Admin | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
displayName | string |
No | Admin | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
description | string |
No | Admin | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |
New
sdk.vault.create
Description:
Create a vault. When the transaction is executed, one gwei of the deposit token must be stored in the vault to avoid inflation attack.
Pay attention to chains where the deposit token is not a native token (such as Gnosis or Chiado).
On these chains before creating the vault, ensure that you call the approve
function on the deposit token contract,
allowing the vault factory address to spend one gwei.
You can retrieve the vault factory contract using the helper function: sdk.getVaultFactory({ vaultType: params.type, isErc20: params.isErc20 })
.
Arguments:
Name | Type | Required | Description |
---|---|---|---|
userAddress | string |
Yes | The address of the user initiating the action. This address will become the vault admin |
type | VaultType |
No | Allowed vault types: Default, Private and Blocklist. Available vault types can be found in the enum VaultType which you can be imported from the library |
vaultToken | { name: string, symbol: string } |
No | If provided, the vault will be created with its own ERC20 token |
capacity | bigint |
No | If provided, should be defined in gwei. By default, capacity is MaxUint256 ; the minimum allowed capacity is parseEther('32') |
keysManagerFee | number |
No | If provided, should be between 0 and 100 , inclusive with a maximum of two decimal digits allowed (e.g., 15.35 ). By default, the fee is 0 |
isOwnMevEscrow | boolean |
No | Defines whether to send block rewards to the Smoothing Pool (false ) or keep them only to your Vault (true ). By default, this value is false |
image | string |
No | The vault image in base64 string format (will be uploaded to IPFS; maximum size is 1 MB) |
displayName | string |
No | The vault display name (will be uploaded to IPFS; maximum size is 30 characters) |
description | string |
No | The vault description (will be uploaded to IPFS; maximum size is 1000 characters) |
Example:
const params = {
userAddress: '0x...',
type: VaultType.Default,
vaultToken: {
name: 'Vault Token',
symbol: 'vlt',
},
capacity: MaxUint256,
keysManagerFee: 0,
isOwnMevEscrow: false,
image: 'data:image/png;base64,...',
displayName: 'Example vault',
description: 'Example description',
}
// Transaction example
// Send transaction to create a vault
const hash = await sdk.vault.create(params)
// When you sign transactions on the backend (for custodians)
const { data, to, value } = await sdk.vault.deposit.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.deposit.estimateGas(params)
What's Changed
- Improve versions by @Cast0001 in #143
- Vault create sdk by @mike-diamond in #144
- [skip upload metadata] add skip rule by @mike-diamond in #145
Full Changelog: 2.0.0...2.0.1
2.0.0
- Update eslint -> 8.56.0
- Update node version -> 20.12.2
- Update Backend GraphQ url -> "https://holesky-api.stakewise.io/graphql"
- Add removeOldFiles helper. The removeOldFiles function deletes all files with the extension .graphql.ts in subdirectories of the specified directory, if there is no corresponding file with the extension .graphql.
If the directory does not contain any .graphql files, it is deleted along with all its contents. - Refactor multicall contracts. Implement new commonMulticall, vaultMulticall, eigenPodOwnerMulticall, rewardSplitterMulticall.
- Implement new logic for encode & estimateGas to all transaction methods
- Add new check access utils methods:
checkAdminAccess | checkBlocklistManagerAccess | checkDepositDataManagerAccess | checkRestakeOperatorsManagerAccess | checkWhitelisterAccess
, to more thoroughly verify access for vault transactions
Updates
sdk.vault.getExitQueuePositions
Returns:
type Output = {
...oldOutput,
duration: number | null
}
Name | Description |
---|---|
duration |
Total queue duration time (in seconds). - It represents the approximate time after which the assets can be collected (in seconds). - If the value is null, the time is still being calculated. - If the value is 0, the assets are available and can be collected. (New*) |
sdk.vault.getVault
Returns:
type Output = {
...oldOutput,
version: number
isRestake: boolean
whitelistManager: string
depositDataManager: string
restakeOperatorsManager: string
restakeWithdrawalsManager: string
}
Name | Description | Status |
---|---|---|
whitelister |
- | Deprecated! |
vaultKeysManager |
- | Deprecated! |
version |
Vault version (1 or 2) | New |
isRestake |
Indicates whether the Vault is a restaking vault | New |
whitelistManager |
Whitelist | New |
depositDataManager |
Keys | New |
restakeOperatorsManager |
If the Vault is a restaking vault, restake operators manager can add/remove restake operators | New |
restakeWithdrawalsManager |
If the Vault is a restaking vault, restake withdrawals manager can manage EigenLayer withdrawals | New |
sdk.vault.getMaxWithdraw
New arguments:
Name | Type | Required | Info |
---|---|---|---|
vaultAddress | bigint |
Yes | Address of vault |
sdk.vault.updateWhitelist Deprecated!
Description:
Use sdk.vault.operate instead
sdk.vault.updateBlocklist Deprecated!
Description:
Use sdk.vault.operate instead
osToken
sdk.osToken.getBurnAmount
New arguments:
Name | Type | Required | Info |
---|---|---|---|
vaultAddress | string |
Yes | Address of vault |
sdk.osToken.getMaxMint
New arguments:
Name | Type | Required | Info |
---|---|---|---|
vaultAddress | string |
Yes | Address of vault |
sdk.osToken.getBaseData Deprecated!
Description:
Use osToken.getConfig and osToken.getRate
New
Vault
sdk.vault.getRewardSplitters
Fetch the list of created reward splitters. A reward splitter is a contract designed to distribute vault rewards among multiple fee recipients in predefined proportions.
To use a reward splitter, its address should be added to the vault as a fee recipient.
Arguments:
Name | Type | Type | Description |
---|---|---|---|
vaultAddress | string |
Yes | The address of the vault |
owner | string |
Yes | The owner of the reward splitter |
rewardSplitterAddress | string |
No | The address of the reward splitter (optional) |
Returns:
type FeeRecipient = {
shares: bigint
percent: number
address: string
}
type RewardSplitter = {
owner: string
address: string
totalShares: bigint
feeRecipients: FeeRecipient[]
}
type Output = {
rewardSplitters: RewardSplitter[]
}
Name | Description |
---|---|
rewardSplitters |
An array of objects representing the result of the query based on your parameters |
sdk.vault.getEigenPods
Returns eigen pods for restake vault.
Arguments:
Name | Type | Required | Description |
---|---|---|---|
vaultAddress | string |
Yes | The address of the vault |
limit | number |
No | Limits the number of eigen pods returned. Defaults to 100 |
skip | number |
No | Skips the specified number of eigen pods. Defaults to 0 |
Returns:
type Output = {
link: string
owner: string
operator: string
restaked: string
createdAt: number
podAddress: string
}
Name | Description |
---|---|
createdAt |
Date of Creation |
link |
Link to beaconchain |
operator |
The eigenPod's operator |
podAddress |
The eigenPod's address |
restaked |
EgenPod's restaked (in ETH) |
owner |
The address of the eigen pod owner |
sdk.vault.setDepositDataRoot
Description:
Adding root validators to vaults version 2 or higher
Arguments:
Name | Type | Required | Description |
---|---|---|---|
validatorsRoot | string |
Yes | The vault validators merkle tree |
userAddress | string |
Yes | - |
vaultAddress | string |
Yes | - |
Example:
const params = {
validatorsRoot: 'hash',
vaultAddress: '0x...',
userAddress: '0x...',
}
// Send transaction
const hash = await sdk.vault.setDepositDataRoot(params)
// When you sign transactions on the backend (for custodians)
const { data, to } = await sdk.vault.setDepositDataRoot.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.setDepositDataRoot.estimateGas(params)
sdk.vault.setDepositDataManager
Description:
Adding deposit data manager to vaults version 2 or higher
Arguments:
Name | Type | Required | Description |
---|---|---|---|
managerAddress | string |
Yes | New deposit-data manager |
userAddress | string |
Yes | - |
vaultAddress | string |
Yes | - |
Example:
const params = {
managerAddress: '0x...',
vaultAddress: '0x...',
userAddress: '0x...',
}
// Send transaction
const hash = await sdk.vault.setDepositDataManager(params)
// When you sign transactions on the backend (for custodians)
const { data, to } = await sdk.vault.setDepositDataManager.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.setDepositDataManager.estimateGas(params)
sdk.vault.createEigenPod
Description:
Adding eigen pod to the vault. Only for restake vaults and only restake operators manager can perform this action.
Arguments:
Name | Type | Required | Description |
---|---|---|---|
userAddress | string |
Yes | The address of the user making the request |
vaultAddress | string |
Yes | The address of the vault |
Example:
const params = {
vaultAddress: '0x...',
userAddress: '0x...',
}
// Send transaction
const hash = await sdk.vault.createEigenPod(params)
// When you sign transactions on the backend (for custodians)
const { data, to } = await sdk.vault.createEigenPod.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.createEigenPod.estimateGas(params)
sdk.vault.setEigenPodOperator
Description:
Adding operator to the current eigen pod. This action is specific to restake vaults and can only be executed by the restake operators manager.
Arguments:
Name | Type | Required | Description |
---|---|---|---|
userAddress | string |
Yes | The address of the user making the request |
vaultAddress | string |
Yes | The address of the vault |
ownerAddress | string |
Yes | The address of the eigen pod owner |
operatorAddress | string |
Yes | New operator for current eigen pods |
Example:
const params = {
operatorAddress: '0x...',
}
// Send transaction
const hash = await sdk.vault.setEigenPodOperator(params)
// When you sign transactions on the backend (for custodians)
const { data, to } = await sdk.vault.setEigenPodOperator.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.setEigenPodOperator.estimateGas(params)
sdk.vault.updateEigenPodOperator
Description:
Update operator to the...
1.3.1
What's Changed
- 1.3.0 by @Cast0001 in #88
- [abort promise] update abort promise by @mike-diamond in #99
- [fallback]: add fallback logic by @dfkadyr in #93
- [balancer swap] add balancer vault address by @mike-diamond in #95
- Handle 429 error by @Cast0001 in #102
- [quick node token] add jwt by @mike-diamond in #105
- Ethers by @Cast0001 in #113
Full Changelog: 1.3.0...1.3.1
1.3.0
What's Changed
- 1.2.0 by @Cast0001 in #74
- Remove goerli by @Cast0001 in #75
- List actions by @mike-diamond in #81
- [blocklist sync] fix sync by @mike-diamond in #83
- Improves by @Cast0001 in #85
- [fix-exit-queue] v1/v2 support logic by @Cast0001 in #86
- [exit-queue-req] add prop by @Cast0001 in #87
Full Changelog: 1.2.0...1.3.0
1.2.0
What's Changed
- Abort request by @mike-diamond in #72
- Fix scheme & add token by @Cast0001 in #73
Full Changelog: 1.1.0...1.2.0