@trezor/connect 9.0.1 → 9.0.3

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 (58) hide show
  1. package/README.md +5 -5
  2. package/lib/api/bitcoin/TransactionComposer.js +2 -1
  3. package/lib/api/bitcoin/outputs.js +2 -4
  4. package/lib/api/bitcoin/signtxVerify.d.ts +3 -3
  5. package/lib/api/bitcoin/signtxVerify.js +16 -15
  6. package/lib/api/getAddress.d.ts +2 -1
  7. package/lib/api/getAddress.js +12 -1
  8. package/lib/api/getPublicKey.d.ts +1 -0
  9. package/lib/api/getPublicKey.js +22 -7
  10. package/lib/api/index.d.ts +1 -0
  11. package/lib/api/index.js +3 -1
  12. package/lib/api/signTransaction.d.ts +1 -0
  13. package/lib/api/signTransaction.js +14 -2
  14. package/lib/api/unlockPath.d.ts +10 -0
  15. package/lib/api/unlockPath.js +35 -0
  16. package/lib/core/index.d.ts +1 -1
  17. package/lib/core/method.d.ts +1 -1
  18. package/lib/data/config.js +1 -1
  19. package/lib/data/version.d.ts +1 -1
  20. package/lib/data/version.js +1 -1
  21. package/lib/device/DeviceCommands.d.ts +7 -2
  22. package/lib/device/DeviceCommands.js +37 -25
  23. package/lib/events/ui-request.d.ts +40 -4
  24. package/lib/factory.js +1 -0
  25. package/lib/types/api/bitcoin/index.d.ts +1 -0
  26. package/lib/types/api/cardano/index.d.ts +3 -7
  27. package/lib/types/api/eos/index.d.ts +0 -4
  28. package/lib/types/api/eosGetPublicKey.d.ts +4 -4
  29. package/lib/types/api/getAddress.d.ts +1 -0
  30. package/lib/types/api/getPublicKey.d.ts +5 -0
  31. package/lib/types/api/index.d.ts +2 -0
  32. package/lib/types/api/unlockPath.d.ts +8 -0
  33. package/lib/types/api/unlockPath.js +3 -0
  34. package/lib/utils/assets.d.ts +1 -1
  35. package/lib/utils/assets.js +2 -2
  36. package/lib/utils/pathUtils.d.ts +2 -3
  37. package/lib/utils/pathUtils.js +42 -15
  38. package/package.json +12 -2
  39. package/lib/api/bitcoin/__fixtures__/inputs.d.ts +0 -112
  40. package/lib/api/bitcoin/__fixtures__/inputs.js +0 -102
  41. package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +0 -147
  42. package/lib/api/bitcoin/__fixtures__/signtxVerify.js +0 -216
  43. package/lib/api/common/__fixtures__/paramsValidator.d.ts +0 -596
  44. package/lib/api/common/__fixtures__/paramsValidator.js +0 -355
  45. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +0 -225
  46. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +0 -341
  47. package/lib/utils/__fixtures__/accountUtils.d.ts +0 -4
  48. package/lib/utils/__fixtures__/accountUtils.js +0 -32
  49. package/lib/utils/__fixtures__/addressUtils.d.ts +0 -10
  50. package/lib/utils/__fixtures__/addressUtils.js +0 -214
  51. package/lib/utils/__fixtures__/ethereumUtils.d.ts +0 -3
  52. package/lib/utils/__fixtures__/ethereumUtils.js +0 -20
  53. package/lib/utils/__fixtures__/formatUtils.d.ts +0 -3
  54. package/lib/utils/__fixtures__/formatUtils.js +0 -15
  55. package/lib/utils/__fixtures__/hdnodeUtils.d.ts +0 -186
  56. package/lib/utils/__fixtures__/hdnodeUtils.js +0 -206
  57. package/lib/utils/bip39.d.ts +0 -3
  58. package/lib/utils/bip39.js +0 -2053
