File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,16 @@ export const SignInLedgerForm = ({ onClose }: ModalPageProps) => {
126126 const handleConnect = async ( ) => {
127127 setErrorMessage ( "" ) ;
128128 try {
129+ // Close existing connections to avoid "device already open" error
130+ const existingTransports = await TransportWebHID . list ( ) ;
131+ await Promise . all (
132+ existingTransports . map ( ( existingTransport ) =>
133+ existingTransport . close ( ) . catch ( ( ) => {
134+ // Ignore close errors - device might already be closed
135+ } ) ,
136+ ) ,
137+ ) ;
138+
129139 const transport = await TransportWebHID . request ( ) ;
130140 dispatch ( fetchLedgerStellarAddressAction ( { ledgerBipPath, transport } ) ) ;
131141 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -7,6 +7,16 @@ export const signLedgerTransaction = async (
77 publicKey : string ,
88 bipPath : string ,
99) => {
10+ // Close existing connections to avoid "device already open" error
11+ const existingTransports = await TransportWebHID . list ( ) ;
12+ await Promise . all (
13+ existingTransports . map ( ( existingTransport ) =>
14+ existingTransport . close ( ) . catch ( ( ) => {
15+ // Ignore close errors - device might already be closed
16+ } ) ,
17+ ) ,
18+ ) ;
19+
1020 const transport = await TransportWebHID . create ( ) ;
1121 const ledgerApi = new LedgerApi ( transport ) ;
1222 const result = await ledgerApi . signTransaction (
You can’t perform that action at this time.
0 commit comments