Skip to content

zone.useSignAuthorizationToken ​

Hook for signing and storing a Tempo zone authorization token.

Use this hook before querying zone RPC methods that require the zone transport to send an X-Authorization-Token header.

Requires viem >=2.56.2

Zone actions and hooks require viem >=2.56.2.

Usage ​

ts
import { Hooks } from 'wagmi/tempo'
import { Zone } from 'viem/tempo'

const zoneChain = Zone.b
const signAuthorizationToken = Hooks.zone.useSignAuthorizationToken()

const result = await signAuthorizationToken.mutateAsync({
  chainId: zoneChain.id,
})

console.log('Token:', result.token)
// @log: Token: 0x1234
ts
// @noErrors
import { createConfig } from 'wagmi'
import { webAuthn } from 'wagmi/tempo'
import { http as zoneHttp, Zone } from 'viem/tempo'

const zoneChain = Zone.b

export const config = createConfig({
  connectors: [webAuthn()],
  chains: [zoneChain],
  multiInjectedProviderDiscovery: false,
  transports: {
    [zoneChain.id]: zoneHttp(),
  },
})

Return Type ​

See TanStack Query mutation docs for more info hook return types.

data ​

See Wagmi Action zone.signAuthorizationToken Return Type

mutate/mutateAsync ​

See Wagmi Action zone.signAuthorizationToken Parameters

Parameters ​

config ​

Config | undefined

Config to use instead of retrieving from the nearest WagmiProvider.

mutation ​

See the TanStack Query mutation docs for more info hook parameters.

Action ​

Released under the MIT License.