import type { Call } from "starknet"; import { type Address, type ExecuteOptions } from "../types/index.js"; import type { Tx } from "../tx/index.js"; import type { TrovesStrategiesResponse, TrovesStatsResponse, TrovesCallParams, TrovesDepositParams, TrovesWithdrawParams, TrovesPosition } from "../troves/types.js"; import type { WalletInterface } from "../wallet/interface.js"; export interface TrovesOptions { fetcher?: typeof fetch; timeoutMs?: number; /** * Override the Troves API base URL. * * Required to use Troves on a non-mainnet chain — the SDK throws on * Sepolia by default since Troves is a mainnet-only service. */ apiBase?: string; } /** * Troves module for interacting with Troves DeFi strategies via StarkZap. * * Read operations (getStrategies, getStats) use Troves HTTP APIs. * Write operations (deposit, withdraw) call the Troves deposit/withdraw API to get * transaction calls, then execute them via wallet.execute(). * * @example * ```ts * const wallet = await sdk.connectWallet({ account: { signer } }); * const troves = new Troves(wallet); * * const strategies = await troves.getStrategies(); * const stats = await troves.getStats(); * const tx = await troves.deposit({ * strategyId: "evergreen_strk", * amount: Amount.parse("1", STRK), * }); * ``` */ export declare class Troves { private readonly wallet; private readonly fetcher; private readonly timeoutMs; private readonly apiBase; constructor(wallet: Pick, options?: TrovesOptions); private fetchJson; getStrategies(options?: { noCache?: boolean; }): Promise; getStats(): Promise; /** * Get the wallet's position in a Troves strategy. * * Reads on-chain via two view calls on the strategy's `Vault` contract: * `balance_of` for the share count, then `convert_to_assets` to express * the holding in its underlying tokens. The SDK infers single- vs * dual-asset layout from `strategy.depositTokens.length`. * * Returns `null` when the wallet holds no shares, or when the strategy * has no readable vault contract (e.g. accumulator / TVA strategies). * * @throws Error if the strategy id is unknown * * @example * ```ts * const pos = await wallet.troves().getPosition("ekubo_cl_strketh"); * if (pos) { * console.log(`shares: ${pos.shares}`); * pos.amounts.forEach((a) => console.log(a.toFormatted())); * } * ``` */ getPosition(strategyId: string, address?: Address): Promise; private populateCalls; /** * Returns the deposit calls without executing — kept separate from `deposit()` * so callers can compose them atomically with other calls. */ populateDepositCalls(params: TrovesCallParams): Promise; /** * Returns the withdraw calls without executing — kept separate from `withdraw()` * so callers can compose them atomically with other calls. */ populateWithdrawCalls(params: TrovesCallParams): Promise; /** * Returns the deposit calls for an `Amount`-typed request without executing. * * Used by `wallet.tx().trovesDeposit(...)` to compose a Troves deposit * into a larger atomic transaction. Use `deposit()` to execute directly. */ populateDeposit(params: TrovesDepositParams): Promise; /** * Returns the withdraw calls for an `Amount`-typed request without executing. * * Used by `wallet.tx().trovesWithdraw(...)` to compose a Troves withdraw * into a larger atomic transaction. Use `withdraw()` to execute directly. */ populateWithdraw(params: TrovesWithdrawParams): Promise; deposit(params: TrovesDepositParams, options?: ExecuteOptions): Promise; withdraw(params: TrovesWithdrawParams, options?: ExecuteOptions): Promise; } //# sourceMappingURL=troves.d.ts.map