@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
48 lines • 1.71 kB
TypeScript
/**
* @purpose Address Lookup Table utilities for SRSLY
*
* Provides helpers for fetching and using the SRSLY Address Lookup Table
* to reduce transaction size for rental operations.
*/
import { type Address } from '@solana/kit';
/**
* Address Lookup Table account data structure
* Contains the list of addresses that can be referenced by index in transactions
*/
export interface AddressLookupTableData {
/** The address of the lookup table account */
address: Address;
/** The addresses stored in the lookup table */
addresses: Address[];
/** Whether the lookup table is active (has addresses) */
isActive: boolean;
}
/**
* Fetch the SRSLY Address Lookup Table from chain
*
* The ALT contains static addresses used across all rental operations,
* reducing transaction size by ~310 bytes when used with versioned transactions.
*
* @param rpcUrl - Optional RPC endpoint URL. If not provided, uses RPC from global config
* @returns ALT data with addresses, or null if ALT not configured
* @throws Error if fetch fails
*
* @example
* ```typescript
* // Fetch ALT using global config RPC
* const alt = await fetchLookupTable();
* if (alt) {
* console.log('ALT address:', alt.address);
* console.log('Contains', alt.addresses.length, 'addresses');
* }
* ```
*/
export declare function fetchLookupTable(rpcUrl?: string): Promise<AddressLookupTableData | null>;
/**
* Get the ALT address from config without fetching full ALT data
*
* @param rpcUrl - Optional RPC endpoint URL
* @returns ALT address, or null if not configured
*/
export declare function getLookupTableAddress(rpcUrl?: string): Promise<Address | null>;
//# sourceMappingURL=lookupTable.d.ts.map