Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/sdk/API/01-vault/01-transactions/burnAndWithdraw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: burnAndWithdraw
slug: /sdk/api/vault/transactions/burnandwithdraw
description: Use the StakeWise SDK burnAndWithdraw method to burn osToken and unstake funds from a vault in a single transaction.
---

#### Description:

Burn the osToken required to unstake and withdraw funds from a vault in a single transaction.

Pass `assets` for the default withdraw-driven mode: unstake that amount, burning the minimum osToken it requires.
Pass `shares` instead for the burn-driven mode: burn exactly that many osToken shares and unstake all the collateral that burning frees.

Provide one of `assets` or `shares`.

#### Arguments:

| Name | Type | Required | Description |
|--------------|----------|----------|-------------------------------------------------------------------|
| assets | `bigint` | No | Unstake amount (withdraw-driven mode) |
| shares | `bigint` | No | osToken shares to burn; unstakes all the collateral it frees |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault |

#### Example:

```ts
const params = {
vaultAddress: '0x...',
userAddress: '0x...',
assets: 200n, // withdraw-driven; or pass shares: 200n to burn exactly that and unstake the equivalent
}

// Send transaction
const hash = await sdk.vault.burnAndWithdraw(params)

// Wait for the transaction to be confirmed and indexed
await sdk.provider.waitForTransaction(hash)
await sdk.utils.waitForSubgraph({ hash })

// When you sign transactions on the backend (for custodians)
const { data, to } = await sdk.vault.burnAndWithdraw.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.burnAndWithdraw.estimateGas(params)
```
11 changes: 6 additions & 5 deletions docs/sdk/API/01-vault/01-transactions/deposit.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ Deposit (stake) in a vault

#### Arguments:

| Name | Type | Required | Description |
|--------------|----------|----------|---------------------------|
| assets | `bigint` | **Yes** | Deposit amount |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault |
| Name | Type | Required | Description |
|-----------------|----------|----------|------------------------------|
| assets | `bigint` | **Yes** | Deposit amount |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault |
| referrerAddress | `string` | **No** | The address of the referrer |

#### Example:

Expand Down
50 changes: 50 additions & 0 deletions docs/sdk/API/01-vault/01-transactions/depositAndMint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
id: depositAndMint
slug: /sdk/api/vault/transactions/depositandmint
description: Use the StakeWise SDK vault depositAndMint method to stake assets and mint osToken in one transaction.
---

#### Description:

Deposit (stake) and mint osToken in one transaction.

#### Arguments:

| Name | Type | Required | Description |
|-----------------|----------|----------|-------------------------------|
| assets | `bigint` | **Yes** | Deposit amount |
| receiveShares | `bigint` | **Yes** | The amount of osToken to mint |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault |
| referrerAddress | `string` | **No** | The address of the referrer |

#### Example:

```ts
const assets = parseEther('1')

const receiveShares = await sdk.osToken.getMaxMintAmount({
vaultAddress: '0x...',
userAddress: '0x...',
additionalStakedAssets: assets,
})

const params = {
vaultAddress: '0x...',
userAddress: '0x...',
assets,
receiveShares,
}

// Send transaction
const hash = await sdk.vault.depositAndMint(params)

// Wait for the transaction to be confirmed and indexed
await sdk.provider.waitForTransaction(hash)
await sdk.utils.waitForSubgraph({ hash })

// When you sign transactions on the backend (for custodians)
const { data, to, value } = await sdk.vault.depositAndMint.encode(params)
// Get an approximate gas per transaction
const gas = await sdk.vault.depositAndMint.estimateGas(params)
```
13 changes: 7 additions & 6 deletions docs/sdk/API/01-vault/getMaxWithdrawAmount.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
---
id: getMaxWithdrawAmount
slug: /sdk/api/vault/requests/getmaxwithdrawamount
description: Use the StakeWise SDK getMaxWithdrawAmount method to calculate the maximum amount a user can withdraw from a vault.
description: Use the StakeWise SDK getMaxWithdrawAmount method to calculate the maximum amount a user can withdraw from a vault, optionally including the assets freed by burning their osToken.
---

#### Description:

How much a user can withdraw. Use this method if the user has mintedAssets, if minted balance is null then maxWithdraw will be equal to stakedAssests.
How much a user can withdraw. The result accounts for the user's minted osToken; if there is no minted balance, it equals their staked assets. Pass `withBurn: true` to also include the assets that would be freed by burning the user's osToken, capped by the balance held in their wallet.

#### Arguments:

| Name | Type | Required | Info |
|--------------|----------|----------|--------------------------------------------------------------|
| vaultAddress | `string` | **Yes** | The address of the vault |
| userAddress | `string` | **Yes** | The address of the user |
| Name | Type | Required | Info |
|--------------|-----------|----------|------------------------------------------------------------------|
| vaultAddress | `string` | **Yes** | The address of the vault |
| userAddress | `string` | **Yes** | The address of the user |
| withBurn | `boolean` | No | Include assets freed by burning osToken (capped by the wallet) |

