/** * Stellar Adapter for August SDK * * Provides Stellar vault operations: deposit, redeem, position queries, * and on-chain data fetching via Soroban RPC. * * @module StellarAdapter */ import * as StellarConstants from './constants'; import * as StellarGetters from './getters'; import * as StellarActions from './actions'; import * as StellarSubmit from './submit'; import type { IStellarNetwork, IStellarDepositParams, IStellarRedeemParams, IStellarUserPosition } from './types'; export declare const Stellar: { utils: { isStellarAddress: typeof import("./utils").isStellarAddress; getExplorerLink: typeof import("./utils").getExplorerLink; assertNotStellar: typeof import("./utils").assertNotStellar; }; constants: typeof StellarConstants; actions: typeof StellarActions; submit: typeof StellarSubmit; getters: typeof StellarGetters; }; /** * Stellar Adapter for August SDK * * @example * ``` * const adapter = new StellarAdapter('testnet'); * const xdr = await adapter.vaultDeposit({ * contractId: 'CBGWW5...', * amount: '1000000', * senderAddress: 'GDLZ...', * }); * // Sign xdr with wallet (e.g. Freighter), then submit via adapter.submitTransaction() * ``` */ export declare class StellarAdapter { private _network; /** * Optional consumer-supplied Soroban RPC endpoint (e.g. a keyed Alchemy URL). * When set it is the primary, with the SDK's public endpoints as failover. */ private _sorobanRpcUrl?; /** * @param network - Stellar network to operate on; defaults to `'mainnet'`. * @param options - Optional adapter configuration. Its `sorobanRpcUrl` field * overrides the Soroban RPC endpoint (e.g. a keyed Alchemy URL): it becomes * the primary with the SDK's built-in public endpoints kept behind it as * failover, and a per-call `sorobanRpcUrl` (on the deposit/redeem params) * takes precedence over this adapter-level one. */ constructor(network?: IStellarNetwork, options?: { sorobanRpcUrl?: string; }); get network(): IStellarNetwork; isStellarAddress(address: string): boolean; getExplorerLink(id: string, type?: 'contract' | 'account' | 'tx'): string; /** * Build an unsigned deposit transaction for a Stellar vault. * @returns Base64-encoded XDR of the unsigned transaction. */ vaultDeposit(params: Omit): Promise; /** * Build an unsigned redeem transaction for a Stellar vault. * * Side effect on failure: a redemption the vault cannot serve is reported to * that vault's curator, since Stellar vaults are instant-redeem only and this * is the curator's only signal. Fire-and-forget — it never delays or alters * the error you receive. On by default in production; see * `monitoring.curatorAlerts` and the Curator Notifications section of the * Stellar Actions guide for exactly what is sent and how to opt out. * * @returns Base64-encoded XDR of the unsigned transaction. */ vaultRedeem(params: Omit): Promise; /** * Side effect: a submitted transaction that the network reports as a failed * `redeem` operation is reported to that vault's curator, on the same * fire-and-forget terms as {@link StellarAdapter.vaultRedeem}. * * Submit a signed Soroban transaction and poll until the network confirms it. * * Submits on the network this adapter was constructed with, so `signedXdr` * must be signed for that same network. * * @param signedXdr - Base64-encoded XDR of the signed transaction. * @returns The transaction hash once the network confirms it as successful. * @throws {@link AugustTimeoutError} when the transaction is not confirmed * within the poll budget (`MAX_POLL_ATTEMPTS`). * @throws {@link AugustSDKError} when the RPC rejects the submission or the * transaction confirms as failed. Its `context` carries `{ network, status }` * plus, when the result XDR decodes, a `resultCode` string holding the * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode` * is `undefined` when the code cannot be decoded. * @example * ```ts * try { * const hash = await adapter.submitTransaction(signedXdr); * } catch (err) { * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') { * // stale sequence number — rebuild the transaction and resubmit * } * } * ``` */ submitTransaction(signedXdr: string): Promise; /** * Get user's vault share balance. * * @returns The position `{ shares, decimals, decimalsFromFallback }`, or null * if the balance read fails. When `decimalsFromFallback` is `true` the * `decimals()` read failed and `decimals` is the fallback (7) — callers sizing * a redeem MUST refuse rather than trust it. */ getUserPosition(vaultAddress: string, walletAddress: string): Promise; /** * Preview how many vault shares a deposit amount would yield. * @param vaultAddress Stellar contract ID (C… address) * @param rawAmount Deposit amount in the deposit token's smallest unit * @returns Raw share amount as a string, or null if query fails. */ convertToShares(vaultAddress: string, rawAmount: string): Promise; } export default StellarAdapter;