Skip to content

Conversation

@prestwich
Copy link
Member

Summary

  • Add tokenDecimals field to SignetSystemConstants for chain-specific decimal overrides
  • Add getTokenDecimals(symbol, config?) helper that respects testnet overrides
  • Add Flow type ("passage" | "orders") to distinguish entry mechanisms
  • Breaking: Update needsWethWrap(symbol, direction, flow) to require flow parameter
  • Add RPC Patterns documentation section to README

Details

Issue #11: Testnet token decimals

PARMIGIANA uses 18 decimals for WUSD instead of mainnet's 6. The new tokenDecimals field on chain configs allows per-chain overrides, and getTokenDecimals() provides a convenient lookup.

Issue #14: needsWethWrap logic

The function was ambiguous because it conflated two entry mechanisms:

  • Passage flow: enter() accepts native ETH directly - no wrap needed
  • Orders flow: Permit2 requires ERC20 tokens - wrap needed for ETH entry

The new flow parameter makes this explicit.

Test plan

  • pnpm typecheck passes
  • pnpm test:run passes (192 tests)
  • pnpm lint passes
  • pnpm format passes
  • New tests for getTokenDecimals and updated needsWethWrap tests

Closes #11
Closes #14

🤖 Generated with Claude Code

Add chain-specific token decimal overrides and disambiguate the
needsWethWrap function by requiring a flow parameter.

- Add tokenDecimals field to SignetSystemConstants for testnet overrides
- Add WUSD: 18 override to PARMIGIANA (mainnet uses 6)
- Add getTokenDecimals(symbol, config?) helper function
- Add Flow type ("passage" | "orders") to distinguish entry mechanisms
- Update needsWethWrap to require flow parameter (breaking change)
- Add RPC Patterns documentation section to README

Closes #11
Closes #14

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@prestwich prestwich merged commit 1660701 into main Feb 5, 2026
5 checks passed
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.

needsWethWrap logic appears backwards for Passage/Permit2 flows Add testnet token decimals to chain config

1 participant