Skip to content

fix(adapter-tron): fall back to direct full node calls for chains the Blockchain API doesn't support - #5781

Merged
santgr11 merged 13 commits into
mainfrom
fix/tron-shasta-send-tx-fallback
Sep 18, 2026
Merged

santgr11 merged 13 commits into
mainfrom
fix/tron-shasta-send-tx-fallback

Conversation

@santgr11

Copy link
Copy Markdown
Contributor

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's
tron_createTransaction/tron_broadcastTransaction calls behind that proxy, but only wired up
mainnet and Nile as supported chains there, silently dropping Shasta, which used to work by
calling TRON's fullnode directly.

This PR:

  • Adds CaipNetworksUtil.isWcHttpRpcSupported(caipNetworkId), so callers can check whether a
    chain is covered by the Blockchain API proxy.
  • Adds TronFullnodeUtil, implementing the legacy, spec-correct TRON REST calls
    (/wallet/createtransaction, /wallet/broadcasttransaction) against a chain's own fullnode.
  • Both TronConnectConnector.sendTransaction and TronWalletConnectConnector.sendTransaction
    now fall back to TronFullnodeUtil for 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.
  • Fixes TronConnectConnector.switchNetwork, which was a no-op: injected wallet adapters that
    keep 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 this
    repo's own lab config don't implement it, and previously got a silent no-op there too).

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

Related to FS-189

Showcase (Optional)

2026-09-15 send shasta

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

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.
@linear

linear Bot commented Sep 15, 2026

Copy link
Copy Markdown

FS-189

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
appkit-demo Ready Ready Preview Sep 18, 2026 4:25pm UTC
appkit-gallery Ready Ready Preview Sep 18, 2026 4:25pm UTC
appkit-headless-sample-app Ready Ready Preview Sep 18, 2026 4:25pm UTC
appkit-laboratory Ready Ready Preview Sep 18, 2026 4:25pm UTC
9 Skipped Deployments
Project Deployment Actions Updated
appkit-basic-example Ignored Ignored Sep 18, 2026 4:25pm UTC
appkit-basic-sign-client-example Ignored Ignored Sep 18, 2026 4:25pm UTC
appkit-basic-up-example Ignored Ignored Sep 18, 2026 4:25pm UTC
appkit-ethers5-bera Ignored Ignored Sep 18, 2026 4:25pm UTC
appkit-nansen-demo Ignored Ignored Sep 18, 2026 4:25pm UTC
appkit-wagmi-cdn-example Ignored Ignored Sep 18, 2026 4:25pm UTC
ethereum-provider-wagmi-example Ignored Ignored Sep 18, 2026 4:25pm UTC
next-wagmi-solana-bitcoin-example Ignored Ignored Sep 18, 2026 4:25pm UTC
vue-wagmi-example Ignored Ignored Sep 18, 2026 4:25pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Visual Regression Test Results ✅ Passed

⚠️ 20 visual change(s) detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=1121
Storybook Preview: https://6493191bf4b10fed8ca7353f-yyyzgzmvqo.chromatic.com/

👉 Please review the visual changes in Chromatic and accept or reject them.

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronFullnodeUtil.test.ts (line 5): https://api.shasta.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronFullnodeUtil.test.ts (line 5): https://api.shasta.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 43): https://api.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 55): https://api.shasta.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 159): https://api.shasta.trongrid.io/wallet/createtransaction

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 169): https://api.shasta.trongrid.io/wallet/broadcasttransaction

⚠️

🌐 Non-company domain introduced (host: api.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 43): https://api.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 55): https://api.shasta.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 159): https://api.shasta.trongrid.io/wallet/createtransaction

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronConnectConnector.test.ts (line 169): https://api.shasta.trongrid.io/wallet/broadcasttransaction

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronWalletConnectConnector.test.ts (line 62): https://api.shasta.trongrid.io

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronWalletConnectConnector.test.ts (line 303): https://api.shasta.trongrid.io/wallet/createtransaction

⚠️

🌐 Non-company domain introduced (host: api.shasta.trongrid.io) in packages/adapters/tron/src/tests/TronWalletConnectConnector.test.ts (line 324): https://api.shasta.trongrid.io/wallet/broadcasttransaction

Generated by 🚫 dangerJS against 96bbe1c

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

📦 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

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         76.42 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 2 s      on Snapdragon 410
Total time:   3.5 s
@reown/appkit/react
Size limit:   236 kB
Size:         235.88 kB with all dependencies, minified and gzipped
Loading time: 4.7 s     on slow 3G
Running time: 3.7 s     on Snapdragon 410
Total time:   8.3 s
@reown/appkit/vue
Size limit:   80 kB
Size:         76.42 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 1.3 s    on Snapdragon 410
Total time:   2.8 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         215.48 kB with all dependencies, minified and gzipped
Loading time: 4.3 s     on slow 3G
Running time: 2.9 s     on Snapdragon 410
Total time:   7.1 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.16 kB with all dependencies, minified and gzipped
Loading time: 258 ms   on slow 3G
Running time: 105 ms   on Snapdragon 410
Total time:   362 ms

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.14% 40665 / 52040
🔵 Statements 78.14% 40665 / 52040
🔵 Functions 75.76% 4324 / 5707
🔵 Branches 86.69% 9930 / 11454
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/tron/src/connectors/TronConnectConnector.ts 58.43% 55.55% 40% 58.43% 31-32, 35-36, 39-40, 43-44, 47-48, 51-72, 75-86, 89-94, 97-100, 127-128, 154-155, 188-189, 207-217, 222-224, 228, 232-234, 238-242
packages/adapters/tron/src/connectors/TronWalletConnectConnector.ts 85.79% 73.8% 57.89% 85.79% 37-38, 41-42, 45-46, 49-52, 55-58, 77-78, 142-143, 150-151, 180-181, 249-250
packages/adapters/tron/src/utils/TronFullnodeUtil.ts 100% 100% 100% 100%
packages/appkit-utils/src/CaipNetworkUtil.ts 99.57% 98.85% 96% 99.57% 279
Generated in workflow #17360 for commit 96bbe1c by the Vitest Coverage Report Action

Block-comment style, capitalized-comments, and naming-convention
fixes flagged by eslint, plus prettier formatting on two test files.
@changeset-bot

changeset-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4c5f6b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@reown/appkit-ui Patch
pay-test-exchange Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-stellar Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-common Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-testing Patch
@reown/appkit-universal-connector Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button Patch

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants