fix(tron): use fullnode for testnet balances - #5703
Conversation
|
Bugbot is not enabled for this team, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
🦋 Changeset detectedLatest commit: 94df5be The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 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 |
|
@royalpinto007 is attempting to deploy a commit to the Reown Team on Vercel. A member of the Team first needs to authorize it. |
|
All contributors have signed the CTA ✍️ ✅ |
|
I have read the CTA Document and I hereby sign the CTA |
There was a problem hiding this comment.
Pull request overview
Fixes TRON testnet (Shasta/Nile) balance fetching in the TRON adapter by bypassing the WalletConnect RPC proxy (which returns 503 for TRON testnet balance reads) and querying the configured TRON fullnode REST endpoint instead.
Changes:
- Updated
TronAdapter.getBalance()to use/wallet/getaccounton the configuredrpcUrls.chainDefaultfullnode fortestnetnetworks, while keeping the Blockchain API path for mainnet. - Extracted TRX balance formatting into a helper method for reuse across both paths.
- Added unit tests covering testnet vs mainnet routing behavior and included a changeset.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/adapters/tron/src/adapter.ts | Route testnet balances through TRON fullnode /wallet/getaccount; keep mainnet via BlockchainApiController; refactor formatting. |
| packages/adapters/tron/src/tests/client.test.ts | Adds unit coverage ensuring testnet uses fullnode and mainnet uses Blockchain API. |
| .changeset/tron-testnet-fullnode-balance.md | Publishes a patch release note for the TRON testnet balance fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!rpcUrl) { | ||
| return 0 | ||
| } | ||
|
|
||
| const response = await fetch(`${rpcUrl}/wallet/getaccount`, { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ address, visible: true }) | ||
| }) |
| beforeEach(() => { | ||
| vi.clearAllMocks() | ||
| adapter = new TronAdapter() | ||
| }) |
530f660 to
94df5be
Compare
|
Bugbot is not enabled for this team, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Addressed the Copilot review suggestions:
Re-ran:
Note: lint exits successfully. It still reports the existing warning in |
Description
Fixes TRON testnet balance fetching for the TRON adapter.
TronAdapter.getBalance()previously routed all TRON balance reads throughBlockchainApiController.getAddressBalance(). For Shasta/Nile, that goes through the WalletConnect RPC proxy, which currently returns 503 for TRON testnet balance requests. This made AppKit show0 TRXand log repeated balance errors on Shasta.This PR keeps the existing Blockchain API path for TRON mainnet, but uses the configured TRON fullnode
chainDefaultendpoint for testnet balances via/wallet/getaccount.Type of change
Associated Issues
closes #5699
Showcase (Optional)
No UI change. The behavior is covered by unit tests:
https://api.shasta.trongrid.io/wallet/getaccountBlockchainApiController.getAddressBalance()Checklist
Preview link is not applicable because this change is in adapter balance-fetching logic, not a UI surface.
Testing
pnpm --filter @reown/appkit-adapter-tron... buildpnpm --filter @reown/appkit-adapter-tron testpnpm --filter @reown/appkit-adapter-tron lintNote: lint exits successfully. It still reports the existing warning in
TronWalletConnectConnector.tsforusesV1Format, which this PR does not touch.