Skip to content

Commit

Permalink
Small improves (#55)
Browse files Browse the repository at this point in the history
* [small-improves] remove getRewardsPerYear

* [small-improves] add getGas to main class
  • Loading branch information
Cast0001 authored Jan 4, 2024
1 parent 5aeb0da commit 0aa66f0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 126 deletions.
34 changes: 3 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ const sdk = new StakeWiseSDK({ network: Network.Mainnet })
##### Request table:
| **Vault** | **osToken** | **Utils** |
|------|-------------|------|
| [sdk.vault.getStakerActions](#sdkvaultgetstakeractions) | [sdk.osToken.getBurnAmount](#sdkostokengetburnamount) | [sdk.utils.getRewardsPerYear](#sdkutilsgetrewardsperyear) |
| [sdk.vault.getSnapshots](#sdkvaultgetsnapshots) | [sdk.osToken.getHealthFactor](#sdkostokengethealthfactor) | [sdk.utils.getSwiseUsdPrice](#sdkutilsgetswiseusdprice) |
| [sdk.vault.getExitQueuePositions](#sdkvaultgetexitqueuepositions) | [sdk.osToken.getAPY](#sdkostokengetapy) | [sdk.utils.getTransactions](#sdkutilsgettransactions) |
| [sdk.vault.getStakerActions](#sdkvaultgetstakeractions) | [sdk.osToken.getBurnAmount](#sdkostokengetburnamount) | [sdk.utils.getSwiseUsdPrice](#sdkutilsgetswiseusdprice) |
| [sdk.vault.getSnapshots](#sdkvaultgetsnapshots) | [sdk.osToken.getHealthFactor](#sdkostokengethealthfactor) | [sdk.utils.getTransactions](#sdkutilsgettransactions) |
| [sdk.vault.getExitQueuePositions](#sdkvaultgetexitqueuepositions) | [sdk.osToken.getAPY](#sdkostokengetapy) |
| [sdk.vault.getValidators](#sdkvaultgetvalidators) | [sdk.osToken.getPosition](#sdkostokengetposition) |
| [sdk.vault.getVault](#sdkvaultgetvault) | [sdk.osToken.getMaxMint](#sdkostokengetmaxmint) |
| [sdk.vault.getMaxWithdraw](#sdkvaultgetmaxwithdraw) | [sdk.osToken.getBaseData](#sdkostokengetbasedata) |
Expand Down Expand Up @@ -795,34 +795,6 @@ await sdk.utils.getSharesFromAssets({ amount: 0n })
---
## API-utils
### `sdk.utils.getRewardsPerYear`
#### Description:
Get a list of interactions with the vault.
#### Arguments:
| Name | Type | Type | Description |
|------|------|-------------|---------|
| amount | `string` | **Require** | Deposit amount |
| averageRewardsPerSecond | `string` | **Require** | [getAPY](#sdkostokengetapy) |
#### Returns:
```ts
type Output = string
```
#### Example:
```ts
sdk.utils.getRewardsPerYear({
averageRewardsPerSecond: 0n,
amount: 0n,
})
```
---
### `sdk.utils.getSwiseUsdPrice`
#### Description:
Expand Down
9 changes: 8 additions & 1 deletion src/StakeWiseSDK.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JsonRpcProvider } from 'ethers'

import methods from './methods'
import { configs, apiUrls } from './utils'
import { configs, apiUrls, getGas } from './utils'
import { createContracts, vaultMulticall } from './contracts'


Expand Down Expand Up @@ -45,6 +45,13 @@ class StakeWiseSDK {
})
}

getGas(estimatedGas: bigint) {
return getGas({
provider: this.provider,
estimatedGas,
})
}

get network() {
return this.options.network
}
Expand Down
68 changes: 0 additions & 68 deletions src/methods/utils/getRewardsPerYear.spec.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/methods/utils/getRewardsPerYear.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/methods/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as getRewardsPerYear } from './getRewardsPerYear'
export { default as getSwiseUsdPrice } from './getSwiseUsdPrice'
export { default as getTransactions } from './getTransactions'

0 comments on commit 0aa66f0

Please sign in to comment.