/** * @module RecordBuilder / LookupRecordBuilder * @category Record Builders */ import { JwtConfig, LedgerMeta, LedgerRecord } from "../../../../types/src"; import { BaseListResponse } from '../types/list-response'; import { BaseRecordBuilder } from './base-record-builder'; /** * A handler for records lookup on the remote API. */ export type LookupRecordHandler = (record: LedgerRecord, authParams: JwtConfig) => Promise; /** * Implements a builder pattern that allows a more * convenient way to work with ledger records. This * class has functions that simplify construction, * hashing, signing, testing and sending records to * remote ledger instances. * * This builder is intended for creating new records, * sending a record to ledger will attempt to create it * on the API with the content that was prepared in the * builder. * * NOTE: current record instance is mutated by this * class, we are not cloning instances intentionally, * and it isn't advised to reuse builder instances when * working with multiple records or mutating objects * passed to this builder in external code. It is * recommended to clone objects in such cases to avoid * unexpected behaviors. */ export declare class LookupRecordBuilder, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder { /** * A handler for anchor lookup on the remote API. */ protected lookupRecord: LookupRecordHandler; /** * Creates new instance of record builder. * * @param lookupRecord function which handles lookup on ledger api */ constructor(lookupRecord: LookupRecordHandler); /** * Sends the current lookup payload to the remote ledger. * * @returns api response with the lookup response * @throws if any method in builder chain fails */ send(): Promise; }