Skip to content

fix(deposit): pre-flight validation, gas reserve, session guard, actionable errors#99

Merged
JamesLawton merged 4 commits intomainfrom
fix/deposit-flow-ux
Apr 27, 2026
Merged

fix(deposit): pre-flight validation, gas reserve, session guard, actionable errors#99
JamesLawton merged 4 commits intomainfrom
fix/deposit-flow-ux

Conversation

@JamesLawton
Copy link
Copy Markdown
Collaborator

Summary

  • Polygon-only enforcement: deposit now rejects non-Polygon chains immediately with a clear message instead of silently returning empty results
  • Pre-flight balance check: before encoding transactions, the CLI fetches the wallet's USDC and native POL balance on-chain; fails fast with a helpful message if balance is insufficient
  • Auto gas reserve: when the wallet has 0 POL (USDC paymaster path), the CLI automatically reduces the deposit amount by 0.05 USDC and prints a note — user no longer has to manually calculate the reserve
  • Session replacement guard: wallet create now blocks if a session already exists, with a message explaining the orphaning risk; --force bypasses it
  • Actionable relay errors: "Identity signers not found", "Request aborted", and code 1005 are now mapped to the specific fix command (fund / recreate session with --usdc-limit 5 or --contract)
  • USDC fee cap fix: dapp-client raised the ERC-20 fee cap from 0.0001 to 0.1 token units (was too low for the relay to accept); "Unable to determine fee option" now names the fix
  • connector-ui use case: removed Katana and $100M TVL filter from "Automate yield strategies" prompt (earn pool API doesn't support Katana)
  • SKILL.md: documents --usdc-limit and --force on wallet create; removes Katana vault table; adds actionable troubleshooting rows

Test plan

  • polygon-agent deposit --chain 1 --amount 1 → error: deposit only supports Polygon mainnet
  • polygon-agent deposit --amount 999 --asset USDC (dry-run, wallet has less than 999 USDC) → error: Insufficient USDC
  • polygon-agent deposit --amount <full-balance> --broadcast on a wallet with 0 POL → amount auto-reduced by 0.05 USDC, note printed
  • polygon-agent wallet create when session already exists → error with --force hint
  • polygon-agent wallet create --force when session already exists → proceeds normally
  • Broadcast with expired/wrong-contract session → actionable error naming the recreate command

…and actionable errors

Addresses seven friction points surfaced in a real first-run test session:

- deposit restricted to Polygon mainnet (chainId 137); clear error for other chains
- pre-flight balance check before transaction encoding; fails fast with an
  actionable message instead of waiting for a relay rejection
- auto-reserve 0.05 USDC for gas when wallet has no native POL balance
  (USDC paymaster path); prints a note and reduces the deposit amount
- remap opaque relay errors ("Identity signers not found", "Request aborted",
  code 1005) to messages that name the fix command
- "no pools found" error now suggests polygon-agent balances as a diagnostic step
- wallet create guards against silently replacing an existing session; requires
  --force to proceed and warns that the old balance is not accessible
- dapp-client fee cap raised from 0.0001 to 0.1 token units (0.1 USDC for
  6-decimal tokens); "Unable to determine fee option" now names the fix
- connector-ui use-case prompt removes Katana and $100M TVL filter (unsupported
  by the earn pool API provider)
- SKILL.md: documents --usdc-limit and --force on wallet create, removes Katana
  vault table, expands troubleshooting table with actionable error rows
@JamesLawton JamesLawton merged commit 629ff3d into main Apr 27, 2026
4 checks passed
@JamesLawton JamesLawton deleted the fix/deposit-flow-ux branch April 27, 2026 11:04
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