#### Returns:

Expand Down
26 changes: 15 additions & 11 deletions docs/sdk/API/01-vault/getUserRewards.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ type Output = {
dailyRewardsJpy: number
dailyRewardsKrw: number
dailyRewardsAud: number
dailyStakeRewards: number
dailyBoostRewards: number
}
```

| Name | Description |
|-------------------|---------------------------|
| `date` | Сurrent rate date |
| `dailyRewards` | Daily reward asset in ETH |
| `dailyRewardsUsd` | Daily reward asset in USD |
| `dailyRewardsEur` | Daily reward asset in EUR |
| `dailyRewardsGbp` | Daily reward asset in GBP |
| `dailyRewardsCny` | Daily reward asset in CNY |
| `dailyRewardsJpy` | Daily reward asset in JPY |
| `dailyRewardsKrw` | Daily reward asset in KRW |
| `dailyRewardsAud` | Daily reward asset in AUD |
| Name | Description |
|---------------------|---------------------------------|
| `date` | Сurrent rate date |
| `dailyRewards` | Daily reward asset in ETH |
| `dailyRewardsUsd` | Daily reward asset in USD |
| `dailyRewardsEur` | Daily reward asset in EUR |
| `dailyRewardsGbp` | Daily reward asset in GBP |
| `dailyRewardsCny` | Daily reward asset in CNY |
| `dailyRewardsJpy` | Daily reward asset in JPY |
| `dailyRewardsKrw` | Daily reward asset in KRW |
| `dailyRewardsAud` | Daily reward asset in AUD |
| `dailyStakeRewards` | Daily stake reward asset in ETH |
| `dailyBoostRewards` | Daily boost reward asset in ETH |

#### Example:

Expand Down
23 changes: 14 additions & 9 deletions docs/sdk/API/02-boost/01-transactions/lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ Boost your osToken apy using leverage staking

#### Arguments:

| Name | Type | Required | Description |
|-----------------|----------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| amount | `bigint` | **Yes** | Boost amount |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault that will mint osTokens for leverage staking |
| boostAddress | `string` | **Yes** | The address of the strategy proxy using the [sdk.boost.getLeverageStrategyProxy](/sdk/api/boost/requests/getleveragestrategyproxy) method |
| referrerAddress | `string` | **No** | The address of the referrer |
| permitParams | `PermitParams` | **No** | The permit signature is required if there isn’t enough osToken allowance for the strategy proxy contract.<br /><br />**For MultiSig**<br />The permit signature is not necessary for Multi Sig (e.g. Safe Wallet), as it should use `sdk.contracts.tokens.mintToken.approve(boostAddress, MaxUint256)` instead of a permit call to set up osToken allowance. This will be called in the action if needed.<br /><br />**For other wallets**<br />The permit signature is optional since it will be obtained automatically using the [utils.getPermitSignature](/sdk/api/utils/getpermitsignature) method. |
| Name | Type | Required | Description |
|----------------------|----------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| amount | `bigint` | **Yes** | Boost amount |
| userAddress | `string` | **Yes** | The user address |
| vaultAddress | `string` | **Yes** | The address of the vault that will mint osTokens for leverage staking |
| boostAddress | `string` | **Yes** | The address of the strategy proxy using the [sdk.boost.getLeverageStrategyProxy](/sdk/api/boost/requests/getleveragestrategyproxy) method |
| referrerAddress | `string` | **No** | The address of the referrer |
| permitParams | `PermitParams` | **No** | The permit signature is required if there isn’t enough osToken allowance for the strategy proxy contract.<br /><br />**For MultiSig**<br />The permit signature is not necessary for Multi Sig (e.g. Safe Wallet), as it should use `sdk.contracts.tokens.mintToken.approve(boostAddress, MaxUint256)` instead of a permit call to set up osToken allowance. This will be called in the action if needed.<br /><br />**For other wallets**<br />The permit signature is optional since it will be obtained automatically using the [utils.getPermitSignature](/sdk/api/utils/getpermitsignature) method. |
| approveParams | `ApproveParams` | **No** | Force an on-chain `approve` instead of an off-chain permit, so the approval can be one of the bundled calls in an EIP-5792 transaction batch. When provided, `lock.encode` returns `approveTxData` for EOAs too (not only MultiSig) and `lockTxData` omits the permit. `amount` is the approval amount, must be greater than 0 — pass `MaxUint256` for unlimited allowance. |
| leverageStrategyData | `LeverageStrategyData` | **No** | Leverage strategy data from [sdk.boost.getLeverageStrategyData](/sdk/api/boost/requests/getleveragestrategydata). If not provided, it will be fetched automatically during the transaction |

```ts
type LeverageStrategyData = {
version: number
isRequired: boolean
isUpgradeRequired: boolean
}

type PermitParams = {
Expand All @@ -34,6 +35,10 @@ type PermitParams = {
r: string
s: string
}

type ApproveParams = {
amount: bigint
}
```

#### Example:
Expand Down
Loading