@trezor/connect 9.0.2 → 9.0.4

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 (84) hide show
  1. package/README.md +5 -5
  2. package/lib/api/authorizeCoinJoin.js +6 -2
  3. package/lib/api/bitcoin/TransactionComposer.js +2 -1
  4. package/lib/api/bitcoin/enhanceSignTx.js +1 -1
  5. package/lib/api/bitcoin/inputs.js +3 -2
  6. package/lib/api/bitcoin/outputs.js +2 -4
  7. package/lib/api/bitcoin/refTx.js +3 -3
  8. package/lib/api/bitcoin/signtxVerify.d.ts +3 -3
  9. package/lib/api/bitcoin/signtxVerify.js +16 -15
  10. package/lib/api/blockchainDisconnect.js +1 -1
  11. package/lib/api/blockchainSetCustomBackend.js +1 -1
  12. package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -1
  13. package/lib/api/cardano/cardanoAuxiliaryData.js +38 -16
  14. package/lib/api/cardanoSignTransaction.d.ts +1 -0
  15. package/lib/api/cardanoSignTransaction.js +23 -3
  16. package/lib/api/getAddress.d.ts +2 -1
  17. package/lib/api/getAddress.js +12 -1
  18. package/lib/api/getOwnershipProof.d.ts +1 -5
  19. package/lib/api/getOwnershipProof.js +5 -3
  20. package/lib/api/getPublicKey.d.ts +1 -0
  21. package/lib/api/getPublicKey.js +22 -7
  22. package/lib/api/index.d.ts +2 -0
  23. package/lib/api/index.js +5 -1
  24. package/lib/api/setBusy.d.ts +7 -0
  25. package/lib/api/setBusy.js +27 -0
  26. package/lib/api/signTransaction.d.ts +2 -1
  27. package/lib/api/signTransaction.js +24 -5
  28. package/lib/api/unlockPath.d.ts +10 -0
  29. package/lib/api/unlockPath.js +35 -0
  30. package/lib/backend/BackendManager.d.ts +21 -0
  31. package/lib/backend/BackendManager.js +91 -0
  32. package/lib/backend/Blockchain.d.ts +72 -0
  33. package/lib/backend/Blockchain.js +204 -0
  34. package/lib/backend/BlockchainLink.d.ts +6 -71
  35. package/lib/backend/BlockchainLink.js +12 -288
  36. package/lib/constants/cardano.d.ts +3 -1
  37. package/lib/constants/cardano.js +3 -1
  38. package/lib/core/AbstractMethod.d.ts +1 -0
  39. package/lib/core/index.d.ts +1 -1
  40. package/lib/core/index.js +1 -1
  41. package/lib/core/method.d.ts +1 -1
  42. package/lib/data/config.js +2 -2
  43. package/lib/data/version.d.ts +1 -1
  44. package/lib/data/version.js +1 -1
  45. package/lib/device/Device.d.ts +1 -1
  46. package/lib/device/Device.js +8 -2
  47. package/lib/device/DeviceCommands.d.ts +8 -2
  48. package/lib/device/DeviceCommands.js +48 -25
  49. package/lib/factory.js +2 -0
  50. package/lib/types/api/authorizeCoinJoin.d.ts +1 -0
  51. package/lib/types/api/bitcoin/index.d.ts +5 -0
  52. package/lib/types/api/cardano/index.d.ts +13 -10
  53. package/lib/types/api/eos/index.d.ts +0 -4
  54. package/lib/types/api/eosGetPublicKey.d.ts +4 -4
  55. package/lib/types/api/getAddress.d.ts +1 -0
  56. package/lib/types/api/getPublicKey.d.ts +5 -0
  57. package/lib/types/api/index.d.ts +4 -0
  58. package/lib/types/api/setBusy.d.ts +4 -0
  59. package/lib/types/api/setBusy.js +3 -0
  60. package/lib/types/api/unlockPath.d.ts +8 -0
  61. package/lib/types/api/unlockPath.js +3 -0
  62. package/lib/utils/pathUtils.d.ts +2 -3
  63. package/lib/utils/pathUtils.js +42 -15
  64. package/package.json +19 -7
  65. package/lib/api/bitcoin/__fixtures__/inputs.d.ts +0 -112
  66. package/lib/api/bitcoin/__fixtures__/inputs.js +0 -102
  67. package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +0 -147
  68. package/lib/api/bitcoin/__fixtures__/signtxVerify.js +0 -216
  69. package/lib/api/common/__fixtures__/paramsValidator.d.ts +0 -596
  70. package/lib/api/common/__fixtures__/paramsValidator.js +0 -355
  71. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +0 -225
  72. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +0 -341
  73. package/lib/utils/__fixtures__/accountUtils.d.ts +0 -4
  74. package/lib/utils/__fixtures__/accountUtils.js +0 -32
  75. package/lib/utils/__fixtures__/addressUtils.d.ts +0 -10
  76. package/lib/utils/__fixtures__/addressUtils.js +0 -214
  77. package/lib/utils/__fixtures__/ethereumUtils.d.ts +0 -3
  78. package/lib/utils/__fixtures__/ethereumUtils.js +0 -20
  79. package/lib/utils/__fixtures__/formatUtils.d.ts +0 -3
  80. package/lib/utils/__fixtures__/formatUtils.js +0 -15
  81. package/lib/utils/__fixtures__/hdnodeUtils.d.ts +0 -186
  82. package/lib/utils/__fixtures__/hdnodeUtils.js +0 -206
  83. package/lib/utils/bufferUtils.d.ts +0 -3
  84. package/lib/utils/bufferUtils.js +0 -11
