Skip to content

feat: USDC credit purchasing#91

Merged
solimander merged 6 commits intomasterfrom
feat/usdc-billing-and-agentkit-funding
Mar 12, 2026
Merged

feat: USDC credit purchasing#91
solimander merged 6 commits intomasterfrom
feat/usdc-billing-and-agentkit-funding

Conversation

@mmurrs
Copy link
Copy Markdown
Contributor

@mmurrs mmurrs commented Mar 6, 2026

What this is

A stub demonstrating the proposed USDC credit purchasing flow in the ecloud CLI. Not a final implementation — makes the proposed UX concrete so the team can evaluate it. The billing API backend for USDC credit purchases already exists (PR #22 on ecloud-billing-api).

Problem

ecloud billing only routes through Stripe checkout (credit card). Developers who want to purchase credits with USDC have no CLI path — they'd need to know the contract address independently.

What changed

Command Change What it does
ecloud billing top-up New Executes USDCCredits.purchaseCreditsFor(amount, account) on-chain. Prompts for USDC amount → approves USDC spend → calls purchaseCreditsFor → polls billing API for credit confirmation. Stubbed until contract address is deployed.
ecloud billing subscribe Modified Prompts "Credit card or Purchase credits with USDC?" before Stripe checkout. CC path unchanged. USDC delegates to top-up.
ecloud billing status Modified Adds "Need more credits? Run ecloud billing top-up" when credits < $10 or subscription inactive.
ecloud billing cancel Unchanged

How top-up works

1. Show current credit balance (from billing API)
2. Read wallet USDC balance on Base
3. If no USDC → "Send USDC to <wallet> on Base, then re-run"
4. Prompt: "How much USDC to spend on credits?"
5. USDC.approve(USDCCredits, amount)
6. USDCCredits.purchaseCreditsFor(amount, account)
7. Wait for tx confirmation
8. Poll billing API until credits appear

The user's wallet is already loaded (private key is a prerequisite for all billing commands), so the CLI forms and submits the transaction directly.

Demo

npx tsx demo/billing-flow.ts

What's stubbed

No billing API changes. No new dependencies (viem already in the project).

Related

@seanmcgary seanmcgary changed the title feat: USDC credit purchasing — stub + demo feat: USDC credit purchasing Mar 11, 2026
mmurrs and others added 4 commits March 11, 2026 23:08
Add USDC as a payment option alongside credit cards. Today the billing
flow only routes through Stripe checkout — developers who want to pay
with USDC have no CLI path. This surfaces the on-chain credit purchase
flow that the billing API (PR #22) enables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CLI calls approve + purchaseCreditsFor(amount, account) directly
using the user's loaded wallet. Stubbed until the contract address is
deployed, but the full flow is wired: prompt amount → approve USDC →
submit purchaseCreditsFor → poll billing API for credit confirmation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@solimander solimander force-pushed the feat/usdc-billing-and-agentkit-funding branch from 4f68800 to 9deaae7 Compare March 12, 2026 05:09
@solimander solimander merged commit c5a70c8 into master Mar 12, 2026
3 checks passed
@solimander solimander deleted the feat/usdc-billing-and-agentkit-funding branch March 12, 2026 16:31
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.

3 participants