Skip to content

Commit

Permalink
fix(useNetwork): tron switch network
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshbhole-rp committed Jan 3, 2025
1 parent 7297743 commit 66859c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tangled3/react

## 1.15.15

### Patch Changes

- fix tron switch network call

## 1.15.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tangled3/react",
"private": false,
"version": "1.15.14",
"version": "1.15.15",
"type": "module",
"license": "MIT",
"main": "./src/index.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/hooks/useNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export const useNetwork = () => {
return chains.find((chain) => chain.id === switchedChain.id);
}
if (chain.type === 'tron') {
// convert chain id
try {
await (connector as WalletInstance<'tron'>).switchChain(chain.tronName);
await (connector as WalletInstance<'tron'>).switchChain(chain.trxId);
} catch (e) {
if (e === WalletSwitchChainError) {
console.error('Switch chain is not supported');
Expand Down

0 comments on commit 66859c0

Please sign in to comment.