@morpho-org/liquidity-sdk-ethers
v1.2.0
Published
Ethers-based package that helps seamlessly calculate the liquidity available through the PublicAllocator.
Keywords
Readme
@morpho-org/liquidity-sdk-ethers
Viem-based package that provides utilities to build ethers-based liquidity bots on Morpho and examples using Flashbots and Morpho's GraphQL API.
Installation
npm install @morpho-org/liquidity-sdk-ethersyarn add @morpho-org/liquidity-sdk-ethersGetting Started
Fetch from API or RPC
import { LiquidityLoader } from "@morpho-org/liquidity-sdk-ethers";
const loader = new LiquidityLoader(
provider // ethers provider.
);
const [withdrawals1, withdrawals2] = await Promise.all([
loader.fetch(
"0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc" as MarketId,
"api"
),
loader.fetch(
"0xe475337d11be1db07f7c5a156e511f05d1844308e66e17d2ba5da0839d3b34d9" as MarketId,
"rpc"
),
]);Fetch only from API
import { ChainId } from "@morpho-org/blue-sdk";
import { LiquidityLoader } from "@morpho-org/liquidity-sdk-ethers";
const loader = new LiquidityLoader({ chainId: ChainId.EthMainnet });
const [withdrawals1, withdrawals2] = await Promise.all([
loader.fetch(
"0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc" as MarketId
),
loader.fetch(
"0xe475337d11be1db07f7c5a156e511f05d1844308e66e17d2ba5da0839d3b34d9" as MarketId
),
]);