Skip to content

createBuyListPolicies

createBuyListPolicies(params): readonly [Policy, Policy]

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

Build the ZeroDev policy bundle for a buy-list-scoped session key that pays through Settlement.

Plug the returned policies into toPermissionValidator({ policies, … }) and issue the session key via issueSessionKey. To revoke it later, supply the SAME policies in the SAME order.

The on-chain callPolicy version is fixed (V0_0_4) — the only one this two-permission scope has been run against.

Parameters

params

CreateBuyListPoliciesParams

Returns

readonly [Policy, Policy]

Example

import { parseUnits } from "viem";
import {
createBuyListPolicies, getJpycAddress, getSettlementAddress, JPYC_DECIMALS, polygonAmoy,
} from "kawasekit";
const policies = createBuyListPolicies({
jpycAddress: getJpycAddress(polygonAmoy.id),
settlementAddress: getSettlementAddress(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.