Skip to content

Commit 2ab5615

Browse files
committed
improving compatibility with v2.1.x
1 parent 007384f commit 2ab5615

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/helperV2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function signSendChunkv2(app, chunkIdx, chunkNum, chunk) {
2929
}
3030

3131
export async function publicKeyv2(app, data) {
32-
return this.transport.send(CLA, INS.GET_ADDR_SECP256K1, 0, 0, data, [0x9000]).then(response => {
32+
return app.transport.send(CLA, INS.GET_ADDR_SECP256K1, 0, 0, data, [0x9000]).then(response => {
3333
const errorCodeData = response.slice(-2);
3434
const returnCode = errorCodeData[0] * 256 + errorCodeData[1];
3535
const compressedPk = Buffer.from(response.slice(0, 33));

tests/basic.ispec.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ test("publicKey", async () => {
2727
// Derivation path. First 3 items are automatically hardened!
2828
const path = [44, 118, 0, 0, 0];
2929

30-
let elapsed = new Date().getTime();
3130
const resp = await app.publicKey(path);
32-
elapsed = new Date().getTime() - elapsed;
33-
console.log("Elapsed: ", elapsed);
34-
35-
console.log(resp);
3631

3732
expect(resp.return_code).toEqual(0x9000);
3833
expect(resp.error_message).toEqual("No errors");
@@ -217,16 +212,17 @@ test("sign_big_tx", async () => {
217212

218213
expect(responsePk.return_code).toEqual(0x9000);
219214
expect(responsePk.error_message).toEqual("No errors");
220-
expect(responseSign.return_code).toEqual(0x6a80);
221215

222216
switch (app.versionResponse.major) {
223217
case 1:
218+
expect(responseSign.return_code).toEqual(0x6a80);
224219
expect(responseSign.error_message).toEqual(
225220
"Bad key handle : NOMEM: JSON string contains too many tokens",
226221
);
227222
break;
228223
case 2:
229-
expect(responseSign.error_message).toEqual("NOMEM: JSON string contains too many tokens");
224+
expect(responseSign.return_code).toEqual(0x6984);
225+
expect(responseSign.error_message).toEqual("Data is invalid : JSON. Too many tokens");
230226
break;
231227
default:
232228
expect.fail("Version not supported");

0 commit comments

Comments
 (0)