import type { Hex } from 'viem'; import type { ClientWithPns } from '../../contracts/consts.js'; import type { TransactionRequestWithPassthrough } from '../../types.js'; import { type BatchFunctionResult, type GeneratedFunction } from '../../utils/generateFunction.js'; type ExtractResult = TFunction extends { decode: (...args: any[]) => Promise; } ? U : never; export type BatchParameters = BatchFunctionResult[]; export type BatchReturnType = { [TFunctionName in keyof TFunctions]: ExtractResult; }; declare const encode: (client: ClientWithPns, ...items: BatchFunctionResult[]) => TransactionRequestWithPassthrough; declare const decode: (client: ClientWithPns, data: Hex, passthrough: TransactionRequestWithPassthrough[], ...items: I) => Promise>; type BatchableFunctionObject = GeneratedFunction; /** * Batches multiple read functions into a single call. * @param client - {@link ClientWithPns} * @param ...parameters - Array of {@link BatchFunctionResult} objects * @returns Array of return values from each function * * @example * import { createPublicClient, http } from 'viem' * import { mainnet } from 'viem/chains' * import { addPnsContracts } from '@pnsdomains/pnsjs' * import { batch, getTextRecord, getAddressRecord } from '@pnsdomains/pnsjs/public' * * const client = createPublicClient({ * chain: addPnsContracts(mainnet), * transport: http(), * }) * const result = await batch( * client, * getTextRecord.batch({ name: 'pns.pls', key: 'com.twitter' }), * getAddressRecord.batch({ name: 'pns.pls', coin: 'PLS' }), * ) * // [pulsedomains, { id: 1028, name: 'PLS', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 }] */ declare const batch: ((client: ClientWithPns, ...args: I) => Promise>) & BatchableFunctionObject; export default batch; //# sourceMappingURL=batch.d.ts.map