import { PublicKey, TransactionInstruction } from "@solana/web3.js"; import type { TransactionProofStruct } from "../proofs/types.js"; /** * `transact` instruction assembly, driven by the IDL rather than by a * hand-written account list. * * Every existing deposit implementation spells out all sixteen accounts by hand * in an `accountsStrict({...})` literal. That works until the IDL changes, at * which point a silently misordered or missing account produces a runtime * failure that is very hard to trace. Here the account list and the ordering * come from the IDL itself, and an unresolved name throws at build time. * * Building the instruction directly also means no Anchor `Provider` and no * `Wallet` — which is the whole point of a wallet-agnostic shield. */ /** Account names the IDL declares for `transact`, in order. */ export type TransactAccounts = Record; export type TransactArgs = { root: Uint8Array; inputTreeId: number; outputTreeId: number; publicAmount: bigint; extDataHash: Uint8Array; mintAddress: PublicKey; inputNullifiers: [Uint8Array, Uint8Array]; outputCommitments: [Uint8Array, Uint8Array]; deadline: bigint; extData: { recipient: PublicKey; relayer: PublicKey; fee: bigint; refund: bigint; claimant: PublicKey; }; proof: TransactionProofStruct; noteCiphers: { note0EphemeralKey: Uint8Array; note0Encrypted: Uint8Array; note0ViewTag: number; note1EphemeralKey: Uint8Array; note1Encrypted: Uint8Array; note1ViewTag: number; } | null; }; /** Account names in IDL order. Exported so callers can see what must be resolved. */ export declare const TRANSACT_ACCOUNT_NAMES: string[]; /** * Build the `transact` instruction. * * @throws ShieldError('UNRESOLVED_ACCOUNT') if the IDL declares an account the * caller did not supply — a loud failure is the point, because the * alternative is a misordered account list that fails opaquely on-chain. */ export declare function buildTransactInstruction(accounts: TransactAccounts, args: TransactArgs, programId?: PublicKey): TransactionInstruction;