Skip to content

feat: Sepolia card account end-to-end demo scripts (No Merge)#31

Open
livingrockrises wants to merge 5 commits into
mainfrom
feat/sepolia-card-account-scripts
Open

feat: Sepolia card account end-to-end demo scripts (No Merge)#31
livingrockrises wants to merge 5 commits into
mainfrom
feat/sepolia-card-account-scripts

Conversation

@livingrockrises

@livingrockrises livingrockrises commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a full suite of Sepolia demo scripts covering the card account lifecycle using Startale smart accounts (ERC-7579) and the Rhinestone SDK.

All sepolia scripts run without a paymaster — the counterfactual smart account must be pre-funded with Sepolia ETH before running.

Scripts (run in order)

Scripts run without a paymaster — the counterfactual smart account must be pre-funded with Sepolia ETH before running.

Scripts (run in order)

Script Account (index) What it does
demo_basic_userop_without_pm.ts index: 0 Deploys the ERC-7579 card controller smart account
demo_install_controller_validator.ts index: 0 Installs ControllerValidator module on the card controller SA
demo_make_card_account.ts index: 1 Calls CardAccountFactory.makeNewCardAccount via UserOp to deploy a card account clone

Scripts (run in order)

Script Account (index) What it does
demo_basic_userop_without_pm.ts index: 0 Deploys the ERC-7579 card controller smart account
demo_install_controller_validator.ts index: 0 Installs ControllerValidator module on the card controller SA
demo_make_card_account.ts index: 1 Calls CardAccountFactory.makeNewCardAccount via UserOp to deploy a card account clone
demo_basic_userop_without_pm.ts index: 0 Deploys the ERC-7579 card controller smart account
demo_install_controller_validator.ts index: 0 Installs ControllerValidator module on the card controller SA
demo_make_card_account.ts index: 1 Calls CardAccountFactory.makeNewCardAccount via UserOp to deploy a card account clone
demo_install_controller_validator.ts index: 0 Installs ControllerValidator module on the card controller SA
demo_make_card_account.ts index: 1 Calls CardAccountFactory.makeNewCardAccount via UserOp to deploy a card account clone
demo_deploy_nexus_with_controller_validator.ts Alternative: deploy a Rhinestone Nexus account with ControllerValidator as the sole validator (useful for testing a new card account implementation)
demo_card_account_usdc_approval.ts index: 1 Grants unlimited USDSC approval from the user's SA to the card account
demo_card_account_usdc_approval.ts index: 1 Grants unlimited USDSC approval from the user's SA to the card account
demo_deposit_from_user_account.ts index: 0 Card controller calls depositFromUserAccount on the card account — pulls USDSC from user SA into card account (default: 500 USDSC)
demo_settle_card_balance.ts index: 0 Card controller calls settleCardBalance — sends USDSC from card account to Startale treasury

Key addresses (Sepolia)

  • USDSC: 0x7E426d026f604d1c47b50059752122d8ab1E2C28
  • Startale settle target: 0x22C9Baf7A0db2190AD74fCE24faBD68Ec6F97DAc

Required env vars

SEPOLIA_BUNDLER_URL=
OWNER_PRIVATE_KEY=
CONTROLLER_VALIDATOR_ADDRESS=
CARD_ACCOUNT_FACTORY_ADDRESS=
CARD_ACCOUNT_ADDRESS= # set after running demo_make_card_account

|--------|----------------|--------------|
| demo_make_card_account.ts | index: 1 | Calls CardAccountFactory.makeNewCardAccount via UserOp to deploy a card account clone |

| demo_deploy_nexus_with_controller_validator.ts | — | Alternative: deploy a Rhinestone Nexus account with ControllerValidator as the sole validator (useful for testing a new card account implementation) |

| demo_card_account_usdc_approval.ts | index: 1 | Grants unlimited USDSC approval from the user's SA to the card account |

| demo_deposit_from_user_account.ts | index: 0 | Card controller calls depositFromUserAccount on the card account — pulls USDSC from user SA into card account (default: 500 USDSC) |

| demo_settle_card_balance.ts | index: 0 | Card controller calls settleCardBalance — sends USDSC from card account to Startale treasury (default: 10 USDSC) |

Key addresses (Sepolia)

  • USDSC: 0x7E426d026f604d1c47b50059752122d8ab1E2C28 (named USDR on Sepolia)
  • Startale settle target: 0x22C9Baf7A0db2190AD74fCE24faBD68Ec6F97DAc

Required env vars

SEPOLIA_BUNDLER_URL=
OWNER_PRIVATE_KEY=
CONTROLLER_VALIDATOR_ADDRESS=
CARD_ACCOUNT_FACTORY_ADDRESS=
CARD_ACCOUNT_ADDRESS= # set after running demo_make_card_account
RHINESTONE_API_KEY= # only needed for demo_deploy_nexus_with_controller_validator

Test plan

  • demo_make_card_account — card account deployed at 0xBf0136996da3165d252a60471e7b6CbDB9153928
  • demo_card_account_usdc_approval — unlimited USDSC approval set (tx 0xd4256d...)
  • demo_deposit_from_user_account — 500 USDSC deposited into card account (tx 0x976f9a...)
  • demo_settle_card_balance — 10 USDSC settled to Startale treasury (tx 0x33703e...)

@livingrockrises

Copy link
Copy Markdown
Collaborator Author
  • Adds two end-to-end card account demo flows on Sepolia, organised under
    src/sepolia/startale-card-controller/ and src/sepolia/rhinestone-card-controller/
  • Flow 1 (Startale): Startale AA (index 0) as card controller, Startale bundler —
    covers install ControllerValidator, activate card account (makeNewCardAccount + USDSC
    approve in one UserOp), depositFromUserAccount, settleCardBalance
  • Flow 2 (Rhinestone): Rhinestone Nexus with ControllerValidator module as card
    controller, Pimlico bundler — covers deploy Nexus, smoke-test UserOp, activate card
    account, depositFromUserAccount, settleCardBalance via account.sendUserOperation
  • Adds src/sepolia/README.md with run order, explanation of each script, and env var
    reference table
  • Adds NEXUS_CARD_ACCOUNT_ADDRESS to .env_template

Key implementation notes

  • Rhinestone deploy uses bundler.type: 'custom' pointing to Pimlico to force
    deployWithBundler path (avoids Rhinestone orchestrator which requires a Rhinestone
    API key); the sepoliaWithMinFees chain override sets maxPriorityFeePerGas: 2 gwei
    to meet Pimlico's minimum
  • Rhinestone sendUserOperation scripts use bundler.type: 'pimlico' so the SDK calls
    pimlico_getUserOperationGasPrice for correct fee estimation (the chain override does
    not intercept bundler-level fee estimation)
  • Card account activation for Flow 2 uses Startale AA index 3 (fresh account) to avoid
    the factory's one-card-account-per-user restriction

Test runs (Sepolia)

  • Nexus deployed at 0xB892b0f7419Ed7eCA94f02AaAA241D85D747f84E
  • Flow 2 deposit: confirmed via UserOp
  • Flow 2 settle: confirmed via UserOp

@livingrockrises livingrockrises changed the title feat: Sepolia card account end-to-end demo scripts feat: Sepolia card account end-to-end demo scripts (No Merge) Jun 22, 2026
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