@dripfi/silo-sdk
v0.0.1
Published
Silo SDK
Downloads
40
Readme
Silo SDK
Introduction
The Silo SDK is a TypeScript library designed to interact with the Silo protocol. It provides methods to retrieve information about Silo Vaults, deposit, withdraw and fetch user balances.
Installation
To use the Silo SDK in your project, you can install it via npm or yarn:
npm i @dripfi/silo-sdkUsage
import { SiloSdk } from '@dripfi/silo-sdk'
const siloSdk = new SiloSdk(signer)
siloSdk.contracts:
Contains methods to interact with Silo contracts
- Deposit 1 USDC in vault
0x...123:
** Before depositing, make sure to approve token usage for the vault **
const depositAmount = 1_000_000
const depositTx = await siloSdk.deposit(depositAmount, `0x...123`)
- Make a partial withdraw (1 USDC) from vault
0x...123. We assume totalBalance > 1 USDC:
const withdrawAmount = 1_000_000
const withdrawTx = await siloSdk.withdraw(withdrawAmount, `0x...123`)
- Make a total withdraw from vault
0x...123:
const totalShares = await siloSdk.getBalance(`0x...123`)
const withdrawTx = await siloSdk.redeem(totalShares, `0x...123`)
- Get the current total asset balance from vault
0x...123:
const totalBalanceInUsdc = await siloSdk.getBalanceInAssets(`0x...123`)
siloSdk.subgraph:
Contains methods to get information from silo subgraphs. Supports sonic chain only.
Abis
- SILO_VAULT_ABI
