Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7acd426
feat(gas): implement wallet auth generator and config validation
Hebx Nov 17, 2025
763f786
feat(gas): implement x402 gas abstraction service core
Hebx Nov 17, 2025
e381d53
feat(gas): implement telemetry and API routes
Hebx Nov 17, 2025
2c57ca7
feat(gas): add top-up helper and blockhash utilities
Hebx Nov 17, 2025
b840a37
feat(gas): add client feature flags and utilities
Hebx Nov 17, 2025
f0e4c7b
feat(gas): implement gas abstraction context
Hebx Nov 17, 2025
2b447da
feat(gas): implement developer API for agents
Hebx Nov 17, 2025
26e1834
feat(gas): implement gas abstraction screen UI
Hebx Nov 17, 2025
9cf5ba3
feat(gas): implement SendModal gasless transactions and ChatManager i…
Hebx Nov 18, 2025
ff683ed
feat(gas): implement gasless mode for AI tool transactions
Hebx Nov 18, 2025
7577c02
fix(server): resolve variable name conflict preventing server startup
Hebx Nov 18, 2025
2f0aecf
feat(gas): add client-side telemetry logging
Hebx Nov 18, 2025
8ef42a9
feat(gas): implement error handling and graceful degradation
Hebx Nov 18, 2025
d8abaf8
feat(gas): add enhanced error handling UI in SendModal
Hebx Nov 18, 2025
4f8274c
feat(gas): update ChatManager for AI tool transactions
Hebx Nov 18, 2025
b7e7cc7
test(gas): add unit tests for WalletAuthGenerator
Hebx Nov 18, 2025
86b7df5
test(gas): add unit tests for X402GasAbstractionService
Hebx Nov 18, 2025
6a5f8cf
test(gas): add unit tests for GasAbstractionContext
Hebx Nov 18, 2025
08025fd
test(gas): add integration tests for balance check flow
Hebx Nov 18, 2025
ba7a990
test(gas): add integration tests for top-up flow
Hebx Nov 18, 2025
9d88abc
test(gas): add integration tests for sponsorship flow
Hebx Nov 18, 2025
ac54460
test(gas): add integration tests for blockhash expiry handling
Hebx Nov 18, 2025
4a2c83e
test(gas): add end-to-end tests for gas abstraction
Hebx Nov 18, 2025
899e080
fix(gas): improve error handling and test coverage
Hebx Nov 18, 2025
8427686
docs(gas): add API documentation, user guide, and deployment guide
Hebx Nov 18, 2025
02007e9
feat(gas): add gas abstraction tests to CI and changeset
Hebx Nov 18, 2025
0ceb494
fix(gas): fix service instantiation and NaN error handling
Hebx Nov 18, 2025
da6423a
fix(gas): improve error handling and validation
Hebx Nov 18, 2025
431672b
fix(ci): resolve merge conflicts in test workflow YAML
Hebx Nov 18, 2025
bb1c41f
fix(gas): fix top-up flow and improve gas abstraction UX
Hebx Nov 18, 2025
1adeb1b
chore(git): add .env.bak and .test-secrets/ to gitignore
Hebx Nov 20, 2025
a36236c
docs(gas): add error logs for x402 gateway debugging
Hebx Nov 20, 2025
9b78a73
chore(test): add .env.test.example template for test secrets
Hebx Nov 20, 2025
9597601
test(gas): add helper scripts for Grid session extraction and email c…
Hebx Nov 20, 2025
452d010
test(gas): add E2E top-up test scripts with Alchemy RPC fallback
Hebx Nov 20, 2025
b6cb4ce
fix(gas): improve transaction confirmation and raw bytes retrieval fo…
Hebx Nov 20, 2025
fbb27bc
fix(gas): update top-up endpoint to accept base64 x402 payment payload
Hebx Nov 20, 2025
309088a
test(gas): fix integration tests with Alchemy RPC and Grid PDA support
Hebx Nov 20, 2025
51f58c0
test(gas): fix E2E complete flow tests with RPC and error handling
Hebx Nov 20, 2025
082c3a6
refactor(gas): improve wallet authentication generator error handling
Hebx Nov 20, 2025
a488b9d
docs(gas): add comment for x402 gateway maintainer about 402 errors
Hebx Nov 20, 2025
33ea981
docs(cursor): add logs rule for error tracking
Hebx Nov 20, 2025
c7ea8eb
fix(gas): construct x402 payment payload in UI and use correct scheme
Hebx Nov 20, 2025
9dddf2c
docs(gas): update logs with latest test results - gateway still retur…
Hebx Nov 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/plenty-states-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@darkresearch/mallory-client": minor
"@darkresearch/mallory-server": minor
---

Add x402 gas abstraction feature with balance caching, top-up, and transaction sponsorship

