UNPKG

delegate-framework

Version:

A TypeScript framework for building robust, production-ready blockchain workflows with comprehensive error handling, logging, and testing. Maintained by delegate.fun

21 lines 1.4 kB
import { Connection, Keypair } from "@solana/web3.js"; import { Delegate, DelegateUtilities } from "./base"; import { BaseDelegateOptions, BaseDelegateResult } from "./types"; export declare abstract class BaseDelegate<T extends BaseDelegateOptions = BaseDelegateOptions, R extends BaseDelegateResult = BaseDelegateResult> implements Delegate<T, R>, DelegateUtilities { readonly signerKeypair: Keypair; readonly connection: Connection; readonly feeTakerKeypair?: Keypair; protected requestId: number; constructor(connection: Connection, signerKeypair: Keypair, feeTakerKeypair?: Keypair); abstract executeDelegate(delegateOptions: T): Promise<R>; abstract validateOptions(delegateOptions: T): void; retryOperation<U>(operation: () => Promise<U>, maxRetries?: number): Promise<U>; handleError(error: Error, context?: Record<string, any>): Promise<void>; logOperation(operation: string, data?: Record<string, any>): void; protected generateRequestId(): number; protected validatePublicKey(publicKeyString: string, fieldName: string): void; protected validateRequiredField(value: any, fieldName: string): void; protected validateStringField(value: string, fieldName: string, minLength?: number): void; protected validateNumberField(value: number, fieldName: string, min?: number, max?: number): void; } //# sourceMappingURL=base-delegate.d.ts.map