diff --git a/.changelog/1784.trivial.md b/.changelog/1784.trivial.md
new file mode 100644
index 0000000000..4fe40f519e
--- /dev/null
+++ b/.changelog/1784.trivial.md
@@ -0,0 +1 @@
+Rename WalletType.Ledger to WalletType.UsbLedger
diff --git a/src/app/components/Toolbar/Features/Account/DerivationFormatter.tsx b/src/app/components/Toolbar/Features/Account/DerivationFormatter.tsx
index 519b10c41f..73daa21df4 100644
--- a/src/app/components/Toolbar/Features/Account/DerivationFormatter.tsx
+++ b/src/app/components/Toolbar/Features/Account/DerivationFormatter.tsx
@@ -11,7 +11,7 @@ export interface DerivationFormatterProps {
export const DerivationFormatter = (props: DerivationFormatterProps) => {
const { t } = useTranslation()
const walletTypes: { [type in WalletType]: string } = {
- [WalletType.Ledger]: t('toolbar.wallets.type.usbLedger', 'USB Ledger'),
+ [WalletType.UsbLedger]: t('toolbar.wallets.type.usbLedger', 'USB Ledger'),
[WalletType.BleLedger]: t('toolbar.wallets.type.bluetoothLedger', 'BLE Ledger'),
[WalletType.Mnemonic]: t('toolbar.wallets.type.mnemonic', 'Mnemonic'),
[WalletType.PrivateKey]: t('toolbar.wallets.type.privateKey', 'Private key'),
diff --git a/src/app/components/Toolbar/Features/AccountSelector/__tests__/index.test.tsx b/src/app/components/Toolbar/Features/AccountSelector/__tests__/index.test.tsx
index 5a56b9d784..534dc4dc81 100644
--- a/src/app/components/Toolbar/Features/AccountSelector/__tests__/index.test.tsx
+++ b/src/app/components/Toolbar/Features/AccountSelector/__tests__/index.test.tsx
@@ -27,7 +27,7 @@ describe('', () => {
address: 'oasis1qq3xrq0urs8qcffhvmhfhz4p0mu7ewc8rscnlwxe',
balance: { available: '100', debonding: '0', delegations: '0', total: '100' },
publicKey: '00',
- type: WalletType.Ledger,
+ type: WalletType.UsbLedger,
},
},
},
diff --git a/src/app/lib/__tests__/ledger.test.ts b/src/app/lib/__tests__/ledger.test.ts
index cedd9d1aac..9824cb496b 100644
--- a/src/app/lib/__tests__/ledger.test.ts
+++ b/src/app/lib/__tests__/ledger.test.ts
@@ -148,14 +148,14 @@ describe('Ledger Library', () => {
it('Should fail if the wallet does not have a path', () => {
const openWallet = () => {
- new LedgerSigner({ type: WalletType.Ledger } as Wallet)
+ new LedgerSigner({ type: WalletType.UsbLedger } as Wallet)
}
expect(openWallet).toThrow(/ not a ledger wallet/)
})
it('Should fail without USB transport', async () => {
const signer = new LedgerSigner({
- type: WalletType.Ledger,
+ type: WalletType.UsbLedger,
path: [44, 474, 0, 0, 0],
pathDisplay: `m/44'/474'/0'/0'/0'`,
publicKey: '00',
@@ -168,7 +168,7 @@ describe('Ledger Library', () => {
it('Should return the public key', () => {
const signer = new LedgerSigner({
- type: WalletType.Ledger,
+ type: WalletType.UsbLedger,
path: [44, 474, 0, 0, 0],
pathDisplay: `m/44'/474'/0'/0'/0'`,
publicKey: 'aabbcc',
@@ -188,7 +188,7 @@ describe('Ledger Library', () => {
sign.mockResolvedValueOnce({ return_code: 0x6986, error_message: '' })
const signer = new LedgerSigner({
- type: WalletType.Ledger,
+ type: WalletType.UsbLedger,
path: [44, 474, 0, 0, 0],
pathDisplay: `m/44'/474'/0'/0'/0'`,
publicKey: '00',
@@ -215,7 +215,7 @@ describe('Ledger Library', () => {
})
const signer = new LedgerSigner({
- type: WalletType.Ledger,
+ type: WalletType.UsbLedger,
path: [44, 474, 0, 0, 0],
pathDisplay: `m/44'/474'/0'/0'/0'`,
publicKey: '00',
diff --git a/src/app/lib/ledger.ts b/src/app/lib/ledger.ts
index b34587234e..7eaa4795dd 100644
--- a/src/app/lib/ledger.ts
+++ b/src/app/lib/ledger.ts
@@ -111,7 +111,7 @@ export class LedgerSigner implements ContextSigner {
transportType: LedgerWalletType
constructor(wallet: Wallet) {
- if (!wallet.path || (wallet.type !== WalletType.Ledger && wallet.type !== WalletType.BleLedger)) {
+ if (!wallet.path || (wallet.type !== WalletType.UsbLedger && wallet.type !== WalletType.BleLedger)) {
throw new Error('Given wallet is not a ledger wallet')
}
this.path = wallet.path
diff --git a/src/app/pages/ConnectDevicePage/__tests__/index.test.tsx b/src/app/pages/ConnectDevicePage/__tests__/index.test.tsx
index dc8c47c6af..6c6513c310 100644
--- a/src/app/pages/ConnectDevicePage/__tests__/index.test.tsx
+++ b/src/app/pages/ConnectDevicePage/__tests__/index.test.tsx
@@ -32,7 +32,7 @@ describe('', () => {
expect(screen.getByLabelText('Status is okay')).toBeInTheDocument()
expect(screen.queryByRole('button')).not.toBeInTheDocument()
expect(mockDispatch).toHaveBeenCalledWith({
- payload: WalletType.Ledger,
+ payload: WalletType.UsbLedger,
type: importAccountsActions.enumerateAccountsFromLedger.type,
})
})
diff --git a/src/app/pages/ConnectDevicePage/index.tsx b/src/app/pages/ConnectDevicePage/index.tsx
index 48324d3b69..0a7ffbf282 100644
--- a/src/app/pages/ConnectDevicePage/index.tsx
+++ b/src/app/pages/ConnectDevicePage/index.tsx
@@ -54,7 +54,7 @@ export function ConnectDevicePage() {
const device = await requestDevice()
if (device) {
setConnection('connected')
- dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
}
} catch {
setConnection('error')
diff --git a/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx b/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx
index 1a147d296d..8c51375d7f 100644
--- a/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx
+++ b/src/app/pages/OpenWalletPage/Features/FromLedger/index.tsx
@@ -38,7 +38,7 @@ export function FromLedger() {
type="submit"
label={t('openWallet.importAccounts.selectWallets', 'Select accounts to open')}
onClick={() => {
- dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
}}
primary
/>
@@ -48,7 +48,7 @@ export function FromLedger() {
abort={() => {
dispatch(importAccountsActions.clear())
}}
- type={WalletType.Ledger}
+ type={WalletType.UsbLedger}
/>
)}
diff --git a/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/__tests__/index.test.tsx b/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/__tests__/index.test.tsx
index ebf1e0bcee..10269e5291 100644
--- a/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/__tests__/index.test.tsx
+++ b/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/__tests__/index.test.tsx
@@ -19,7 +19,7 @@ const renderComponent = (store: any, abortFunction = () => {}) =>
render(
-
+
,
)
diff --git a/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/index.tsx b/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/index.tsx
index f99f32edd7..17afde7751 100644
--- a/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/index.tsx
+++ b/src/app/pages/OpenWalletPage/Features/ImportAccountsSelectionModal/index.tsx
@@ -47,7 +47,7 @@ function ImportAccountsSelector({ accounts }: ImportAccountsSelectorSelectorProp
interface ImportAccountsSelectionModalProps {
abort: () => void
- type: WalletType.Mnemonic | WalletType.Ledger
+ type: WalletType.Mnemonic | WalletType.UsbLedger
}
interface FormValue extends ChoosePasswordFieldsFormValue {}
@@ -64,7 +64,7 @@ export function ImportAccountsSelectionModal(props: ImportAccountsSelectionModal
const openAccounts = ({ value }: { value: FormValue }) => {
dispatch(
- props.type === WalletType.Ledger
+ props.type === WalletType.UsbLedger
? walletActions.openWalletsFromLedger({ choosePassword: value.password2 })
: walletActions.openWalletFromMnemonic({ choosePassword: value.password2 }),
)
@@ -84,7 +84,7 @@ export function ImportAccountsSelectionModal(props: ImportAccountsSelectionModal
const onNext = () => {
dispatch(importAccountsActions.setPage(pageNum + 1))
if (props.type === 'ledger') {
- dispatch(importAccountsActions.enumerateMoreAccountsFromLedger(WalletType.Ledger))
+ dispatch(importAccountsActions.enumerateMoreAccountsFromLedger(WalletType.UsbLedger))
}
}
diff --git a/src/app/pages/ParaTimesPage/useParaTimesNavigation.ts b/src/app/pages/ParaTimesPage/useParaTimesNavigation.ts
index 9f16330642..7559d06836 100644
--- a/src/app/pages/ParaTimesPage/useParaTimesNavigation.ts
+++ b/src/app/pages/ParaTimesPage/useParaTimesNavigation.ts
@@ -24,7 +24,7 @@ export const useParaTimesNavigation = (): ParaTimesNavigationHook => {
const { t } = useTranslation()
const dispatch = useDispatch()
const walletType = useSelector(selectType)
- const canAccessParaTimesRoute = backend() === BackendAPIs.OasisScan && walletType !== WalletType.Ledger
+ const canAccessParaTimesRoute = backend() === BackendAPIs.OasisScan && walletType !== WalletType.UsbLedger
const getParaTimesRoutePath = (address: string) => `/account/${address}/paratimes`
const navigateToDeposit = useCallback(() => dispatch(paraTimesActions.navigateToDeposit()), [dispatch])
const navigateToWithdraw = useCallback(() => dispatch(paraTimesActions.navigateToWithdraw()), [dispatch])
diff --git a/src/app/state/importaccounts/saga.test.ts b/src/app/state/importaccounts/saga.test.ts
index 411f43afd0..b67e0f21a8 100644
--- a/src/app/state/importaccounts/saga.test.ts
+++ b/src/app/state/importaccounts/saga.test.ts
@@ -38,7 +38,7 @@ describe('importAccounts Sagas', () => {
[matchers.call.fn(Ledger.deriveAccountUsingOasisApp), validAccount],
[matchers.call.fn(getAccountBalanceWithFallback), {}],
])
- .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
.put.actionType(importAccountsActions.accountGenerated.type)
.put.actionType(importAccountsActions.accountGenerated.type)
.put.actionType(importAccountsActions.accountGenerated.type)
@@ -96,7 +96,7 @@ describe('importAccounts Sagas', () => {
},
],
])
- .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
.put.like({ action: { payload: { code: WalletErrors.USBTransportNotSupported } } })
.silentRun(50)
})
@@ -108,7 +108,7 @@ describe('importAccounts Sagas', () => {
[matchers.call.fn(TransportWebUSB.isSupported), true],
[matchers.call.fn(TransportWebUSB.create), Promise.reject(new Error('No device selected'))],
])
- .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
.put.like({ action: { payload: { code: WalletErrors.LedgerNoDeviceSelected } } })
.silentRun(50)
})
@@ -120,7 +120,7 @@ describe('importAccounts Sagas', () => {
[matchers.call.fn(TransportWebUSB.isSupported), true],
[matchers.call.fn(TransportWebUSB.create), Promise.reject(new Error('Dummy error'))],
])
- .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
.put.like({ action: { payload: { code: WalletErrors.USBTransportError, message: 'Dummy error' } } })
.silentRun(50)
})
@@ -139,7 +139,7 @@ describe('importAccounts Sagas', () => {
[matchers.call.fn(Ledger.getOasisApp), undefined],
[matchers.call.fn(Ledger.deriveAccountUsingOasisApp), Promise.reject(new Error('Dummy error'))],
])
- .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.Ledger))
+ .dispatch(importAccountsActions.enumerateAccountsFromLedger(WalletType.UsbLedger))
.put.like({ action: { payload: { code: WalletErrors.UnknownError, message: 'Dummy error' } } })
.silentRun(50)
})
diff --git a/src/app/state/transaction/saga.ts b/src/app/state/transaction/saga.ts
index 403960d697..8b10ccf824 100644
--- a/src/app/state/transaction/saga.ts
+++ b/src/app/state/transaction/saga.ts
@@ -59,7 +59,7 @@ function* getSigner() {
if (wallet.type === WalletType.PrivateKey || wallet.type === WalletType.Mnemonic) {
const bytes = hex2uint(privateKey!)
signer = yield* call(signerFromPrivateKey, bytes)
- } else if (wallet.type === WalletType.Ledger || wallet.type === WalletType.BleLedger) {
+ } else if (wallet.type === WalletType.UsbLedger || wallet.type === WalletType.BleLedger) {
signer = new LedgerSigner(wallet)
} else {
throw new ExhaustedTypeError('Invalid wallet type', wallet.type)
@@ -190,7 +190,7 @@ export function* doTransaction(action: PayloadAction) {
yield* setStep(TransactionStep.Signing)
- if (activeWallet.type === WalletType.Ledger || activeWallet.type === WalletType.BleLedger) {
+ if (activeWallet.type === WalletType.UsbLedger || activeWallet.type === WalletType.BleLedger) {
yield* call(sign, signer as LedgerSigner, tw)
} else {
yield* call(OasisTransaction.sign, chainContext, signer as Signer, tw)
diff --git a/src/app/state/wallet/saga.ts b/src/app/state/wallet/saga.ts
index 0f38435bd2..09c95f1b41 100644
--- a/src/app/state/wallet/saga.ts
+++ b/src/app/state/wallet/saga.ts
@@ -51,7 +51,7 @@ export function* openWalletsFromLedger({ payload }: PayloadAction