ZoneRpcAuthentication.from
Instantiates a typed Zone RPC authentication token.
Imports
Named
import { ZoneRpcAuthentication } from 'ox/tempo'Examples
import { ZoneRpcAuthentication } from 'ox/tempo'
const authentication = ZoneRpcAuthentication.from({
chainId: 4217000026,
expiresAt: 1711235160,
issuedAt: 1711234560,
zoneId: 26,
})Attaching Signatures
import { Secp256k1 } from 'ox'
import { ZoneRpcAuthentication } from 'ox/tempo'
const authentication = ZoneRpcAuthentication.from({
chainId: 4217000026,
expiresAt: 1711235160,
issuedAt: 1711234560,
zoneId: 26,
})
const signature = Secp256k1.sign({
payload: ZoneRpcAuthentication.getSignPayload(authentication),
privateKey: '0x...',
})
const authentication_signed = ZoneRpcAuthentication.from(authentication, {
signature,
})Definition
function from<authentication, signature>(
authentication: authentication | ZoneRpcAuthentication,
options?: from.Options<signature>,
): from.ReturnType<authentication, signature>Source: src/tempo/ZoneRpcAuthentication.ts
Parameters
authentication
- Type:
authentication | ZoneRpcAuthentication
Zone RPC authentication token fields.
options
- Type:
from.Options<signature> - Optional
Zone RPC authentication options.
options.signature
- Type:
SignatureEnvelope | signature - Optional
The signature to attach to the authentication token.
Return Type
The instantiated Zone RPC authentication token.
from.ReturnType<authentication, signature>

