import { SvmSpokeClient } from "@across-protocol/contracts";
import { Idl } from "@coral-xyz/anchor";
import { Address, Instruction, KeyPairSigner, type Commitment, type TransactionSigner } from "@solana/kit";
import { RelayData, RelayDataWithMessageHash } from "../../interfaces";
import { BigNumber, Address as SdkAddress } from "../../utils";
import { AttestedCCTPMessage, EventName, SVMProvider, LatestBlockhash, SolanaTransaction } from "./types";
import winston from "winston";
/**
 * Basic void TransactionSigner type
 */
export declare const SolanaVoidSigner: (simulationAddress: string) => TransactionSigner<string>;
/**
 * Helper to determine if the current RPC network is devnet.
 */
export declare function isDevnet(rpc: SVMProvider): Promise<boolean>;
/**
 * Small utility to convert an Address to a Solana Kit branded type.
 */
export declare function toAddress(address: SdkAddress): Address<string>;
/**
 * For a given slot (or implicit head of chain), find the immediate preceding slot that contained a block.
 * @param provider SVM Provider instance.
 * @param opts An object containing a specific slot number, or a Solana commitment, defaulting to "confirmed".
 * @returns An object containing the slot number and the relevant timestamp for the block.
 */
export declare function getNearestSlotTime(provider: SVMProvider, opts?: {
    slot: bigint;
} | {
    commitment: Commitment;
}, logger?: winston.Logger): Promise<{
    slot: bigint;
    timestamp: number;
}>;
/**
 * Resolve the latest finalized slot, and then work backwards to find the nearest slot containing a block.
 * In most cases the first-resolved slot should also have a block. Avoid making arbitrary decisions about
 * how many slots to rotate through.
 */
export declare function getLatestFinalizedSlotWithBlock(provider: SVMProvider, logger: winston.Logger, maxSlot: bigint, maxLookback?: number): Promise<number>;
/**
 * Parses event data from a transaction.
 */
export declare function parseEventData(eventData: any): any;
/**
 * Decodes a raw event according to a supplied IDL.
 */
export declare function decodeEvent(idl: Idl, rawEvent: string): {
    data: unknown;
    name: string;
};
/**
 * Gets the event name from a raw name.
 */
export declare function getEventName(rawName: string): EventName;
/**
 * Unwraps any data structure and converts Address types to strings and Uint8Array to hex or BigInt.
 * Recursively processes nested objects and arrays.
 */
export declare function unwrapEventData(data: unknown, uint8ArrayKeysAsBigInt?: string[], currentKey?: string): unknown;
/**
 * Returns the PDA for the State account.
 * @param programId The SpokePool program ID.
 * @returns The PDA for the State account.
 */
export declare function getStatePda(programId: Address): Promise<Address>;
/**
 * Returns the fill status PDA for the given relay data.
 * @param programId The SpokePool program ID.
 * @param relayData The relay data to get the fill status PDA for.
 * @param destinationChainId The destination chain ID.
 * @returns The PDA for the fill status.
 */
export declare function getFillStatusPda(programId: Address, relayData: RelayDataWithMessageHash, destinationChainId: number): Promise<Address>;
/**
 * Returns the PDA for a route account on SVM Spoke.
 * @param originToken The origin token address.
 * @param seed The seed for the route account.
 * @param routeChainId The route chain ID.
 * @returns The PDA for the route account.
 */
export declare function getRoutePda(originToken: Address, seed: bigint, routeChainId: bigint): Promise<Address>;
/**
 * Returns the PDA for the SVM Spoke's transfer liability account.
 * @param programId the address of the spoke pool.
 * @param originToken the address of the corresponding token.
 */
export declare function getTransferLiabilityPda(programId: Address, originToken: Address): Promise<Address>;
/**
 * Returns the PDA for the SVM Spoke's root bundle account.
 * @param programId the address of the spoke pool.
 * @param rootBundleId the associated root bundle ID.
 */
export declare function getRootBundlePda(programId: Address, rootBundleId: number): Promise<Address>;
/**
 * Returns the PDA for the SVM Spoke's instruction params account.
 * @param programId the address of the spoke pool.
 * @param signer the signer of the authenticated call.
 */
