Advanced utilities and types
Convert between the shapes contracts use and the shapes an app shows.
Contracts express every timestamp as Unix seconds in a bigint.
dateToEthereumTimestamp converts
a JavaScript Date to that form, for fields such as expirationTimestampSeconds on the inputs in
Create and redeem a LOC.
An expiration 30 days out:
// Contracts express time as Unix seconds in a bigint.const thirtyDays = 30 * 24 * 60 * 60 * 1000;const expiration = new Date(Date.now() + thirtyDays);const expirationTimestampSeconds = dateToEthereumTimestamp(expiration);Primary APIs
Functions
dateToEthereumTimestamp— Converts a JavaScriptDateto the Unix-secondsbigintthe protocol uses for every onchain timestamp, such as…