Skip to content

Commit

Permalink
Merge branch 'main' into balance-disorder
Browse files Browse the repository at this point in the history
  • Loading branch information
mhluongo authored Feb 26, 2022
2 parents 561fd25 + 483c0dd commit 11131a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions background/services/ledger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { getOrCreateDB, LedgerDatabase } from "./db"
import { ethersTransactionRequestFromEIP1559TransactionRequest } from "../chain/utils"
import { ETH } from "../../constants"
import { normalizeEVMAddress } from "../../lib/utils"
import { HIDE_IMPORT_LEDGER } from "../../features/features"

enum LedgerType {
UNKNOWN,
Expand All @@ -37,6 +38,9 @@ export const LedgerProductDatabase = {
LEDGER_NANO_X: { productId: 0x4015 },
}

export const isLedgerSupported =
!HIDE_IMPORT_LEDGER && typeof navigator.usb === "object"

const TestedProductId = (productId: number): boolean => {
return Object.values(LedgerProductDatabase).some(
(e) => e.productId === productId
Expand Down
6 changes: 2 additions & 4 deletions ui/pages/Onboarding/OnboardingAddWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { ReactElement } from "react"
import {
HIDE_ADD_SEED,
HIDE_CREATE_PHRASE,
HIDE_IMPORT_LEDGER,
} from "@tallyho/tally-background/features/features"
import { isLedgerSupported } from "@tallyho/tally-background/services/ledger"
import SharedBackButton from "../../components/Shared/SharedBackButton"
import SharedButton from "../../components/Shared/SharedButton"

Expand Down Expand Up @@ -45,9 +45,7 @@ export default function OnboardingStartTheHunt(): ReactElement {
</SharedButton>
</li>
)}
{HIDE_IMPORT_LEDGER ? (
<></>
) : (
{isLedgerSupported && (
<li className="option standard_width">
<div className="icon ledger_icon" />
<SharedButton
Expand Down
9 changes: 6 additions & 3 deletions ui/pages/SignTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ export default function SignTransaction({
const signingMethod = signerAccountTotal?.signingMethod ?? null
if (
typeof transactionDetails === "undefined" ||
typeof signerAccountTotal === "undefined" ||
signingMethod === null
typeof signerAccountTotal === "undefined"
) {
// TODO Some sort of unexpected state error if we end up here... Or do we
// go back in history? That won't work for dApp popovers though.
Expand All @@ -122,7 +121,11 @@ export default function SignTransaction({
await dispatch(rejectTransactionSignature())
}
const handleConfirm = async () => {
if (isTransactionDataReady && transactionDetails) {
if (
isTransactionDataReady &&
transactionDetails &&
signingMethod !== null
) {
dispatch(
signTransaction({
transaction: transactionDetails,
Expand Down

0 comments on commit 11131a7

Please sign in to comment.