Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.rhinestone.dev/llms.txt

Use this file to discover all available pages before exploring further.

Restrict when a session function can be called. Attach the policy at the function level.
const session = toSession({
  chain: base,
  owners: {
    type: 'ecdsa',
    accounts: [sessionOwnerAccount],
  },
  permissions: [
    {
      abi: erc20Abi,
      address: usdcAddress,
      functions: {
        transfer: {
          policies: [
            {
              type: 'time-frame',
              validAfter: Date.now(),
              validUntil: Date.now() + 1000 * 60 * 60 * 24,
            },
          ],
        },
      },
    },
  ],
})
This limits the function to a 24-hour window.