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.

This page covers the framework-agnostic setup: installing the SDK, configuring environment variables, and choosing a signer. The SDK does not assume Next.js, React, wagmi, or any particular auth provider; pick whichever signer fits your project.
The SDK source is at StartaleGroup/scs-aa-sdk and the published package is @startale-scs/aa-sdk.

Install the SDK

The minimum runtime dependencies are the SDK itself plus viem:
npm install @startale-scs/aa-sdk viem
Add the optional packages below only if your app uses them. None of them are required by @startale-scs/aa-sdk:
PackageAdd it whenWhy
@rhinestone/module-sdkYou install or build custom ERC-7579 modules.Provides typed helpers for module init data.
wagmi + @tanstack/react-queryYou already use wagmi for connection state.Lets you reuse wagmi’s WalletClient as the signer.
@dynamic-labs/sdk-react-coreYou authenticate with Dynamic.Provides the wallet that exposes the signer.
@privy-io/react-authYou authenticate with Privy.Provides the embedded wallet that exposes the signer.
ethersYou already pass ethers wallets around your codebase.The SDK accepts EthersWallet directly as a signer.

Configure runtime credentials

The SDK takes the bundler URL, paymaster URL, and paymasterId at call time. Where you store them is up to your framework. A plain .env file works for any Node-based runtime:
.env
BUNDLER_URL="https://soneium-minato.bundler.scs.startale.com?apikey=YOUR_API_KEY"
PAYMASTER_URL="https://paymaster.scs.startale.com/v1?apikey=YOUR_API_KEY"
PAYMASTER_ID="pm_..."
Keep your API key on the server when possible. If you must expose it to the browser (for example, in a single-page app without a backend), prefer per-domain SCS API keys with a tight gas policy so a leak has bounded blast radius. The SDK does not require any specific environment variable prefix; framework-specific prefixes like NEXT_PUBLIC_* or VITE_* are not part of the SDK’s contract.

Pick a signer

toStartaleSmartAccount accepts any of the signer types below. The choice is yours and depends on how your app already manages keys.
import { toStartaleSmartAccount } from "@startale-scs/aa-sdk"

const account = await toStartaleSmartAccount({
  signer,                 // pick one of the four shapes below
  chain,
  transport: http(),
  index: 0n,
})
A LocalAccount holds a private key directly. Best for backend services, scheduled jobs, or developer scripts.
import { privateKeyToAccount } from "viem/accounts"

const signer = privateKeyToAccount(process.env.OWNER_PRIVATE_KEY as `0x${string}`)
SymbolSourceRole
privateKeyToAccountviem/accountsBuilds a LocalAccount from a hex private key.

Optional: wagmi alongside the SDK

If your app already uses wagmi for connection state, you can keep wagmi for connection management and feed its WalletClient into toStartaleSmartAccount as a signer. wagmi is not required by the SDK.
import { useWalletClient } from "wagmi"
import { toStartaleSmartAccount } from "@startale-scs/aa-sdk"
import { http } from "viem"
import { soneiumMinato } from "viem/chains"

const { data: walletClient } = useWalletClient()

const account = await toStartaleSmartAccount({
  signer: walletClient!, // viem WalletClient from wagmi
  chain: soneiumMinato,
  transport: http(),
  index: 0n,
})
SymbolSourceRole
useWalletClientwagmiHook that returns a viem WalletClient for the currently connected wallet.
toStartaleSmartAccount@startale-scs/aa-sdkBuilds the smart account from any supported signer.
httpviemHTTP transport used by the smart account for RPC reads.

Sanity check

Before moving on, confirm you can read your smart account address on Soneium Minato:
import { http, createPublicClient } from "viem"
import { soneiumMinato } from "viem/chains"
import { toStartaleSmartAccount } from "@startale-scs/aa-sdk"

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

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

console.log("counterfactual address:", account.address)
console.log("is delegated EIP-7702 account:", await account.isDelegated())
If the address prints, the SDK can talk to Soneium and you are ready for Smart account setup.

Next steps

Smart account setup

Wrap the account in a React provider and initialise sponsored and ERC-20 clients.

Contract interactions

Send single and batched calls through the smart account.

Auth providers

Plug Dynamic or Privy into the signer slot for social login.

Portal setup

If you have not provisioned a paymaster yet, do that first.