5.7.1 Java  Script
5.7.1.1 Types
5.7.1.2 loader.mjs
5.7.1.3 Accounts
5.7.1.4 Contracts
5.7.1.5 Network Utilities
5.7.1.6 Utilities
5.7.1.7 ask.mjs
On this page:
get  Network  Time
wait  Until  Time
REACH_  ISOLATED_  NETWORK
wait
5.7.1.5 Network Utilities

These functions interact with the consensus network itself.

getNetworkTime() => Promise<time>

Returns a Promise for the current consensus network time. For ETH and ALGO, this is the current block number, represented as a BigNumber.

waitUntilTime(time, onProgress) => Promise<time>

Returns a Promise that will only be resolved after the specified consensus network time. In isolated testing modes, this will also force time to pass on the network, usually by sending trivial transactions. An isolated testing modes is a REACH_CONNECTOR_MODE that matches $NET-test-dockerized-$IMPL for all valid $NET and $IMPL, or when REACH_ISOLATED_NETWORK is set.

You may provide an optional onProgress callback, used for reporting progress, which may be called many times up until the specified time. It will receive an object with keys currentTime and targetTime,

wait(timedelta, onProgress) => Promise<time>

Returns a Promise that will only be resolved after the specified time delta has elapsed. The expression await wait(delta, onProgress) is the same as await waitUntilTime(add(await getNetworkTime(), delta), onProgress). As with waitUntilTime, the onProgress callback is optional.