@@ -7,7 +7,6 @@ import { useState, useCallback, useEffect, useMemo } from 'react';
77import { useTranslation } from 'react-i18next' ;
88import type { BioAccount } from '@biochain/bio-sdk' ;
99import { normalizeChainId } from '@biochain/bio-sdk' ;
10- import { getChainType , getEvmChainIdFromApi } from '@/lib/chain' ;
1110import { parseAmount } from '@/lib/fee' ;
1211import { Button } from '@/components/ui/button' ;
1312import { Card , CardContent , CardHeader , CardTitle , CardDescription } from '@/components/ui/card' ;
@@ -170,53 +169,10 @@ export default function App() {
170169 setError ( null ) ;
171170 try {
172171 const externalChain = activeOption . externalChain ;
173- const chainType = getChainType ( externalChain ) ;
174-
175- let extAcc : BioAccount ;
176-
177- if ( chainType === 'evm' ) {
178- if ( ! window . ethereum ) {
179- throw new Error ( 'Ethereum provider not available' ) ;
180- }
181- const evmChainId = getEvmChainIdFromApi ( externalChain ) ;
182- if ( evmChainId ) {
183- await window . ethereum . request ( {
184- method : 'wallet_switchEthereumChain' ,
185- params : [ { chainId : evmChainId } ] ,
186- } ) ;
187- }
188- const accounts = await window . ethereum . request < string [ ] > ( {
189- method : 'eth_requestAccounts' ,
190- } ) ;
191- if ( ! accounts || accounts . length === 0 ) {
192- throw new Error ( 'No accounts returned' ) ;
193- }
194- extAcc = {
195- address : accounts [ 0 ] ,
196- chain : normalizeChainId ( externalChain ) ,
197- publicKey : '' ,
198- } ;
199- } else if ( chainType === 'tron' ) {
200- if ( ! window . tronLink ) {
201- throw new Error ( 'TronLink provider not available' ) ;
202- }
203- const result = await window . tronLink . request < { code : number ; message : string ; data : { base58 : string } } > ( {
204- method : 'tron_requestAccounts' ,
205- } ) ;
206- if ( ! result || result . code !== 200 ) {
207- throw new Error ( 'TRON connection failed' ) ;
208- }
209- extAcc = {
210- address : result . data . base58 ,
211- chain : 'tron' ,
212- publicKey : '' ,
213- } ;
214- } else {
215- extAcc = await window . bio . request < BioAccount > ( {
216- method : 'bio_selectAccount' ,
217- params : [ { chain : normalizeChainId ( externalChain ) } ] ,
218- } ) ;
219- }
172+ const extAcc = await window . bio . request < BioAccount > ( {
173+ method : 'bio_selectAccount' ,
174+ params : [ { chain : normalizeChainId ( externalChain ) } ] ,
175+ } ) ;
220176 setExternalAccount ( extAcc ) ;
221177
222178 const intAcc = await window . bio . request < BioAccount > ( {
0 commit comments