@trezor/connect 9.0.0-beta.6 → 9.0.1

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.
Files changed (86) hide show
  1. package/README.md +32 -19
  2. package/lib/api/binanceSignTransaction.js +1 -1
  3. package/lib/api/bitcoin/Fees.js +1 -1
  4. package/lib/api/bitcoin/TransactionComposer.js +1 -1
  5. package/lib/api/bitcoin/index.js +9 -9
  6. package/lib/api/bitcoin/refTx.d.ts +2 -2
  7. package/lib/api/checkFirmwareAuthenticity.d.ts +10 -0
  8. package/lib/api/checkFirmwareAuthenticity.js +44 -0
  9. package/lib/api/common/Discovery.js +1 -1
  10. package/lib/api/common/paramsValidator.d.ts +1 -1
  11. package/lib/api/composeTransaction.js +2 -2
  12. package/lib/api/eos/eosSignTx.js +1 -1
  13. package/lib/api/eosSignTransaction.js +1 -1
  14. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +1 -1
  15. package/lib/api/ethereum/ethereumSignTx.d.ts +2 -2
  16. package/lib/api/ethereum/ethereumSignTypedData.js +1 -1
  17. package/lib/api/ethereumSignTransaction.js +1 -1
  18. package/lib/api/firmware/calculateFirmwareHash.d.ts +1 -1
  19. package/lib/api/firmwareUpdate.js +1 -1
  20. package/lib/api/index.d.ts +1 -1
  21. package/lib/api/index.js +4 -4
  22. package/lib/api/nemSignTransaction.js +1 -1
  23. package/lib/api/signTransaction.js +1 -1
  24. package/lib/api/stellarSignTransaction.js +1 -1
  25. package/lib/api/tezos/tezosSignTx.js +1 -1
  26. package/lib/api/tezosSignTransaction.js +1 -1
  27. package/lib/backend/BlockchainLink.js +1 -1
  28. package/lib/constants/errors.d.ts +1 -2
  29. package/lib/constants/errors.js +0 -1
  30. package/lib/constants/index.js +5 -5
  31. package/lib/core/AbstractMethod.d.ts +0 -1
  32. package/lib/core/AbstractMethod.js +1 -2
  33. package/lib/core/index.d.ts +1 -1
  34. package/lib/core/index.js +1 -14
  35. package/lib/core/method.d.ts +1 -1
  36. package/lib/core/method.js +1 -1
  37. package/lib/data/DataManager.d.ts +2 -4
  38. package/lib/data/DataManager.js +4 -9
  39. package/lib/data/config.d.ts +1 -7
  40. package/lib/data/config.js +1 -9
  41. package/lib/data/connectSettings.d.ts +1 -1
  42. package/lib/data/version.d.ts +1 -1
  43. package/lib/data/version.js +1 -1
  44. package/lib/device/AbortController.js +1 -1
  45. package/lib/device/DescriptorStream.js +1 -1
  46. package/lib/device/Device.d.ts +1 -0
  47. package/lib/device/Device.js +9 -1
  48. package/lib/device/DeviceCommands.js +2 -2
  49. package/lib/device/DeviceList.d.ts +1 -5
  50. package/lib/device/DeviceList.js +7 -35
  51. package/lib/events/index.d.ts +0 -2
  52. package/lib/events/index.js +10 -10
  53. package/lib/events/ui-request.d.ts +1 -9
  54. package/lib/events/ui-request.js +0 -1
  55. package/lib/events/ui-response.d.ts +1 -10
  56. package/lib/events/ui-response.js +0 -1
  57. package/lib/exports.js +3 -3
  58. package/lib/factory.d.ts +1 -2
  59. package/lib/factory.js +2 -2
  60. package/lib/index-browser.js +1 -2
  61. package/lib/index.js +2 -35
  62. package/lib/types/api/checkFirmwareAuthenticity.d.ts +8 -0
  63. package/lib/types/api/{customMessage.js → checkFirmwareAuthenticity.js} +1 -1
  64. package/lib/types/api/index.d.ts +2 -2
  65. package/lib/types/device.d.ts +4 -0
  66. package/lib/types/index.js +15 -15
  67. package/lib/utils/__fixtures__/accountUtils.js +1 -1
  68. package/lib/utils/__fixtures__/ethereumUtils.js +1 -1
  69. package/lib/utils/__fixtures__/formatUtils.js +1 -1
  70. package/lib/utils/accountUtils.d.ts +2 -2
  71. package/lib/utils/assets-browser.js +1 -1
  72. package/lib/utils/assets.js +1 -1
  73. package/lib/utils/browserUtils.js +1 -1
  74. package/lib/utils/debug.d.ts +2 -2
  75. package/lib/utils/deviceFeaturesUtils.d.ts +1 -1
  76. package/lib/utils/ethereumUtils.d.ts +1 -1
  77. package/lib/utils/formatUtils.js +1 -1
  78. package/lib/utils/hdnodeUtils.d.ts +1 -1
  79. package/lib/utils/pathUtils.d.ts +2 -2
  80. package/lib/workers/workers-browser.js +5 -5
  81. package/lib/workers/workers-react-native.js +4 -4
  82. package/lib/workers/workers.js +4 -4
  83. package/package.json +16 -13
  84. package/lib/api/customMessage.d.ts +0 -13
  85. package/lib/api/customMessage.js +0 -56
  86. package/lib/types/api/customMessage.d.ts +0 -12
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./api"), exports);
5
- (0, tslib_1.__exportStar)(require("./account"), exports);
6
- (0, tslib_1.__exportStar)(require("./coinInfo"), exports);
7
- (0, tslib_1.__exportStar)(require("./device"), exports);
8
- (0, tslib_1.__exportStar)(require("./firmware"), exports);
9
- (0, tslib_1.__exportStar)(require("./params"), exports);
10
- (0, tslib_1.__exportStar)(require("./settings"), exports);
11
- (0, tslib_1.__exportStar)(require("./api/cardano"), exports);
12
- (0, tslib_1.__exportStar)(require("./api/binance"), exports);
13
- (0, tslib_1.__exportStar)(require("./api/bitcoin"), exports);
14
- (0, tslib_1.__exportStar)(require("./api/eos"), exports);
15
- (0, tslib_1.__exportStar)(require("./api/ripple"), exports);
16
- (0, tslib_1.__exportStar)(require("./api/ethereum"), exports);
17
- (0, tslib_1.__exportStar)(require("./api/stellar"), exports);
18
- (0, tslib_1.__exportStar)(require("./api/tezos"), exports);
4
+ tslib_1.__exportStar(require("./api"), exports);
5
+ tslib_1.__exportStar(require("./account"), exports);
6
+ tslib_1.__exportStar(require("./coinInfo"), exports);
7
+ tslib_1.__exportStar(require("./device"), exports);
8
+ tslib_1.__exportStar(require("./firmware"), exports);
9
+ tslib_1.__exportStar(require("./params"), exports);
10
+ tslib_1.__exportStar(require("./settings"), exports);
11
+ tslib_1.__exportStar(require("./api/cardano"), exports);
12
+ tslib_1.__exportStar(require("./api/binance"), exports);
13
+ tslib_1.__exportStar(require("./api/bitcoin"), exports);
14
+ tslib_1.__exportStar(require("./api/eos"), exports);
15
+ tslib_1.__exportStar(require("./api/ripple"), exports);
16
+ tslib_1.__exportStar(require("./api/ethereum"), exports);
17
+ tslib_1.__exportStar(require("./api/stellar"), exports);
18
+ tslib_1.__exportStar(require("./api/tezos"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isUtxoBasedFixtures = exports.getAccountLabelFixtures = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const coins_json_1 = (0, tslib_1.__importDefault)(require("@trezor/connect-common/files/coins.json"));
5
+ const coins_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins.json"));
6
6
  const coinInfo_1 = require("../../data/coinInfo");
7
7
  (0, coinInfo_1.parseCoinsJson)(coins_json_1.default);
8
8
  exports.getAccountLabelFixtures = [
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNetworkLabelFixtures = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const coins_json_1 = (0, tslib_1.__importDefault)(require("@trezor/connect-common/files/coins.json"));
5
+ const coins_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins.json"));
6
6
  const coinInfo_1 = require("../../data/coinInfo");
7
7
  (0, coinInfo_1.parseCoinsJson)(coins_json_1.default);
8
8
  exports.getNetworkLabelFixtures = [
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatAmountFixtures = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const coins_json_1 = (0, tslib_1.__importDefault)(require("@trezor/connect-common/files/coins.json"));
5
+ const coins_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins.json"));
6
6
  const coinInfo_1 = require("../../data/coinInfo");
7
7
  (0, coinInfo_1.parseCoinsJson)(coins_json_1.default);
8
8
  exports.formatAmountFixtures = [
@@ -3,9 +3,9 @@ declare type Bip44Options = {
3
3
  purpose?: number;
4
4
  coinType?: number;
5
5
  };
6
- export declare const getAccountAddressN: (coinInfo: CoinInfo, accountIndex: number, bip44?: Bip44Options | undefined) => number[];
6
+ export declare const getAccountAddressN: (coinInfo: CoinInfo, accountIndex: number, bip44?: Bip44Options) => number[];
7
7
  export declare const getAccountLabel: (path: number[], coinInfo: CoinInfo) => string;
8
- export declare const getPublicKeyLabel: (path: number[], coinInfo?: BitcoinNetworkInfo | undefined) => string;
8
+ export declare const getPublicKeyLabel: (path: number[], coinInfo?: BitcoinNetworkInfo) => string;
9
9
  export declare const isUtxoBased: (coinInfo: CoinInfo) => boolean;
10
10
  export {};
11
11
  //# sourceMappingURL=accountUtils.d.ts.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.httpRequest = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const cross_fetch_1 = (0, tslib_1.__importDefault)(require("cross-fetch"));
5
+ const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
6
6
  const httpRequest = async (url, type = 'text') => {
7
7
  const response = await (0, cross_fetch_1.default)(url, { credentials: 'same-origin' });
8
8
  if (response.ok) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.httpRequest = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const cross_fetch_1 = (0, tslib_1.__importDefault)(require("cross-fetch"));
5
+ const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
6
6
  const fs_1 = require("fs");
7
7
  const assets_browser_1 = require("./assets-browser");
8
8
  const assetUtils_1 = require("./assetUtils");
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.suggestUdevInstaller = exports.suggestBridgeInstaller = exports.getSuggestedPlatform = exports.getOS = exports.getBrowserState = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const bowser_1 = (0, tslib_1.__importDefault)(require("bowser"));
5
+ const bowser_1 = tslib_1.__importDefault(require("bowser"));
6
6
  const transportInfo_1 = require("../data/transportInfo");
7
7
  const udevInfo_1 = require("../data/udevInfo");
8
8
  const DEFAULT_STATE = {
@@ -16,8 +16,8 @@ declare class Log {
16
16
  warn(...args: any[]): void;
17
17
  debug(...args: any[]): void;
18
18
  }
19
- export declare const initLog: (prefix: string, enabled?: boolean | undefined) => Log;
20
- export declare const enableLog: (enabled?: boolean | undefined) => void;
19
+ export declare const initLog: (prefix: string, enabled?: boolean) => Log;
20
+ export declare const enableLog: (enabled?: boolean) => void;
21
21
  export declare const enableLogByPrefix: (prefix: string, enabled: boolean) => void;
22
22
  export declare const getLog: () => LogMessage[];
23
23
  export {};
@@ -1,6 +1,6 @@
1
1
  import { PROTO } from '../constants';
2
2
  import type { Features, CoinInfo, UnavailableCapabilities } from '../types';
3
- export declare const parseCapabilities: (features?: PROTO.Features | undefined) => PROTO.Capability[];
3
+ export declare const parseCapabilities: (features?: Features) => PROTO.Capability[];
4
4
  export declare const getUnavailableCapabilities: (features: Features, coins: CoinInfo[]) => UnavailableCapabilities;
5
5
  export declare const parseRevision: (features: Features) => string | null;
6
6
  //# sourceMappingURL=deviceFeaturesUtils.d.ts.map
@@ -1,3 +1,3 @@
1
1
  import type { CoinInfo } from '../types';
2
- export declare const getNetworkLabel: (label: string, network?: CoinInfo | undefined) => string;
2
+ export declare const getNetworkLabel: (label: string, network?: CoinInfo) => string;
3
3
  //# sourceMappingURL=ethereumUtils.d.ts.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.messageToHex = exports.stripHexPrefix = exports.hasHexPrefix = exports.btckb2satoshib = exports.formatTime = exports.formatAmount = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const bignumber_js_1 = (0, tslib_1.__importDefault)(require("bignumber.js"));
5
+ const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
6
6
  const formatAmount = (n, coinInfo) => `${new bignumber_js_1.default(n).div(10 ** coinInfo.decimals).toString(10)} ${coinInfo.shortcut}`;
7
7
  exports.formatAmount = formatAmount;
8
8
  const formatTime = (n) => {
@@ -1,6 +1,6 @@
1
1
  import type { Network } from '@trezor/utxo-lib';
2
2
  import { PROTO } from '../constants';
3
- export declare const convertXpub: (xpub: string, originalNetwork?: Network | undefined, requestedNetwork?: Network | undefined) => string;
3
+ export declare const convertXpub: (xpub: string, originalNetwork?: Network, requestedNetwork?: Network) => string;
4
4
  export declare const convertBitcoinXpub: (xpub: string, network: Network) => string;
5
5
  export declare function xpubDerive<PK extends PROTO.PublicKey | PROTO.EthereumPublicKey>(xpub: PK, childXPub: PK, suffix: number, network?: Network, _requestedNetwork?: Network): PK;
6
6
  export declare const xpubToHDNodeType: (xpub: string, network: Network) => PROTO.HDNodeType;
@@ -10,11 +10,11 @@ export declare const isBech32Path: (path: number[] | undefined) => boolean;
10
10
  export declare const isTaprootPath: (path: number[] | undefined) => boolean;
11
11
  export declare const getAccountType: (path: number[] | undefined) => "p2pkh" | "p2sh" | "p2tr" | "p2wpkh";
12
12
  export declare const getScriptType: (path: number[] | undefined) => PROTO.InternalInputScriptType;
13
- export declare const getOutputScriptType: (path?: number[] | undefined) => PROTO.ChangeOutputScriptType;
13
+ export declare const getOutputScriptType: (path?: number[]) => PROTO.ChangeOutputScriptType;
14
14
  export declare const validatePath: (path: string | number[], length?: number, base?: boolean) => number[];
15
15
  export declare const getSerializedPath: (path: number[]) => string;
16
16
  export declare const getPathFromIndex: (bip44purpose: number, bip44cointype: number, index: number) => number[];
17
17
  export declare const getIndexFromPath: (path: number[]) => number;
18
18
  export declare const fixPath: <T extends PROTO.TxInputType | PROTO.TxOutputType>(utxo: T) => T;
19
- export declare const getLabel: (label: string, coinInfo?: CoinInfo | undefined) => string;
19
+ export declare const getLabel: (label: string, coinInfo?: CoinInfo) => string;
20
20
  //# sourceMappingURL=pathUtils.d.ts.map
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const sharedConnectionWorker_1 = (0, tslib_1.__importDefault)(require("@trezor/transport/lib/lowlevel/sharedConnectionWorker"));
6
- const blockbook_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockbook"));
5
+ const sharedConnectionWorker_1 = tslib_1.__importDefault(require("@trezor/transport/lib/lowlevel/sharedConnectionWorker"));
6
+ const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
7
7
  exports.BlockbookWorker = blockbook_1.default;
8
- const ripple_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/ripple"));
8
+ const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/ripple"));
9
9
  exports.RippleWorker = ripple_1.default;
10
- const blockfrost_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockfrost"));
10
+ const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockfrost"));
11
11
  exports.BlockfrostWorker = blockfrost_1.default;
12
- const transport_1 = (0, tslib_1.__importDefault)(require("@trezor/transport"));
12
+ const transport_1 = tslib_1.__importDefault(require("@trezor/transport"));
13
13
  const WebUsbPlugin = () => new transport_1.default.Lowlevel(new transport_1.default.WebUsb(), typeof SharedWorker !== 'undefined' ? () => new sharedConnectionWorker_1.default() : null);
14
14
  exports.WebUsbPlugin = WebUsbPlugin;
15
15
  const ReactNativeUsbPlugin = undefined;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const blockbook_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockbook"));
5
+ const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
6
6
  exports.BlockbookWorker = blockbook_1.default;
7
- const ripple_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/ripple"));
7
+ const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/ripple"));
8
8
  exports.RippleWorker = ripple_1.default;
9
- const blockfrost_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockfrost"));
9
+ const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockfrost"));
10
10
  exports.BlockfrostWorker = blockfrost_1.default;
11
- const transport_1 = (0, tslib_1.__importDefault)(require("@trezor/transport"));
11
+ const transport_1 = tslib_1.__importDefault(require("@trezor/transport"));
12
12
  const RNUsbPlugin_1 = require("./RNUsbPlugin");
13
13
  const WebUsbPlugin = undefined;
14
14
  exports.WebUsbPlugin = WebUsbPlugin;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const blockbook_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockbook"));
5
+ const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
6
6
  exports.BlockbookWorker = blockbook_1.default;
7
- const ripple_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/ripple"));
7
+ const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/ripple"));
8
8
  exports.RippleWorker = ripple_1.default;
9
- const blockfrost_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/blockfrost"));
9
+ const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockfrost"));
10
10
  exports.BlockfrostWorker = blockfrost_1.default;
11
- const electrum_1 = (0, tslib_1.__importDefault)(require("@trezor/blockchain-link/lib/workers/electrum"));
11
+ const electrum_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/electrum"));
12
12
  exports.ElectrumWorker = electrum_1.default;
13
13
  const WebUsbPlugin = undefined;
14
14
  exports.WebUsbPlugin = WebUsbPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.0.0-beta.6",
3
+ "version": "9.0.1",
4
4
  "author": "Trezor <info@trezor.io>",
5
5
  "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
6
6
  "description": "High-level javascript interface for Trezor hardware wallet.",
@@ -21,8 +21,8 @@
21
21
  "main": "lib/index",
22
22
  "browser": {
23
23
  "./lib/index": "./lib/index-browser",
24
- "./lib/workers/workers": "./lib/workers/workers-browser",
25
- "./lib/utils/assets": "./lib/utils/assets-browser"
24
+ "./lib/utils/assets": "./lib/utils/assets-browser",
25
+ "./lib/workers/workers": "./lib/workers/workers-browser"
26
26
  },
27
27
  "react-native": {
28
28
  "./lib/index": "./lib/index",
@@ -34,22 +34,22 @@
34
34
  "!**/*.map"
35
35
  ],
36
36
  "scripts": {
37
- "lint": "eslint '**/*.{ts,tsx,js}'",
37
+ "lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
38
38
  "test:unit": "jest",
39
39
  "type-check": "tsc --build",
40
- "build:lib": "rimraf ./lib && tsc --build tsconfig.lib.json",
41
- "version:beta": "node scripts/bump-version.js prerelease",
42
- "version:patch": "node scripts/bump-version.js patch",
43
- "version:minor": "node scripts/bump-version.js minor",
44
- "version:major": "node scripts/bump-version.js major"
40
+ "build:lib": "rimraf ./lib && yarn tsc --build tsconfig.lib.json",
41
+ "version:beta": "tsx scripts/bump-version.ts prerelease",
42
+ "version:patch": "tsx scripts/bump-version.ts patch",
43
+ "version:minor": "tsx scripts/bump-version.ts minor",
44
+ "version:major": "tsx scripts/bump-version.ts major"
45
45
  },
46
46
  "dependencies": {
47
- "@trezor/blockchain-link": "^2.1.3",
48
- "@trezor/connect-common": "0.0.8",
47
+ "@trezor/blockchain-link": "^2.1.4",
48
+ "@trezor/connect-common": "0.0.9",
49
49
  "@trezor/transport": "^1.1.4",
50
50
  "@trezor/utils": "^9.0.2",
51
51
  "@trezor/utxo-lib": "^1.0.0",
52
- "bignumber.js": "^9.0.2",
52
+ "bignumber.js": "^9.1.0",
53
53
  "blakejs": "^1.2.1",
54
54
  "bowser": "^2.11.0",
55
55
  "cross-fetch": "^3.1.5",
@@ -61,6 +61,9 @@
61
61
  "devDependencies": {
62
62
  "@types/parse-uri": "^1.0.0",
63
63
  "@types/randombytes": "^2.0.0",
64
- "version-bump-prompt": "^6.1.0"
64
+ "jest": "^26.6.3",
65
+ "rimraf": "^3.0.2",
66
+ "tsx": "^3.8.2",
67
+ "typescript": "4.7.4"
65
68
  }
66
69
  }
@@ -1,13 +0,0 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- declare type Params = {
3
- customMessages?: JSON | Record<string, any>;
4
- message: string;
5
- params?: any;
6
- };
7
- export default class CustomMessage extends AbstractMethod<'customMessage', Params> {
8
- init(): void;
9
- getCustomMessages(): JSON | Record<string, any> | undefined;
10
- run(): Promise<any>;
11
- }
12
- export {};
13
- //# sourceMappingURL=customMessage.d.ts.map
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const paramsValidator_1 = require("./common/paramsValidator");
5
- const constants_1 = require("../constants");
6
- const events_1 = require("../events");
7
- class CustomMessage extends AbstractMethod_1.AbstractMethod {
8
- init() {
9
- this.requiredPermissions = ['custom-message', 'read', 'write'];
10
- this.info = 'Custom message';
11
- const { payload } = this;
12
- (0, paramsValidator_1.validateParams)(payload, [
13
- { name: 'message', type: 'string', required: true },
14
- { name: 'params', type: 'object', required: true },
15
- ]);
16
- if (payload.messages) {
17
- try {
18
- JSON.parse(JSON.stringify(payload.messages));
19
- }
20
- catch (error) {
21
- throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Parameter "messages" has invalid type. JSON expected.');
22
- }
23
- }
24
- this.params = {
25
- customMessages: payload.messages,
26
- message: payload.message,
27
- params: payload.params,
28
- };
29
- }
30
- getCustomMessages() {
31
- return this.params.customMessages;
32
- }
33
- async run() {
34
- if (this.device.features.vendor === 'trezor.io' ||
35
- this.device.features.vendor === 'bitcointrezor.com') {
36
- throw constants_1.ERRORS.TypedError('Runtime', 'Cannot use custom message on device with official firmware. Change device "vendor" field.');
37
- }
38
- const response = await this.device
39
- .getCommands()
40
- ._commonCall(this.params.message, this.params.params);
41
- const uiPromise = this.createUiPromise(events_1.UI.CUSTOM_MESSAGE_RESPONSE);
42
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.CUSTOM_MESSAGE_REQUEST, response));
43
- const uiResp = await uiPromise.promise;
44
- const { payload } = uiResp;
45
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'message', type: 'string', required: true }]);
46
- if (payload.message.toLowerCase() === 'release') {
47
- return response;
48
- }
49
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'params', type: 'object', required: true }]);
50
- this.params.message = payload.message;
51
- this.params.params = payload.params;
52
- return this.run();
53
- }
54
- }
55
- exports.default = CustomMessage;
56
- //# sourceMappingURL=customMessage.js.map
@@ -1,12 +0,0 @@
1
- import type { Params, Response } from '../params';
2
- export interface CustomMessage {
3
- messages?: JSON | Record<string, any>;
4
- message: string;
5
- params: JSON | Record<string, any>;
6
- callback: (request: any) => Promise<{
7
- message: string;
8
- params?: Record<string, any>;
9
- }>;
10
- }
11
- export declare function customMessage<R extends Record<string, any>>(params: Params<CustomMessage>): Response<R>;
12
- //# sourceMappingURL=customMessage.d.ts.map