Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
have hw-app-eth specific error and add one for NFT clear signing (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
gre authored Jan 6, 2022
1 parent b7c891f commit b300cfc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/hw-app-eth/src/Eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
* limitations under the License.
********************************************************************************/
// FIXME drop:
import { EthAppPleaseEnableContractData } from "@ledgerhq/errors";
import type Transport from "@ledgerhq/hw-transport";
import { BigNumber } from "bignumber.js";
import { decodeTxInfo } from "./utils";
// NB: these are temporary import for the deprecated fallback mechanism
import { LedgerEthTransactionResolution, LoadConfig } from "./services/types";
import ledgerService from "./services/ledger";
import {
EthAppNftNotSupported,
EthAppPleaseEnableContractData,
} from "./errors";

export type StarkQuantizationType =
| "eth"
Expand Down Expand Up @@ -1187,8 +1190,8 @@ function provideNFTInformation(
return false;
}
if (e && e.statusCode === 0x6d00) {
// ignore older version of ETH app
return false;
// older version of ETH app => error because we don't allow blind sign when NFT is explicitly requested to be resolved.
throw new EthAppNftNotSupported();
}
throw e;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/hw-app-eth/src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createCustomErrorClass } from "@ledgerhq/errors";

export const EthAppPleaseEnableContractData = createCustomErrorClass(
"EthAppPleaseEnableContractData"
);
export const EthAppNftNotSupported = createCustomErrorClass(
"EthAppNftNotSupported"
);

0 comments on commit b300cfc

Please sign in to comment.