import { AccountState, Address } from '@ton/core'; import { SmartContract } from './SmartContract'; import { Blockchain } from './Blockchain'; /** * @interface BlockchainStorage Provides information about contracts by blockchain */ export interface BlockchainStorage { /** * Retrieves a smart contract by blockchain and address. * * @param {Blockchain} blockchain - The blockchain instance. * @param {Address} address - The address of the smart contract. * @returns {Promise} - The smart contract instance. */ getContract(blockchain: Blockchain, address: Address): Promise; /** * Lists all known smart contracts. * * @returns {SmartContract[]} - An array of known smart contracts. */ knownContracts(): SmartContract[]; /** * Clears the internal cache of known contracts. */ clearKnownContracts(): void; } /** * In-memory storage for blockchain smart contracts. */ export declare class LocalBlockchainStorage implements BlockchainStorage { private contracts; getContract(blockchain: Blockchain, address: Address): Promise; knownContracts(): SmartContract[]; clearKnownContracts(): void; } export interface RemoteBlockchainStorageClient { getLastBlockSeqno(): Promise; getAccount(seqno: number, address: Address): Promise<{ state: AccountState; balance: bigint; lastTransaction?: { lt: bigint; hash: Buffer; }; }>; } /** * Wraps ton client for remote storage. * * @example * let client = new TonClient4({ * endpoint: 'https://mainnet-v4.tonhubapi.com' * }) * * let remoteStorageClient = wrapTonClient4ForRemote(client); * * @param client TonClient4 to wrap */ export declare function wrapTonClient4ForRemote(client: { getLastBlock(): Promise<{ last: { seqno: number; }; }>; getAccount(seqno: number, address: Address): Promise<{ account: { state: { type: 'uninit'; } | { type: 'active'; code: string | null; data: string | null; } | { type: 'frozen'; stateHash: string; }; balance: { coins: string; }; last: { lt: string; hash: string; } | null; }; }>; }): RemoteBlockchainStorageClient; /** * @class {RemoteBlockchainStorage} Remote blockchain storage implementation. * * @example * let client = new TonClient4({ * endpoint: 'https://mainnet-v4.tonhubapi.com' * }) * * let blockchain = await Blockchain.create({ * storage: new RemoteBlockchainStorage(wrapTonClient4ForRemote(client), 34892000) * }); */ export declare class RemoteBlockchainStorage implements BlockchainStorage { private contracts; private client; private blockSeqno?; constructor(client: RemoteBlockchainStorageClient, blockSeqno?: number); private getLastBlockSeqno; getContract(blockchain: Blockchain, address: Address): Promise; knownContracts(): SmartContract[]; clearKnownContracts(): void; }