Skip to content

fix: use network-aware token address for testnet balance queries#47

Open
crabanagent wants to merge 1 commit into
tempoxyz:mainfrom
crabanagent:fix/testnet-token-address
Open

fix: use network-aware token address for testnet balance queries#47
crabanagent wants to merge 1 commit into
tempoxyz:mainfrom
crabanagent:fix/testnet-token-address

Conversation

@crabanagent

Copy link
Copy Markdown

Summary

whoami --network testnet always shows balance: 0 even when the wallet is funded on the moderato chain (42431). The usdcToken constant in constants.ts is hardcoded to the mainnet USDC.e address, so balance queries on testnet hit the wrong token contract.

Changes

  • Add moderatoToken constant for the testnet token contract (0x20c0…0000)
  • Add tokenAddress(chain) helper in network.ts, mirroring the existing escrowContract(chain) pattern
  • Update tokenDecimals() and tokenSymbol() to recognize both mainnet and testnet token addresses
  • Replace hardcoded token fallbacks in identity.ts, fund.ts, sessions.ts, and transfer.ts with network-aware lookups
  • transfer.ts MPP challenge validation now accepts both mainnet and testnet tokens

Testing

  • pnpm typecheck — passes ✅
  • pnpm test — all 108 tests pass ✅

Closes #46

The usdcToken constant was hardcoded to the mainnet USDC.e address,
so whoami --network testnet always showed 0 balance even when the
wallet is funded on the moderato chain.

Add a moderatoToken constant for the testnet token contract and a
tokenAddress() helper that switches on chain ID, mirroring the existing
escrowContract() pattern. Update all call sites in identity, fund,
sessions, and transfer commands to use the network-aware token.

Closes tempoxyz#46
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.

whoami --network testnet shows 0 balance — usdcToken hardcoded to mainnet address

1 participant