For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prepared flows

Methods named prepare* return a serialized prepared flow — an ordered list of unsigned transactions for the user's wallet to sign.

Terminology

In Celina, a prepared flow is not a workflow engine. It is the object returned by prepare*: primarily steps, an ordered list of unsigned transactions (PreparedTx). The same object is what you:

  • pass to wagmi / viem one step at a time, or

  • submit via createAAClient / sendPreparedFlow as sponsored UserOp(s)

Supported prepare methods

Method
Service
Typical steps

prepareSend

transaction

1 (ERC-20 transfer; CELO uses GoldToken)

prepareFx

mentoFx

1–2 (optional approve + swap)

prepareSwap

uniswap

1–3 (optional ERC-20 + Permit2 approve + swap)

prepareSupply

aave

1–2 (optional approve + supply)

prepareWithdraw

aave

1 (withdraw)

prepareClaimUbi

gooddollar

1 (UBI claim)

prepareReserveSwap

gooddollar

1–2 (optional ERC-20 approve + MentoBroker swapIn)

prepareFunction

contract

1 (caller-supplied ABI write)

SerializedPreparedFlow shape

{
  preparedFlow: true,
  steps: PreparedTx[],
  summary: string,       // human-readable label for UI
  from: `0x${string}`,
  chainId: 42220,        // celo.id / CHAIN.id
}

The preparedFlow: true discriminator makes it easy to detect prepared flows in chat APIs or JSON responses.

PreparedTx fields

Field
Type
Description

kind

"native" | "erc20" | "contract"

Transaction category

to

`0x${string}`

Target contract or recipient

data

`0x${string}` (optional)

Calldata for contract calls

value

string (optional)

Wei amount as decimal string (JSON-safe)

description

string

Human-readable step label for UI

kind values

  • native — Native-value transfer (to is recipient, value is wei); rare in Celina prepare flows

  • erc20 — ERC-20 call (to is token contract, data is encoded function). CELO sends use GoldToken (0x471E…) via token duality.

  • contract — Generic contract call (Aave pool, Mento router, Universal Router, etc.)

Multi-step flows

When an ERC-20 approval is required before a swap or supply, the SDK returns multiple steps in order:

Sign and confirm each step sequentially. Do not skip or reorder steps.

Sign-time simulation

Call simulatePreparedStep from @andrewkimjoseph/celina-sdk/simulation per step, immediately before sendTransactionAsync — after any prior step is mined. Simulation uses current chain state; simulating step 2 before step 1 confirms falsely fails with insufficient allowance.

Local stdio MCP execute_* tools use the same helper internally before signing with CELO_PRIVATE_KEY.

See Prepared-step simulation.

Those MCP tools sign and broadcast with CELO_PRIVATE_KEY instead of returning unsigned flows to the user.

JSON serialization

value fields are decimal strings (not BigInt) so flows serialize cleanly over JSON APIs:

When calling wagmi, convert back to BigInt:

Celina data suffix

Prepared calldata is tagged with Celina ERC-8021 Schema 0 attribution (appendCelinaCalldataTag) for on-chain identification — sends, Mento FX, Uniswap, Aave, and GoodDollar. You do not need to modify data before passing it to wagmi or to createAAClient().sendPreparedFlow — the same tagged steps work for EOA signing and sponsored UserOps.

createAAClient also accepts optional attributionTags. When set, sendPreparedFlow applies the same ERC-8021 tagger to each step’s data (useful for hand-built steps). When omitted, step data is passed through unchanged. Prefer one consistent tag list per send path — on createCelinaClient for prepare*, or on createAAClient for hand-built flows. Full wire format and check vs verify: On-chain attribution.

See Configuration for the full options table.

Last updated

Was this helpful?