@alephium/ledger-app 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/index.js CHANGED
@@ -28,7 +28,6 @@ const web3_1 = require("@alephium/web3");
28
28
  const hw_transport_1 = require("@ledgerhq/hw-transport");
29
29
  const serde = __importStar(require("./serde"));
30
30
  const elliptic_1 = require("elliptic");
31
- const console_1 = require("console");
32
31
  const ec = new elliptic_1.ec('secp256k1');
33
32
  exports.CLA = 0x80;
34
33
  var INS;
@@ -50,7 +49,9 @@ class AlephiumApp {
50
49
  }
51
50
  // TODO: make address display optional
52
51
  async getAccount(startPath, targetGroup) {
53
- (0, console_1.assert)((targetGroup ?? 0) < exports.GROUP_NUM);
52
+ if ((targetGroup ?? 0) >= exports.GROUP_NUM) {
53
+ throw Error(`Invalid targetGroup: ${targetGroup}`);
54
+ }
54
55
  const p1 = targetGroup === undefined ? 0x00 : exports.GROUP_NUM;
55
56
  const p2 = targetGroup === undefined ? 0x00 : targetGroup;
56
57
  const response = await this.transport.send(exports.CLA, INS.GET_PUBLIC_KEY, p1, p2, serde.serializePath(startPath));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/ledger-app",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "GPL",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "exports": {
package/src/index.ts CHANGED
@@ -2,7 +2,6 @@ import { Account, addressFromPublicKey, encodeHexSignature, groupOfAddress } fro
2
2
  import Transport, { StatusCodes } from '@ledgerhq/hw-transport'
3
3
  import * as serde from './serde'
4
4
  import { ec as EC } from 'elliptic'
5
- import { assert } from 'console'
6
5
 
7
6
  const ec = new EC('secp256k1')
8
7
 
@@ -31,7 +30,10 @@ export default class AlephiumApp {
31
30
 
32
31
  // TODO: make address display optional
33
32
  async getAccount(startPath: string, targetGroup?: number): Promise<Account> {
34
- assert((targetGroup ?? 0) < GROUP_NUM)
33
+ if ((targetGroup ?? 0) >= GROUP_NUM) {
34
+ throw Error(`Invalid targetGroup: ${targetGroup}`)
35
+ }
36
+
35
37
  const p1 = targetGroup === undefined ? 0x00 : GROUP_NUM
36
38
  const p2 = targetGroup === undefined ? 0x00 : targetGroup
37
39
  const response = await this.transport.send(CLA, INS.GET_PUBLIC_KEY, p1, p2, serde.serializePath(startPath))