Sponsor Gas
Choose sponsored execution or pay gas from your account.
Namera sponsors gas by default. Set sponsor: false to pay gas from your account
instead. The same execution method supports both options.
Set Up the Transfer
Set up authentication and a session key installed on Base Sepolia with permission to send 0.001 test ETH. Replace the IDs and recipient below with your own.
npm install @namera-ai/sdk viemimport { NameraClient, type ExecuteRequest } from "@namera-ai/sdk";
import { parseEther } from "viem";
const transfer = {
namespace: "eip155",
walletId: "0199dfe1-0000-7000-8000-000000000001",
sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
chainId: "eip155:84532",
calls: [
{
to: "0x2222222222222222222222222222222222222222",
value: parseEther("0.001"),
data: "0x",
},
],
} satisfies ExecuteRequest;Choose one of the following options. Each example submits a new transfer.
Use Sponsored Gas
const namera = new NameraClient({ apiKey: process.env.NAMERA_API_KEY! });
const sponsored = await namera.executions.execute({ ...transfer, sponsor: true });
if (!sponsored.success) throw new Error(sponsored.error.message);
console.log(sponsored.data);{
"namespace": "eip155",
"submissionId": "0199dfe1-0000-7000-8000-000000000003",
"status": "prepared",
"userOperationHash": "0x1111111111111111111111111111111111111111111111111111111111111111"
}Omitting sponsor has the same effect as sponsor: true. Sponsorship is subject
to your workspace's plan and available allowance.
Sponsorship only covers gas
The account still needs the assets being transferred. Session-key permissions and API policies, including gas budgets, still apply.
Pay Gas from Your Account
Set maxGasCostWei on the client and pass sponsor: false to the execution.
Here, 0.0001 ETH is the maximum gas cost you approve for the operation:
const selfFundedClient = new NameraClient({
apiKey: process.env.NAMERA_API_KEY!,
maxGasCostWei: parseEther("0.0001"),
});
const selfFunded = await selfFundedClient.executions.execute({
...transfer,
sponsor: false,
});
if (!selfFunded.success) throw new Error(selfFunded.error.message);
console.log(selfFunded.data);{
"namespace": "eip155",
"submissionId": "0199dfe1-0000-7000-8000-000000000011",
"status": "prepared",
"userOperationHash": "0x2222222222222222222222222222222222222222222222222222222222222222"
}Fund the account with enough ETH on the selected network for the transfer and gas. The ceiling is not a gas price or an extra payment. The SDK rejects a prepared operation that exceeds it; choose a ceiling you are willing to pay.
Self-funded execution does not use sponsored-gas credits, but still counts toward execution usage.
With either option, track the submission to read the final outcome.