Ika Accountsdocs

Transactions

#execute

Runs a Sui transaction from the user's account. Gas is sponsored.

ts
await accounts.execute(tx);            // a Transaction
await accounts.execute(step);          // (tx, { address }) => void
await accounts.execute([step1, step2]); // steps compose into one transaction

It resolves with { digest } once the transaction has executed, and throws IkaAccountsError('transaction_failed') if it failed on-chain.

Rules for sponsored transactions

  • Don't spend from the gas coin. Use coinWithBalance({ …, useGasCoin: false }) or coins from the user's account.
  • The transaction must fit the sponsor's gas budget, and a user can have up to 3 transactions in flight.
  • Transactions are checked by simulation before the user is asked to approve.

#What the user approves

The wallet shows a plain-text message, generated by the key frame from the exact transaction:

  • your app's name and origin,
  • the Move calls it makes, with full package IDs,
  • every address it sends to that isn't the user's own,
  • balance changes from a simulation, with full coin types for anything that isn't SUI or USDC,
  • the transaction digest and an expiry.

The signature is verified on-chain by the Registry before Ika signs. An approval can't be reused for another transaction, and it can't be forged by our backend or yours.

#perform

perform makes sure the account holds what a transaction needs, bridges the difference from any chain if it doesn't, then runs it.

ts
await accounts.perform({
  requires: [{ coinType: USDC, amount: 50_000_000n }], // 50 USDC
  fundWith: 'auto',            // or a specific 1Click asset id
  transaction: [buy, stake],   // one Sui transaction
  onStatus: (s) => setStage(s.stage),
});

Stages: checking-balance → quoting → awaiting-deposit → bridging → swapping (only for tokens bridging can't deliver) → executing → done.

With fundWith: 'auto', the SDK picks the user's largest balance that covers the shortfall with about 5% headroom, asks their wallet for one transfer, waits for the funds on Sui, then executes. If the account already holds enough, it goes straight to execution.

Tokens that NEAR Intents can't deliver directly (a launchpad token, for example) are reached by bridging USDC and swapping on Sui through the Aftermath router.

#Sessions

A session lets transactions within a declared scope run without a wallet prompt. The user sees the scope in the approval that grants it, and the limits are enforced in two places: the key frame only signs what fits, and the Registry contract enforces the session key, its expiry and its transaction count on-chain.

ts
createIkaAccounts({
  // …
  session: {
    minutes: 60,                              // up to 1440
    maxTransactions: 50,                      // up to 1000
    packages: [YOUR_PACKAGE_ID],              // contracts your transactions call
    spend: { '0x2::sui::SUI': '2000000000' }, // most that may leave the account, per coin
    allowPublish: false,                      // e.g. true for a launchpad publishing coins
    appTokens: false,                         // let uncapped tokens flow into your contracts
  },
});

A transaction runs without a prompt only if all of these hold:

  • it only calls your packages and a short list of coin plumbing in the Sui framework,
  • it sends nothing to any address other than the user's own,
  • no object other than coins leaves the account,
  • the spend on every capped coin stays within the cap for the whole session,
  • coins without a cap only go into your contracts, and only with appTokens: true (SUI and USDC always need a cap),
  • it doesn't publish or upgrade packages, unless allowPublish is set,
  • the session hasn't expired or run out of transactions.

Anything else falls back to a normal wallet approval. disconnect() ends the session on-chain.

#Cost and timing

Measured on mainnet, at a SUI price of $1.18:

Cost to youTime
A user's first transaction (also creates the dWallet)about $0.14about 10 s
Every transaction afterabout $0.07about 8.5 s

Plus the time the user takes to approve, and 0.3% on top of the cost. Most of the cost is Sui gas for the Ika request, not Ika fees.