import { At as MethodInfo, Dt as DuplexStreamingCall, Et as UnaryCall, Ot as ClientStreamingCall, Tt as RpcTransport, f as GrpcWebTransportAdditionalOptions, kt as ServerStreamingCall, wt as RpcOptions } from "./index-C15wCMY6.cjs"; //#region src/client/base/GrpcWebRpcTransport.d.ts /** * GrpcWebRpcTransport provides a simple wrapper around GrpcWebFetchTransport * from @protobuf-ts/grpcweb-transport for use with protobuf-ts generated clients. * * This transport works in browser, Node.js, and React Native environments. */ declare class GrpcWebRpcTransport implements RpcTransport { private transport; constructor(baseUrl: string, options?: GrpcWebTransportAdditionalOptions); mergeOptions(options?: Partial): RpcOptions; unary(method: MethodInfo, input: I, options: RpcOptions): UnaryCall; serverStreaming(method: MethodInfo, input: I, options: RpcOptions): ServerStreamingCall; clientStreaming(method: MethodInfo, options: RpcOptions): ClientStreamingCall; duplex(method: MethodInfo, options: RpcOptions): DuplexStreamingCall; } //#endregion //#region src/client/base/BaseGrpcConsumer.d.ts /** * BaseGrpcConsumer provides base functionality for all gRPC consumers. * It uses the GrpcWebRpcTransport with GrpcWebFetchTransport from @protobuf-ts/grpcweb-transport. */ declare class BaseGrpcConsumer { private _client; protected endpoint: string; protected module: string; protected transport: GrpcWebRpcTransport; protected metadata?: Record; protected options?: GrpcWebTransportAdditionalOptions; constructor(endpoint: string, options?: GrpcWebTransportAdditionalOptions); setMetadata(map: Record): this; /** * @deprecated Manage options within the constructor instead */ clearMetadata(): void; getTransport(): GrpcWebRpcTransport; /** * Lazily initializes and returns the gRPC client. * Call this from a getter in subclasses to avoid constructor boilerplate. * * @example * private get client() { * return this.initClient(MyGrpcClient) * } */ protected initClient(ClientClass: new (transport: GrpcWebRpcTransport) => TClient): TClient; /** * Builds RpcOptions with metadata * @deprecated Options should be managed externally and passed into the constructor instead */ protected getRpcOptions(): RpcOptions; /** * Converts gRPC status names or numeric status values into numeric codes. */ private getGrpcStatusCode; /** * Determines whether a gRPC error is safe to retry. */ private isRetryableGrpcError; /** * Retry a gRPC call with backoff, only for retryable gRPC statuses. */ protected retry(grpcCall: () => Promise, retries?: number, delay?: number): Promise; /** * Extracts the ABCI error code from a gRPC error message. * Chain errors contain patterns like: {key:"ABCICode" value:"100"} */ private getABCICodeFromMessage; /** * Extracts the codespace/module from a gRPC error message. * Chain errors contain patterns like: {key:"Codespace" value:"exchange"} */ private getCodespaceFromMessage; /** * Centralized error handler for gRPC calls. * When the error contains chain error details (ABCI code and codespace), * throws a TransactionException which will map the error to a user-friendly message. * Otherwise throws a GrpcUnaryRequestException for generic gRPC errors. */ protected handleGrpcError(e: unknown, context: string): never; /** * Generic wrapper for gRPC calls with retry and error handling * Simplifies the common pattern of: retry -> await response -> handle errors * * Usage with explicit type parameter: * ```typescript * const response = await this.executeGrpcCall( * request, * this.client.params.bind(this.client), * ) * ``` * @template TRequest - The request message type * @template TResponse - The response message type * @param options.noRetry - Set to true for non-idempotent RPCs (e.g. broadcast, * prepare-auto-sign) where retrying after a server-side success could cause * duplicate side effects. Defaults to false (retry with exponential backoff). */ protected executeGrpcCall(request: TRequest, clientMethod: (req: TRequest, options?: RpcOptions) => UnaryCall, options?: { noRetry?: boolean; }): Promise; } //#endregion export { BaseGrpcConsumer as t };