@@ -12,7 +12,7 @@ import {
1212 KeyringType ,
1313 type EntropySourceId ,
1414} from '@metamask/keyring-api' ;
15- import type { AccountId } from '@metamask/keyring-utils' ;
15+ import type { AccountId , EthKeyring } from '@metamask/keyring-utils' ;
1616import type { Hex } from '@metamask/utils' ;
1717
1818import type { TrezorKeyring } from './trezor-keyring' ;
@@ -51,16 +51,24 @@ export type TrezorKeyringV2Options = {
5151 type ?: KeyringType . Trezor | KeyringType . OneKey ;
5252} ;
5353
54+ // TrezorKeyring.signTransaction returns `TypedTransaction | OldEthJsTransaction` for
55+ // backwards compatibility with old ethereumjs-tx, but EthKeyring expects `TypedTxData`.
56+ // The runtime behavior is correct - we cast the type to satisfy the constraint.
57+ type TrezorKeyringAsEthKeyring = TrezorKeyring & EthKeyring ;
58+
5459export class TrezorKeyringV2
55- extends EthKeyringWrapper < TrezorKeyring , Bip44Account < KeyringAccount > >
60+ extends EthKeyringWrapper <
61+ TrezorKeyringAsEthKeyring ,
62+ Bip44Account < KeyringAccount >
63+ >
5664 implements KeyringV2
5765{
5866 readonly entropySource : EntropySourceId ;
5967
6068 constructor ( options : TrezorKeyringV2Options ) {
6169 super ( {
6270 type : options . type ?? KeyringType . Trezor ,
63- inner : options . legacyKeyring ,
71+ inner : options . legacyKeyring as TrezorKeyringAsEthKeyring ,
6472 capabilities : trezorKeyringV2Capabilities ,
6573 } ) ;
6674 this . entropySource = options . entropySource ;
0 commit comments