Skip to main content

TimeLock

@iota/audit-trails API documentation


Class: TimeLock

Time-based lock used in the trail's LockingConfig.

Remarks

TimeLock.withUntilDestroyed is rejected by the audit-trail package when used as the trail-delete lock; pass it only for the write lock.

Properties

args

readonly args: any

Returns the lock argument for parameterized variants.

Returns

The numeric argument for UnlockAt/UnlockAtMs variants, or undefined otherwise.


type

readonly type: TimeLockType

Returns the lock variant.

Returns

The TimeLockType discriminant for this lock.

Methods

toJSON()

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object


toString()

toString(): string

Return stringified version of self.

Returns

string


withInfinite()

static withInfinite(): TimeLock

Creates a lock that never unlocks.

Returns

TimeLock

A lock that is always active.


withNone()

static withNone(): TimeLock

Creates a disabled lock.

Returns

TimeLock

A lock that does not gate the protected operation.


withUnlockAt()

static withUnlockAt(time_sec): TimeLock

Creates a lock that unlocks at a Unix timestamp in seconds.

Parameters

time_sec

number

Returns

TimeLock

A lock that unlocks once the on-chain clock reaches timeSec.


withUnlockAtMs()

static withUnlockAtMs(time_ms): TimeLock

Creates a lock that unlocks at a Unix timestamp in milliseconds.

Parameters

time_ms

bigint

Returns

TimeLock

A lock that unlocks once the on-chain clock reaches timeMs.


withUntilDestroyed()

static withUntilDestroyed(): TimeLock

Creates a lock that stays active until the protected object is destroyed.

Returns

TimeLock

A lock that remains active until the protected object is destroyed.