Skip to main content

CorrectRecord

@iota/audit-trails API documentation


Class: CorrectRecord

Transaction wrapper for correcting a record.

Remarks

Appends a new record that supersedes an existing record while preserving the original. The correction records the sequence number it replaces, and the replaced record receives a back-pointer to the new correction so clients can resolve the current record.

Tagged corrections require the correction tag to exist in the trail registry and the supplied capability's role to allow both the replaced record's tag, when present, and the correction record's tag, when present. The transaction aborts on-chain when the package version is incompatible, the capability is invalid, the trail is write-locked, the target record does not exist, the target record was already replaced, or tag authorization fails.

Requires the Permission.CorrectRecord permission.

Emits a RecordAdded event on success.

Methods

toJSON()

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object


toString()

toString(): string

Return stringified version of self.

Returns

string


applyWithEvents()

applyWithEvents(wasm_effects, wasm_events, client): Promise<RecordAdded>

Applies transaction effects and events and decodes the matching event payload.

Parameters

wasm_effects

TransactionEffects

wasm_events

IotaEvent[]

client

CoreClientReadOnly

Read-only core client used during application.

Returns

Promise<RecordAdded>

Decoded RecordAdded event payload for the appended correction.

Throws

When the expected event is missing or transaction application fails.


buildProgrammableTransaction()

buildProgrammableTransaction(client): Promise<Uint8Array<ArrayBufferLike>>

Builds the programmable transaction bytes for submission.

Parameters

client

CoreClientReadOnly

Read-only core client used to resolve packages and serialize the transaction.

Returns

Promise<Uint8Array<ArrayBufferLike>>

BCS-encoded programmable transaction bytes ready for signing and submission.

Throws

When transaction construction or serialization fails, including when the target record cannot be loaded, the correction tag is not defined, or no suitable capability can be found.