import { CryptoStore, GroupEncryptionAlgorithmId, GroupEncryptionCrypto, type EncryptionDeviceInitOpts } from '@towns-protocol/encryption'; import { type StreamRpcClient } from './makeStreamRpcClient'; import { type SignerContext } from './signerContext'; import { type TownsConfig } from './townsEnv'; import { ethers } from 'ethers'; import { type Address } from '@towns-protocol/web3'; import { type ParsedEvent, type MiniblockInfoResponse } from './types'; import { UnpackEnvelopeOpts } from './sign'; import { UserInboxPayload_GroupEncryptionSessions, type Envelope, type PlainMessage, type StreamEvent, type Tags } from '@towns-protocol/proto'; import { AppRegistryRpcClient } from './makeAppRegistryRpcClient'; import { StreamStateView } from './streamStateView'; type Client_Base = { /** The userId of the Client. */ userId: Address; /** The signer context of the Client. */ signerContext: SignerContext; /** The wallet of the Client. */ wallet: ethers.Wallet; /** RPC client that connects to the Towns network. */ rpc: StreamRpcClient; /** The config of the Client. Stores environenment id, base and river chain config */ config: TownsConfig; /** Crypto Store */ keychain: CryptoStore; /** Crypto Backend */ crypto: GroupEncryptionCrypto; /** Algorithm used for group encryption. */ defaultGroupEncryptionAlgorithm: GroupEncryptionAlgorithmId; /** Disable hash validation for streams. */ disableHashValidation: boolean; /** Disable signature validation for streams. */ disableSignatureValidation: boolean; /** Options for unpacking envelopes */ unpackEnvelopeOpts: UnpackEnvelopeOpts; /** Get the app service, will authenticate on first call and cache the service for subsequent calls */ appServiceClient: () => Promise; /** Get a stream by streamId and unpack it */ getStream: (streamId: string) => Promise; /** Get the miniblock info for a stream */ getMiniblockInfo: (streamId: string) => Promise; /** Unpack envelope using client config */ unpackEnvelope: (envelope: Envelope) => Promise; /** Unpack envelopes using client config */ unpackEnvelopes: (envelopes: Envelope[]) => Promise; /** injest a group encryption session */ importGroupEncryptionSessions: (payload: { streamId: string; sessions: UserInboxPayload_GroupEncryptionSessions; }) => Promise; /** Send an event to a stream */ sendEvent: (streamId: string, eventPayload: PlainMessage['payload'], tags?: PlainMessage, ephemeral?: boolean) => Promise<{ eventId: string; prevMiniblockHash: Uint8Array; envelope: Envelope; }>; }; export type ClientV2 = Client_Base & (extended extends Extended ? extended : unknown) & { extend: (fn: (client: ClientV2) => client) => ClientV2 & (extended extends Extended ? extended : unknown)>; }; type Extended = Prettify<{ [_ in keyof Client_Base]?: undefined; } & { [key: string]: unknown; }>; export type Prettify = { [K in keyof T]: T[K]; } & {}; export type CreateTownsClientParams = { env: string; encryptionDevice?: EncryptionDeviceInitOpts; /** Toggle hash validation of Envelopes. Defaults to `false`. */ hashValidation?: boolean; /** Toggle signature validation of Envelopes. Defaults to `false`. */ signatureValidation?: boolean; /** Maximum number of entries to store in the crypto store (for in-memory stores). * Helps prevent memory leaks in long-running bots. * Defaults to 5000. */ maxCryptoStoreEntries?: number; }; export declare const createTownsClient: (params: ({ privateKey: string; } | { mnemonic: string; } | { bearerToken: string; }) & CreateTownsClientParams) => Promise; export {}; //# sourceMappingURL=client-v2.d.ts.map