Files
nofx/.gitignore
Lance 2f483633ed feat(claw402): preflight USDC balance before AI calls (#1479)
* chore: ignore nofx-server build artifact

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(claw402): preflight USDC balance before AI calls

Short-circuit claw402 Call/CallWithRequestFull when the wallet balance
can't cover the estimated cost of the call, surfacing ErrInsufficientFunds
instead of letting x402 fail mid-flight after the sign step.

- wallet: cached balance lookup (30s TTL, per-address mutex) to avoid
  hammering the Base RPC; separate error-returning and display-only APIs
  so callers can distinguish zero balance from an unreachable RPC.
- claw402: 1.5× safety multiplier on the flat per-call estimate, 4.0×
  for reasoner models whose chain-of-thought cost can blow past the
  flat rate. Fail-open on RPC errors — x402 still gates actually-empty
  wallets, and we prefer availability over extra strictness.
- shortAddr redacts the wallet in error strings to avoid leaking the
  full address into telemetry bundles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 21:17:45 +08:00

132 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# IDE 配置文件
.idea/
*.iml
*.xml
# AI 工具
.claude/
CLAUDE.md
# 编译产物
nofx-auto
*.exe
nofx
nofx_test
# Go 相关
*.test
*.out
.gocache/
# 操作系统
.DS_Store
Thumbs.db
# 临时文件
*.log
*.tmp
*.bak
*.backup
.cache/
.gh-config/
# 环境变量
.env
config.json
configbak.json
# 数据目录(数据库、日志等)
data/
*.db
# 决策日志
decision_logs/
nofx_test
# Node.js
web/node_modules/
node_modules/
web/dist/
web/.vite/
# ESLint 临时报告文件(调试时生成,不纳入版本控制)
eslint-*.json
# VS code
.vscode
# 密钥和敏感文件
# 注意crypto目录包含加密服务代码应该被提交
# 只忽略密钥文件本身
secrets/
*.key
*.pem
*.p12
*.pfx
rsa_key*
# 加密相关
DATA_ENCRYPTION_KEY=*
*.enc
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Python 虚拟环境
.venv/
venv/
ENV/
env/
.env/
# uv
.uv/
uv.lock
# Pytest
.pytest_cache/
.coverage
htmlcov/
*.cover
.hypothesis/
# Jupyter Notebook
.ipynb_checkpoints
*.ipynb
# pyenv
.python-version
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
PR_DESCRIPTION.md
# Go build artifacts
/nofx-server