/** * Stellar Invocation Decoding * * Reads back what a built transaction actually invokes. `submitStellarTransaction` * takes an opaque signed XDR — it has no idea whether it is broadcasting a * deposit, a redeem, or something else — so a failure there cannot be attributed * to a vault operation without looking inside the envelope. */ import type { FeeBumpTransaction, Transaction } from '@stellar/stellar-sdk'; /** A vault contract invocation recovered from a transaction envelope. */ export interface IVaultInvocation { /** Invoked contract (C-address). */ contractId: string; /** Contract function name, e.g. `'redeem'` or `'deposit'`. */ functionName: string; /** * First argument as a decimal string, when it decodes to an integer. Both * `deposit(assets, …)` and `redeem(shares, …)` lead with the `i128` amount. * `undefined` when the argument is absent or not an integer. */ amountRaw?: string; /** * Second argument as a Stellar address, when it decodes to one — the * `receiver` in both vault signatures. `undefined` otherwise. */ receiver?: string; /** * Third argument as a Stellar address, when it decodes to one — `owner` in * `redeem(shares, receiver, owner, operator)`, i.e. the account whose shares * are burned. Identical to `receiver` for the self-redeem the SDK builds, but * they differ for a delegated redemption. `undefined` otherwise. */ owner?: string; } /** * Decode the single Soroban contract invocation in a transaction. * * Every transaction the SDK builds carries exactly one `invokeHostFunction` * operation (see `buildSorobanTx`), so the first one found is authoritative. * Purely local — no RPC, no network. * * Written defensively rather than optimistically: this is called from an error * path where the envelope may be anything a caller handed us, and a throw here * would replace the real transaction failure with a decoding error. Anything * unexpected — a fee-bump wrapper, a classic payment, a shape-drifted SDK * union, a non-address argument — yields `undefined`. * * @param tx - Parsed transaction (e.g. `TransactionBuilder.fromXDR(...)`, whose * return type includes the fee-bump wrapper — that case yields `undefined`, * since the invocation lives in the inner transaction and the SDK never * builds one). * @returns The invocation, or `undefined` when the transaction does not carry a * decodable contract call. */ export declare function describeVaultInvocation(tx: Transaction | FeeBumpTransaction): IVaultInvocation | undefined;