Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.startale.com/llms.txt

Use this file to discover all available pages before exploring further.

The sponsored flow is the simplest paymaster mode: your dapp pays gas on the user’s behalf. The same call site works for both managed and self-funded paymasters; the only difference is how the paymaster is funded in the Portal.

End-to-end flow

The SDK handles every step; the only thing you need to plug in is the paymasterId.

Wire the client

import { http, createPublicClient } from "viem"
import { soneiumMinato } from "viem/chains"
import {
  createSCSPaymasterClient,
  createSmartAccountClient,
  toStartaleSmartAccount,
} from "@startale-scs/aa-sdk"

const publicClient = createPublicClient({ chain: soneiumMinato, transport: http() })

const paymasterClient = createSCSPaymasterClient({
  transport: http(process.env.PAYMASTER_URL!),
})

const account = await toStartaleSmartAccount({
  signer,
  chain: soneiumMinato,
  transport: http(),
  index: 0n,
})

const smartAccountClient = createSmartAccountClient({
  account,
  transport: http(process.env.BUNDLER_URL!),
  client: publicClient,
  paymaster: paymasterClient,
  paymasterContext: {
    paymasterId: process.env.PAYMASTER_ID!,
  },
})
SymbolSourceRole
createSCSPaymasterClient@startale-scs/aa-sdkConnects to the SCS Paymaster RPC.
paymasterContext.paymasterIdSCS PortalThe id of the paymaster you provisioned. Both managed and self-funded paymasters return one.

Send a sponsored UserOperation

import { type Address, encodeFunctionData } from "viem"

const callData = encodeFunctionData({
  abi: counterAbi,
  functionName: "count",
})

const hash = await smartAccountClient.sendUserOperation({
  calls: [
    {
      to: counterAddress as Address,
      data: callData,
      value: 0n,
    },
  ],
})

const receipt = await smartAccountClient.waitForUserOperationReceipt({ hash })
If the paymaster declines, the call throws before the UserOperation reaches the bundler. The most common causes are:
ReasonWhat to check
Policy exceededOpen the paymaster’s policies in the SCS Portal and look at the current 7-day window.
Self-funded paymaster emptyTop up the sponsor balance.
Wrong paymasterIdConfirm you copied the id from the Portal exactly, including any prefix.
Wrong networkSoneium Minato uses chain id 1946; mainnet uses 1868. The bundler URL and chain must match.

Choosing between managed and self-funded

Both modes use the same SDK call site. Pick whichever matches how you want to settle gas. See the Portal setup guide for a side-by-side comparison.
ManagedSelf-funded
FundingSCS fronts gas, bills you in fiatYou top up ETH on the paymaster
Best forProduction apps, predictable invoicingHard treasury caps, crypto-native settlement
Call sitepaymasterId: "pm_..."paymasterId: "pm_..."
A managed paymaster does not have unlimited funds. SCS still applies the gas policies you configure in the Portal; tighten them before launch.

Next steps

ERC-20 paymaster

Charge users in ASTR, USDC, or other supported tokens.

Parallel transactions

Run multiple sponsored UserOperations in parallel via nonce lanes.

Smart sessions

Combine sponsorship with scoped session keys for the smoothest UX.

Portal setup

Tune your gas policies and rotate API keys.