Skip to content

createBuyListPolicies

createBuyListPolicies(params): readonly [Policy, Policy]

Defined in: src/policy/buy-list.ts:80

Build the ZeroDev policy bundle for a buy-list-scoped, single-use session key.

Plug the returned policies into toPermissionValidator({ policies, … }) and issue the session key via issueSessionKey.

Parameters

params

CreateBuyListPoliciesParams

Returns

readonly [Policy, Policy]

Example

import { parseUnits } from "viem";
import { createBuyListPolicies, getJpycAddress, JPYC_DECIMALS, polygonAmoy } from "kawasekit";
const policies = createBuyListPolicies({
jpycAddress: getJpycAddress(polygonAmoy.id),
merchants: [merchantA, merchantB], // pay ONLY these (allowlist)
maxPerTransfer: parseUnits("500", JPYC_DECIMALS),
validUntil: Math.floor(Date.now() / 1000) + 3 * 86_400, // valid 3 days
});
// user funds the account with their budget; the policies bound who/how-much/when.