コンテンツにスキップ

deriveAuthorizationNonce

このコンテンツはまだ日本語訳がありません。

deriveAuthorizationNonce(input, scope): `0x${string}`

Defined in: src/tokens/eip3009.ts:170

Derives a deterministic 32-byte EIP-3009 nonce from a reasoning-step idempotency key, scoped to (from, verifyingContract, chainId) so the same key never collides across tokens or chains (M5-1, Half B).

nonce = keccak256(DOMAIN_TAG ‖ idempotencyKey ‖ from ‖ verifyingContract ‖ chainId). No shared secret: determinism across replicas / sub-agents needs only a shared conversationId (the source of the key), not secret distribution. A replayed key ⇒ identical nonce ⇒ the token contract’s authorizationState rejects the second settlement — the on-chain last line of defence against re-signed same-intent duplicate payments. Use in place of generateAuthorizationNonce only when a key is available.

chainId is in the preimage, so the same JPYC address on Polygon / Avalanche / Kaia / Ethereum yields distinct nonces (cross-chain replay safety).

Parameters

input

idempotencyKey

string

scope

chainId

number

from

`0x${string}`

verifyingContract

`0x${string}`

Returns

`0x${string}`

Example

import { deriveAuthorizationNonce } from "kawasekit";
const nonce = deriveAuthorizationNonce(
{ idempotencyKey },
{ from: account.address, verifyingContract, chainId },
);