import { PublicKey, Keypair, Connection } from '@solana/web3.js'; import type { TossUser, TossUserContext } from './types/tossUser'; import type { OfflineTransaction } from './types/nonceAccount'; import { type ArciumEncryptedOutput } from './internal/arciumHelper'; /** * Status of an intent in its lifecycle */ export type IntentStatus = 'pending' | 'settled' | 'failed' | 'expired'; /** * Core type for an offline intent following TOSS specification * Enhanced with durable nonce account support */ export interface SolanaIntent { id: string; from: string; to: string; fromUser?: TossUserContext; toUser?: TossUserContext; amount: number; nonce: number; expiry: number; signature: string; status: IntentStatus; createdAt: number; updatedAt: number; error?: string; blockhash?: string; feePayer?: string; signatures?: string[]; serialized?: string; nonceAccount?: string; nonceAuth?: string; nonceAccountAddress?: string; nonceAccountAuth?: string; offlineTransaction?: OfflineTransaction; requiresBiometric?: boolean; encrypted?: ArciumEncryptedOutput; } /** * Options for creating a new intent */ export interface CreateIntentOptions { /** Whether to encrypt the transaction details using Arcium */ privateTransaction?: boolean; /** Program ID for Arcium encryption */ mxeProgramId?: PublicKey; /** Provider for blockchain access */ provider?: any; /** Expiry time in seconds from now (default: 1 hour) */ expiresIn?: number; /** Custom nonce (auto-generated if not provided) */ nonce?: number; /** Keypair for the nonce account (for durable transactions) */ nonceAccount?: Keypair; /** Public key authorized to use the nonce account */ nonceAuth?: PublicKey; /** Fee payer for the transaction (defaults to sender) */ feePayer?: PublicKey | string; /** Optional minimal user contexts for sender and recipient */ fromUser?: TossUserContext; toUser?: TossUserContext; } /** * Manages nonce values for transaction replay protection */ declare class NonceManager { private nonceStore; private readonly NONCE_EXPIRY; getNextNonce(publicKey: PublicKey, connection: Connection): Promise; private extractNonceFromAccountInfo; private cleanupNonces; } export declare const nonceManager: NonceManager; /** * Creates a signed intent between two TOSS users (User-centric API) * Recommended for application developers - validates user wallets * * GAP #8 FIX: Requires biometric authentication for sensitive transactions */ export declare function createUserIntent(senderUser: TossUser, senderKeypair: Keypair, recipientUser: TossUser, amount: number, connection: Connection, options?: CreateIntentOptions): Promise; /** * Creates a signed intent that can be verified offline */ export declare function createSignedIntent(sender: Keypair, recipient: PublicKey, amount: number, connection: Connection, options?: CreateIntentOptions): Promise; /** * Verifies the signature, nonce, and expiry of an intent */ export declare function verifyIntent(intent: SolanaIntent, connection?: Connection): Promise; /** * Creates an offline Solana intent following TOSS specification. * If privateTransaction is true, encrypts internal data with Arcium. */ export declare function createIntent(sender: Keypair, recipient: PublicKey, amount: number, connection: Connection, options?: CreateIntentOptions): Promise; /** * Checks if an intent has expired */ export declare function isIntentExpired(intent: SolanaIntent): boolean; /** * Updates the status of an intent */ export declare function updateIntentStatus(intent: SolanaIntent, status: IntentStatus, error?: string): SolanaIntent; /** * Creates an offline intent with durable nonce account support * Enables replay-protected offline transactions using nonce accounts * Requires biometric authentication for enhanced security */ export declare function createOfflineIntent(senderUser: TossUser, senderKeypair: Keypair, recipientUser: TossUser, amount: number, nonceAccountInfo: any, // NonceAccountInfo from NonceAccountManager connection: Connection, options?: CreateIntentOptions): Promise; export {}; //# sourceMappingURL=intent.d.ts.map