Skip to content

hashOrderDetails

hashOrderDetails(params): `0x${string}`

Defined in: src/settlement/order-hash.ts:134

details — the off-chain commitment to an order’s contents: its id, its lines and a salt.

Strings are hashed as UTF-8 bytes, so non-ASCII ids are fine. An empty lines array is valid.

Parameters

params

HashOrderDetailsParams

Returns

`0x${string}`

Throws

viem’s encoding error if salt is not 32 bytes of hex or a quantity does not fit a uint32. hashStruct does not run viem’s typed-data validation, so such an input surfaces as that raw error rather than a friendlier one — validate at the edge if the input is untrusted.

Example

import { hashOrderDetails } from "kawasekit";
const details = hashOrderDetails({
orderId: "ord_01J8ZK3V7Q",
lines: [{ itemId: "item_espresso", unitPrice: 1200n * 10n ** 18n, quantity: 1 }],
salt: "0x…32 bytes…",
});