TrailLocking
@iota/audit-trails API documentation
Class: TrailLocking
Locking API scoped to a specific trail.
Remarks
Updates the trail's LockingConfig and queries whether an individual record is currently locked against deletion.
Methods
toJSON()
toJSON():
Object
- Return copy of self without private attributes.
Returns
Object
toString()
toString():
string
Return stringified version of self.
Returns
string
isRecordLocked()
isRecordLocked(
sequence_number):Promise<boolean>
Returns whether a record is currently locked against deletion.
Parameters
sequence_number
bigint
Returns
Promise<boolean>
true when the record is still inside the delete-record window, false
otherwise.
Remarks
Evaluates the trail's deleteRecordWindow against the record at sequenceNumber. For
count-based windows, the result reflects the last count records currently present in
trail order at call time; time-based windows are evaluated against the current clock time.
Throws
When no record exists at sequenceNumber.
update()
update(
config):TransactionBuilder<UpdateLockingConfig>
Builds a transaction that replaces the full locking configuration.
Parameters
config
Replacement LockingConfig.
Returns
TransactionBuilder<UpdateLockingConfig>
A TransactionBuilder wrapping the UpdateLockingConfig transaction.
Remarks
Overwrites all three locking dimensions at once: delete-record window, delete-trail lock,
and write lock. config.deleteTrailLock must not be TimeLock.withUntilDestroyed,
and a count-based config.deleteRecordWindow must use count > 0 —
use LockingWindow.withNone to express "no deletion lock". config.writeLock may
still be TimeLock.withUntilDestroyed.
Requires the Permission.UpdateLockingConfig permission.
Throws
When the wrapper was created from a read-only client, or when config violates
one of the constraints above.
Emits a LockingConfigUpdated event on success.
updateDeleteRecordWindow()
updateDeleteRecordWindow(
window):TransactionBuilder<UpdateDeleteRecordWindow>
Builds a transaction that updates only the delete-record window.
Parameters
window
Replacement LockingWindow.
Returns
TransactionBuilder<UpdateDeleteRecordWindow>
A TransactionBuilder wrapping the UpdateDeleteRecordWindow transaction.
Remarks
Replaces the trail's deleteRecordWindow. Records currently inside the new window
immediately become locked against deletion. A count-based window must use count > 0 —
use LockingWindow.withNone to express "no deletion lock".
Requires the Permission.UpdateLockingConfigForDeleteRecord permission.
Throws
When the wrapper was created from a read-only client, or when window is a
count-based window with count == 0.
Emits a LockingConfigUpdated event on success.
updateDeleteTrailLock()
updateDeleteTrailLock(
lock):TransactionBuilder<UpdateDeleteTrailLock>
Builds a transaction that updates only the delete-trail lock.
Parameters
lock
Replacement delete-trail TimeLock.
Returns
TransactionBuilder<UpdateDeleteTrailLock>
A TransactionBuilder wrapping the UpdateDeleteTrailLock transaction.
Remarks
Replaces the trail's deleteTrailLock. The new lock must not be
TimeLock.withUntilDestroyed; that variant is reserved for the write lock.
Requires the Permission.UpdateLockingConfigForDeleteTrail permission.
Throws
When the wrapper was created from a read-only client, or when lock is
TimeLock.withUntilDestroyed.
Emits a LockingConfigUpdated event on success.
updateWriteLock()
updateWriteLock(
lock):TransactionBuilder<UpdateWriteLock>
Builds a transaction that updates only the write lock.
Parameters
lock
Replacement write TimeLock.
Returns
TransactionBuilder<UpdateWriteLock>
A TransactionBuilder wrapping the UpdateWriteLock transaction.
Remarks
Replaces the trail's writeLock. While the new lock is active, TrailRecords.add
aborts on-chain. TimeLock.withUntilDestroyed is permitted here.
Requires the Permission.UpdateLockingConfigForWrite permission.
Throws
When the wrapper was created from a read-only client.
Emits a LockingConfigUpdated event on success.