@@ -43,10 +43,28 @@ export declare const UI_REQUEST: {
43
43
  readonly ADDRESS_VALIDATION: "ui-address_validation";
44
44
  readonly IFRAME_FAILURE: "ui-iframe_failure";
45
45
  };
46
- export interface UiRequestWithoutPayload {
47
- type: typeof UI_REQUEST.LOADING | typeof UI_REQUEST.REQUEST_UI_WINDOW | typeof UI_REQUEST.IFRAME_FAILURE | typeof UI_REQUEST.TRANSPORT | typeof UI_REQUEST.INSUFFICIENT_FUNDS | typeof UI_REQUEST.CLOSE_UI_WINDOW | typeof UI_REQUEST.LOGIN_CHALLENGE_REQUEST;
46
+ export declare type UiRequestWithoutPayload = {
47
+ type: typeof UI_REQUEST.LOADING;
48
48
  payload?: typeof undefined;
49
- }
49
+ } | {
50
+ type: typeof UI_REQUEST.REQUEST_UI_WINDOW;
51
+ payload?: typeof undefined;
52
+ } | {
53
+ type: typeof UI_REQUEST.IFRAME_FAILURE;
54
+ payload?: typeof undefined;
55
+ } | {
56
+ type: typeof UI_REQUEST.TRANSPORT;
57
+ payload?: typeof undefined;
58
+ } | {
59
+ type: typeof UI_REQUEST.INSUFFICIENT_FUNDS;
60
+ payload?: typeof undefined;
61
+ } | {
62
+ type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
63
+ payload?: typeof undefined;
64
+ } | {
65
+ type: typeof UI_REQUEST.LOGIN_CHALLENGE_REQUEST;
66
+ payload?: typeof undefined;
67
+ };
50
68
  export declare type UiRequestDeviceAction = {
51
69
  type: typeof UI_REQUEST.REQUEST_PIN;
52
70
  payload: {
@@ -60,7 +78,25 @@ export declare type UiRequestDeviceAction = {
60
78
  type: PROTO.WordRequestType;
61
79
  };
62
80
  } | {
63
- type: typeof UI_REQUEST.INVALID_PIN | typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE | typeof UI_REQUEST.REQUEST_PASSPHRASE | typeof UI_REQUEST.INVALID_PASSPHRASE;
81
+ type: typeof UI_REQUEST.INVALID_PIN;
82
+ payload: {
83
+ device: Device;
84
+ type?: typeof undefined;
85
+ };
86
+ } | {
87
+ type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
88
+ payload: {
89
+ device: Device;
90
+ type?: typeof undefined;
91
+ };
92
+ } | {
93
+ type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
94
+ payload: {
95
+ device: Device;
96
+ type?: typeof undefined;
97
+ };
98
+ } | {
99
+ type: typeof UI_REQUEST.INVALID_PASSPHRASE;
64
100
  payload: {
65
101
  device: Device;
66
102
  type?: typeof undefined;
package/lib/factory.js CHANGED
@@ -94,6 +94,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
94
94
  }),
95
95
  tezosGetPublicKey: params => call({ ...params, method: 'tezosGetPublicKey' }),
96
96
  tezosSignTransaction: params => call({ ...params, method: 'tezosSignTransaction' }),
97
+ unlockPath: params => call({ ...params, method: 'unlockPath' }),
97
98
  eosGetPublicKey: params => call({ ...params, method: 'eosGetPublicKey' }),
98
99
  eosSignTransaction: params => call({ ...params, method: 'eosSignTransaction' }),
99
100
  binanceGetAddress: params => call({
@@ -65,6 +65,7 @@ export interface SignTransaction {
65
65
  push?: boolean;
66
66
  preauthorized?: boolean;
67
67
  amountUnit?: PROTO.AmountUnit;
68
+ unlockPath?: PROTO.UnlockPath;
68
69
  }
69
70
  export declare type SignedTransaction = {
70
71
  signatures: string[];
@@ -1,4 +1,5 @@
1
1
  import type { PROTO } from '../../../constants';
2
+ import type { GetPublicKey, PublicKey } from '../../params';
2
3
  export interface CardanoCertificatePointer {
3
4
  blockIndex: number;
4
5
  txIndex: number;
@@ -46,15 +47,10 @@ export interface CardanoGetNativeScriptHash {
46
47
  export interface CardanoNativeScriptHash {
47
48
  scriptHash: string;
48
49
  }
49
- export interface CardanoGetPublicKey {
50
- path: string | number[];
51
- showOnTrezor?: boolean;
50
+ export interface CardanoGetPublicKey extends GetPublicKey {
52
51
  derivationType?: PROTO.CardanoDerivationType;
53
52
  }
54
- export interface CardanoPublicKey {
55
- path: number[];
56
- serializedPath: string;
57
- publicKey: string;
53
+ export interface CardanoPublicKey extends PublicKey {
58
54
  node: PROTO.HDNodeType;
59
55
  }
60
56
  export interface CardanoInput {
@@ -1,8 +1,4 @@
1
1
  import { PROTO } from '../../../constants';
2
- export interface EosGetPublicKey {
3
- path: string | number[];
4
- showOnTrezor?: boolean;
5
- }
6
2
  export interface EosPublicKey {
7
3
  wifPublicKey: string;
8
4
  rawPublicKey: string;
@@ -1,5 +1,5 @@
1
- import type { Params, BundledParams, Response } from '../params';
2
- import { EosGetPublicKey, EosPublicKey } from './eos';
3
- export declare function eosGetPublicKey(params: Params<EosGetPublicKey>): Response<EosPublicKey>;
4
- export declare function eosGetPublicKey(params: BundledParams<EosGetPublicKey>): Response<EosPublicKey[]>;
1
+ import type { Params, GetPublicKey, BundledParams, Response } from '../params';
2
+ import { EosPublicKey } from './eos';
3
+ export declare function eosGetPublicKey(params: Params<GetPublicKey>): Response<EosPublicKey>;
4
+ export declare function eosGetPublicKey(params: BundledParams<GetPublicKey>): Response<EosPublicKey[]>;
5
5
  //# sourceMappingURL=eosGetPublicKey.d.ts.map
@@ -5,6 +5,7 @@ interface GetAddress extends GetAddressShared {
5
5
  crossChain?: boolean;
6
6
  multisig?: PROTO.MultisigRedeemScriptType;
7
7
  scriptType?: PROTO.InternalInputScriptType;
8
+ unlockPath?: PROTO.UnlockPath;
8
9
  }
9
10
  declare type Address = AddressShared & PROTO.Address;
10
11
  export declare function getAddress(params: Params<GetAddress>): Response<Address>;
@@ -1,7 +1,12 @@
1
+ import type { PROTO } from '../../constants';
1
2
  import type { GetPublicKey as GetPublicKeyShared, Params, BundledParams, Response } from '../params';
2
3
  export interface GetPublicKey extends GetPublicKeyShared {
3
4
  coin?: string;
4
5
  crossChain?: boolean;
6
+ scriptType?: PROTO.InternalInputScriptType;
7
+ ignoreXpubMagic?: boolean;
8
+ ecdsaCurveName?: string;
9
+ unlockPath?: PROTO.UnlockPath;
5
10
  }
6
11
  export interface HDNodeResponse {
7
12
  path: number[];
@@ -69,6 +69,7 @@ import { tezosGetAddress } from './tezosGetAddress';
69
69
  import { tezosGetPublicKey } from './tezosGetPublicKey';
70
70
  import { tezosSignTransaction } from './tezosSignTransaction';
71
71
  import { uiResponse } from './uiResponse';
72
+ import { unlockPath } from './unlockPath';
72
73
  import { verifyMessage } from './verifyMessage';
73
74
  import { wipeDevice } from './wipeDevice';
74
75
  import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
@@ -144,6 +145,7 @@ export interface TrezorConnect {
144
145
  tezosGetPublicKey: typeof tezosGetPublicKey;
145
146
  tezosSignTransaction: typeof tezosSignTransaction;
146
147
  uiResponse: typeof uiResponse;
148
+ unlockPath: typeof unlockPath;
147
149
  verifyMessage: typeof verifyMessage;
148
150
  wipeDevice: typeof wipeDevice;
149
151
  checkFirmwareAuthenticity: typeof checkFirmwareAuthenticity;
@@ -0,0 +1,8 @@
1
+ import type { PROTO } from '../../constants';
2
+ import type { Params, Response } from '../params';
3
+ export interface UnlockPathParams {
4
+ path: string | number[];
5
+ mac?: string;
6
+ }
7
+ export declare function unlockPath(params: Params<UnlockPathParams>): Response<PROTO.UnlockPath>;
8
+ //# sourceMappingURL=unlockPath.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unlockPath.js.map
@@ -1,2 +1,2 @@
1
- export declare const httpRequest: (url: string, _type: string) => any;
1
+ export declare const httpRequest: (url: string, type: string) => any;
2
2
  //# sourceMappingURL=assets.d.ts.map
@@ -9,10 +9,10 @@ const assetUtils_1 = require("./assetUtils");
9
9
  if (global && typeof global.fetch !== 'function') {
10
10
  global.fetch = cross_fetch_1.default;
11
11
  }
12
- const httpRequest = (url, _type) => {
12
+ const httpRequest = (url, type) => {
13
13
  const asset = (0, assetUtils_1.getAssetByUrl)(url);
14
14
  if (!asset) {
15
- return /^https?/.test(url) ? (0, assets_browser_1.httpRequest)(url) : fs_1.promises.readFile(url);
15
+ return /^https?/.test(url) ? (0, assets_browser_1.httpRequest)(url, type) : fs_1.promises.readFile(url);
16
16
  }
17
17
  return asset;
18
18
  };
@@ -4,13 +4,12 @@ export declare const HD_HARDENED = 2147483648;
4
4
  export declare const toHardened: (n: number) => number;
5
5
  export declare const fromHardened: (n: number) => number;
6
6
  export declare const getHDPath: (path: string) => number[];
7
- export declare const isMultisigPath: (path: number[] | undefined) => boolean;
8
7
  export declare const isSegwitPath: (path: number[] | undefined) => boolean;
9
8
  export declare const isBech32Path: (path: number[] | undefined) => boolean;
10
9
  export declare const isTaprootPath: (path: number[] | undefined) => boolean;
11
10
  export declare const getAccountType: (path: number[] | undefined) => "p2pkh" | "p2sh" | "p2tr" | "p2wpkh";
12
- export declare const getScriptType: (path: number[] | undefined) => PROTO.InternalInputScriptType;
13
- export declare const getOutputScriptType: (path?: number[]) => PROTO.ChangeOutputScriptType;
11
+ export declare const getScriptType: (path: number[] | undefined) => PROTO.InternalInputScriptType | undefined;
12
+ export declare const getOutputScriptType: (path?: number[]) => PROTO.ChangeOutputScriptType | undefined;
14
13
  export declare const validatePath: (path: string | number[], length?: number, base?: boolean) => number[];
15
14
  export declare const getSerializedPath: (path: number[]) => string;
16
15
  export declare const getPathFromIndex: (bip44purpose: number, bip44cointype: number, index: number) => number[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLabel = exports.fixPath = exports.getIndexFromPath = exports.getPathFromIndex = exports.getSerializedPath = exports.validatePath = exports.getOutputScriptType = exports.getScriptType = exports.getAccountType = exports.isTaprootPath = exports.isBech32Path = exports.isSegwitPath = exports.isMultisigPath = exports.getHDPath = exports.fromHardened = exports.toHardened = exports.HD_HARDENED = void 0;
3
+ exports.getLabel = exports.fixPath = exports.getIndexFromPath = exports.getPathFromIndex = exports.getSerializedPath = exports.validatePath = exports.getOutputScriptType = exports.getScriptType = exports.getAccountType = exports.isTaprootPath = exports.isBech32Path = exports.isSegwitPath = exports.getHDPath = exports.fromHardened = exports.toHardened = exports.HD_HARDENED = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  exports.HD_HARDENED = 0x80000000;
6
6
  const toHardened = (n) => (n | exports.HD_HARDENED) >>> 0;
@@ -35,13 +35,11 @@ const getHDPath = (path) => {
35
35
  });
36
36
  };
37
37
  exports.getHDPath = getHDPath;
38
- const isMultisigPath = (path) => Array.isArray(path) && path[0] === (0, exports.toHardened)(48);
39
- exports.isMultisigPath = isMultisigPath;
40
38
  const isSegwitPath = (path) => Array.isArray(path) && path[0] === (0, exports.toHardened)(49);
41
39
  exports.isSegwitPath = isSegwitPath;
42
40
  const isBech32Path = (path) => Array.isArray(path) && path[0] === (0, exports.toHardened)(84);
43
41
  exports.isBech32Path = isBech32Path;
44
- const isTaprootPath = (path) => Array.isArray(path) && path[0] === (0, exports.toHardened)(86);
42
+ const isTaprootPath = (path) => Array.isArray(path) && (path[0] === (0, exports.toHardened)(86) || path[0] === (0, exports.toHardened)(10025));
45
43
  exports.isTaprootPath = isTaprootPath;
46
44
  const getAccountType = (path) => {
47
45
  if ((0, exports.isTaprootPath)(path))
@@ -55,40 +53,69 @@ const getAccountType = (path) => {
55
53
  exports.getAccountType = getAccountType;
56
54
  const getScriptType = (path) => {
57
55
  if (!Array.isArray(path) || path.length < 1)
58
- return 'SPENDADDRESS';
56
+ return undefined;
59
57
  const p1 = (0, exports.fromHardened)(path[0]);
60
58
  switch (p1) {
61
- case 48:
62
- return 'SPENDMULTISIG';
59
+ case 44:
60
+ return 'SPENDADDRESS';
61
+ case 48: {
62
+ if (path.length < 4)
63
+ return undefined;
64
+ const p3 = (0, exports.fromHardened)(path[3]);
65
+ switch (p3) {
66
+ case 0:
67
+ return 'SPENDMULTISIG';
68
+ case 1:
69
+ return 'SPENDP2SHWITNESS';
70
+ case 2:
71
+ return 'SPENDWITNESS';
72
+ default:
73
+ return undefined;
74
+ }
75
+ }
63
76
  case 49:
64
77
  return 'SPENDP2SHWITNESS';
65
78
  case 84:
66
79
  return 'SPENDWITNESS';
67
80
  case 86:
81
+ case 10025:
68
82
  return 'SPENDTAPROOT';
69
83
  default:
70
- return 'SPENDADDRESS';
84
+ return undefined;
71
85
  }
72
86
  };
73
87
  exports.getScriptType = getScriptType;
74
88
  const getOutputScriptType = (path) => {
75
89
  if (!Array.isArray(path) || path.length < 1)
76
- return 'PAYTOADDRESS';
77
- if (path[0] === 49) {
78
- return 'PAYTOP2SHWITNESS';
79
- }
90
+ return undefined;
80
91
  const p = (0, exports.fromHardened)(path[0]);
81
92
  switch (p) {
82
- case 48:
83
- return 'PAYTOMULTISIG';
93
+ case 44:
94
+ return 'PAYTOADDRESS';
95
+ case 48: {
96
+ if (path.length < 4)
97
+ return undefined;
98
+ const p3 = (0, exports.fromHardened)(path[3]);
99
+ switch (p3) {
100
+ case 0:
101
+ return 'PAYTOMULTISIG';
102
+ case 1:
103
+ return 'PAYTOP2SHWITNESS';
104
+ case 2:
105
+ return 'PAYTOWITNESS';
106
+ default:
107
+ return undefined;
108
+ }
109
+ }
84
110
  case 49:
85
111
  return 'PAYTOP2SHWITNESS';
86
112
  case 84:
87
113
  return 'PAYTOWITNESS';
88
114
  case 86:
115
+ case 10025:
89
116
  return 'PAYTOTAPROOT';
90
117
  default:
91
- return 'PAYTOADDRESS';
118
+ return undefined;
92
119
  }
93
120
  };
94
121
  exports.getOutputScriptType = getOutputScriptType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.0.1",
3
+ "version": "9.0.3",
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.",
@@ -41,7 +41,9 @@
41
41
  "version:beta": "tsx scripts/bump-version.ts prerelease",
42
42
  "version:patch": "tsx scripts/bump-version.ts patch",
43
43
  "version:minor": "tsx scripts/bump-version.ts minor",
44
- "version:major": "tsx scripts/bump-version.ts major"
44
+ "version:major": "tsx scripts/bump-version.ts major",
45
+ "test:e2e:node": "TESTS_FIRMWARE=$(tsx ../integration-tests/wait-for-env.ts) yarn jest --runInBand --verbose -c e2e/jest.config.js",
46
+ "test:e2e:web": "TESTS_FIRMWARE=$(tsx ../integration-tests/wait-for-env.ts) yarn karma start e2e/karma.config.js"
45
47
  },
46
48
  "dependencies": {
47
49
  "@trezor/blockchain-link": "^2.1.4",
@@ -59,9 +61,17 @@
59
61
  "tslib": "^2.3.1"
60
62
  },
61
63
  "devDependencies": {
64
+ "@trezor/trezor-user-env-link": "*",
62
65
  "@types/parse-uri": "^1.0.0",
63
66
  "@types/randombytes": "^2.0.0",
64
67
  "jest": "^26.6.3",
68
+ "karma": "^6.3.16",
69
+ "karma-babel-preprocessor": "^8.0.2",
70
+ "karma-chrome-launcher": "^3.1.0",
71
+ "karma-jasmine": "4.0.1",
72
+ "karma-jasmine-async": "^0.0.1",
73
+ "karma-sourcemap-loader": "^0.3.8",
74
+ "karma-webpack": "^5.0.0",
65
75
  "rimraf": "^3.0.2",
66
76
  "tsx": "^3.8.2",
67
77
  "typescript": "4.7.4"
@@ -1,112 +0,0 @@
1
- export declare const validateTrezorInputs: ({
2
- description: string;
3
- params: {
4
- address_n: number[];
5
- amount: string;
6
- prev_index: number;
7
- prev_hash: string;
8
- }[];
9
- result: {
10
- amount: string;
11
- }[];
12
- } | {
13
- description: string;
14
- params: {
15
- address_n: number[];
16
- amount: string;
17
- prev_index: number;
18
- prev_hash: string;
19
- }[];
20
- result: {
21
- address_n: number[];
22
- }[];
23
- } | {
24
- description: string;
25
- params: {
26
- address_n: number[];
27
- amount: string;
28
- prev_index: number;
29
- prev_hash: string;
30
- multisig: {
31
- pubkeys: {
32
- node: string;
33
- }[];
34
- };
35
- }[];
36
- result: {
37
- multisig: {
38
- pubkeys: {
39
- node: {
40
- public_key: string;
41
- chain_code: string;
42
- depth: number;
43
- };
44
- }[];
45
- };
46
- }[];
47
- } | {
48
- description: string;
49
- params: {
50
- amount: string;
51
- prev_index: number;
52
- prev_hash: string;
53
- script_type: string;
54
- script_pubkey: string;
55
- witness: string;
56
- }[];
57
- result: {
58
- amount: string;
59
- }[];
60
- } | {
61
- description: string;
62
- params: {
63
- amount: string;
64
- prev_index: number;
65
- prev_hash: string;
66
- }[];
67
- result?: undefined;
68
- } | {
69
- description: string;
70
- params: {
71
- address_n: number[];
72
- amount: string;
73
- prev_hash: string;
74
- }[];
75
- result?: undefined;
76
- } | {
77
- description: string;
78
- params: {
79
- address_n: number[];
80
- amount: string;
81
- prev_index: number;
82
- }[];
83
- result?: undefined;
84
- } | {
85
- description: string;
86
- params: {
87
- address_n: number[];
88
- prev_index: number;
89
- prev_hash: string;
90
- }[];
91
- result: {
92
- prev_index: number;
93
- }[];
94
- } | {
95
- description: string;
96
- params: {
97
- address_n: number[];
98
- prev_index: number;
99
- prev_hash: string;
100
- }[];
101
- result?: undefined;
102
- } | {
103
- description: string;
104
- params: {
105
- amount: string;
106
- prev_index: number;
107
- prev_hash: string;
108
- script_type: string;
109
- }[];
110
- result?: undefined;
111
- })[];
112
- //# sourceMappingURL=inputs.d.ts.map
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateTrezorInputs = void 0;
4
- exports.validateTrezorInputs = [
5
- {
6
- description: 'valid input',
7
- params: [
8
- {
9
- address_n: [1],
10
- amount: '1',
11
- prev_index: 1,
12
- prev_hash: 'txid',
13
- },
14
- ],
15
- result: [{ amount: '1' }],
16
- },
17
- {
18
- description: 'input with fixed path',
19
- params: [
20
- {
21
- address_n: [44 | 0x80000000],
22
- amount: '1',
23
- prev_index: 1,
24
- prev_hash: 'txid',
25
- },
26
- ],
27
- result: [{ address_n: [(44 | 0x80000000) >>> 0] }],
28
- },
29
- {
30
- description: 'input with converted multisig pubkey',
31
- params: [
32
- {
33
- address_n: [0],
34
- amount: '1',
35
- prev_index: 1,
36
- prev_hash: 'txid',
37
- multisig: {
38
- pubkeys: [
39
- {
40
- node: 'xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy',
41
- },
42
- ],
43
- },
44
- },
45
- ],
46
- result: [
47
- {
48
- multisig: {
49
- pubkeys: [
50
- {
51
- node: {
52
- public_key: '03f645ec6544a92f951f3bca16a2bc1c56846d065594db222725d59b9902528385',
53
- chain_code: '2fb77e25cd3e2e034bcbafa1f81ec7e4caf927b06c87db296f1186208315525e',
54
- depth: 0,
55
- },
56
- },
57
- ],
58
- },
59
- },
60
- ],
61
- },
62
- {
63
- description: 'valid EXTERNAL input',
64
- params: [
65
- {
66
- amount: '1',
67
- prev_index: 1,
68
- prev_hash: 'txid',
69
- script_type: 'EXTERNAL',
70
- script_pubkey: '0000',
71
- witness: '00',
72
- },
73
- ],
74
- result: [{ amount: '1' }],
75
- },
76
- {
77
- description: 'missing address_n',
78
- params: [{ amount: '1', prev_index: 1, prev_hash: 'txid' }],
79
- },
80
- {
81
- description: 'missing prev_index',
82
- params: [{ address_n: [0], amount: '1', prev_hash: 'txid' }],
83
- },
84
- {
85
- description: 'missing prev_hash',
86
- params: [{ address_n: [0], amount: '1', prev_index: 1 }],
87
- },
88
- {
89
- description: 'missing amount on non segwit path. valid only because of legacy reasons',
90
- params: [{ address_n: [0], prev_index: 1, prev_hash: 'txid' }],
91
- result: [{ prev_index: 1 }],
92
- },
93
- {
94
- description: 'missing amount p2sh',
95
- params: [{ address_n: [49 | 0x80000000], prev_index: 1, prev_hash: 'txid' }],
96
- },
97
- {
98
- description: 'missing script_pubkey in EXTERNAL',
99
- params: [{ amount: '1', prev_index: 1, prev_hash: 'txid', script_type: 'EXTERNAL' }],
100
- },
101
- ];
102
- //# sourceMappingURL=inputs.js.map