@@ -1,186 +0,0 @@
1
- import { networks } from '@trezor/utxo-lib';
2
- export declare const convertXpub: ({
3
- description: string;
4
- network: networks.Network;
5
- xpub: string;
6
- result: string;
7
- requestedNetwork?: undefined;
8
- } | {
9
- description: string;
10
- network: networks.Network;
11
- requestedNetwork: {
12
- bip32: {
13
- public: number;
14
- private: number;
15
- };
16
- messagePrefix: string;
17
- bech32: string;
18
- pubKeyHash: number;
19
- scriptHash: number;
20
- wif: number;
21
- forkId?: number | undefined;
22
- };
23
- xpub: string;
24
- result: string;
25
- })[];
26
- export declare const convertBitcoinXpub: {
27
- description: string;
28
- network: networks.Network;
29
- xpub: string;
30
- result: string;
31
- }[];
32
- export declare const convertMultisigPubKey: ({
33
- description: string;
34
- utxo: {
35
- multisig?: undefined;
36
- };
37
- result: {
38
- multisig?: undefined;
39
- };
40
- network?: undefined;
41
- } | {
42
- description: string;
43
- utxo: {
44
- multisig: {
45
- pubkeys?: undefined;
46
- };
47
- };
48
- result: {
49
- multisig: {
50
- pubkeys?: undefined;
51
- };
52
- };
53
- network?: undefined;
54
- } | {
55
- description: string;
56
- utxo: {
57
- multisig: {
58
- pubkeys: {
59
- node: {
60
- depth: number;
61
- };
62
- }[];
63
- };
64
- };
65
- result: {
66
- multisig: {
67
- pubkeys: {
68
- node: {
69
- depth: number;
70
- };
71
- }[];
72
- };
73
- };
74
- network?: undefined;
75
- } | {
76
- description: string;
77
- network: networks.Network;
78
- utxo: {
79
- multisig: {
80
- pubkeys: {
81
- node: string;
82
- }[];
83
- };
84
- };
85
- result: {
86
- multisig: {
87
- pubkeys: {
88
- node: {
89
- chain_code: string;
90
- child_num: number;
91
- depth: number;
92
- fingerprint: number;
93
- public_key: string;
94
- };
95
- }[];
96
- };
97
- };
98
- })[];
99
- export declare const xpubDerive: ({
100
- description: string;
101
- suffix: number;
102
- xpub: {
103
- xpub: string;
104
- node: {
105
- child_num: number;
106
- chain_code: string;
107
- public_key: string;
108
- fingerprint: number;
109
- depth: number;
110
- };
111
- };
112
- childXPub: {
113
- xpub: string;
114
- node: {
115
- child_num: number;
116
- chain_code: string;
117
- public_key: string;
118
- fingerprint: number;
119
- depth: number;
120
- };
121
- };
122
- network?: undefined;
123
- error?: undefined;
124
- } | {
125
- description: string;
126
- suffix: number;
127
- xpub: {
128
- xpub: string;
129
- node: {
130
- child_num: number;
131
- chain_code: string;
132
- public_key: string;
133
- fingerprint: number;
134
- depth: number;
135
- };
136
- };
137
- childXPub: {
138
- xpub: string;
139
- node: {
140
- child_num: number;
141
- chain_code: string;
142
- public_key: string;
143
- fingerprint: number;
144
- depth: number;
145
- };
146
- };
147
- network: {
148
- bip32: {
149
- public: number;
150
- private: number;
151
- };
152
- messagePrefix: string;
153
- bech32: string;
154
- pubKeyHash: number;
155
- scriptHash: number;
156
- wif: number;
157
- forkId?: number | undefined;
158
- };
159
- error?: undefined;
160
- } | {
161
- description: string;
162
- suffix: number;
163
- xpub: {
164
- xpub: string;
165
- node: {
166
- child_num: number;
167
- chain_code: string;
168
- public_key: string;
169
- fingerprint: number;
170
- depth: number;
171
- };
172
- };
173
- childXPub: {
174
- xpub: string;
175
- node: {
176
- child_num: number;
177
- chain_code: string;
178
- public_key: string;
179
- fingerprint: number;
180
- depth: number;
181
- };
182
- };
183
- error: string;
184
- network?: undefined;
185
- })[];
186
- //# sourceMappingURL=hdnodeUtils.d.ts.map
@@ -1,206 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.xpubDerive = exports.convertMultisigPubKey = exports.convertBitcoinXpub = exports.convertXpub = void 0;
4
- const utxo_lib_1 = require("@trezor/utxo-lib");
5
- const NETWORK_P2SH = {
6
- ...utxo_lib_1.networks.bitcoin,
7
- bip32: {
8
- ...utxo_lib_1.networks.bitcoin.bip32,
9
- public: 77429938,
10
- },
11
- };
12
- const NETWORK_P2WPKH = {
13
- ...utxo_lib_1.networks.bitcoin,
14
- bip32: {
15
- ...utxo_lib_1.networks.bitcoin.bip32,
16
- public: 78792518,
17
- },
18
- };
19
- exports.convertXpub = [
20
- {
21
- description: 'No requested network == no change',
22
- network: utxo_lib_1.networks.bitcoin,
23
- xpub: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
24
- result: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
25
- },
26
- {
27
- description: 'P2PKH > P2SH',
28
- network: utxo_lib_1.networks.bitcoin,
29
- requestedNetwork: NETWORK_P2SH,
30
- xpub: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
31
- result: 'ypub6XKbB5DSkq8Royg8isNtGktj6bmEfGJXDs83Ad5CZ5tpDV8QofwSWQFTWP2Pv24vNdrPhquehL7vRMvSTj2GpKv6UaTQCBKZALm6RJAmxG6',
32
- },
33
- {
34
- description: 'P2SH > P2PKH',
35
- network: NETWORK_P2SH,
36
- requestedNetwork: utxo_lib_1.networks.bitcoin,
37
- xpub: 'ypub6XKbB5DSkq8Royg8isNtGktj6bmEfGJXDs83Ad5CZ5tpDV8QofwSWQFTWP2Pv24vNdrPhquehL7vRMvSTj2GpKv6UaTQCBKZALm6RJAmxG6',
38
- result: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
39
- },
40
- {
41
- description: 'P2PKH > Bech32/P2WPKH',
42
- network: utxo_lib_1.networks.bitcoin,
43
- requestedNetwork: NETWORK_P2WPKH,
44
- xpub: 'xpub6DDUPHpUo4pcy43iJeZjbSVWGav1SMMmuWdMHiGtkK8rhKmfbomtkwW6GKs1GGAKehT6QRocrmda3WWxXawpjmwaUHfFRXuKrXSapdckEYF',
45
- result: 'zpub6rszzdAK6RuafeRwyN8z1cgWcXCuKbLmjjfnrW4fWKtcoXQ8787214pNJjnBG5UATyghuNzjn6Lfp5k5xymrLFJnCy46bMYJPyZsbpFGagT',
46
- },
47
- {
48
- description: 'Bech32/P2WPKH > P2PKH',
49
- network: NETWORK_P2WPKH,
50
- requestedNetwork: utxo_lib_1.networks.bitcoin,
51
- xpub: 'zpub6rszzdAK6RuafeRwyN8z1cgWcXCuKbLmjjfnrW4fWKtcoXQ8787214pNJjnBG5UATyghuNzjn6Lfp5k5xymrLFJnCy46bMYJPyZsbpFGagT',
52
- result: 'xpub6DDUPHpUo4pcy43iJeZjbSVWGav1SMMmuWdMHiGtkK8rhKmfbomtkwW6GKs1GGAKehT6QRocrmda3WWxXawpjmwaUHfFRXuKrXSapdckEYF',
53
- },
54
- ];
55
- exports.convertBitcoinXpub = [
56
- {
57
- description: 'No requested network == no change',
58
- network: utxo_lib_1.networks.bitcoin,
59
- xpub: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
60
- result: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
61
- },
62
- {
63
- description: 'Requested network P2SH',
64
- network: NETWORK_P2SH,
65
- xpub: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
66
- result: 'ypub6XKbB5DSkq8Royg8isNtGktj6bmEfGJXDs83Ad5CZ5tpDV8QofwSWQFTWP2Pv24vNdrPhquehL7vRMvSTj2GpKv6UaTQCBKZALm6RJAmxG6',
67
- },
68
- {
69
- description: 'Requested network Bech32/P2WPKH',
70
- network: NETWORK_P2WPKH,
71
- xpub: 'xpub6DDUPHpUo4pcy43iJeZjbSVWGav1SMMmuWdMHiGtkK8rhKmfbomtkwW6GKs1GGAKehT6QRocrmda3WWxXawpjmwaUHfFRXuKrXSapdckEYF',
72
- result: 'zpub6rszzdAK6RuafeRwyN8z1cgWcXCuKbLmjjfnrW4fWKtcoXQ8787214pNJjnBG5UATyghuNzjn6Lfp5k5xymrLFJnCy46bMYJPyZsbpFGagT',
73
- },
74
- ];
75
- exports.convertMultisigPubKey = [
76
- {
77
- description: 'no multisig = no conversion',
78
- utxo: {},
79
- result: {},
80
- },
81
- {
82
- description: 'no pubkeys = no conversion',
83
- utxo: {
84
- multisig: {},
85
- },
86
- result: {
87
- multisig: {},
88
- },
89
- },
90
- {
91
- description: 'node is not a string = no conversion',
92
- utxo: {
93
- multisig: {
94
- pubkeys: [{ node: { depth: 4 } }],
95
- },
96
- },
97
- result: {
98
- multisig: {
99
- pubkeys: [{ node: { depth: 4 } }],
100
- },
101
- },
102
- },
103
- {
104
- description: 'convert multisig input',
105
- network: utxo_lib_1.networks.bitcoin,
106
- utxo: {
107
- multisig: {
108
- pubkeys: [
109
- {
110
- node: 'xpub6EexEtC6c2rN5QCpzrL2nUNGDfxizCi3kM1C2Mk5a6PfQs4H3F72C642M3XbnzycvvtD4U6vzn1nYPpH8VUmiREc2YuXP3EFgN1uLTrVEj4',
111
- },
112
- ],
113
- },
114
- },
115
- result: {
116
- multisig: {
117
- pubkeys: [
118
- {
119
- node: {
120
- chain_code: 'fd5fd24c06088bce57f3d817df206d0891adf5a77f5391bdc12793ef1917460e',
121
- child_num: 2147483648,
122
- depth: 4,
123
- fingerprint: 2559962404,
124
- public_key: '02d598ec0f8f418c80859b690e8ee731e2bf7c8e2233d7fa722249bc3f27a65151',
125
- },
126
- },
127
- ],
128
- },
129
- },
130
- },
131
- ];
132
- const DEFAULT_NODE = {
133
- xpub: 'xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx',
134
- node: {
135
- child_num: 2147483648,
136
- chain_code: '072d8252ea73b130c7f6139daf220842bf0d42ffe43fd274c9c158504f4c50bf',
137
- public_key: '0215a09870bbb713f1ba94d364e1e5bfcf9cdb5178d22efbca6ec17dc2c4f706cd',
138
- fingerprint: 1910945124,
139
- depth: 3,
140
- },
141
- };
142
- const DEFAULT_NODE_CHILD = {
143
- xpub: 'xpub6EnV9K1LzPtRDXqqcDkBk99uCFneHiHR3DBQxXcbuWzQoUGLfJiHeF3uDW1JZH3ZG7mr4TuNtPbgLYwEibEkcDcnQkQksZi7jm3eY8PqKFv',
144
- node: {
145
- child_num: 0,
146
- chain_code: '2589d77d82c575ed697ef8122f8c44c235377d2969c7a674fe73a7347066c4b6',
147
- public_key: '020ddd7e4206daf889a2c11920fcccbb60df383d4c5fcd982cd5c7d400fdd46c8e',
148
- fingerprint: 2856412653,
149
- depth: 4,
150
- },
151
- };
152
- exports.xpubDerive = [
153
- {
154
- description: 'success P2PKH format',
155
- suffix: 0,
156
- xpub: DEFAULT_NODE,
157
- childXPub: DEFAULT_NODE_CHILD,
158
- },
159
- {
160
- description: 'success P2SH format',
161
- suffix: 0,
162
- xpub: {
163
- ...DEFAULT_NODE,
164
- xpub: 'ypub6XKbB5DSkq8Royg8isNtGktj6bmEfGJXDs83Ad5CZ5tpDV8QofwSWQFTWP2Pv24vNdrPhquehL7vRMvSTj2GpKv6UaTQCBKZALm6RJAmxG6',
165
- },
166
- childXPub: {
167
- ...DEFAULT_NODE_CHILD,
168
- xpub: 'ypub6ZckSygG95Ru4q2xSaXoxEFQNDw6ELGuxKhdjvWVHXNHra5ZuxsrGJi3EhxtZBhUfkteowVwM3xEDqYoSHemQTJPH67BTUXc1V7Hvneqgzd',
169
- },
170
- network: NETWORK_P2SH,
171
- },
172
- {
173
- description: 'Invalid network version. (P2SH xpub is used, but network is set to P2PKH)',
174
- suffix: 0,
175
- xpub: {
176
- ...DEFAULT_NODE,
177
- xpub: 'ypub6XKbB5DSkq8Royg8isNtGktj6bmEfGJXDs83Ad5CZ5tpDV8QofwSWQFTWP2Pv24vNdrPhquehL7vRMvSTj2GpKv6UaTQCBKZALm6RJAmxG6',
178
- },
179
- childXPub: {
180
- ...DEFAULT_NODE_CHILD,
181
- xpub: 'ypub6ZckSygG95Ru4q2xSaXoxEFQNDw6ELGuxKhdjvWVHXNHra5ZuxsrGJi3EhxtZBhUfkteowVwM3xEDqYoSHemQTJPH67BTUXc1V7Hvneqgzd',
182
- },
183
- error: 'Invalid network version',
184
- },
185
- {
186
- description: 'Invalid public key transmission. (depths are the same)',
187
- suffix: 0,
188
- xpub: DEFAULT_NODE,
189
- childXPub: {
190
- ...DEFAULT_NODE_CHILD,
191
- node: {
192
- ...DEFAULT_NODE_CHILD.node,
193
- depth: 3,
194
- },
195
- },
196
- error: 'Invalid public key transmission detected',
197
- },
198
- {
199
- description: 'Invalid child cross-check. (suffix is set to 1 but 0 was used to derive child)',
200
- suffix: 1,
201
- xpub: DEFAULT_NODE,
202
- childXPub: DEFAULT_NODE_CHILD,
203
- error: 'Invalid child cross-check public key',
204
- },
205
- ];
206
- //# sourceMappingURL=hdnodeUtils.js.map
@@ -1,3 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const reverseBuffer: (buf: Buffer) => Buffer;
3
- //# sourceMappingURL=bufferUtils.d.ts.map
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reverseBuffer = void 0;
4
- const reverseBuffer = (buf) => {
5
- const copy = Buffer.alloc(buf.length);
6
- buf.copy(copy);
7
- [].reverse.call(copy);
8
- return copy;
9
- };
10
- exports.reverseBuffer = reverseBuffer;
11
- //# sourceMappingURL=bufferUtils.js.map