@onekeyfe/hardware-cli 1.2.0-alpha.101 → 1.2.0-alpha.103

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.
package/dist/cli.js CHANGED
@@ -62,15 +62,11 @@ program
62
62
  program
63
63
  .command('upload-wallpaper')
64
64
  .description('Upload and activate a Pro2 wallpaper')
65
- .requiredOption('--rgba <path>', '604x1024 raw RGBA file')
65
+ .requiredOption('--jpeg <path>', '604x1024 JPEG file')
66
66
  .option('--file-name <name>', 'Device wallpaper file name', 'wallpaper-cli')
67
67
  .option('--chunk-size <bytes>', 'Transfer chunk size in bytes')
68
68
  .action(opts => runCommand({}, async ({ sdk, globalOpts, params }) => {
69
- const rgba = readBinaryParam(opts.rgba);
70
- const expectedBytes = 604 * 1024 * 4;
71
- if (rgba.byteLength !== expectedBytes) {
72
- throw new Error(`Invalid RGBA size: expected ${expectedBytes} bytes, received ${rgba.byteLength}`);
73
- }
69
+ const jpegBase64 = (0, node_fs_1.readFileSync)(opts.jpeg).toString('base64');
74
70
  let transferStartedAt;
75
71
  let transferEndedAt;
76
72
  let lastProgress = -1;
@@ -111,9 +107,7 @@ program
111
107
  try {
112
108
  result = await sdk.deviceUploadWallpaper(globalOpts.connectId, {
113
109
  ...params,
114
- width: 604,
115
- height: 1024,
116
- rgba,
110
+ jpegBase64,
117
111
  fileName: opts.fileName,
118
112
  chunkSize: opts.chunkSize ? safeParseInt(opts.chunkSize, '--chunk-size') : undefined,
119
113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hardware-cli",
3
- "version": "1.2.0-alpha.101",
3
+ "version": "1.2.0-alpha.103",
4
4
  "description": "OneKey hardware wallet CLI for testing device communication",
5
5
  "author": "OneKey",
6
6
  "license": "Apache-2.0",
@@ -31,12 +31,12 @@
31
31
  "test": "jest"
32
32
  },
33
33
  "dependencies": {
34
- "@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.101",
35
- "@onekeyfe/hd-core": "1.2.0-alpha.101",
36
- "@onekeyfe/hd-shared": "1.2.0-alpha.101",
37
- "@onekeyfe/hd-transport-usb": "1.2.0-alpha.101",
34
+ "@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.103",
35
+ "@onekeyfe/hd-core": "1.2.0-alpha.103",
36
+ "@onekeyfe/hd-shared": "1.2.0-alpha.103",
37
+ "@onekeyfe/hd-transport-usb": "1.2.0-alpha.103",
38
38
  "@stoprocent/noble": "2.3.16",
39
39
  "commander": "^12.0.0"
40
40
  },
41
- "gitHead": "f24ac3a93c71dc3814e62c5e6bcf6a4c757e0d44"
41
+ "gitHead": "ba7c3866269200b25a514202b8286d0c9e9105d3"
42
42
  }
@@ -6,6 +6,7 @@ describe('upload-wallpaper CLI command', () => {
6
6
 
7
7
  expect(command).toBeDefined();
8
8
  expect(command?.description()).toBe('Upload and activate a Pro2 wallpaper');
9
+ expect(command?.options.some(option => option.long === '--jpeg' && option.required)).toBe(true);
9
10
  });
10
11
 
11
12
  test('reports effective transfer speed from encoded bytes and elapsed time', () => {
package/src/cli.ts CHANGED
@@ -99,18 +99,12 @@ program
99
99
  program
100
100
  .command('upload-wallpaper')
101
101
  .description('Upload and activate a Pro2 wallpaper')
102
- .requiredOption('--rgba <path>', '604x1024 raw RGBA file')
102
+ .requiredOption('--jpeg <path>', '604x1024 JPEG file')
103
103
  .option('--file-name <name>', 'Device wallpaper file name', 'wallpaper-cli')
104
104
  .option('--chunk-size <bytes>', 'Transfer chunk size in bytes')
105
105
  .action(opts =>
106
106
  runCommand({}, async ({ sdk, globalOpts, params }) => {
107
- const rgba = readBinaryParam(opts.rgba);
108
- const expectedBytes = 604 * 1024 * 4;
109
- if (rgba.byteLength !== expectedBytes) {
110
- throw new Error(
111
- `Invalid RGBA size: expected ${expectedBytes} bytes, received ${rgba.byteLength}`
112
- );
113
- }
107
+ const jpegBase64 = readFileSync(opts.jpeg).toString('base64');
114
108
 
115
109
  let transferStartedAt: number | undefined;
116
110
  let transferEndedAt: number | undefined;
@@ -159,9 +153,7 @@ program
159
153
  try {
160
154
  result = await sdk.deviceUploadWallpaper(globalOpts.connectId, {
161
155
  ...params,
162
- width: 604,
163
- height: 1024,
164
- rgba,
156
+ jpegBase64,
165
157
  fileName: opts.fileName,
166
158
  chunkSize: opts.chunkSize ? safeParseInt(opts.chunkSize, '--chunk-size') : undefined,
167
159
  });