- Implement wallet authentication generator for gateway authentication
- Add x402 gas abstraction service with balance query, top-up, and transaction sponsorship
- Add client-side gas abstraction context with 10-second balance caching
- Implement gas abstraction screen UI with balance display, top-up flow, and transaction history
- Add developer API for agents (GasSponsorClient)
- Integrate gasless mode for AI tool transactions and SendModal
- Add comprehensive test coverage (unit, integration, and E2E tests)
- Add telemetry logging for gas abstraction operations
- Support graceful degradation with SOL fallback
7 changes: 7 additions & 0 deletions .cursor/rules/logs.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
alwaysApply: true
---

Log every error we encounter in a file called logs.md and add a timestamp to the error.
whenever we encounter an error, you source of truth is the logs.md file.
to check if we already encountered the same error, so we never loop again in the same cycle of errors.
89 changes: 89 additions & 0 deletions .cursor/rules/x402gasabstraction.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
alwaysApply: true
---
# =========================================
# CURSOR GLOBAL RULES — Mallory Gas Abstraction Development
# =========================================

# SOURCE OF TRUTH
1. The following documents are the SINGLE authoritative specification:
- .kiro/specs/x402_gas_abstraction/requirements.md
- .kiro/specs/x402_gas_abstraction/design.md
- .kiro/specs/x402_gas_abstraction/tasks.md
Cursor must ALWAYS read these files before implementing anything.

2. No deviation is allowed:
- Do not invent features.
- Do not simplify flows.
- Do not remove constraints, validations, retries, or error-handling steps
specified in requirements.md or design.md or tasks.md.
- If something is unclear, prefer the spec over assumptions.

# WORKFLOW RULES
3. Cursor must work IN SMALL TASK GROUPS (1–3 sub-tasks at a time).
4. For each cycle:
- Identify the next tasks marked `[ ]` in tasks.md.
- Present a short plan for those tasks.
- Ask for approval before modifying code.
- After approval, implement changes with minimal diffs.
- Run typecheck, lint, tests.
- Propose a git commit.
- Update tasks.md by checking off completed items.

5. ALWAYS maintain a buildable repo:
- Every commit must compile.
- Every commit must pass tests.
- Never leave failing or partial work uncommitted.

# CODE QUALITY RULES
6. Follow existing Mallory architecture and conventions:
- Use existing Solana helpers.
- Use existing Grid context helpers.
- Respect file naming.
- Respect folder structure.

7. Keep code DRY and modular:
- Don’t duplicate logic that already exists elsewhere.
- Implement new modules (auth generator, abstraction service, context, screens)
only in designated directories.

8. All TypeScript code must be fully typed.
9. NEVER rewrite entire files if diff-based patching is possible.

# FEATURE GUARANTEES
10. Gas abstraction MUST:
- Support balance caching (10 sec)
- Support top-up via x402 payload
- Support sponsored tx flow
- Respect SOL fallback behavior
- Support telemetry logging
- Support error handling for:
- 402 insufficient balance
- 400 old blockhash
- 400 prohibited instruction
- 401 stale auth retry
- 503 temporary outage
- Integrate with agents (developer API)
- Provide UI screens
- Support low-balance banners
- Be disabled via feature flag

# TESTING RULES
11. Write tests for modules marked with `*` in tasks.md.
12. Do not skip tests unless the spec explicitly allows it.
13. When updating tasks.md, keep starred tasks clearly marked.

# COMMITS
14. Commit messages MUST be conventional:
- feat(gas): ...
- fix(gas): ...
- refactor(gas): ...
- chore(gas): ...
- docs(gas): ...

15. Each commit must:
- Contain 1–3 completed tasks.
- Be atomic and revertible.
- Pass tests and linting.

# END OF RULES
32 changes: 32 additions & 0 deletions .env.test.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Test Environment Variables Example
# Copy this file to .env.test and fill in your actual values
# DO NOT commit .env.test to version control

# Test Wallet Address (Grid wallet with USDC for testing)
TEST_WALLET_ADDRESS=YOUR_WALLET_ADDRESS_HERE

# Grid Session Account (JSON string)
# Get this from browser localStorage using get-grid-session.js
# Format: {"address":"...","policies":{...},"grid_user_id":"...","authentication":[...]}
TEST_GRID_ACCOUNT=

# Grid Session Secrets (JSON array string)
# Get this from browser localStorage using get-grid-session.js
# Format: [{"publicKey":"...","privateKey":"...","provider":"...","tag":"..."},...]
TEST_GRID_SESSION_SECRETS=

# Test Supabase Credentials (for authentication)
TEST_SUPABASE_EMAIL=your-test-email@example.com
TEST_SUPABASE_PASSWORD=your-test-password

# Backend URL for testing
TEST_BACKEND_URL=http://localhost:3001

# Solana RPC URL (optional, will use public endpoints if not set)
SOLANA_RPC_URL=

# Alchemy RPC URLs (optional, used as fallbacks)
# Get these from your Alchemy dashboard - these are private API keys
SOLANA_RPC_ALCHEMY_1=
SOLANA_RPC_ALCHEMY_2=
SOLANA_RPC_ALCHEMY_3=
Loading