Documentation>Sponsorship Rules

Sponsorship Rules

Control exactly which transactions you sponsor — per project, per wallet, per function

Sponsorship Rules let you define fine-grained policies for gasless transactions. Instead of sponsoring every transaction from every user, you choose who can transact, which smart contract functions are allowed, and how much gas you're willing to cover.

Rules are configured per-project from the Dashboard — no code changes required. The gateway reads your rules and enforces them before any transaction reaches the relayer.

Available Rules
All rules are optional. When disabled or left empty, no restriction is applied.
RuleTypeDescription
allowedFunctionsstring[]Whitelist of Move functions (e.g. 0x1::coin::transfer). If set, only these functions are sponsored.
allowedSendersstring[]Only these wallet addresses can submit sponsored transactions.
blockedSendersstring[]Block specific wallets from using your sponsorship.
maxTxsPerWalletPerHournumberMax sponsored transactions per wallet per hour.
maxTxsPerWalletPerDaynumberMax sponsored transactions per wallet per day.
maxGasPerTxnumberMaximum gas units per transaction. Rejects transactions requesting more.
requireCaptchabooleanRequire a CAPTCHA token with each request to prevent bot abuse.
Dashboard Configuration
Configure rules for each project directly from your dashboard — no code changes, no redeployment.

1. Open the Dashboard and select your project.

2. Expand the Sponsorship Rules panel.

3. Toggle rules on and configure thresholds.

4. Click Save Rules. Changes apply immediately to all new transactions.

CAPTCHA Integration (SDK)
When requireCaptcha is enabled, your frontend must provide a CAPTCHA token with each request.
App.tsx
TypeScript
1import { SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
2 
3const submitter = new SmoothSendTransactionSubmitter({
4 apiKey: process.env.NEXT_PUBLIC_SMOOTHSEND_API_KEY!,
5 network: 'mainnet',
6 getCaptchaToken: async () => {
7 // Return a token from your CAPTCHA provider (e.g. Turnstile, reCAPTCHA)
8 return await turnstile.getToken();
9 },
10});

The SDK calls getCaptchaToken() before each request and includes the token in the X-Captcha-Token header. If the rule is enabled and no token is provided, the request is rejected with 403.

Error Codes
When a transaction violates a sponsorship rule, the relayer returns one of these errors.
HTTPCodeMeaning
403SPONSORSHIP_SENDER_BLOCKEDWallet is on the blocked list.
403SPONSORSHIP_SENDER_NOT_ALLOWEDWallet is not on the allowed list.
403SPONSORSHIP_FUNCTION_NOT_ALLOWEDContract function is not in the allowlist.
403SPONSORSHIP_GAS_LIMIT_EXCEEDEDTransaction gas exceeds maxGasPerTx.
403CAPTCHA_REQUIREDCAPTCHA token missing or invalid.
429WALLET_RATE_LIMITEDWallet exceeded hourly or daily transaction cap.
How It Works
1

You configure rules in the Dashboard

Rules are stored per-project in the gateway database.

2

SDK sends a transaction

The request hits the Cloudflare Worker gateway with your API key.

3

Gateway loads your rules

Rules are read from D1 and forwarded to the relayer as a header.

4

Relayer enforces rules

Sender lists, rate limits, function allowlists, and gas caps are checked before the transaction is relayed.