@trezor/connect 9.0.2 → 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.
- package/README.md +5 -5
- package/lib/api/bitcoin/TransactionComposer.js +2 -1
- package/lib/api/bitcoin/outputs.js +2 -4
- package/lib/api/bitcoin/signtxVerify.d.ts +3 -3
- package/lib/api/bitcoin/signtxVerify.js +16 -15
- package/lib/api/getAddress.d.ts +2 -1
- package/lib/api/getAddress.js +12 -1
- package/lib/api/getPublicKey.d.ts +1 -0
- package/lib/api/getPublicKey.js +22 -7
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/signTransaction.d.ts +1 -0
- package/lib/api/signTransaction.js +14 -2
- package/lib/api/unlockPath.d.ts +10 -0
- package/lib/api/unlockPath.js +35 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/method.d.ts +1 -1
- package/lib/data/config.js +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/DeviceCommands.d.ts +7 -2
- package/lib/device/DeviceCommands.js +37 -25
- package/lib/factory.js +1 -0
- package/lib/types/api/bitcoin/index.d.ts +1 -0
- package/lib/types/api/cardano/index.d.ts +3 -7
- package/lib/types/api/eos/index.d.ts +0 -4
- package/lib/types/api/eosGetPublicKey.d.ts +4 -4
- package/lib/types/api/getAddress.d.ts +1 -0
- package/lib/types/api/getPublicKey.d.ts +5 -0
- package/lib/types/api/index.d.ts +2 -0
- package/lib/types/api/unlockPath.d.ts +8 -0
- package/lib/types/api/unlockPath.js +3 -0
- package/lib/utils/pathUtils.d.ts +2 -3
- package/lib/utils/pathUtils.js +42 -15
- package/package.json +12 -2
- package/lib/api/bitcoin/__fixtures__/inputs.d.ts +0 -112
- package/lib/api/bitcoin/__fixtures__/inputs.js +0 -102
- package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +0 -147
- package/lib/api/bitcoin/__fixtures__/signtxVerify.js +0 -216
- package/lib/api/common/__fixtures__/paramsValidator.d.ts +0 -596
- package/lib/api/common/__fixtures__/paramsValidator.js +0 -355
- package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +0 -225
- package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +0 -341
- package/lib/utils/__fixtures__/accountUtils.d.ts +0 -4
- package/lib/utils/__fixtures__/accountUtils.js +0 -32
- package/lib/utils/__fixtures__/addressUtils.d.ts +0 -10
- package/lib/utils/__fixtures__/addressUtils.js +0 -214
- package/lib/utils/__fixtures__/ethereumUtils.d.ts +0 -3
- package/lib/utils/__fixtures__/ethereumUtils.js +0 -20
- package/lib/utils/__fixtures__/formatUtils.d.ts +0 -3
- package/lib/utils/__fixtures__/formatUtils.js +0 -15
- package/lib/utils/__fixtures__/hdnodeUtils.d.ts +0 -186
- package/lib/utils/__fixtures__/hdnodeUtils.js +0 -206
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({
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import type { Params, BundledParams, Response } from '../params';
|
|
2
|
-
import {
|
|
3
|
-
export declare function eosGetPublicKey(params: Params<
|
|
4
|
-
export declare function eosGetPublicKey(params: BundledParams<
|
|
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[];
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -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
|
package/lib/utils/pathUtils.d.ts
CHANGED
|
@@ -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[];
|
package/lib/utils/pathUtils.js
CHANGED
|
@@ -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.
|
|
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
|
|
56
|
+
return undefined;
|
|
59
57
|
const p1 = (0, exports.fromHardened)(path[0]);
|
|
60
58
|
switch (p1) {
|
|
61
|
-
case
|
|
62
|
-
return '
|
|
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
|
|
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
|
|
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
|
|
83
|
-
return '
|
|
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
|
|
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.
|
|
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
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
declare const _default: ({
|
|
2
|
-
description: string;
|
|
3
|
-
inputs: {
|
|
4
|
-
address_n: number[];
|
|
5
|
-
prev_hash: string;
|
|
6
|
-
prev_index: number;
|
|
7
|
-
amount: string;
|
|
8
|
-
}[];
|
|
9
|
-
outputs: {
|
|
10
|
-
address: string;
|
|
11
|
-
amount: string;
|
|
12
|
-
script_type: string;
|
|
13
|
-
}[];
|
|
14
|
-
tx: string;
|
|
15
|
-
getHDNode?: undefined;
|
|
16
|
-
network?: undefined;
|
|
17
|
-
error?: undefined;
|
|
18
|
-
} | {
|
|
19
|
-
description: string;
|
|
20
|
-
inputs: {
|
|
21
|
-
address_n: number[];
|
|
22
|
-
prev_hash: string;
|
|
23
|
-
prev_index: number;
|
|
24
|
-
amount: string;
|
|
25
|
-
}[];
|
|
26
|
-
outputs: {
|
|
27
|
-
address_n: number[];
|
|
28
|
-
amount: string;
|
|
29
|
-
script_type: string;
|
|
30
|
-
}[];
|
|
31
|
-
tx: string;
|
|
32
|
-
getHDNode: () => {
|
|
33
|
-
xpub: string;
|
|
34
|
-
};
|
|
35
|
-
network?: undefined;
|
|
36
|
-
error?: undefined;
|
|
37
|
-
} | {
|
|
38
|
-
description: string;
|
|
39
|
-
network: string;
|
|
40
|
-
inputs: {
|
|
41
|
-
address_n: number[];
|
|
42
|
-
prev_hash: string;
|
|
43
|
-
prev_index: number;
|
|
44
|
-
amount: string;
|
|
45
|
-
}[];
|
|
46
|
-
outputs: {
|
|
47
|
-
address: string;
|
|
48
|
-
amount: string;
|
|
49
|
-
script_type: string;
|
|
50
|
-
}[];
|
|
51
|
-
tx: string;
|
|
52
|
-
getHDNode?: undefined;
|
|
53
|
-
error?: undefined;
|
|
54
|
-
} | {
|
|
55
|
-
description: string;
|
|
56
|
-
network: string;
|
|
57
|
-
inputs: {
|
|
58
|
-
address_n: number[];
|
|
59
|
-
prev_hash: string;
|
|
60
|
-
prev_index: number;
|
|
61
|
-
amount: string;
|
|
62
|
-
}[];
|
|
63
|
-
outputs: ({
|
|
64
|
-
address: string;
|
|
65
|
-
amount: string;
|
|
66
|
-
script_type: string;
|
|
67
|
-
address_n?: undefined;
|
|
68
|
-
} | {
|
|
69
|
-
address_n: number[];
|
|
70
|
-
amount: string;
|
|
71
|
-
script_type: string;
|
|
72
|
-
address?: undefined;
|
|
73
|
-
})[];
|
|
74
|
-
tx: string;
|
|
75
|
-
getHDNode: () => {
|
|
76
|
-
xpub: string;
|
|
77
|
-
};
|
|
78
|
-
error?: undefined;
|
|
79
|
-
} | {
|
|
80
|
-
description: string;
|
|
81
|
-
inputs: {
|
|
82
|
-
address_n: number[];
|
|
83
|
-
prev_hash: string;
|
|
84
|
-
prev_index: number;
|
|
85
|
-
amount: string;
|
|
86
|
-
}[];
|
|
87
|
-
outputs: {
|
|
88
|
-
op_return_data: string;
|
|
89
|
-
amount: string;
|
|
90
|
-
script_type: string;
|
|
91
|
-
}[];
|
|
92
|
-
tx: string;
|
|
93
|
-
getHDNode?: undefined;
|
|
94
|
-
network?: undefined;
|
|
95
|
-
error?: undefined;
|
|
96
|
-
} | {
|
|
97
|
-
description: string;
|
|
98
|
-
inputs: {
|
|
99
|
-
address_n: number[];
|
|
100
|
-
prev_hash: string;
|
|
101
|
-
prev_index: number;
|
|
102
|
-
amount: string;
|
|
103
|
-
}[];
|
|
104
|
-
outputs: {
|
|
105
|
-
op_return_data: string;
|
|
106
|
-
script_type: string;
|
|
107
|
-
}[];
|
|
108
|
-
tx: string;
|
|
109
|
-
getHDNode?: undefined;
|
|
110
|
-
network?: undefined;
|
|
111
|
-
error?: undefined;
|
|
112
|
-
} | {
|
|
113
|
-
description: string;
|
|
114
|
-
inputs: {
|
|
115
|
-
address_n: number[];
|
|
116
|
-
prev_hash: string;
|
|
117
|
-
prev_index: number;
|
|
118
|
-
amount: string;
|
|
119
|
-
}[];
|
|
120
|
-
outputs: {
|
|
121
|
-
address: string;
|
|
122
|
-
amount: string;
|
|
123
|
-
script_type: string;
|
|
124
|
-
}[];
|
|
125
|
-
tx: string;
|
|
126
|
-
error: string;
|
|
127
|
-
getHDNode?: undefined;
|
|
128
|
-
network?: undefined;
|
|
129
|
-
} | {
|
|
130
|
-
description: string;
|
|
131
|
-
inputs: {
|
|
132
|
-
address_n: number[];
|
|
133
|
-
prev_hash: string;
|
|
134
|
-
prev_index: number;
|
|
135
|
-
amount: string;
|
|
136
|
-
}[];
|
|
137
|
-
outputs: {
|
|
138
|
-
amount: string;
|
|
139
|
-
script_type: string;
|
|
140
|
-
}[];
|
|
141
|
-
tx: string;
|
|
142
|
-
error: string;
|
|
143
|
-
getHDNode?: undefined;
|
|
144
|
-
network?: undefined;
|
|
145
|
-
})[];
|
|
146
|
-
export default _default;
|
|
147
|
-
//# sourceMappingURL=signtxVerify.d.ts.map
|