Skip to content

Test the full app and backend user flow on a fork and on Base Sepolia - #39

Merged
ManulParihar merged 4 commits into
mainfrom
test/user-flow
Sep 19, 2026
Merged

ManulParihar merged 4 commits into
mainfrom
test/user-flow

Conversation

@ManulParihar

Copy link
Copy Markdown
Member

Summary

Adds a consumer test that runs the whole user flow the way the app and backend would, from signup to an eSIM identifier onchain. The same steps run on a local Base Sepolia fork and on the live network with Pimlico.

Steps covered

Step Who What is checked
0 backend works out the device wallet address at signup
1 app the passkey resolves to the same address
2 app deploys the device wallet, gas sponsored
3 backend registers it with postCreateAccount from its own records
4 app deployAndBindESIMWallet with no fund access
5 backend verifies the eSIM wallet belongs to the user (receipt, registry, owner, predicted address)
6 app buys with buyDataBundleWithTransfer; exact amount moved, no pull access
7 backend finds the payment by its reference
8 backend assigns the eSIM identifier, and a second assignment is refused
top-up app another purchase on the same wallet
other asset app a purchase in a second accepted asset (Circle USDC on live)
external wallet backend recordSettledPurchase with ExternalWallet; no tokens move
card backend recordSettledPurchase with Fiat and USD; no tokens move
refusals backend wrong settlement, reused reference, price over cap, unknown asset

Each step logs its user operation and transaction hashes. On live, the hashes are Basescan links.

Layout

  • tests/consumer/flows/userFlow.ts: the steps, written once
  • tests/consumer/userFlow.fork.test.ts: fork setup; the backend is a new private key made admin
  • tests/consumer/userFlow.live.test.ts: live setup; the real admin key, Pimlico, and 3 confirmations after each write

Running

npm run test:consumer:fork -- --reporter=verbose
npm run test:consumer:live -- --reporter=verbose   # needs .env

A live run spends 2 USDCt and 1 USDC from the admin, plus gas for 5 admin transactions.

Results

  • Fork: 14/14
  • Live on Base Sepolia: 14/14
  • Consumer fork tier: 30/30

The steps live in one shared definition so the fork and live runs cannot drift apart.
The backend records them with recordSettledPurchase. The steps check the event, the history entry and the spent reference, that no tokens moved, and that the contract refuses the cases it should.
@ManulParihar
ManulParihar merged commit e313210 into main Sep 19, 2026
@ManulParihar
ManulParihar deleted the test/user-flow branch September 19, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant