/// import type { Accounts, Idl } from "@coral-xyz/anchor"; import { BorshCoder, EventParser } from "@coral-xyz/anchor"; import type { InstructionDisplay } from "@coral-xyz/anchor/dist/esm/coder/borsh/instruction.js"; import type { IdlAccountItem, IdlTypeDef } from "@coral-xyz/anchor/dist/esm/idl.js"; import type { Provider as SaberProvider } from "@saberhq/solana-contrib"; import type { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; import { TransactionInstruction } from "@solana/web3.js"; import type { ErrorMap } from "../errors.js"; import type { AccountParsers } from "../generateAccountParsers.js"; import type { AnchorAccountMap } from "./accounts.js"; /** * Formatted instruction with its name. */ export type InstructionParsed = InstructionDisplay & { name: string; }; type CoderAnchorTypes = { AccountMap: Record; Events: Record; IDL: Idl; Instructions: Record; }>; Program: unknown; }; type IDLAccountName = NonNullable[number]["name"]; /** * Coder wrapper. * * Allows interacting with a program without a provider. */ export declare class SuperCoder { /** * Program address. */ readonly address: PublicKey; /** * Program IDL. */ readonly idl: T["IDL"]; /** * Underlying Coder. */ readonly coder: BorshCoder; /** * Parses events. */ readonly eventParser: EventParser; /** * All accounts. */ readonly accounts: AnchorAccountMap; /** * Parses accounts. * @deprecated use {@link SuperCoder#accounts} */ readonly accountParsers: AccountParsers; /** * All account {@link IdlTypeDef}s. * @deprecated use {@link SuperCoder#accounts} */ readonly accountTypeDefs: { [K in IDLAccountName]: IdlTypeDef; }; /** * Mapping of error name to error details. */ readonly errorMap: ErrorMap; /** * Mapping of hex discriminator to the account name. */ readonly discriminators: { [hexDiscriminator: string]: string; }; /** * Mapping of hex discriminator to the account name. * @deprecated use {@link SuperCoder#accounts} */ readonly discriminatorsByAccount: { [K in NonNullable[number]["name"]]: Buffer; }; /** * Constructor. * @param address * @param idl */ constructor( /** * Program address. */ address: PublicKey, /** * Program IDL. */ idl: T["IDL"]); /** * Creates a {@link GetProgramAccountsFilter} for the given account. */ makeGPAFilter(account: NonNullable[number]["name"], ...filters: GetProgramAccountsFilter[]): GetProgramAccountsFilter[]; /** * Parses events in the program log. * @param logs * @returns */ parseProgramLogEvents(logs?: string[]): readonly E[]; /** * Encodes a {@link TransactionInstruction}. * @returns */ encodeIX(name: K, args: I["namedArgs"], accounts: Accounts): TransactionInstruction; /** * Parses a {@link TransactionInstruction}. * @returns */ parseInstruction(txInstruction: TransactionInstruction): InstructionParsed; /** * Gets a {@link Program} from a provider. * @param provider * @returns */ getProgram(provider: SaberProvider): T["Program"]; } /** * Builds a map of coders from their IDLs and addresses. * * @param provider * @param programs * @returns */ export declare const buildCoderMap:

(idls: { [K_1 in keyof P]: Idl; }, addresses: { [K_2 in keyof P]: PublicKey; }) => { [K_3 in keyof P]: SuperCoder; }; export {}; //# sourceMappingURL=coder.d.ts.map