Period
Utilities for constructing period durations (in seconds) for recurring spending limits.
Periods define the reset interval for access key spending limits. A spending limit with a
period will reset every period seconds. For example, a daily spending limit uses
Period.days(1) (86400 seconds).
Examples
import { Value } from 'ox'
import { KeyAuthorization, Period } from 'ox/tempo'
const authorization = KeyAuthorization.from({
address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
chainId: 4217n,
type: 'secp256k1',
limits: [{
token: '0x20c0000000000000000000000000000000000001',
limit: Value.from('100', 6),
period: Period.days(1), // resets daily
}],
})Functions
| Name | Description |
|---|---|
Period.days | Returns the number of seconds in n days. |
Period.hours | Returns the number of seconds in n hours. |
Period.minutes | Returns the number of seconds in n minutes. |
Period.months | Returns the number of seconds in n months (30 days). |
Period.seconds | Returns the number of seconds in n seconds. |
Period.weeks | Returns the number of seconds in n weeks. |
Period.years | Returns the number of seconds in n years (365 days). |

