🔋
Ionic Docs
  • Welcome to Ionic
  • Ionic pools
  • Yield-Bearing Vaults (ERC-4626)
  • Partner & Pool Operator Documents
    • Overview
    • Ionic For Partners
      • Long-tail and exotic asset support
      • Liquid Staking Tokens
      • Forex Markets & Non-US Centric DeFi
      • Delta-Neutral Strategies
      • AMM LP Pools
    • Advanced Features
    • Getting Started
    • Pool Customisations
      • The Markets
      • The Yield
      • Pool Parameters
  • Security
    • Security Outline
      • Oracle Security
      • Yield Bearing 4626 Strategy Risk Scoring
      • Liquidity Monitoring
    • Audit
  • Developers
    • Ionic SDK
      • Chain Configuration and Addresses
      • Data Fetching & Pool Introspection
      • Funding Operations
      • Advanced Use-Cases
      • Liquidations
      • Putting It All Together
      • API Reference, Typing & Interfaces
    • Deployed Contract Addresses
  • Support
    • Media Kit
    • DeFi Terms Glossary
    • FAQ
  • Documents
    • Privacy Policy
    • Terms and Conditions
Powered by GitBook
On this page
  • fetchPoolData
  • fetchPools
  • fetchPoolsManual
  1. Developers
  2. Ionic SDK

Data Fetching & Pool Introspection

Whether it be to create a custom dashboard, or just finding out what current positions look like, fetching pool information might be the first and foremost task that most developers will want to use

Initialisation always works the same way -- pick a chain and a provider, and create the ionic object

// Initialisation always works the same way -- 
// pick a chain and a provider, and create the ionic object

const sdk = new IonicSdk(provider, chainId);

fetchPoolData

Arguments:

  • poolId: string

  • address?: string

Returns:

  • Promise<IonicPoolData>

The poolId is the canonical pool index, retrievable via the UI. E.g. https://app.ionic.money/56/pool/1 -> poolId = 1

The address is the address of a pool user, e.g. someone that has provided liquidity, or borrowed assets. If passed, the function will returned detailed information about the user's balances.

const poolData = await sdk.fetchPoolData("1", "0x111...")

poolData.assets.map((a) => console.log(a.underlyingSymbol));

>>> "2brl", "WBNB", "ETH", "BUSD"

fetchPools

Arguments:

  • filter: string | null

  • options: { from: string })

Returns:

  • Promise<IonicPoolData[]>

Returns an array of ionic pools, given a specific filter. Filters can be:

"created-pools" | "verified-pools" | "unverified-pools"

Passing the { from: address } will return the detailed balances of the address provided

fetchPoolsManual

  • verification: boolean

  • options: { from: string }

Returns:

  • Promise<(IonicPoolData | null)[] | undefined>

Slightly optimised data fetching function for expensive calculations that handles failures gracefully in case of using less efficient RPC endpoints

PreviousChain Configuration and AddressesNextFunding Operations

Last updated 1 year ago

This returns a Promise of . Check out the type definition for more information about the data contained in it.

IonicPoolData