export interface BankConfig { /** API origin, e.g. "https://api.lux.financial" or "https://api.sandbox.lux.financial". */ baseUrl: string; /** IAM bearer token, or a getter so rotation is picked up per request. */ token?: string | (() => string | null | undefined); fetch?: typeof fetch; } export declare class BankError extends Error { readonly status: number; readonly body: unknown; constructor(message: string, status: number, body: unknown); } export interface Config { sandbox: boolean; demoLogin?: boolean; demoEmail?: string; fiat: string[]; crypto: string[]; network: string; disclaimer: string; partner?: { name: string; terms: string; privacy: string; }; } export interface Plan { id: string; name: string; monthly: number; card: 'virtual' | 'plastic' | 'metal'; iban: boolean; freeACH: number; freeWires: number; achFee: number; wireFee: number; fxPct: number; depositPct: number; dailyLimit: number; monthlyLimit: number; holders: number; invite?: boolean; perks: string[]; } export interface Balance { currency: string; available: number; held: number; decimals: number; kind: 'fiat' | 'crypto'; valueUsd: number; } export interface Receiving { bankName: string; accountHolder: string; routingNumber?: string; accountNumber?: string; accountType?: string; iban?: string; swift?: string; bankAddress?: string; } export interface Account { id: string; entityName: string; entityType: 'individual' | 'business'; country: string; currency: string; status: string; kycStatus: string; iban: string; receiving?: Receiving; } export interface Wallet { id: string; currency: string; address: string; network: string; status: string; } export interface Card { id: string; holderName: string; brand: string; type: string; last4: string; display: string; expMonth: number; expYear: number; currency: string; status: string; design: string; } export interface Transaction { id: string; type: string; direction: 'credit' | 'debit'; amount: number; currency: string; decimals: number; status: string; reference: string; txHash?: string; network?: string; created: string; } export interface Beneficiary { id: string; name: string; bankAccountHolder: string; currency: string; country: string; paymentType: string; bankDetails: { iban?: string; bic?: string; accountNumber?: string; sortCode?: string; }; verified: boolean; } export interface CryptoPrice { asset: string; usd: number; decimals: number; } export interface CryptoMove { txHash: string; network: string; asset: string; amount: number; toAddress?: string; balances: Balance[]; } export interface ExchangeQuote { fromCurrency: string; toCurrency: string; fromAmount: number; toAmount: number; fromDecimals: number; toDecimals: number; rate: number; expiresAt: string; } export interface ExchangeResult { fromCurrency: string; toCurrency: string; fromAmount: number; toAmount: number; rate: number; balances: Balance[]; } /** The issuer's normalized card-lifecycle state; branch on this pair only. */ export interface IssuerState { status: 'not_started' | 'pending' | 'approved' | 'rejected' | 'error' | string; nextAction: 'register' | 'complete_kyc' | 'accept_agreement' | 'retry_kyc' | 'order_card' | 'none' | string; } export interface CardholderProfile { firstName: string; middleName?: string; lastName: string; cardHolderFirstName: string; cardHolderLastName: string; gender: 0 | 1 | 2; dateOfBirth: string; placeOfBirth: string; occupation: number; phoneNumber: string; phoneNumberCountryCode: string; address: { addressLine1: string; addressLine2?: string; subdivision: string; city: string; postalCode: string; country: string; }; } export interface Vault { id: string; name: string; collateral: string; underlying: string; synthetic: string; apy: number; maxLtv: number; tvlUsd: number; description: string; } export interface Position { vault: string; collateral: number; collateralUsd: number; debt: number; ltv: number; borrowable: number; yieldUsdYear: number; selfRepayDays: number; } export type VaultView = Vault & { position?: Position | null; }; export interface EarnSummary { collateralUsd: number; debt: number; netUsd: number; yieldUsdYear: number; positions: number; netApy: number; } export interface Overview { sandbox: boolean; onboarded: boolean; account?: Account; balances?: Balance[]; wallet?: Wallet | null; wallets?: Wallet[]; cards?: Card[]; earn?: EarnSummary; recentTransactions?: Transaction[]; } export declare class Bank { private baseUrl; private token?; private fetchFn; constructor(config: BankConfig); private request; health(): Promise<{ status: string; sandbox: boolean; }>; config(): Promise; plans(): Promise; onboard(profile: Record): Promise; overview(): Promise; transactions(): Promise; accounts(): Promise; transfer(fromAccountId: string, toAccountId: string, amount: number, currency: string, reference?: string): Promise<{ debitId: string; creditId: string; status: string; }>; pay(accountId: string, beneficiaryId: string, amount: number, currency: string, reference?: string): Promise<{ transactionId: string; status: string; }>; balances(accountId: string): Promise; wallets(accountId: string): Promise; accountTransactions(accountId: string): Promise; beneficiaries(): Promise; createBeneficiary(beneficiary: Record): Promise<{ id: string; }>; deleteBeneficiary(id: string): Promise<{ deleted: string; }>; cards(): Promise; issueCard(currency?: string): Promise<{ card: Card; cvv: string; pan: string; }>; freezeCard(id: string): Promise; unfreezeCard(id: string): Promise; createCardAccount(profile: CardholderProfile): Promise<{ status: string; message?: string; }>; cardAccount(): Promise<{ status: string; data: Record; }>; cardKYC(): Promise<{ status: string; data: Record; }>; createVirtualCard(): Promise<{ status: string; data?: IssuerState; }>; /** Sensitive: hand the URL straight to the user's browser; never log or persist it. */ cardKYCURL(): Promise<{ url: string; }>; /** Sensitive: hand the URL straight to the user's browser; never log or persist it. */ cardConsentURL(): Promise<{ url: string; }>; orderVirtualCard(): Promise<{ status: string; message?: string; }>; wallet(): Promise<{ wallet: Wallet; wallets: Wallet[]; holdings: Balance[]; network: string; sandbox: boolean; }>; cryptoPrices(): Promise<{ prices: CryptoPrice[]; sandbox: boolean; }>; sendCrypto(asset: string, amount: number, toAddress: string): Promise; /** Sandbox-only testnet faucet. */ depositCrypto(asset: string, amount: number): Promise; vaults(): Promise; earnVaults(): Promise; private earnMove; earnDeposit(vault: string, amount: number): Promise<{ vault: string; position: Position; balances: Balance[]; }>; earnBorrow(vault: string, amount: number): Promise<{ vault: string; position: Position; balances: Balance[]; }>; earnRepay(vault: string, amount: number): Promise<{ vault: string; position: Position; balances: Balance[]; }>; earnWithdraw(vault: string, amount: number): Promise<{ vault: string; position: Position; balances: Balance[]; }>; exchangeQuote(fromCurrency: string, toCurrency: string, amount: number): Promise; exchange(fromCurrency: string, toCurrency: string, amount: number): Promise; sandboxLogin(email: string, password: string): Promise<{ token: string; user: { id: string; email: string; }; }>; }