Skip to content

Commit 2278132

Browse files
authored
Merge pull request #208 from Zondax/dev
2 parents 1791cfa + 0c834e7 commit 2278132

File tree

5 files changed

+51
-48
lines changed

5 files changed

+51
-48
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,39 @@
3131
"url": "https://github.com/zondax/zemu/issues"
3232
},
3333
"dependencies": {
34-
"@grpc/grpc-js": "^1.8.8",
34+
"@grpc/grpc-js": "^1.8.12",
3535
"@grpc/proto-loader": "^0.7.5",
36-
"@ledgerhq/hw-transport": "^6.28.0",
37-
"@ledgerhq/hw-transport-http": "^6.27.11",
38-
"axios": "^1.3.3",
36+
"@ledgerhq/hw-transport": "^6.28.1",
37+
"@ledgerhq/hw-transport-http": "^6.27.12",
38+
"axios": "^1.3.4",
3939
"axios-retry": "^3.4.0",
4040
"dockerode": "^3.3.1",
4141
"elfy": "^1.0.0",
4242
"fs-extra": "^11.0.0",
4343
"get-port": "^5.1.1",
44-
"pngjs": "^6.0.0",
44+
"pngjs": "^7.0.0",
4545
"randomstring": "^1.2.3"
4646
},
4747
"devDependencies": {
4848
"@types/dockerode": "^3.3.11",
4949
"@types/fs-extra": "^11.0.1",
5050
"@types/jest": "^29.4.0",
51-
"@types/node": "^18.13.0",
51+
"@types/node": "^18.14.6",
5252
"@types/pngjs": "^6.0.1",
5353
"@types/randomstring": "^1.1.8",
54-
"@typescript-eslint/eslint-plugin": "^5.52.0",
55-
"@typescript-eslint/parser": "^5.52.0",
56-
"@zondax/ledger-substrate": "^0.40.4",
54+
"@typescript-eslint/eslint-plugin": "^5.54.1",
55+
"@typescript-eslint/parser": "^5.54.1",
56+
"@zondax/ledger-substrate": "^0.40.5",
5757
"copyfiles": "^2.4.1",
58-
"eslint": "^8.34.0",
59-
"eslint-config-prettier": "^8.6.0",
58+
"eslint": "^8.35.0",
59+
"eslint-config-prettier": "^8.7.0",
6060
"eslint-config-standard-with-typescript": "^34.0.0",
6161
"eslint-plugin-import": "^2.27.5",
6262
"eslint-plugin-n": "^15.6.1",
6363
"eslint-plugin-promise": "^6.0.0",
64-
"jest": "^29.4.2",
64+
"jest": "^29.5.0",
6565
"prettier": "^2.8.4",
66-
"rimraf": "^4.1.2",
66+
"rimraf": "^4.3.1",
6767
"ts-jest": "^29.0.5",
6868
"ts-node": "^10.9.1",
6969
"typescript": "^4.9.5"

src/Zemu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ export default class Zemu {
131131
clearTimeout(timer);
132132
}
133133

134-
static checkAndPullImage(): void {
135-
EmuContainer.checkAndPullImage(DEFAULT_EMU_IMG);
134+
static async checkAndPullImage(): Promise<void> {
135+
await EmuContainer.checkAndPullImage(DEFAULT_EMU_IMG);
136136
}
137137

138138
static checkElf(model: TModel, elfPath: string): void {

src/buttons.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,97 +24,97 @@ export const dummyButton: IButton = {
2424
const infoButton: IButton = {
2525
x: 375,
2626
y: 30,
27-
delay: 0.5,
27+
delay: 0.1,
2828
};
2929

3030
const quitAppButton: IButton = {
3131
x: 0,
3232
y: 0,
33-
delay: 0.5,
33+
delay: 0.1,
3434
};
3535

3636
export const tapContinueButton: IButton = {
3737
x: 200,
3838
y: 250,
39-
delay: 0.5,
39+
delay: 0.1,
4040
};
4141

4242
const prevPageButton: IButton = {
4343
x: 35,
4444
y: 35,
45-
delay: 0.5,
45+
delay: 0.1,
4646
};
4747

4848
const toggleOption1: IButton = {
4949
x: 350,
5050
y: 125,
51-
delay: 0.5,
51+
delay: 0.1,
5252
};
5353

5454
const toggleOption2: IButton = {
5555
x: 350,
5656
y: 200,
57-
delay: 0.5,
57+
delay: 0.1,
5858
};
5959

6060
const toggleOption3: IButton = {
6161
x: 350,
6262
y: 250,
63-
delay: 0.5,
63+
delay: 0.1,
6464
};
6565

6666
const navRightButton: IButton = {
6767
x: 300,
6868
y: 625,
69-
delay: 0.5,
69+
delay: 0.1,
7070
};
7171

7272
const navLeftButton: IButton = {
7373
x: 100,
7474
y: 625,
75-
delay: 0.5,
75+
delay: 0.1,
7676
};
7777

7878
const approveTapButton: IButton = {
7979
x: 200,
8080
y: 550,
81-
delay: 0.5,
81+
delay: 0.1,
8282
};
8383

8484
const approveHoldButton: IButton = {
8585
x: 335,
8686
y: 525,
87-
delay: 6,
87+
delay: 3,
8888
};
8989

9090
const rejectButton: IButton = {
9191
x: 200,
9292
y: 650,
93-
delay: 0.5,
93+
delay: 0.1,
9494
};
9595

9696
const confirmYesButton: IButton = {
9797
x: 200,
9898
y: 550,
99-
delay: 0.5,
99+
delay: 0.1,
100100
};
101101

102102
const confirmNoButton: IButton = {
103103
x: 200,
104104
y: 650,
105-
delay: 0.5,
105+
delay: 0.1,
106106
};
107107

108108
const showQRButton: IButton = {
109109
x: 200,
110110
y: 300,
111-
delay: 0.5,
111+
delay: 0.1,
112112
};
113113

114114
const closeQRButton: IButton = {
115115
x: 200,
116116
y: 650,
117-
delay: 0.5,
117+
delay: 0.1,
118118
};
119119

120120
export const TouchElements = new Map<ButtonKind, IButton>([

src/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
******************************************************************************* */
1616
import { ButtonKind, type IDeviceWindow, type IStartOptions } from "./types";
1717

18-
export const DEFAULT_EMU_IMG =
19-
"zondax/builder-zemu@sha256:8d7b06cedf2d018b9464f4af4b7a8357c3fbb180f3ab153f8cb8f138defb22a4";
18+
export const DEFAULT_EMU_IMG = "zondax/builder-zemu:f9192ca";
2019

2120
export const DEFAULT_MODEL = "nanos";
2221
export const DEFAULT_START_TEXT = "Ready";

src/emulator.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,32 @@ export default class EmuContainer {
5252
});
5353
}
5454

55-
static checkAndPullImage(imageName: string): void {
55+
static async checkAndPullImage(imageName: string): Promise<void> {
5656
const docker = new Docker();
57-
docker.pull(imageName, {}, (err: any, stream: any) => {
58-
function onProgress(event: any): void {
59-
const progress = event?.progress ?? "";
60-
const status = event?.status ?? "";
61-
process.stdout.write(`[DOCKER] ${status}: ${progress}\n`);
62-
}
57+
await new Promise<void>(resolve => {
58+
docker.pull(imageName, {}, (err: any, stream: any) => {
59+
function onProgress(event: any): void {
60+
const progress = event?.progress ?? "";
61+
const status = event?.status ?? "";
62+
process.stdout.write(`[DOCKER] ${status}: ${progress}\n`);
63+
}
64+
65+
function onFinished(err: any, _output: any): void {
66+
if (err != null) {
67+
process.stdout.write(`[DOCKER] ${err}\n`);
68+
throw err;
69+
} else {
70+
resolve()
71+
}
72+
}
6373

64-
function onFinished(err: any, _output: any): void {
6574
if (err != null) {
6675
process.stdout.write(`[DOCKER] ${err}\n`);
6776
throw err;
6877
}
69-
}
70-
71-
if (err != null) {
72-
process.stdout.write(`[DOCKER] ${err}\n`);
73-
throw new Error(err);
74-
}
7578

76-
docker.modem.followProgress(stream, onFinished, onProgress);
79+
docker.modem.followProgress(stream, onFinished, onProgress);
80+
});
7781
});
7882
}
7983

0 commit comments

Comments
 (0)