Interact with Contracts
Encode a contract call and execute it through a session key.
Install the CLI and sign in. Replace the example account ID, session-key ID, and recipient with your own. Use an active key installed on Base Sepolia with permission for the operation.
Confirm the contract address and ABI from the contract's publisher. The key must
allow the target and function. This example calls setValue(uint256) on a
contract you control.
Encode Calldata
npm install viemimport { encodeFunctionData, parseAbi } from "viem";
console.log(
encodeFunctionData({
abi: parseAbi(["function setValue(uint256 value)"]),
functionName: "setValue",
args: [42n],
}),
);Simulate the Call
calldata=$(node encode-call.mjs)
namera execution simulate \
--namespace evm \
--wallet 0199dfe1-0000-7000-8000-000000000001 \
--session-key 0199dfe1-0000-7000-8000-000000000002 \
--network 'Base Sepolia' \
--to <contract-address> \
--value 0 \
--data "$calldata"Transaction preview
-> Account: 👛 Example account
-> Network: Base Sepolia
-> Session key: Example session
-> Policy decision: Allowed
-> Calls: Succeeded
Simulation only. No transaction was submitted.Execute the Call
Use the same calldata and contract only after reviewing the preview:
namera execution execute \
--namespace evm \
--wallet 0199dfe1-0000-7000-8000-000000000001 \
--session-key 0199dfe1-0000-7000-8000-000000000002 \
--network 'Base Sepolia' \
--to <contract-address> \
--value 0 \
--data "$calldata" \
--sponsor true-> Account: 👛 Example account
-> Network: Base Sepolia
-> Session key: Example session
-> Status: Queued
-> UserOp Hash: 0x1111111111111111111111111111111111111111111111111111111111111111
Not confirmed yet. Check again with:
namera execution status 0199dfe1-0000-7000-8000-000000000003Save the submission ID and track it. Do not repeat the execution to check progress.
Example output uses fixture accounts and hashes, captured with the CLI's output formatters. Plain-text output is shown without terminal colors; your values and relative expiry dates will differ.