import { IUniSigner, IAccount, IBroadcastResult, ICryptoBytes, ISigned } from '@interchainjs/types'; import { PublicKey } from '../types'; import { ISolanaQueryClient } from '../types/solana-client-interfaces'; /** * Solana account data structure */ export interface SolanaAccount extends IAccount { address: string; publicKey: PublicKey; lamports?: number; algo: string; } /** * Solana transaction instruction */ export interface SolanaInstruction { keys: Array<{ pubkey: PublicKey; isSigner: boolean; isWritable: boolean; }>; programId: PublicKey; data: Uint8Array; } /** * Solana transaction message */ export interface SolanaTransactionMessage { accountKeys: PublicKey[]; recentBlockhash: string; instructions: SolanaInstruction[]; } /** * Arguments for signing a Solana transaction */ export interface SolanaSignArgs { instructions: SolanaInstruction[]; feePayer?: PublicKey; recentBlockhash?: string; memo?: string; options?: SolanaSignOptions; } /** * Options for Solana signing */ export interface SolanaSignOptions { signerAddress?: string; skipPreflight?: boolean; preflightCommitment?: string; maxRetries?: number; } /** * Options for broadcasting Solana transactions */ export interface SolanaBroadcastOptions { skipPreflight?: boolean; preflightCommitment?: string; maxRetries?: number; commitment?: string; } /** * Response from broadcasting a Solana transaction */ export interface SolanaBroadcastResponse extends IBroadcastResult { signature: string; slot?: number; confirmations?: number; err?: any; } /** * Solana transaction response */ export interface SolanaTransactionResponse { signature: string; slot: number; confirmations: number | null; err: any; memo?: string; } /** * Signed Solana transaction */ export interface SolanaSignedTransaction extends ISigned { signature: ICryptoBytes; txBytes: Uint8Array; broadcast: (options?: SolanaBroadcastOptions) => Promise; } /** * Solana signer interface extending IUniSigner */ export interface ISolanaSigner extends IUniSigner { /** * Get the public key for a specific account index */ getPublicKey(index?: number): Promise; /** * Get all addresses managed by this signer */ getAddresses(): Promise; /** * Sign a transaction and return the signed transaction */ sign(args: SolanaSignArgs): Promise; /** * Broadcast a signed transaction */ broadcast(signed: SolanaSignedTransaction, options?: SolanaBroadcastOptions): Promise; /** * Sign and broadcast a transaction in one step */ signAndBroadcast(args: SolanaSignArgs, options?: SolanaBroadcastOptions): Promise; } /** * Configuration for Solana signers */ export interface SolanaSignerConfig { /** * Query client for Solana RPC interactions */ queryClient: ISolanaQueryClient; /** * Default commitment level */ commitment?: string; /** * Skip preflight checks by default */ skipPreflight?: boolean; /** * Maximum number of retries for transactions */ maxRetries?: number; }