import { Connection, Keypair, PublicKey, Transaction, TransactionInstruction } from "@solana/web3.js"; import { WalletAdapter } from "../src/schemas/solana"; import { RevertOptions } from "../types/contracts.types"; /** * Type for flexible signer - can be Keypair or wallet adapter */ export type FlexibleSigner = Keypair | WalletAdapter; /** * Browser-safe utilities for Solana operations without Anchor dependencies */ /** * Gateway IDL interface structure */ export interface GatewayIDL { accounts: Array<{ discriminator: number[]; name: string; }>; address: string; instructions: Array<{ accounts: Array<{ name: string; optional?: boolean; signer?: boolean; writable?: boolean; }>; args: Array<{ name: string; type: string; }>; discriminator: number[]; name: string; }>; metadata: { name: string; spec: string; version: string; }; types: Array<{ name: string; type: { fields: Array<{ name: string; type: string; }>; kind: string; }; }>; } /** * Call instruction result interface */ export interface CallInstructionResult { accounts: { pda: PublicKey; signer: PublicKey; }; instruction: TransactionInstruction; } /** * Get Solana RPC API URL by chain ID */ export declare const getAPIbyChainId: (chainId: string) => string; /** * Create revert options compatible with browser environment * This replaces the Anchor-dependent createRevertOptions function */ export declare const createRevertOptions: (options: RevertOptions, publicKey: PublicKey) => { abortAddress: Uint8Array; callOnRevert: boolean; onRevertGasLimit: bigint; revertAddress: PublicKey; revertMessage: Buffer; }; /** * Browser-safe interface for Solana gateway operations * This replaces the Anchor Program interface for browser environments */ export interface BrowserSolanaGateway { connection: Connection; /** * Create a call instruction for cross-chain calls */ createCallInstruction: (receiverBytes: Uint8Array, message: Buffer, revertOptions: ReturnType, signer: PublicKey) => CallInstructionResult; idl: GatewayIDL; programId: PublicKey; } /** * Create a browser-safe Solana gateway interface * This replaces createSolanaGatewayProgram without Anchor dependencies */ export declare const createBrowserSolanaGateway: (chainId: string) => { connection: Connection; gateway: BrowserSolanaGateway; }; /** * Sign and send a transaction with flexible signer support */ export declare const signAndSendTransaction: (connection: Connection, transaction: Transaction, signer: FlexibleSigner) => Promise; /** * Execute a cross-chain call using browser-compatible methods * Supports both Keypair and wallet adapter signers */ export declare const executeBrowserSolanaCall: (chainId: string, signer: FlexibleSigner, receiverBytes: Uint8Array, message: Buffer, revertOptions: ReturnType) => Promise; /** * Type definitions for browser-safe operations */ export interface BrowserSolanaCallOptions { chainId: string; signer: Keypair; } export interface BrowserSolanaCallParams { receiver: string; revertOptions: RevertOptions; types: string[]; values: (string | bigint | boolean)[]; } /** * Browser-safe SPL token handling without Anchor dependencies */ export declare const getBrowserSafeSPLToken: (connection: Connection, signer: FlexibleSigner, mint: string, amount: string) => Promise<{ decimals: number; from: PublicKey; }>; /** * Browser-safe SOL balance checking without Anchor dependencies */ export declare const isBrowserSafeSOLBalanceSufficient: (connection: Connection, signer: FlexibleSigner, amount: string) => Promise;