export declare function getInstructionParamsPda(programId: Address, signer: Address): Promise<Address>;
/**
 * Returns the PDA for an individual's claim account.
 * @param programId the address of the spoke pool.
 * @param mint the address of the token.
 * @param tokenOwner the address of the signer which owns the claim account.
 */
export declare function getClaimAccountPda(programId: Address, mint: Address, tokenOwner: Address): Promise<Address>;
/**
 * Returns the PDA for the Event Authority.
 * @returns The PDA for the Event Authority.
 */
export declare function getEventAuthority(programId: Address): Promise<Address>;
/**
 * Returns the PDA for the handler signer.
 * @param programId The multicall handler program ID.
 * @returns The PDA for the State account.
 */
export declare function getHandlerSignerPda(programId: Address): Promise<Address>;
/**
 * Returns the PDA for the Self Authority.
 * @returns The PDA for the Self Authority.
 */
export declare const getSelfAuthority: () => Promise<Address<string>>;
/**
 * Returns a random SVM address.
 */
export declare function getRandomSvmAddress(): Address<string>;
/**
 * Creates a default v0 transaction skeleton.
 * @param rpcClient - The Solana client.
 * @param signer - The signer of the transaction.
 * @returns The default transaction.
 */
export declare const createDefaultTransaction: (rpcClient: SVMProvider, signer: TransactionSigner, latestBlockhash?: LatestBlockhash) => Promise<SolanaTransaction>;
/**
 * Simulates a transaction and decodes the result using a parser function.
 * @param solanaClient - The Solana client.
 * @param ix - The instruction to simulate.
 * @param signer - The signer of the transaction.
 * @param parser - The parser function to decode the result.
 * @returns The decoded result.
 */
export declare const simulateAndDecode: <P extends (buf: Buffer) => unknown>(solanaClient: SVMProvider, ix: Instruction, signer: KeyPairSigner, parser: P, latestBlockhash?: LatestBlockhash) => Promise<ReturnType<P>>;
/**
 * Converts a common `RelayData` type to an SvmSpokeClient.RelayData` type. This is useful for when we need
 * to interface directly with the SvmSpoke.
 * @param relayData The common RelayData TS type.
 * @returns RelayData which conforms to the typing of the SvmSpoke.
 */
export declare function toSvmRelayData(relayData: RelayData): SvmSpokeClient.RelayData;
/**
 * Returns the PDA for the CCTP nonce.
 * @param solanaClient The Solana client.
 * @param signer The signer of the transaction.
 * @param nonce The nonce to get the PDA for.
 * @param sourceDomain The source domain.
 * @returns The PDA for the CCTP nonce.
 */
export declare const getCCTPNoncePda: (solanaClient: SVMProvider, signer: KeyPairSigner, nonce: number, sourceDomain: number, latestBlockhash?: LatestBlockhash) => Promise<Address>;
/**
 * Checks if a CCTP message is a deposit for burn event.
 * @param event The CCTP message event.
 * @returns True if the message is a deposit for burn event, false otherwise.
 */
export declare function isDepositForBurnEvent(event: AttestedCCTPMessage): boolean;
/**
 * True if `body` encodes a `relayRootBundle(bytes32,bytes32)` call.
 */
export declare const isRelayRootBundleMessageBody: (body: Buffer) => boolean;
/**
 * True if `body` encodes a `emergencyDeleteRootBundle(uint32)` call.
 */
export declare const isEmergencyDeleteRootBundleMessageBody: (body: Buffer) => boolean;
/**
 * Decodes the root bundle ID from an emergency delete root bundle message body.
 * @param body The message body.
 * @returns The root bundle ID.
 */
export declare const getEmergencyDeleteRootBundleRootBundleId: (body: Buffer) => number;
/**
 * Convert a bigint (0 ≤ n < 2^256) to a 32-byte Uint8Array (big-endian).
 * @param n The bigint to convert.
 * @returns The 32-byte Uint8Array.
 */
export declare function bigintToU8a32(n: bigint): Uint8Array;
export declare const bigToU8a32: (bn: bigint | BigNumber) => Uint8Array<ArrayBufferLike>;
export declare const numberToU8a32: (n: number) => Uint8Array<ArrayBufferLike>;
