Skip to content

Commit d567319

Browse files
committed
[DDW-596] merge-in latest develop
2 parents 6cc778b + e0fd21e commit d567319

File tree

107 files changed

+4457
-3905
lines changed

Some content is hidden

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

107 files changed

+4457
-3905
lines changed

.eslintrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"@typescript-eslint/no-empty-function": 1,
7777
"@typescript-eslint/ban-types": 1,
7878
"import/no-unresolved": 1,
79-
"@typescript-eslint/no-var-requires": 1,
79+
"@typescript-eslint/no-var-requires": 0,
8080
"camelcase": 1,
8181
"no-empty": 1,
8282
"@typescript-eslint/no-explicit-any": 1,
@@ -115,6 +115,12 @@
115115
"no-useless-constructor": "off",
116116
"@typescript-eslint/no-useless-constructor": "error"
117117
}
118+
},
119+
{
120+
"files": "hardware-wallet-tests/**/*.ts",
121+
"rules": {
122+
"jest/no-standalone-expect": "off",
123+
}
118124
}
119125
]
120126
}

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
!source/
66
!features/
77
!storybook/
8+
!hardware-wallet-tests/
89
!tests/
910

1011
# Now we ignore all files

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
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))
1619
- Fixed stake pool list styling ([PR 2920](https://github.com/input-output-hk/daedalus/pull/2920))
1720
- Fixed PopOver overlap ([PR 2954](https://github.com/input-output-hk/daedalus/pull/2954))
1821
- Fixed tooltip being hidden in several places ([PR-2934](https://github.com/input-output-hk/daedalus/pull/2934))
@@ -30,6 +33,7 @@
3033

3134
### Chores
3235

36+
- Updated cardano-launcher to 0.20220119.0 ([PR 2839](https://github.com/input-output-hk/daedalus/pull/2839))
3337
- Added `storybook:build` check to pre-push hook ([PR 2955](https://github.com/input-output-hk/daedalus/pull/2955))
3438
- Bumped vulnerable dependencies versions ([PR 2943](https://github.com/input-output-hk/daedalus/pull/2943))
3539
- Using new faker.js ([PR 2855](https://github.com/input-output-hk/daedalus/pull/2855))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 =
28+
createHardwareWalletConnectionChannel();
29+
30+
return new Promise<void>((resolve) => {
31+
hardwareWalletConnectionChannel.onReceive(
32+
async (params: { path: string }) => {
33+
expect(params).toEqual({
34+
disconnected: expect.any(Boolean),
35+
deviceType: expect.any(String),
36+
deviceId: null,
37+
deviceModel: expect.any(String),
38+
deviceName: expect.any(String),
39+
path: expect.any(String),
40+
product: expect.any(String),
41+
});
42+
43+
const cardanoAppChannelReply = await cardanoAppChannel.request(
44+
{ path: params.path },
45+
ipcRenderer,
46+
ipcRenderer
47+
);
48+
49+
expect(cardanoAppChannelReply).toEqual({
50+
minor: expect.any(Number),
51+
major: expect.any(Number),
52+
patch: expect.any(Number),
53+
deviceId: expect.any(String),
54+
});
55+
56+
const extendedPublicKey = await publicKeyChannel.request(
57+
{
58+
path: "1852'/1815'/0'",
59+
// Shelley 1852 ADA 1815 indicator for account '0'
60+
isTrezor: false,
61+
devicePath: params.path,
62+
},
63+
ipcRenderer,
64+
ipcRenderer
65+
);
66+
67+
expect(extendedPublicKey).toEqual({
68+
chainCodeHex: expect.any(String),
69+
publicKeyHex: expect.any(String),
70+
deviceId: expect.any(String),
71+
});
72+
73+
resolve();
74+
}
75+
);
76+
77+
initLedgerChannel();
78+
});
79+
};
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 =
28+
createHardwareWalletConnectionChannel();
29+
30+
return new Promise<void>((resolve) => {
31+
hardwareWalletConnectionChannel.onReceive(
32+
async (params: { path: string }) => {
33+
expect(params).toEqual({
34+
disconnected: expect.any(Boolean),
35+
deviceType: expect.any(String),
36+
deviceId: null,
37+
deviceModel: expect.any(String),
38+
deviceName: expect.any(String),
39+
path: expect.any(String),
40+
product: expect.any(String),
41+
});
42+
43+
const cardanoAppChannelResponse =
44+
await requestLaunchingCardanoAppOnLedger(params.path);
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+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 =
18+
createHardwareWalletConnectionChannel();
19+
20+
createTestInstructions([
21+
'Start test runner',
22+
'Plug Ledger Nano S to your computer',
23+
'Plug Ledger Nano X to your computer',
24+
]);
25+
26+
const getNextExpectedSequence = createSequentialResult([
27+
{
28+
disconnected: false,
29+
deviceModel: 'nanoS',
30+
},
31+
{
32+
disconnected: false,
33+
deviceModel: 'nanoX',
34+
},
35+
]);
36+
37+
return new Promise<void>((resolve) => {
38+
hardwareWalletConnectionChannel.onReceive(
39+
async (message: { path: string; deviceModel: string }) => {
40+
const [expectedValue, isOver] = getNextExpectedSequence();
41+
expect(message).toEqual(expectedValue);
42+
43+
if (isOver) {
44+
await waitForZombieMessages();
45+
resolve();
46+
}
47+
}
48+
);
49+
50+
initLedgerChannel();
51+
});
52+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 =
37+
createHardwareWalletConnectionChannel();
38+
39+
createTestInstructions([
40+
'Connect Nano S',
41+
'Connect Nano X',
42+
'Disconnect Nano S',
43+
'Disconnect Nano X',
44+
]);
45+
46+
return new Promise<void>((resolve) => {
47+
hardwareWalletConnectionChannel.onReceive(
48+
async (params: { path: string; deviceModel: string }) => {
49+
const [expectedValue, isOver] = getNextExpectedSequence();
50+
51+
expect(params).toEqual(expectedValue);
52+
53+
if (isOver) {
54+
await waitForZombieMessages();
55+
return resolve();
56+
}
57+
}
58+
);
59+
60+
initLedgerChannel();
61+
});
62+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import expect from 'expect';
2+
3+
import {
4+
createAndRegisterHardwareWalletChannels,
5+
createHardwareWalletConnectionChannel,
6+
initLedgerChannel,
7+
createTestInstructions,
8+
createSequentialResult,
9+
waitForZombieMessages,
10+
} from './utils';
11+
12+
export const run = () => {
13+
expect.assertions(3);
14+
15+
createTestInstructions([
16+
'Plug Ledger Nano S to your computer',
17+
'Disconnect Nano S',
18+
]);
19+
20+
createAndRegisterHardwareWalletChannels();
21+
22+
const hardwareWalletConnectionChannel =
23+
createHardwareWalletConnectionChannel();
24+
25+
const getNextExpectedSequence = createSequentialResult([
26+
{
27+
disconnected: false,
28+
},
29+
{
30+
disconnected: true,
31+
},
32+
]);
33+
34+
return new Promise<void>((resolve) => {
35+
hardwareWalletConnectionChannel.onReceive(
36+
async (params: { path: string }) => {
37+
const [expectedValue, isOver] = getNextExpectedSequence();
38+
expect(params).toEqual(expectedValue);
39+
40+
if (isOver) {
41+
await waitForZombieMessages();
42+
return resolve();
43+
}
44+
}
45+
);
46+
47+
initLedgerChannel();
48+
});
49+
};

0 commit comments

Comments
 (0)