npm i @alphafi/alphafi-sdk
Call this to get all Vaults that a particular user has deposited in.
import { getVaults, AlphaFiVault } from "@alphafi/alphafi-sdk";
const vaults: AlphaFiVault[] | undefined = await getVaults(address);
Call this to get all Single Asset Vaults that a particular user has deposited in.
import { getSingleAssetVaults, AlphaFiVault } from "@alphafi/alphafi-sdk";
const vaults: AlphaFiVault[] | undefined = await getSingleAssetVaults(address);
Call this to get all Double Asset Vaults that a particular user has deposited in.
import { getDoubleAssetVaults, AlphaFiVault } from "@alphafi/alphafi-sdk";
const vaults: AlphaFiVault[] | undefined = await getDoubleAssetVaults(address);
Call this to get all Vaults on AlphaFi Protocol.
import { getAllVaults } from "@alphafi/alphafi-sdk";
const vaults: string[] = await getAllVaults();
Call this to get all Single Asset Vaults on AlphaFi Protocol.
import { getAllSingleAssetVaults } from "@alphafi/alphafi-sdk";
const vaults: string[] = await getAllSingleAssetVaults();
Call this to get all Double Asset Vaults on AlphaFi Protocol.
import { getAllDoubleAssetVaults } from "@alphafi/alphafi-sdk";
const vaults: string[] = await getAllDoubleAssetVaults();
Call this to get user balance in Alpha Vault.
import { getAlphaVaultBalance, AlphaVaultBalance } from "@alphafi/alphafi-sdk";
const balance: AlphaVaultBalance | undefined =
await getAlphaVaultBalance(address);
Call this to get user balance in Single Asset Vaults.
import {
getSingleAssetVaultBalance,
SingleAssetVaultBalance,
} from "@alphafi/alphafi-sdk";
const balance: SingleAssetVaultBalance | undefined =
await getSingleAssetVaultBalance(address, poolName);
Call this to get user balance in Double Asset Vaults.
import {
getDoubleAssetVaultBalance,
DoubleAssetVaultBalance,
} from "@alphafi/alphafi-sdk";
const balance: DoubleAssetVaultBalance | undefined =
await getDoubleAssetVaultBalance(address, poolName);
Call this to get user balance for all vaults.
import {
PoolName,
AlphaFiVaultBalance,
getAllVaultBalances,
} from "@alphafi/alphafi-sdk";
const balance: Map<PoolName, AlphaFiVaultBalance> =
await getAllVaultBalances(address);
Call this to withdraw from Vaults on AlphaFi Protocol.
import { claimRewardTxb } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await claimRewardTxb(address);
Call this to deposit in Single Asset Vaults on AlphaFi Protocol.
import { depositSingleAssetTxb } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await depositSingleAssetTxb(
poolName,
address,
amount,
);
Call this to deposit in Double Asset Vaults on AlphaFi Protocol.
import { depositDoubleAssetTxb } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await depositDoubleAssetTxb(
poolName,
address,
amount,
isAmountA,
);
Call this to withdraw from Vaults on AlphaFi Protocol. xTokensAmount can be calculated using coinAmountToXTokensSingleAsset or coinAmountToXTokensDoubleAsset function depending on whether the pool is singleAsset or doubleAsset.
import { withdrawTxb } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await withdrawTxb(xTokensAmount, poolName, address);
Call this to withdraw from Alpha Vault on AlphaFi Protocol. xTokensAmount can be calculated using coinAmountToXTokensSingleAsset function. If you want to withdraw from locked alpha tokens then pass withdrawFromLocked as true, otherwise false.
import { withdrawAlphaTxb } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await withdrawAlphaTxb(
xTokensAmount,
withdrawFromLocked,
address,
);
Call this to convert coin amount to xTokenAmount for any Single Asset pool on AlphaFi Protocol.
import { coinAmountToXTokensSingleAsset } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await coinAmountToXTokensSingleAsset(
amount,
poolName,
);
Call this to convert coin amount to xTokenAmount for any Double Asset pool on AlphaFi Protocol. isAmountA parameter is true if you have passed amount of 1st coin, otherwise its false.
import { coinAmountToXTokensDoubleAsset } from "@alphafi/alphafi-sdk";
import { Transaction } from "@mysten/sui/transactions";
const vaults: Transaction = await coinAmountToXTokensDoubleAsset(
amount,
poolName,
isAmountA,
);