Skip to content

Commit e466617

Browse files
author
Marcin Mazurek
committed
Merge remote-tracking branch 'origin/develop' into fix/ddw-926-trezor-error-handling
2 parents 4182c72 + 3df2fbf commit e466617

File tree

101 files changed

+3608
-2515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+3608
-2515
lines changed

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@
109109
"no-useless-constructor": "off",
110110
"@typescript-eslint/no-useless-constructor": "error"
111111
}
112+
},
113+
{
114+
"files": "hardware-wallet-tests/**/*.ts",
115+
"rules": {
116+
"jest/no-standalone-expect": "off",
117+
}
112118
}
113119
]
114120
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
!source/
66
!features/
77
!storybook/
8+
!hardware-wallet-tests/
89

910
# Now we ignore all files
1011
*.*

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
### Fixes
1515

16+
- Fixed dialogs being closed after receiving address shared ([PR 2965](https://github.com/input-output-hk/daedalus/pull/2965))
17+
- Fixed no progress shown on loading screen on Windows ([PR 2967](https://github.com/input-output-hk/daedalus/pull/2967))
18+
- Fixes hardware wallet issues on Windows ([PR 2900](https://github.com/input-output-hk/daedalus/pull/2900))
19+
- Fixed stake pool list styling ([PR 2920](https://github.com/input-output-hk/daedalus/pull/2920))
1620
- Fixed PopOver overlap ([PR 2954](https://github.com/input-output-hk/daedalus/pull/2954))
1721
- Fixed tooltip being hidden in several places ([PR-2934](https://github.com/input-output-hk/daedalus/pull/2934))
1822
- Adjusted padding for search field in stake pools ([PR 2945](https://github.com/input-output-hk/daedalus/pull/2945))
@@ -29,6 +33,9 @@
2933

3034
### Chores
3135

36+
- Updated cardano-wallet to v2022-04-27 and cardano-node to 1.34.1 ([PR 2951](https://github.com/input-output-hk/daedalus/pull/2951))
37+
- Refactor to remove duplicated code ([PR 2956](https://github.com/input-output-hk/daedalus/pull/2956))
38+
- Updated cardano-launcher to 0.20220119.0 ([PR 2839](https://github.com/input-output-hk/daedalus/pull/2839))
3239
- Added `storybook:build` check to pre-push hook ([PR 2955](https://github.com/input-output-hk/daedalus/pull/2955))
3340
- Using new faker.js ([PR 2855](https://github.com/input-output-hk/daedalus/pull/2855))
3441
- Fixed spelling issues and typos ([PR 2915](https://github.com/input-output-hk/daedalus/pull/2915))

default.nix

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ let
3131
};
3232
};
3333
pkgs = import sources.nixpkgs { inherit system config; };
34-
pkgsNative = localLib.iohkNix.getPkgsDefault {};
3534
sources = localLib.sources;
35+
flake-compat = import sources.flake-compat;
36+
walletFlake = flake-compat { src = sources.cardano-wallet; };
37+
walletPackages = with walletFlake.defaultNix.hydraJobs; {
38+
x86_64-windows = linux.windows;
39+
x86_64-linux = linux.native;
40+
x86_64-darwin = macos.intel;
41+
aarch64-darwin = macos.silicon;
42+
}.${target};
3643
walletPkgs = import "${sources.cardano-wallet}/nix" {};
3744
# only used for CLI, to be removed when upgraded to next node version
3845
nodePkgs = import "${sources.cardano-node}/nix" {};
@@ -73,15 +80,11 @@ let
7380

7481
sources = localLib.sources;
7582
bridgeTable = {
76-
cardano = self.callPackage ./nix/cardano-bridge.nix {
77-
cardano-wallet = self.cardano-wallet.cardano-wallet;
78-
cardanoWalletPkgs = self.cardano-wallet.pkgs;
79-
};
83+
cardano = self.callPackage ./nix/cardano-bridge.nix {};
8084
};
81-
cardano-wallet = import self.sources.cardano-wallet { inherit system; gitrev = self.sources.cardano-wallet.rev; crossSystem = crossSystem walletPkgs.lib; };
82-
cardano-wallet-native = import self.sources.cardano-wallet { inherit system; gitrev = self.sources.cardano-wallet.rev; };
83-
cardano-address = (import self.sources.cardano-wallet { inherit system; gitrev = self.sources.cardano-wallet.rev; crossSystem = crossSystem walletPkgs.lib; }).cardano-address;
84-
mock-token-metadata-server = (import self.sources.cardano-wallet { inherit system; gitrev = self.sources.cardano-wallet.rev; crossSystem = crossSystem walletPkgs.lib; }).mock-token-metadata-server;
85+
inherit (walletPackages) cardano-wallet;
86+
inherit (walletPackages) cardano-address;
87+
inherit (walletPackages) mock-token-metadata-server;
8588
cardano-shell = import self.sources.cardano-shell { inherit system; crossSystem = crossSystem shellPkgs.lib; };
8689
local-cluster = if cluster == "selfnode" then (import self.sources.cardano-wallet { inherit system; gitrev = self.sources.cardano-wallet.rev; crossSystem = crossSystem walletPkgs.lib; }).local-cluster else null;
8790
cardano-node-cluster = let
@@ -99,10 +102,10 @@ let
99102
in (import self.sources.cardano-node { inherit system customConfig; crossSystem = crossSystem nodePkgs.lib; }).cluster;
100103
cardano-node = if useLocalNode
101104
then (import self.sources.cardano-node { inherit system; crossSystem = crossSystem nodePkgs.lib; }).cardano-node
102-
else self.cardano-wallet.cardano-node;
105+
else walletPackages.cardano-node;
103106
cardano-cli = if useLocalNode
104107
then (import self.sources.cardano-node { inherit system; crossSystem = crossSystem nodePkgs.lib; }).haskellPackages.cardano-cli
105-
else self.cardano-wallet.cardano-cli;
108+
else walletPackages.cardano-cli;
106109
darwin-launcher = self.callPackage ./nix/darwin-launcher.nix {};
107110

108111
# a cross-compiled fastlist for the ps-list package
@@ -123,7 +126,6 @@ let
123126
network = cluster;
124127
os = ostable.${target};
125128
backend = nodeImplementation;
126-
runCommandNative = pkgsNative.runCommand;
127129
};
128130

129131
unsignedUnpackedCardano = self.daedalus-bridge; # TODO
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createCardanoAppChannel,
9+
createGetPublicKeyChannel,
10+
ipcRenderer,
11+
} from './utils';
12+
13+
export const run = () => {
14+
expect.assertions(3);
15+
16+
createTestInstructions([
17+
'Plug Ledger Nano S to your computer',
18+
'Launch Cardano APP on Nano S/Nano X',
19+
'Run the test again with Cardano App opened',
20+
'Export the public key',
21+
]);
22+
23+
createAndRegisterHardwareWalletChannels();
24+
25+
const cardanoAppChannel = createCardanoAppChannel();
26+
const publicKeyChannel = createGetPublicKeyChannel();
27+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
28+
29+
return new Promise<void>((resolve) => {
30+
hardwareWalletConnectionChannel.onReceive(
31+
async (params: { path: string }) => {
32+
expect(params).toEqual({
33+
disconnected: expect.any(Boolean),
34+
deviceType: expect.any(String),
35+
deviceId: null,
36+
deviceModel: expect.any(String),
37+
deviceName: expect.any(String),
38+
path: expect.any(String),
39+
product: expect.any(String),
40+
});
41+
42+
const cardanoAppChannelReply = await cardanoAppChannel.request(
43+
{ path: params.path },
44+
ipcRenderer,
45+
ipcRenderer
46+
);
47+
48+
expect(cardanoAppChannelReply).toEqual({
49+
minor: expect.any(Number),
50+
major: expect.any(Number),
51+
patch: expect.any(Number),
52+
deviceId: expect.any(String),
53+
});
54+
55+
const extendedPublicKey = await publicKeyChannel.request(
56+
{
57+
path: "1852'/1815'/0'",
58+
// Shelley 1852 ADA 1815 indicator for account '0'
59+
isTrezor: false,
60+
devicePath: params.path,
61+
},
62+
ipcRenderer,
63+
ipcRenderer
64+
);
65+
66+
expect(extendedPublicKey).toEqual({
67+
chainCodeHex: expect.any(String),
68+
publicKeyHex: expect.any(String),
69+
deviceId: expect.any(String),
70+
});
71+
72+
resolve();
73+
}
74+
);
75+
76+
initLedgerChannel();
77+
});
78+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createGetPublicKeyChannel,
9+
ipcRenderer,
10+
requestLaunchingCardanoAppOnLedger,
11+
} from './utils';
12+
13+
export const run = () => {
14+
expect.assertions(3);
15+
16+
createTestInstructions([
17+
'Start test runner',
18+
'Plug Ledger Nano S to your computer',
19+
'Start Cardano APP on Nano S',
20+
'Nano S will prompt to export the public key',
21+
'Export the public key',
22+
]);
23+
24+
createAndRegisterHardwareWalletChannels();
25+
26+
const publicKeyChannel = createGetPublicKeyChannel();
27+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
28+
29+
return new Promise<void>((resolve) => {
30+
hardwareWalletConnectionChannel.onReceive(
31+
async (params: { path: string }) => {
32+
expect(params).toEqual({
33+
disconnected: expect.any(Boolean),
34+
deviceType: expect.any(String),
35+
deviceId: null,
36+
deviceModel: expect.any(String),
37+
deviceName: expect.any(String),
38+
path: expect.any(String),
39+
product: expect.any(String),
40+
});
41+
42+
const cardanoAppChannelResponse = await requestLaunchingCardanoAppOnLedger(
43+
params.path
44+
);
45+
46+
expect(cardanoAppChannelResponse).toEqual({
47+
minor: expect.any(Number),
48+
major: expect.any(Number),
49+
patch: expect.any(Number),
50+
deviceId: expect.any(String),
51+
});
52+
53+
const extendedPublicKey = await publicKeyChannel.request(
54+
{
55+
path: "1852'/1815'/0'",
56+
// Shelley 1852 ADA 1815 indicator for account '0'
57+
isTrezor: false,
58+
devicePath: params.path,
59+
},
60+
ipcRenderer,
61+
ipcRenderer
62+
);
63+
64+
expect(extendedPublicKey).toEqual({
65+
chainCodeHex: expect.any(String),
66+
publicKeyHex: expect.any(String),
67+
deviceId: expect.any(String),
68+
});
69+
70+
resolve();
71+
}
72+
);
73+
74+
initLedgerChannel();
75+
});
76+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
createSequentialResult,
7+
initLedgerChannel,
8+
createTestInstructions,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
export const run = () => {
13+
expect.assertions(2);
14+
15+
createAndRegisterHardwareWalletChannels();
16+
17+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
18+
19+
createTestInstructions([
20+
'Start test runner',
21+
'Plug Ledger Nano S to your computer',
22+
'Plug Ledger Nano X to your computer',
23+
]);
24+
25+
const getNextExpectedSequence = createSequentialResult([
26+
{
27+
disconnected: false,
28+
deviceModel: 'nanoS',
29+
},
30+
{
31+
disconnected: false,
32+
deviceModel: 'nanoX',
33+
},
34+
]);
35+
36+
return new Promise<void>((resolve) => {
37+
hardwareWalletConnectionChannel.onReceive(
38+
async (message: { path: string; deviceModel: string }) => {
39+
const [expectedValue, isOver] = getNextExpectedSequence();
40+
expect(message).toEqual(expectedValue);
41+
42+
if (isOver) {
43+
await waitForZombieMessages();
44+
resolve();
45+
}
46+
}
47+
);
48+
49+
initLedgerChannel();
50+
});
51+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
createSequentialResult,
7+
initLedgerChannel,
8+
createTestInstructions,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
const getNextExpectedSequence = createSequentialResult([
13+
{
14+
disconnected: false,
15+
deviceModel: 'nanoS',
16+
},
17+
{
18+
disconnected: false,
19+
deviceModel: 'nanoX',
20+
},
21+
{
22+
disconnected: true,
23+
deviceModel: 'nanoS',
24+
},
25+
{
26+
disconnected: true,
27+
deviceModel: 'nanoX',
28+
},
29+
]);
30+
31+
export const run = () => {
32+
expect.assertions(4);
33+
34+
createAndRegisterHardwareWalletChannels();
35+
36+
const hardwareWalletConnectionChannel = createHardwareWalletConnectionChannel();
37+
38+
createTestInstructions([
39+
'Connect Nano S',
40+
'Connect Nano X',
41+
'Disconnect Nano S',
42+
'Disconnect Nano X',
43+
]);
44+
45+
return new Promise<void>((resolve) => {
46+
hardwareWalletConnectionChannel.onReceive(
47+
async (params: { path: string; deviceModel: string }) => {
48+
const [expectedValue, isOver] = getNextExpectedSequence();
49+
50+
expect(params).toEqual(expectedValue);
51+
52+
if (isOver) {
53+
await waitForZombieMessages();
54+
return resolve();
55+
}
56+
}
57+
);
58+
59+
initLedgerChannel();
60+
});
61+
};

0 commit comments

Comments
 (0)