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
readonlyargs:any
The argument carried by the lock variant, if any.
Returns
The unlock timestamp (number) for UnlockAt (seconds);
undefined for None and UntilDestroyed.
type
readonlytype: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()
staticwithNone():TimeLock
Creates an absent lock — semantically "no restriction".
Returns
TimeLock
A TimeLock of type TimeLockType.None.
withUnlockAt()
staticwithUnlockAt(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()
staticwithUntilDestroyed():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.