@@ -13,44 +13,13 @@ import {
1313import { networks } from 'bitcoinjs-lib'
1414import Logger from 'utils/Logger'
1515import bs58 from 'bs58'
16-
17- export interface AddressInfo {
18- id : string
19- address : string
20- derivationPath : string
21- network : string
22- }
23-
24- export interface ExtendedPublicKey {
25- path : string
26- key : string
27- chainCode : string
28- }
29-
30- export interface PublicKeyInfo {
31- key : string
32- derivationPath : string
33- curve : 'secp256k1' | 'ed25519'
34- }
35-
36- export enum LedgerAppType {
37- AVALANCHE = 'Avalanche' ,
38- SOLANA = 'Solana' ,
39- ETHEREUM = 'Ethereum' ,
40- UNKNOWN = 'Unknown'
41- }
42-
43- export const LedgerReturnCode = {
44- SUCCESS : 0x9000 ,
45- USER_REJECTED : 0x6985 ,
46- APP_NOT_OPEN : 0x6a80 ,
47- DEVICE_LOCKED : 0x5515 ,
48- INVALID_PARAMETER : 0x6b00 ,
49- COMMAND_NOT_ALLOWED : 0x6986
50- } as const
51-
52- export type LedgerReturnCodeType =
53- typeof LedgerReturnCode [ keyof typeof LedgerReturnCode ]
16+ import {
17+ LedgerAppType ,
18+ ExtendedPublicKey ,
19+ LedgerReturnCode ,
20+ PublicKeyInfo ,
21+ AddressInfo
22+ } from './types'
5423
5524export interface AppInfo {
5625 applicationName : string
@@ -129,7 +98,7 @@ export class LedgerService {
12998 throw new Error ( 'Transport not initialized' )
13099 }
131100
132- return await getLedgerAppInfo ( this . transport as any )
101+ return await getLedgerAppInfo ( this . transport as Transport )
133102 }
134103
135104 // Map app name to our enum
@@ -224,7 +193,7 @@ export class LedgerService {
224193 Logger . info ( 'Avalanche app detected, creating app instance...' )
225194
226195 // Create Avalanche app instance
227- const avalancheApp = new AppAvalanche ( this . transport as any )
196+ const avalancheApp = new AppAvalanche ( this . transport as Transport )
228197 Logger . info ( 'Avalanche app instance created' )
229198
230199 try {
@@ -413,7 +382,7 @@ export class LedgerService {
413382 // Use the SDK function directly (like the extension does)
414383 const publicKey = await getSolanaPublicKeyFromLedger (
415384 startIndex ,
416- this . transport as any
385+ this . transport as Transport
417386 )
418387
419388 const publicKeys : PublicKeyInfo [ ] = [
@@ -480,7 +449,7 @@ export class LedgerService {
480449 await this . waitForApp ( LedgerAppType . AVALANCHE )
481450
482451 // Create Avalanche app instance
483- const avalancheApp = new AppAvalanche ( this . transport as any )
452+ const avalancheApp = new AppAvalanche ( this . transport as Transport )
484453
485454 const publicKeys : PublicKeyInfo [ ] = [ ]
486455
@@ -554,7 +523,7 @@ export class LedgerService {
554523 await this . waitForApp ( LedgerAppType . AVALANCHE )
555524
556525 // Create Avalanche app instance
557- const avalancheApp = new AppAvalanche ( this . transport as any )
526+ const avalancheApp = new AppAvalanche ( this . transport as Transport )
558527
559528 const addresses : AddressInfo [ ] = [ ]
560529
0 commit comments