Skip to content

fix(checkout-widgets): resolve checkout stuck in Crunching Numbers when paying with IMX (Issue 3)#2803

Open
rodrigo-fournier-immutable wants to merge 1 commit intomainfrom
BSB-37
Open

fix(checkout-widgets): resolve checkout stuck in Crunching Numbers when paying with IMX (Issue 3)#2803
rodrigo-fournier-immutable wants to merge 1 commit intomainfrom
BSB-37

Conversation

@rodrigo-fournier-immutable
Copy link
Contributor

@rodrigo-fournier-immutable rodrigo-fournier-immutable commented Mar 18, 2026

Fix Checkout stuck in Crunching Numbers (SDK 2.12.7)

Summary

This PR addresses Issue 3 reported after upgrading to @imtbl/sdk ^2.12.7 in the Treeverse integration. See docs/TREEVERSE_ISSUES_ANALYSIS.md for the full analysis.


Issue 3: Checkout widget stuck in "Crunching Numbers" when paying with IMX on testnet

Expected: Checkout flow should complete or show an error, not hang indefinitely.

Fix: When fetching funding balances for native tokens (e.g. tIMX on zkEVM), the primary-sales API returns a zero address. The code was using ERC20ItemRequirement, which calls getTokenContract().decimals() and fails for non-contract addresses, causing CheckoutError and leaving the widget stuck in loading. Now uses NativeItemRequirement for native tokens instead of ERC20ItemRequirement.

Packages: checkout-widgets


How to test locally

  1. Setup:

    pnpm build
    pnpm --filter @imtbl/checkout-widgets-sample-app run start
  2. Test flow:

    • Open the checkout sample app (e.g. http://localhost:3000/checkout)
    • Click Primary Sale or Direct NFT Purchase
    • Connect Passport
    • Select IMX as payment currency
    • Click pay with tokens
  3. Expected (fixed): The flow should complete normally or show an error/funding options screen, instead of hanging indefinitely on "Crunching Numbers".

  4. Optional — simulate the bug (without fix):

    • Use the treeverse-issues-reproduction branch
    • Enable the "Simulate Issue 3" checkbox at the top of the page (or add ?simulateIssue3=1 to the URL)
    • Repeat the flow — without the fix, the widget would hang; with the fix, the flow completes
  5. Optional — bypass primary-sales API (mock):

    • Add ?mockPrimarySales=1 to the URL to use mock quote data (triggers the native token flow with tIMX zero address)

…en paying with IMX (Issue 3)

When fetching funding balances for native tokens (e.g. tIMX on zkEVM), the
primary-sales API returns zero address. The code used ERC20ItemRequirement
which calls getTokenContract().decimals() and fails for non-contract addresses,
causing CheckoutError and leaving the widget stuck in loading.

Use NativeItemRequirement for native tokens instead of ERC20ItemRequirement.
@rodrigo-fournier-immutable rodrigo-fournier-immutable requested a review from a team as a code owner March 18, 2026 06:17
@nx-cloud
Copy link

nx-cloud bot commented Mar 18, 2026

View your CI Pipeline Execution ↗ for commit 488dceb

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 2m 15s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1m 11s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-18 06:32:19 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant