import type { Cell, Transaction } from '@ton/core'; import { type ErrorExplanation } from './errors'; import { type PhoebeEvent } from './events'; export interface TxSummary { /** True iff compute exit was 0 (or absent) and action phase was clean. */ success: boolean; /** Compute-phase exit code, or `null` if compute didn't run. */ exitCode: number | null; /** Action-phase result code, or `null` if no action phase. */ actionResultCode: number | null; /** `explainError(exitCode)` when `exitCode > 0`; `null` otherwise. */ explanation: ErrorExplanation | null; /** All Phoebe events emitted by this tx (decoded from external-out bodies). */ events: PhoebeEvent[]; /** Raw external-out bodies — useful if you need to decode events from a different SDK. */ rawExternalBodies: Cell[]; } /** * Collapse a `Transaction` into its diagnostically useful fields. Use * after any `send*` to know whether it succeeded and what fired. * * Phoebe-specific: events are decoded into the typed `PhoebeEvent` union. * Internal outbounds (FulfillPrice / SyncRequest) won't appear here * because those are internal-out, not external-out — find them via the * containing tx's `outMessages` directly. */ export declare function summarizeTx(tx: Transaction): TxSummary; /** Batch convenience for a tx array (e.g. `result.transactions` from sandbox). */ export declare function summarizeTxs(txs: readonly Transaction[]): TxSummary[]; /** * One-line human-readable rendering of a `TxSummary` — for `console.log` * and test output. Shape: * `[ok] events: SnapshotPushed, OperatorMirrored` * `[fail] exit 161 InvalidBlsSignature — PushSnapshot aggSig failed BLS_VERIFY …` */ export declare function formatTxSummary(s: TxSummary): string; /** * Deterministic monotone uint64 generator for consumer `queryId`s. * Mostly useful as a defensive measure against accidental collisions in * automated flows that send many concurrent pulls. * * Phoebe doesn't have a duplicate-request guard like Fortuna does * (`E_DUPLICATE_REQUEST`) — Phoebe's RequestPrice is a single-shot * call/callback per attempt, no per-(consumer, queryId) state. But * consumers that index callbacks by queryId still benefit from * monotone-unique IDs. * * @example * const stream = new QueryIdStream(); * const queryId = stream.next(); // 1n * const queryId2 = stream.next(); // 2n */ export declare class QueryIdStream { private cursor; constructor(start?: bigint); /** Advance and return the next queryId (monotone, never 0). */ next(): bigint; /** Current cursor (next-to-emit). Does not advance. */ peek(): bigint; } /** * Compute the recommended `value` to attach to `sendRequestPrice`. Equals * `pullFee + minGasForPull + forwardFeeSlack`, where `pullFee` is read * from live config (or passed in) and `minGasForPull` is the on-chain * floor (`MIN_GAS_FOR_PULL = 0.03 TON` per phoebe.tolk). * * Off-chain helper for consumer integrations — saves a round-trip if you * already have the config in memory. For one-shot estimates use * `npx phoebe estimate pull --pull-fee 0.01`. * * Pass `withFresh: true` when attaching a `freshUpdate` — adds ~0.05 TON * to cover the BLS_VERIFY's ~60k extra gas. Cached fast-path consumers * leave it false (default). * * @example * // Cached fast-path * const value = estimatePullValue({ pullFee: cfg.pullFee }); * * // Fresh-update path (sub-heartbeat freshness) * const value = estimatePullValue({ pullFee: cfg.pullFee, withFresh: true }); * * @param opts.pullFee — current `cfg.pullFee` (read from `getConfig()` or use the SDK default). * @param opts.minGasForPull — on-chain floor; default `MIN_GAS_FOR_PULL = 0.03 TON`. * @param opts.forwardFeeSlack — extra padding to cover forward-fee deduction; default 0.05 TON. * @param opts.withFresh — set true when attaching a freshUpdate; adds 0.05 TON for the BLS_VERIFY. */ export declare function estimatePullValue(opts: { pullFee: bigint; minGasForPull?: bigint; forwardFeeSlack?: bigint; withFresh?: boolean; }): bigint; /** * Compute the recommended `value` to attach to `sendPushSnapshot`. Equals * `MIN_GAS_FOR_PUSH + forwardFeeSlack` since operators pay no fee — the * contract refunds excess via `CARRY_ALL_REMAINING_MESSAGE_VALUE`. * * @example * const value = estimatePushValue(); * await phoebe.sendPushSnapshot(via, { value, timestamp, root, aggSig }); * * @param opts.minGasForPush — on-chain floor; default `MIN_GAS_FOR_PUSH = 0.05 TON`. * @param opts.forwardFeeSlack — extra padding for forward-fee deduction; default 0.05 TON. */ export declare function estimatePushValue(opts?: { minGasForPush?: bigint; forwardFeeSlack?: bigint; }): bigint; /** * Recommended `value` for `sendClaimReward`. * * Floor + slack matching the on-chain `MIN_GAS_FOR_CLAIM = 0.03 TON`. The * contract uses `SEND_MODE_PAY_FEES_SEPARATELY` for the payout, so forward * fees come out of the contract's balance (not the payout) — the operator's * inbound covers only their own gas + forward fee for the inbound message. * * Note: unlike `estimatePullValue` / `estimatePushValue`, any excess * inbound is RETAINED by the contract (not refunded to the operator) — * see `handleClaimReward`'s outbound discipline. Send tight value * (default 0.05 TON) to minimise operator overpay; or batch claims to * amortize the per-claim gas cost across a larger accrued balance. * * @example * const value = estimateClaimValue(); * await phoebe.sendClaimReward(via, { value, to: treasury, amount: 0n }); * * @param opts.minGasForClaim — on-chain floor; default `MIN_GAS_FOR_CLAIM = 0.03 TON`. * @param opts.forwardFeeSlack — extra padding for the inbound forward fee; default 0.02 TON. */ export declare function estimateClaimValue(opts?: { minGasForClaim?: bigint; forwardFeeSlack?: bigint; }): bigint;