How to Sponsor a User Operation
To sponsor a user operation, simply specify isSponsored: true
when submitting the user operation. By sponsoring the operation, your organization's gas tank will be used to pay for the gas fees, instead of the owner's individual gas tank.
Example: Submitting a Sponsored User Operation
Using the API
curl -X POST -H "Content-Type: application/json" \
-H "x-app-id: $YOUR_APP_ID" \
-H "x-signature: $CALCULATED_SIGNATURE" \
-H "x-timestamp: $TIMESTAMP" \
-d '{
"signature": "0x.....",
"userOpId": "67b1fc9a442f26832dadd881",
"hash": "0x.....",
"isSponsored": true
}' {{BASE_URL}}/api/v1/userOp/submit
Using the SDK (TypeScript)
await xellar.accountAbstraction.submitUserOp({
userOpId,
hash,
signature: ownerSignature.signature,
isSponsored: true,
});
Note:
- When
isSponsored
is set totrue
, the organization gas tank will be used for the operation's gas fees. - If
isSponsored
is omitted or set tofalse
, the owner's individual gas tank will be used instead.