import { Provider } from '@ethersproject/providers'; import { Signer } from 'ethers'; import { KasuSdk } from '../kasu-sdk'; import { DepositsFacade } from './deposits'; import { FlowsFacade } from './flows'; import { StrategiesFacade } from './strategies'; import { ChainConfigEntry, KasuOptions } from './types'; import { PortfolioFacade } from './user-portfolio'; /** * High-level entry point for external integrators. * * Provides four domain facades — `strategies`, `deposits`, `portfolio`, * `flows` — and exposes the underlying `KasuSdk` services via `.services` for * power-users. * * ```ts * import { Kasu } from '@kasufinance/kasu-sdk'; * * // Read-only — no wallet needed, uses the chain's default RPC * const kasu = Kasu.create({ chain: 'base' }); * const strategies = await kasu.strategies.getAll(); * * // Writable — same config, bound to a signer * const signed = kasu.connect(signer); * const tx = await signed.deposits.deposit({ poolId, trancheId, amount, kycSignature }); * * // User positions (read-only is enough) * const positions = await kasu.portfolio.getPositions(userAddress); * ``` */ export declare class Kasu { /** Browse lending strategies, APY, capacity. */ readonly strategies: StrategiesFacade; /** Deposit, withdraw, KYC helpers. */ readonly deposits: DepositsFacade; /** User positions, yields, transaction history. */ readonly portfolio: PortfolioFacade; /** Headless deposit / withdraw state machines. */ readonly flows: FlowsFacade; private readonly _sdk; private readonly _chainConfig; private readonly _signerOrProvider; /** * Kept so `connect(signer)` can rebuild an identical instance. A connected * instance that silently dropped the overrides would query a different set * of pools than the read-only one it came from. */ private readonly _configOverrides; private constructor(); /** * Create a Kasu instance with built-in chain config. * * `signerOrProvider` is optional: without one the instance is READ-ONLY on * `chainConfig.rpcUrls[0]`. Use `connect(signer)` when a wallet arrives. * * ```ts * // Minimal setup — read-only, built-in Base mainnet config * const kasu = Kasu.create({ chain: 'base' }); * * // Custom config override * const kasu = Kasu.create({ * chain: 'base', * signerOrProvider: signer, * configOverrides: { UNUSED_LENDING_POOL_IDS: ['0x...'] }, * }); * * // Fully custom chain * const kasu = Kasu.create({ * chain: { chainId: 123, name: 'MyChain', ... }, * signerOrProvider: provider, * }); * ``` */ static create(options: KasuOptions): Kasu; /** * A NEW instance bound to `signer`, with the same chain config and the same * `configOverrides` — the writable counterpart of a read-only instance. * * Named after `contract.connect(signer)` in ethers, and behaves the same * way: the receiver is not mutated, so a read-only `Kasu` stays read-only * and can keep serving public data after a wallet connects. * * ```ts * const kasu = Kasu.create({ chain: 'base' }); // read-only * const signed = kasu.connect(await getSigner()); // writable * ``` */ connect(signer: Signer): Kasu; /** * Access the underlying `KasuSdk` services for advanced use cases. * * ```ts * const locks = await kasu.services.Locking.getUserLocks(address); * ``` */ get services(): KasuSdk; /** The resolved chain configuration. */ get chainConfig(): ChainConfigEntry; /** Whether this deployment has KSU token / locking features. */ get isLiteDeployment(): boolean; /** * True when this instance was built from a Provider rather than a Signer, * so every read works and every write is refused. Call `connect(signer)` * for a writable instance. */ get isReadOnly(): boolean; /** * The provider this instance reads through — the signer's own provider when * it was created from a signer. * * Throws for a signer with no provider attached (an offline signer can sign * but cannot read), because there is no provider to hand back and returning * `undefined` would only move the failure somewhere less obvious. */ get provider(): Provider; }