The Yelay Lite SDK is a lightweight software development kit for interacting with Yelay's blockchain ecosystem. It provides streamlined access to vaults, yield farming, and projects via smart contract interactions as well as Backend queries.
Only Base(chainId: 8453) is supported currently.
To install the SDK, use npm or pnpm:
npm install @yelay-lite/sdk
or
pnpm add @yelay-lite/sdk
To start using the SDK, initialize it with an Ethereum signer or provider and a network chainId:
import { YelayLiteSdk } from '@yelay-lite/sdk';
import { Signer } from 'ethers';
import { Provider } from '@ethersproject/abstract-provider';
const signerOrProvider: Signer | Provider = /* Your signer or provider */;
const chainId = 8453;
const sdk = new YelayLiteSdk(signerOrProvider, chainId);
Get all vaults managed on network.
const vaults = await sdk.vaults.getVaults();
const integratorAddress = '0x555';
const vault = '0x1234';
const { minPool, maxPool, clientName } = await sdk.vaults.clientData(integratorAddress, vault);
const poolToActivate = minPool + 5; // should be in range: minPool < poolToActivate < maxPool
const isPoolActive = await sdk.vaults.poolActive(vault, poolToActivate);
if (!isPoolActive) {
await sdk.vaults.activatePool(vault, poolToActivate);
}
const vault = '0x1234';
const pool = 1234;
const amount = '1000000';
const allowance = await sdk.vaults.allowance(vault);
if (allowance.isZero()) {
const approveTx = await sdk.vaults.approve(vault, amount);
await approveTx.wait();
}
const depositTx = await sdk.vaults.deposit(vault, pool, amount);
await depositTx.wait();
const tx = await sdk.vaults.depositEth(vault, pool, amount);
await tx.wait();
const vault = '0x123';
const pool = 1234;
const amount = '1000000';
const tokenToSwap = '0x456';
// only 1inch Aggregation Router v6 is supported
const swapTarget = '1inch Aggregation Router v6 address';
const swapCallData = '0x9...1';
const allowance = await sdk.vaults.vaultWrapperAllowance(tokenToSwap);
if (allowance.isZero()) {
const approveTx = await sdk.vaults.approveVaultWrapper(tokenToSwap, amount);
await approveTx.wait();
}
const swapAndDepositTX = await sdk.vaults.swapAndDeposit(vault, pool, amount, {
swapCallData,
swapTarget,
tokenIn: tokenToSwap,
});
await swapAndDepositTX.wait();
const redeemTx = await sdk.vaults.redeem(vault, pool, amount);
await redeemTx.wait();
const fromPool = 123;
const toPool = 456;
const migrateTx = await sdk.vaults.migrate(vault, fromPool, toPool, amount);
await migrateTx.wait();
const userPoolBalance = await sdk.vaults.balanceOf(vault, pool, await signer.getAddress());
const poolsTvl = await sdk.pools.getPoolsTvl(vault, [pool]);
const vaultsYield = await sdk.yields.getVaultsYield();
const aggregatedYieldData = await sdk.yields.getYields();
This SDK is licensed under the ISC License.