Skip to content

Commit e4e2dea

Browse files
authored
Merge pull request #2991 from input-output-hk/chore/ddw-1102-update-minor-trezor-connect
[DDW-1102] Trezor firmware 2.5.1 support
2 parents 209aaac + 4c014bf commit e4e2dea

File tree

11 files changed

+517
-390
lines changed

11 files changed

+517
-390
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### Chores
1616

17+
- Added support for Trezor firmware 2.5.1 ([PR 2991](https://github.com/input-output-hk/daedalus/pull/2991))
1718
- Added steps on how to link with `react-polymorph` and other external UI libraries ([PR 2948](https://github.com/input-output-hk/daedalus/pull/2948))
1819
- Published selfnode installers for all 3 platforms ([PR 2971](https://github.com/input-output-hk/daedalus/pull/2971))
1920

installers/common/MacInstaller.hs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/
151151
sign_cmd "$ABS_PATH/Contents/Resources/app/build/usb_bindings.node"
152152
sign_cmd "$ABS_PATH/Contents/Resources/app/build/HID.node"
153153
sign_cmd "$ABS_PATH/Contents/Resources/app/build/detection.node"
154-
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/keccak/bin/darwin-x64-"*"/keccak.node"
155-
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/keccak/bin/darwin-arm64-"*"/keccak.node"
156-
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/keccak/build/Release/addon.node"
157-
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/keccak/prebuilds/darwin-x64/node.napi.node"
158-
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/keccak/prebuilds/darwin-arm64/node.napi.node"
159154
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/blake-hash/prebuilds/darwin-x64/node.napi.node"
160155
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/blake-hash/prebuilds/darwin-arm64/node.napi.node"
161156
sign_cmd "$ABS_PATH/Contents/Resources/app/node_modules/blake-hash/bin/darwin-x64-"*"/blake-hash.node"
@@ -239,21 +234,22 @@ buildElectronApp darwinConfig@DarwinConfig{dcAppName, dcAppNameApp} installerCon
239234
, "bignumber.js"
240235
, "bip66"
241236
, "bitcoin-ops"
242-
, "blake2b"
243-
, "blake2"
244237
, "blake-hash"
238+
, "blake2"
239+
, "blake2b"
245240
, "blake2b-wasm"
246241
, "bn.js"
247242
, "brorand"
248243
, "bs58"
249244
, "bs58check"
245+
, "buffer"
250246
, "bytebuffer"
251247
, "call-bind"
252248
, "cashaddrjs"
253-
, "cbor-web"
254249
, "create-hash"
255250
, "create-hmac"
256251
, "cross-fetch"
252+
, "decimal.js"
257253
, "define-properties"
258254
, "elliptic"
259255
, "es-abstract"
@@ -266,13 +262,15 @@ buildElectronApp darwinConfig@DarwinConfig{dcAppName, dcAppNameApp} installerCon
266262
, "ieee754"
267263
, "inherits"
268264
, "int64-buffer"
265+
, "ip"
269266
, "js-chain-libs-node"
270267
, "json-stable-stringify"
271-
, "keccak"
268+
, "jsonschema"
269+
, "lodash"
272270
, "long"
273-
, "ms"
274271
, "minimalistic-assert"
275272
, "minimalistic-crypto-utils"
273+
, "ms"
276274
, "nanoassert"
277275
, "node-fetch"
278276
, "object-keys"
@@ -282,12 +280,19 @@ buildElectronApp darwinConfig@DarwinConfig{dcAppName, dcAppNameApp} installerCon
282280
, "pushdata-bitcoin"
283281
, "randombytes"
284282
, "regenerator-runtime"
283+
, "ripple-address-codec"
284+
, "ripple-binary-codec"
285+
, "ripple-keypairs"
286+
, "ripple-lib"
287+
, "ripple-lib-transactionparser"
285288
, "runtypes"
286289
, "safe-buffer"
287290
, "semver-compare"
288-
, "tiny-worker"
289-
, "trezor-connect"
291+
, "smart-buffer"
292+
, "socks"
293+
, "socks-proxy-agent"
290294
, "tiny-secp256k1"
295+
, "trezor-connect"
291296
, "typeforce"
292297
, "util-deprecate"
293298
, "varuint-bitcoin"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"@types/react": "^17.0.38",
103103
"@types/react-svg-inline": "^2.1.3",
104104
"@types/react-table": "^7.7.9",
105+
"@types/trezor-connect": "8.1.18",
105106
"@typescript-eslint/eslint-plugin": "^5.10.1",
106107
"@typescript-eslint/parser": "^5.10.1",
107108
"asar": "2.1.0",
@@ -277,7 +278,7 @@
277278
"spectron-fake-dialog": "0.0.1",
278279
"tail": "2.2.4",
279280
"tcp-port-used": "1.0.1",
280-
"trezor-connect": "8.2.4-extended",
281+
"trezor-connect": "8.2.8-extended",
281282
"unorm": "1.6.0",
282283
"usb-detection": "4.13.0",
283284
"validator": "13.7.0"

source/common/ipc/api.ts

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import {
2+
CardanoSignedTxData,
3+
CardanoSignTransaction,
4+
CommonParams,
5+
Success,
6+
Unsuccessful,
7+
} from 'trezor-connect';
18
import type {
29
BugReportRequestHttpOptions,
310
BugReportRequestPayload,
@@ -32,39 +39,37 @@ import type {
3239
} from '../types/logging.types';
3340
import type { Locale } from '../types/locales.types';
3441
import type {
42+
CheckFileExistsRequest,
43+
ClearDownloadLocalDataRequest,
44+
ClearDownloadLocalDataResponse,
45+
DeleteDownloadedFileRequest,
46+
DeleteDownloadedFileResponse,
3547
DownloadLocalDataRequest,
3648
DownloadLocalDataResponse,
37-
DownloadsLocalDataRequest,
38-
DownloadsLocalDataResponse,
3949
DownloadRequest,
4050
DownloadResponse,
51+
DownloadsLocalDataRequest,
52+
DownloadsLocalDataResponse,
4153
ResumeDownloadRequest,
4254
ResumeDownloadResponse,
43-
ClearDownloadLocalDataRequest,
44-
ClearDownloadLocalDataResponse,
45-
DeleteDownloadedFileRequest,
46-
DeleteDownloadedFileResponse,
47-
CheckFileExistsRequest,
4855
} from '../types/downloadManager.types';
4956
import type { StoreMessage } from '../types/electron-store.types';
5057
import type {
5158
IntrospectAddressRequest,
5259
IntrospectAddressResponse,
5360
} from '../types/address-introspection.types';
5461
import type {
55-
HardwareWalletTransportDeviceRequest,
56-
HardwareWalletTransportDeviceResponse,
62+
HardwareWalletCardanoAdaAppResponse,
63+
HardwareWalletConnectionRequest,
5764
HardwareWalletExtendedPublicKeyRequest,
5865
HardwareWalletExtendedPublicKeyResponse,
59-
HardwareWalletCardanoAdaAppResponse,
66+
HardwareWalletTransportDeviceRequest,
67+
HardwareWalletTransportDeviceResponse,
68+
LedgerDevicePayload,
6069
LedgerSignTransactionRequest,
6170
LedgerSignTransactionResponse,
62-
TrezorSignTransactionRequest,
63-
TrezorSignTransactionResponse,
64-
HardwareWalletConnectionRequest,
65-
LedgerDevicePayload,
66-
TrezorDevicePayload,
6771
TrezorDeviceErrorPayload,
72+
TrezorDevicePayload,
6873
} from '../types/hardware-wallets.types';
6974

7075
/**
@@ -492,8 +497,11 @@ export type signTransactionLedgerRendererRequest = LedgerSignTransactionRequest;
492497
export type signTransactionLedgerMainResponse = LedgerSignTransactionResponse;
493498
export const SIGN_TRANSACTION_TREZOR_CHANNEL =
494499
'SIGN_TRANSACTION_TREZOR_CHANNEL';
495-
export type signTransactionTrezorRendererRequest = TrezorSignTransactionRequest;
496-
export type signTransactionTrezorMainResponse = TrezorSignTransactionResponse;
500+
export type signTransactionTrezorRendererRequest = CommonParams &
501+
CardanoSignTransaction;
502+
export type signTransactionTrezorMainResponse =
503+
| Success<CardanoSignedTxData>
504+
| Unsuccessful;
497505
export const GET_INIT_TREZOR_CONNECT_CHANNEL =
498506
'GET_INIT_TREZOR_CONNECT_CHANNEL';
499507
export type handleInitTrezorConnectRendererRequest = void;

source/common/types/hardware-wallets.types.ts

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,6 @@ export const DeviceEvents: {
7777
UNREADABLE: 'unreadable-device',
7878
};
7979
export type AddressTypeNibble = 0 | 4 | 6 | 8 | 14;
80-
export const AddressTypeNibbles: {
81-
BASE: AddressTypeNibble;
82-
POINTER: AddressTypeNibble;
83-
ENTERPRISE: AddressTypeNibble;
84-
BYRON: AddressTypeNibble;
85-
REWARD: AddressTypeNibble;
86-
} = {
87-
BASE: 0b0000,
88-
POINTER: 0b0100,
89-
ENTERPRISE: 0b0110,
90-
BYRON: 0b1000,
91-
REWARD: 0b1110,
92-
};
93-
export type CertificateType = 0 | 1 | 2;
94-
export const CertificateTypes: {
95-
STAKE_REGISTRATION: CertificateType;
96-
STAKE_DEREGISTRATION: CertificateType;
97-
STAKE_DELEGATION: CertificateType;
98-
} = {
99-
STAKE_REGISTRATION: 0,
100-
STAKE_DEREGISTRATION: 1,
101-
STAKE_DELEGATION: 2,
102-
};
10380

10481
export type LedgerTransportDevice = {
10582
deviceId: string | null | undefined;
@@ -175,40 +152,6 @@ export type LedgerAuxiliaryDataType = {
175152
nonce: string;
176153
};
177154
};
178-
export type TrezorAuxiliaryDataType = {
179-
catalystRegistrationParameters: {
180-
votingPublicKey: string;
181-
stakingPath: string | Array<number>;
182-
rewardAddressParameters: {
183-
addressType: number;
184-
path: string;
185-
};
186-
nonce: string;
187-
};
188-
};
189-
export type TrezorSignTransactionInputType = {
190-
path: string;
191-
prev_hash: number;
192-
prev_index: number;
193-
};
194-
export type TrezorOutputTypeAddress = {
195-
address: string;
196-
amount: string;
197-
};
198-
export type TrezorOutputTypeChange = {
199-
amount: string;
200-
addressParameters: {
201-
addressType: number;
202-
path: string;
203-
stakingPath: string;
204-
};
205-
};
206-
export type TrezorSignTransactionInputsType = Array<
207-
TrezorSignTransactionInputType
208-
>;
209-
export type TrezorSignTransactionOutputsType = Array<
210-
TrezorOutputTypeAddress | TrezorOutputTypeChange
211-
>;
212155
export type Witness = {
213156
path: BIP32Path;
214157
witnessSignatureHex: string;
@@ -252,21 +195,6 @@ export type LedgerSignTransactionRequest = {
252195
auxiliaryData: LedgerAuxiliaryDataType | null | undefined;
253196
additionalWitnessPaths: Array<BIP32Path | null | undefined>;
254197
};
255-
export type TrezorSignTransactionRequest = {
256-
inputs: TrezorSignTransactionInputsType;
257-
outputs: TrezorSignTransactionOutputsType;
258-
fee?: string;
259-
ttl: string;
260-
networkId: number;
261-
protocolMagic: number;
262-
certificates: Array<Certificate | null | undefined>;
263-
withdrawals: Array<Withdrawal | null | undefined>;
264-
reset?: boolean;
265-
devicePath: string;
266-
validityIntervalStartStr?: string;
267-
signingMode: number;
268-
auxiliaryData: TrezorAuxiliaryDataType | null | undefined;
269-
};
270198
export type LedgerSignTransactionResponse = {
271199
txHashHex: string;
272200
witnesses: Array<Witness>;
@@ -282,21 +210,6 @@ export type TrezorWitness = {
282210
signature: string;
283211
chainCode: string | null | undefined;
284212
};
285-
export type TrezorSerializedTxPayload = {
286-
serializedTx: string;
287-
};
288-
export type TrezorRawTxPayload = {
289-
witnesses: Array<TrezorWitness>;
290-
auxiliaryDataSupplement?: {
291-
type: number;
292-
auxiliaryDataHash: string;
293-
catalystSignature: string;
294-
};
295-
};
296-
export type TrezorSignTransactionResponse = {
297-
success: boolean;
298-
payload: TrezorSerializedTxPayload | TrezorRawTxPayload;
299-
};
300213

301214
export type LedgerDevicePayload = {
302215
disconnected: boolean;

0 commit comments

Comments
 (0)