@@ -13,7 +13,8 @@ import type { TrezorBridge } from './trezor-bridge';
1313import { TrezorKeyring } from './trezor-keyring' ;
1414import {
1515 BIP44_HD_PATH_PREFIX ,
16- LEGACY_MEW_PATH ,
16+ LEGACY_MEW_PATH_PREFIX ,
17+ SLIP0044_TESTNET_PATH_PREFIX ,
1718 TrezorKeyringV2 ,
1819} from './trezor-keyring-v2' ;
1920
@@ -482,23 +483,44 @@ describe('TrezorKeyringV2', () => {
482483
483484 it ( 'creates an account with legacy MEW path' , async ( ) => {
484485 // Create wrapper with legacy MEW path pre-set to avoid HDKey reset
485- const inner = createInnerKeyring ( LEGACY_MEW_PATH ) ;
486+ const inner = createInnerKeyring ( LEGACY_MEW_PATH_PREFIX ) ;
486487 const wrapper = new TrezorKeyringV2 ( {
487488 legacyKeyring : inner ,
488489 entropySource,
489490 } ) ;
490491
491492 const newAccounts = await wrapper . createAccounts (
492- derivePathOptions ( `${ LEGACY_MEW_PATH } /3` ) ,
493+ derivePathOptions ( `${ LEGACY_MEW_PATH_PREFIX } /3` ) ,
493494 ) ;
494495 const account = getFirstAccount ( newAccounts ) ;
495496
496497 expect ( account . address ) . toBe ( EXPECTED_ACCOUNTS [ 3 ] ) ;
497498 expect ( account . options . entropy . groupIndex ) . toBe ( 3 ) ;
498499 expect ( account . options . entropy . derivationPath ) . toBe (
499- `${ LEGACY_MEW_PATH } /3` ,
500+ `${ LEGACY_MEW_PATH_PREFIX } /3` ,
500501 ) ;
501- expect ( inner . hdPath ) . toBe ( LEGACY_MEW_PATH ) ;
502+ expect ( inner . hdPath ) . toBe ( LEGACY_MEW_PATH_PREFIX ) ;
503+ } ) ;
504+
505+ it ( 'creates an account with SLIP0044 testnet path' , async ( ) => {
506+ // Create wrapper with testnet path pre-set to avoid HDKey reset
507+ const inner = createInnerKeyring ( SLIP0044_TESTNET_PATH_PREFIX ) ;
508+ const wrapper = new TrezorKeyringV2 ( {
509+ legacyKeyring : inner ,
510+ entropySource,
511+ } ) ;
512+
513+ const newAccounts = await wrapper . createAccounts (
514+ derivePathOptions ( `${ SLIP0044_TESTNET_PATH_PREFIX } /2` ) ,
515+ ) ;
516+ const account = getFirstAccount ( newAccounts ) ;
517+
518+ expect ( account . address ) . toBe ( EXPECTED_ACCOUNTS [ 2 ] ) ;
519+ expect ( account . options . entropy . groupIndex ) . toBe ( 2 ) ;
520+ expect ( account . options . entropy . derivationPath ) . toBe (
521+ `${ SLIP0044_TESTNET_PATH_PREFIX } /2` ,
522+ ) ;
523+ expect ( inner . hdPath ) . toBe ( SLIP0044_TESTNET_PATH_PREFIX ) ;
502524 } ) ;
503525
504526 it ( 'returns existing account if path already exists' , async ( ) => {
@@ -664,7 +686,7 @@ describe('TrezorKeyringV2', () => {
664686 describe ( 'different HD paths' , ( ) => {
665687 it ( 'uses the correct derivation path from the inner keyring' , async ( ) => {
666688 const inner = createInnerKeyring ( ) ;
667- inner . setHdPath ( LEGACY_MEW_PATH ) ;
689+ inner . setHdPath ( LEGACY_MEW_PATH_PREFIX ) ;
668690 inner . hdk = fakeHdKey ; // Reset after setHdPath clears it
669691 inner . setAccountToUnlock ( 0 ) ;
670692 await inner . addAccounts ( 1 ) ;
@@ -678,7 +700,7 @@ describe('TrezorKeyringV2', () => {
678700 const account = getFirstAccount ( accounts ) ;
679701
680702 expect ( account . options . entropy . derivationPath ) . toBe (
681- `${ LEGACY_MEW_PATH } /0` ,
703+ `${ LEGACY_MEW_PATH_PREFIX } /0` ,
682704 ) ;
683705 } ) ;
684706
0 commit comments