fix(adapter-tron): fall back to direct full node calls for chains the Blockchain API doesn't support - #5781
Conversation
Lets callers check whether the Blockchain API RPC proxy supports a given chain, so they can fall back to a direct RPC call for chains it doesn't cover instead of routing through it blindly.
Shared create/broadcast transaction helper against a TRON fullnode's real REST API, for use as a fallback on chains the Blockchain API RPC proxy doesn't support.
…onnector sendTransaction now falls back to TronFullnodeUtil for chains the Blockchain API RPC proxy doesn't support (e.g. Shasta testnet), instead of unconditionally routing through it and failing before the wallet is ever asked to sign. Chains the proxy does support (mainnet, Nile) are unaffected.
…nnectConnector Same fallback as TronConnectConnector: build/broadcast the transaction via TronFullnodeUtil for chains the Blockchain API doesn't support, instead of routing through it unconditionally. The tron_signTransaction WalletConnect step is unaffected either way.
…allet adapter TronConnectConnector.switchNetwork was a no-op, so wallets that keep their own network/session state (e.g. MetaMask, which always starts on Mainnet) never got told to switch, even after the app's active chain moved to a different network. It now calls the underlying tronweb3 adapter's switchChain with the bare (non-CAIP) chain id. Without this, a wallet like MetaMask would sign/simulate a Shasta-built transaction as if it were still on Mainnet.
The base tronweb3 Adapter class's default switchChain implementation rejects for any adapter that doesn't override it (Trust, Binance, BitKeep, OKX in this repo's own lab config all fall into this bucket). Swallow that failure the same way disconnect() already does, instead of letting it block the app's own network switch for wallets that simply can't act on it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
9 Skipped Deployments
|
Visual Regression Test Results ✅ PassedChromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=1121 👉 Please review the visual changes in Chromatic and accept or reject them. |
|
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit > size-limit |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Block-comment style, capitalized-comments, and naming-convention fixes flagged by eslint, plus prettier formatting on two test files.
🦋 Changeset detectedLatest commit: 4c5f6b5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…tx-fallback # Conflicts: # packages/adapters/tron/src/connectors/TronWalletConnectConnector.ts
The button had no flex-shrink guard, so it could shrink below its content width when space was tight, clipping the label against the swap view's overflow-x: hidden container.
…m cropping" This reverts commit 4c5f6b5.
Description
TRON Send Tx failed outright on chains not covered by Reown's Blockchain API RPC proxy
(currently TRON Shasta testnet). A past change moved
sendTransaction'stron_createTransaction/tron_broadcastTransactioncalls behind that proxy, but only wired upmainnet and Nile as supported chains there, silently dropping Shasta, which used to work by
calling TRON's fullnode directly.
This PR:
CaipNetworksUtil.isWcHttpRpcSupported(caipNetworkId), so callers can check whether achain is covered by the Blockchain API proxy.
TronFullnodeUtil, implementing the legacy, spec-correct TRON REST calls(
/wallet/createtransaction,/wallet/broadcasttransaction) against a chain's own fullnode.TronConnectConnector.sendTransactionandTronWalletConnectConnector.sendTransactionnow fall back to
TronFullnodeUtilfor chains outside the Blockchain API's supported list,instead of routing through it unconditionally. Chains the proxy does support (mainnet, Nile)
are unaffected, same requests as before.
TronConnectConnector.switchNetwork, which was a no-op: injected wallet adapters thatkeep their own network/session state (e.g. MetaMask, which always connects to Mainnet by
default) were never told to switch, so a transaction built for one network could get signed
against the wallet's own, different active network. It now calls the underlying tronweb3
adapter's
switchChain, tolerating wallets that don't support it (several adapters in thisrepo's own lab config don't implement it, and previously got a silent no-op there too).
Type of change
Associated Issues
Related to FS-189
Showcase (Optional)
Checklist