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.
You can limit the amount of ERC20 tokens transferable through a session function. Attach the policy at the function level — it caps the cumulative amount across all uses of that function.
const session = toSession({
chain: base,
owners: {
type: 'ecdsa',
accounts: [sessionOwnerAccount],
},
permissions: [
{
abi: erc20Abi,
address: usdcAddress,
functions: {
transfer: {
policies: [
{
type: 'spending-limits',
limits: [
{
token: usdcAddress,
amount: parseUnits('10', 6),
},
{
token: wethAddress,
amount: parseUnits('0.1', 18),
},
],
},
],
},
},
},
],
})
This caps total transfers within the session to 10 USDC and 0.1 WETH combined.