import { JwtConfig, LedgerMeta, LedgerRecord, LedgerSigningParams } from "../../../../types/src"; import { DropRecordResponse } from '../types/drop-record-response'; import { BaseRecordBuilder } from './base-record-builder'; /** * A handler for droping records on the remote API. */ export type DropRecordHandler = (record: LedgerRecord, authParams: JwtConfig) => Promise; /** * A handler for reading records on the remote API. */ export type ReadRecordHandler = (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 record drops, sending * a record to ledger will perform the drop operation * on the API with the record 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 DropRecordBuilder, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder { /** * A handler for droping records on the remote API. */ protected dropRecord: DropRecordHandler; /** * A handler for reading records on the remote API. */ protected readRecord: ReadRecordHandler; /** * Creates new instance of record builder. * * @param dropRecord function which drops records on ledger API. */ constructor(dropRecord: DropRecordHandler, readRecord: ReadRecordHandler); /** * Initializes the record. This function will completely * replace all existing record properties. * * @param record the record * @returns this builder instance for chaining */ init(): this; /** * Sends the current record version to the remote ledger. * * @returns api response with the dropped record * @throws if any method in builder chain fails */ send(): Promise; /** * Sets custom.status 'dropped' to all the signatures. * * @param params signatures * @returns this builder instance for chaining */ sign(params: LedgerSigningParams[]): this; }