Skip to main content

TimeLock

@iota/notarization API documentation


Class: TimeLock

A time-based lock applied to one of the lock fields of a notarization.

Remarks​

Construct one with the static factory methods (TimeLock.withUnlockAt, TimeLock.withUntilDestroyed, TimeLock.withNone) and inspect it via the TimeLock.type and TimeLock.args getters.

Properties​

args​

readonly args: any

The argument carried by the lock variant, if any.

Returns​

The unlock timestamp (number) for UnlockAt (seconds); undefined for None and UntilDestroyed.


type​

readonly type: TimeLockType

The discriminator for which kind of lock this is.

Methods​

toJSON()​

toJSON(): Object

  • Return copy of self without private attributes.

Returns​

Object


toString()​

toString(): string

Return stringified version of self.

Returns​

string


withNone()​

static withNone(): TimeLock

Creates an absent lock — semantically "no restriction".

Returns​

TimeLock

A TimeLock of type TimeLockType.None.


withUnlockAt()​

static withUnlockAt(time_sec): TimeLock

Creates a lock that releases at a specific timestamp in seconds.

Parameters​

time_sec​

number

Returns​

TimeLock

A TimeLock of type TimeLockType.UnlockAt.


withUntilDestroyed()​

static withUntilDestroyed(): TimeLock

Creates a lock that stays engaged until the notarization is destroyed.

Returns​

TimeLock

A TimeLock of type TimeLockType.UntilDestroyed.

Remarks​

This variant is not valid for the deleteLock field of LockMetadata — using it there causes the on-chain transaction to abort.