import { type Connection, PublicKey } from '@solana/web3.js'; import type { IAddress, ISolanaNetwork, IVaultAvailableRedemption } from '../../types'; import { VaultRedemptionStatus } from '../../types/vaults'; import type { IVaultWithdrawalQueue } from '../../types/vaults'; import type { ISolanaVaultState, ISolanaWithdrawalRequestState } from './types'; /** * The queue PDA for a vault: `["withdrawal_queue", vault_state]` under the queue * program. The vault only ever attaches this address. * * @param vaultState - The vault's `VaultState` account. * @param queueProgramId - The august_withdrawal_queue program id for the network. */ export declare function deriveWithdrawalQueuePda(vaultState: PublicKey, queueProgramId: PublicKey): PublicKey; /** * Where a request stands at `nowSeconds`, by the program's own rules * (`WithdrawalRequest::is_expired` / `is_eligible`): a non-zero `expiresAt` at * or before now is expired, and that is checked first because an expired * request can only be cancelled; otherwise it is claimable from `eligibleAt`. * * @param request - Decoded request; `eligibleAt` / `expiresAt` in Unix seconds. * @param nowSeconds - Unix seconds. Wall-clock time stands in for the chain's * clock, so a request within seconds of a boundary may be classified a slot * early or late. */ export declare function classifyWithdrawalRequest(request: Pick, nowSeconds: number): VaultRedemptionStatus; /** * What finalizing `shares` would pay the recipient at the vault's current * state: the offset-aware `assets_for_redeem`, less the ceil-rounded * withdrawal fee. Finalize prices at execution, so this is an estimate. * * @returns Raw deposit-mint units, net of fee. * @throws AugustValidationError when the vault has no share price. */ export declare function estimateRequestPayout(input: { vaultState: Pick; supply: bigint; shares: bigint; }): bigint; /** * The withdrawal queue program id a Solana service names, or `undefined` when * it names none: the queue is not deployed on its network, or the service has * neither `network` nor `getProgramId`. Read * paths treat that as "no queue" rather than a failed read, so they make no RPC * call and log nothing. * * Prefers `network`, read straight from `programIds`: `getProgramId` is an * instrumented public method, and calling it where it throws by design would * record an error breadcrumb on every vault read. * * @param service - The SolanaAdapter (or a stand-in) the read was given. * @returns The queue program id, or `undefined`. * @throws When the service names a malformed id; callers read inside their * own `try`, so that is logged as a failed queue read. */ export declare function resolveQueueProgramId(service: { network?: ISolanaNetwork; getProgramId?: (type: 'vault' | 'withdrawalQueue') => string; }): PublicKey | undefined; /** * The vault's withdrawal queue summary for `IVault.withdrawalQueue`, or * `undefined` when the vault has no queue. * * `enabled` is whether the vault's redeem gate points at this queue, read from * the vault state in the same call as the queue, so an attach or release shows * at once rather than when a cached vault state expires. A queue that was * released keeps its account and may still hold pending requests, so it is * reported with `enabled: false`. * * RPC: one `getMultipleAccountsInfo` (the queue and the vault state). Not * cached: the counters change with every request. * * @param input - The vault and where to read. */ export declare function getSolanaWithdrawalQueueSummary(input: { connection: Connection; queueProgramId: PublicKey; /** The vault's `VaultState` account. */ vaultState: PublicKey; /** Decimals of the vault's share mint, for `pendingShares`. */ shareDecimals: number; }): Promise; /** * `owner`'s pending requests on a vault's queue, split the way the EVM path * splits them: `availableRedemptions` holds requests still waiting * (`AWAITING_COOLDOWN`) or past their window (`EXPIRED`, cancel-only); * `pendingRedemptions` holds requests finalizable now (`READY_TO_CLAIM`). * * Each entry's `amount` is the escrowed shares and `estimatedAssets` the net * payout at the current share price (see {@link estimateRequestPayout}), * priced from the vault state and share supply of a single slot, never from a * cached state. `receiver` is the wallet that owns the request's payout token * account, which need not be the requester; if that account is gone it is the * account address itself. `id` and `hash` are the request account's address: * the program keeps no creation transaction to point at. `date` and * `day` / `month` / `year` are the eligibility time (UTC); `timestamp` is when * the request was made. * * RPC, worst case: one `getAccountInfo` (skipped once the queue is known to * exist), one `getProgramAccounts` filtered on queue and owner, and, when the * owner has any request, one `getMultipleAccountsInfo` carrying the vault * state, share mint and up to 98 distinct payout accounts. Each further 100 * distinct payout accounts cost one more `getMultipleAccountsInfo`, at most * four in flight. A vault without a queue costs the single `getAccountInfo`. * * @param input - The vault, the owner, and where to read. */ export declare function getSolanaWithdrawalRedemptions(input: { connection: Connection; queueProgramId: PublicKey; /** The vault's `VaultState` account, read fresh for pricing. */ vaultStateAddress: PublicKey; /** The vault's share mint, read in the same call for the supply. */ shareMint: PublicKey; /** The holder whose requests to list. */ owner: PublicKey; /** The vault address to stamp on each entry. */ vault: IAddress; /** Deposit mint decimals, for `estimatedAssets`. */ depositDecimals: number; /** Unix seconds to classify against; defaults to now. */ nowSeconds?: number; }): Promise<{ availableRedemptions: IVaultAvailableRedemption[]; pendingRedemptions: IVaultAvailableRedemption[]; }>;