diff --git a/src/main/ledger.ts b/src/main/ledger.ts index 7de41525..fc74d0cb 100644 --- a/src/main/ledger.ts +++ b/src/main/ledger.ts @@ -22,13 +22,13 @@ export function registerLedgerHandler() { return transporters.map(({ address, publicKey, blockchain }) => ({ address, publicKey, blockchain })) }) - mainApi.listenSync('startLedger', () => { + mainApi.listenAsync('startLedger', () => { if (started) return started = true NodeHidTransportFixed.listen({ - complete: () => {}, - error: () => {}, + complete: () => { }, + error: () => { }, next: async event => { if (event.type === 'add') { const transport = await NodeHidTransportFixed.open(event.descriptor) diff --git a/src/renderer/src/hooks/useBeforeLogin.tsx b/src/renderer/src/hooks/useBeforeLogin.tsx index 4d82cadc..f2ccf0d6 100644 --- a/src/renderer/src/hooks/useBeforeLogin.tsx +++ b/src/renderer/src/hooks/useBeforeLogin.tsx @@ -72,7 +72,7 @@ const useRegisterLedgerListeners = () => { ToastHelper.dismiss('ledger-request-permission') }) - window.api.sendSync('startLedger') + window.api.sendAsync('startLedger') return () => { removeLedgerConnectedListener() diff --git a/src/shared/@types/api.ts b/src/shared/@types/api.ts index 8dca9711..0737aea9 100644 --- a/src/shared/@types/api.ts +++ b/src/shared/@types/api.ts @@ -6,7 +6,6 @@ import { TGetStoreFromWCSession, TIpcMainAsyncListener, TIpcMainSyncListener, TL export type TMainApiListenersSync = { restore: TIpcMainSyncListener sendStoreFromWC: TIpcMainSyncListener - startLedger: TIpcMainSyncListener encryptBasedEncryptedSecretSync: TIpcMainSyncListener<{ value: string; encryptedSecret?: string }, string> decryptBasedEncryptedSecretSync: TIpcMainSyncListener<{ value: string; encryptedSecret?: string }, string> } @@ -17,6 +16,7 @@ export type TMainApiListenersAsync = { saveFile: TIpcMainAsyncListener<{ path: string; content: string }, void> setTitleBarOverlay: TIpcMainAsyncListener setWindowButtonPosition: TIpcMainAsyncListener + startLedger: TIpcMainAsyncListener checkForUpdates: TIpcMainAsyncListener quitAndInstall: TIpcMainAsyncListener getConnectedLedgers: TIpcMainAsyncListener