@ledgerhq/hw-app-vet 0.2.13 → 0.2.14-nightly.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +7 -0
- package/lib/Vet.d.ts +1 -0
- package/lib/Vet.d.ts.map +1 -1
- package/lib/Vet.js +45 -59
- package/lib/Vet.js.map +1 -1
- package/lib/constants.js +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/lib-es/Vet.d.ts +1 -0
- package/lib-es/Vet.d.ts.map +1 -1
- package/lib-es/Vet.js +45 -59
- package/lib-es/Vet.js.map +1 -1
- package/lib-es/utils.d.ts +2 -0
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js.map +1 -1
- package/package.json +5 -6
- package/tsconfig.json +1 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @ledgerhq/hw-app-vet
|
|
2
2
|
|
|
3
|
+
## 0.2.14-nightly.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`ff40e9a`](https://github.com/LedgerHQ/ledger-live/commit/ff40e9a00d325e5b46cb069936ba2a5781c601b5)]:
|
|
8
|
+
- @ledgerhq/cryptoassets@13.10.1-nightly.0
|
|
9
|
+
|
|
3
10
|
## 0.2.13
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/lib/Vet.d.ts
CHANGED
package/lib/Vet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vet.d.ts","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Vet.d.ts","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAchC;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,SAAS,EAAE,SAAS,CAAC;gBAET,SAAS,EAAE,SAAS,EAAE,WAAW,SAAQ;IAS/C,mBAAmB,IAAI,OAAO,CAAC,GAAG,CAAC;IAQzC;;;;;;;;OAQG;IACG,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,SAAS,CAAC,EAAE,OAAO,EACnB,WAAW,GAAE,WAAW,EAAqB,GAC5C,OAAO,CAAC;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAsCF;;;;;OAKG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAsBvE"}
|
package/lib/Vet.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const constants_1 = require("./constants");
|
|
13
4
|
const utils_1 = require("./utils");
|
|
@@ -27,17 +18,16 @@ const remapTransactionRelatedErrors = e => {
|
|
|
27
18
|
* const vet = new Vet(transport)
|
|
28
19
|
*/
|
|
29
20
|
class Vet {
|
|
21
|
+
transport;
|
|
30
22
|
constructor(transport, scrambleKey = "V3T") {
|
|
31
23
|
this.transport = transport;
|
|
32
24
|
transport.decorateAppAPIMethods(this, ["getAppConfiguration", "getAddress", "signTransaction"], scrambleKey);
|
|
33
25
|
}
|
|
34
|
-
getAppConfiguration() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return response.slice(0, 4);
|
|
40
|
-
});
|
|
26
|
+
async getAppConfiguration() {
|
|
27
|
+
const response = await this.transport.send(0xe0, 0x06, 0x00, 0x00, buffer_1.Buffer.alloc(0), [
|
|
28
|
+
constants_1.StatusCodes.OK,
|
|
29
|
+
]);
|
|
30
|
+
return response.slice(0, 4);
|
|
41
31
|
}
|
|
42
32
|
/**
|
|
43
33
|
* get VeChain address for a given BIP 32 path.
|
|
@@ -48,32 +38,30 @@ class Vet {
|
|
|
48
38
|
* @example
|
|
49
39
|
* vet.getAddress("m/44'/818'/0'/0").then(o => o.address)
|
|
50
40
|
*/
|
|
51
|
-
getAddress(path, display, chainCode, statusCodes = [constants_1.StatusCodes.OK]) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
buffer.writeUInt32BE(element, 1 + 4 * index);
|
|
58
|
-
});
|
|
59
|
-
const response = yield this.transport.send(0xe0, 0x02, display ? 0x01 : 0x00, chainCode ? 0x01 : 0x00, buffer, statusCodes);
|
|
60
|
-
const publicKeyLength = response[0];
|
|
61
|
-
const addressLength = response[1 + publicKeyLength];
|
|
62
|
-
const acc = {
|
|
63
|
-
publicKey: response.slice(1, 1 + publicKeyLength).toString("hex"),
|
|
64
|
-
address: "0x" +
|
|
65
|
-
response
|
|
66
|
-
.slice(1 + publicKeyLength + 1, 1 + publicKeyLength + 1 + addressLength)
|
|
67
|
-
.toString("ascii")
|
|
68
|
-
.toLowerCase(),
|
|
69
|
-
};
|
|
70
|
-
if (chainCode) {
|
|
71
|
-
acc.chainCode = response
|
|
72
|
-
.slice(1 + publicKeyLength + 1 + addressLength, 1 + publicKeyLength + 1 + addressLength + 32)
|
|
73
|
-
.toString("hex");
|
|
74
|
-
}
|
|
75
|
-
return acc;
|
|
41
|
+
async getAddress(path, display, chainCode, statusCodes = [constants_1.StatusCodes.OK]) {
|
|
42
|
+
const paths = (0, utils_1.splitPath)(path);
|
|
43
|
+
const buffer = buffer_1.Buffer.alloc(1 + paths.length * 4);
|
|
44
|
+
buffer[0] = paths.length;
|
|
45
|
+
paths.forEach((element, index) => {
|
|
46
|
+
buffer.writeUInt32BE(element, 1 + 4 * index);
|
|
76
47
|
});
|
|
48
|
+
const response = await this.transport.send(0xe0, 0x02, display ? 0x01 : 0x00, chainCode ? 0x01 : 0x00, buffer, statusCodes);
|
|
49
|
+
const publicKeyLength = response[0];
|
|
50
|
+
const addressLength = response[1 + publicKeyLength];
|
|
51
|
+
const acc = {
|
|
52
|
+
publicKey: response.slice(1, 1 + publicKeyLength).toString("hex"),
|
|
53
|
+
address: "0x" +
|
|
54
|
+
response
|
|
55
|
+
.slice(1 + publicKeyLength + 1, 1 + publicKeyLength + 1 + addressLength)
|
|
56
|
+
.toString("ascii")
|
|
57
|
+
.toLowerCase(),
|
|
58
|
+
};
|
|
59
|
+
if (chainCode) {
|
|
60
|
+
acc.chainCode = response
|
|
61
|
+
.slice(1 + publicKeyLength + 1 + addressLength, 1 + publicKeyLength + 1 + addressLength + 32)
|
|
62
|
+
.toString("hex");
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
77
65
|
}
|
|
78
66
|
/**
|
|
79
67
|
* You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign.
|
|
@@ -81,24 +69,22 @@ class Vet {
|
|
|
81
69
|
* @param path: the BIP32 path to sign the transaction on
|
|
82
70
|
* @param rawTxHex: the raw vechain transaction in hexadecimal to sign
|
|
83
71
|
*/
|
|
84
|
-
signTransaction(path, rawTxHex) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return lastResponse.slice(0, 65);
|
|
101
|
-
});
|
|
72
|
+
async signTransaction(path, rawTxHex) {
|
|
73
|
+
const buffers = (0, utils_1.splitRaw)(path, rawTxHex, true);
|
|
74
|
+
const responses = [];
|
|
75
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
76
|
+
const data = buffers[i];
|
|
77
|
+
responses.push(await this.transport
|
|
78
|
+
.send(0xe0, 0x04, i === 0 ? 0x00 : 0x80, 0x00, data, [constants_1.StatusCodes.OK])
|
|
79
|
+
.catch(e => {
|
|
80
|
+
throw remapTransactionRelatedErrors(e);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
const lastResponse = responses[responses.length - 1];
|
|
84
|
+
if (lastResponse.length < 65) {
|
|
85
|
+
throw new Error("invalid signature");
|
|
86
|
+
}
|
|
87
|
+
return lastResponse.slice(0, 65);
|
|
102
88
|
}
|
|
103
89
|
}
|
|
104
90
|
exports.default = Vet;
|
package/lib/Vet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vet.js","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Vet.js","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":";;AACA,2CAA0C;AAE1C,mCAA8C;AAC9C,mCAAgC;AAEhC,qCAA4E;AAE5E,MAAM,6BAA6B,GAAG,CAAC,CAAC,EAAE;IACxC,IAAI,CAAC,IAAI,CAAC,CAA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OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACxB,SAAS,CAAC,IAAI,CACZ,MAAM,IAAI,CAAC,SAAS;iBACjB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,uBAAW,CAAC,EAAE,CAAC,CAAC;iBACrE,KAAK,CAAC,CAAC,CAAC,EAAE;gBACT,MAAM,6BAA6B,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC,CACL,CAAC;QACJ,CAAC;QAED,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,YAAY,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnC,CAAC;CACF;AAxGD,sBAwGC"}
|
package/lib/constants.js
CHANGED
|
@@ -33,5 +33,5 @@ var StatusCodes;
|
|
|
33
33
|
StatusCodes[StatusCodes["GP_AUTH_FAILED"] = 25344] = "GP_AUTH_FAILED";
|
|
34
34
|
StatusCodes[StatusCodes["LICENSING"] = 28482] = "LICENSING";
|
|
35
35
|
StatusCodes[StatusCodes["HALTED"] = 28586] = "HALTED";
|
|
36
|
-
})(StatusCodes
|
|
36
|
+
})(StatusCodes || (exports.StatusCodes = StatusCodes = {}));
|
|
37
37
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,WA+BX;AA/BD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7B,qGAAuC,CAAA;IACvC,yGAAyC,CAAA;IACzC,6FAAmC,CAAA;IACnC,iEAAqB,CAAA;IACrB,2EAA0B,CAAA;IAC1B,qEAAuB,CAAA;IACvB,2DAAkB,CAAA;IAClB,qDAAe,CAAA;AACjB,CAAC,EA/BW,WAAW,2BAAX,WAAW,QA+BtB"}
|
package/lib/utils.d.ts
CHANGED
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,EAW9C,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,MAAM,UAAU,MAAM,iBAAiB,OAAO,KAAG,MAAM,EA8BrF,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,EAW9C,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,MAAM,UAAU,MAAM,iBAAiB,OAAO,KAAG,MAAM,EA8BrF,CAAC"}
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEzB,MAAM,SAAS,GAAG,CAAC,IAAY,EAAY,EAAE;IAClD,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,IA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CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA9BW,QAAA,QAAQ,YA8BnB"}
|
package/lib-es/Vet.d.ts
CHANGED
package/lib-es/Vet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vet.d.ts","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Vet.d.ts","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAchC;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,SAAS,EAAE,SAAS,CAAC;gBAET,SAAS,EAAE,SAAS,EAAE,WAAW,SAAQ;IAS/C,mBAAmB,IAAI,OAAO,CAAC,GAAG,CAAC;IAQzC;;;;;;;;OAQG;IACG,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,SAAS,CAAC,EAAE,OAAO,EACnB,WAAW,GAAE,WAAW,EAAqB,GAC5C,OAAO,CAAC;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAsCF;;;;;OAKG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAsBvE"}
|
package/lib-es/Vet.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { StatusCodes } from "./constants";
|
|
11
2
|
import { splitPath, splitRaw } from "./utils";
|
|
12
3
|
import { Buffer } from "buffer";
|
|
@@ -25,17 +16,16 @@ const remapTransactionRelatedErrors = e => {
|
|
|
25
16
|
* const vet = new Vet(transport)
|
|
26
17
|
*/
|
|
27
18
|
export default class Vet {
|
|
19
|
+
transport;
|
|
28
20
|
constructor(transport, scrambleKey = "V3T") {
|
|
29
21
|
this.transport = transport;
|
|
30
22
|
transport.decorateAppAPIMethods(this, ["getAppConfiguration", "getAddress", "signTransaction"], scrambleKey);
|
|
31
23
|
}
|
|
32
|
-
getAppConfiguration() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return response.slice(0, 4);
|
|
38
|
-
});
|
|
24
|
+
async getAppConfiguration() {
|
|
25
|
+
const response = await this.transport.send(0xe0, 0x06, 0x00, 0x00, Buffer.alloc(0), [
|
|
26
|
+
StatusCodes.OK,
|
|
27
|
+
]);
|
|
28
|
+
return response.slice(0, 4);
|
|
39
29
|
}
|
|
40
30
|
/**
|
|
41
31
|
* get VeChain address for a given BIP 32 path.
|
|
@@ -46,32 +36,30 @@ export default class Vet {
|
|
|
46
36
|
* @example
|
|
47
37
|
* vet.getAddress("m/44'/818'/0'/0").then(o => o.address)
|
|
48
38
|
*/
|
|
49
|
-
getAddress(path, display, chainCode, statusCodes = [StatusCodes.OK]) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
buffer.writeUInt32BE(element, 1 + 4 * index);
|
|
56
|
-
});
|
|
57
|
-
const response = yield this.transport.send(0xe0, 0x02, display ? 0x01 : 0x00, chainCode ? 0x01 : 0x00, buffer, statusCodes);
|
|
58
|
-
const publicKeyLength = response[0];
|
|
59
|
-
const addressLength = response[1 + publicKeyLength];
|
|
60
|
-
const acc = {
|
|
61
|
-
publicKey: response.slice(1, 1 + publicKeyLength).toString("hex"),
|
|
62
|
-
address: "0x" +
|
|
63
|
-
response
|
|
64
|
-
.slice(1 + publicKeyLength + 1, 1 + publicKeyLength + 1 + addressLength)
|
|
65
|
-
.toString("ascii")
|
|
66
|
-
.toLowerCase(),
|
|
67
|
-
};
|
|
68
|
-
if (chainCode) {
|
|
69
|
-
acc.chainCode = response
|
|
70
|
-
.slice(1 + publicKeyLength + 1 + addressLength, 1 + publicKeyLength + 1 + addressLength + 32)
|
|
71
|
-
.toString("hex");
|
|
72
|
-
}
|
|
73
|
-
return acc;
|
|
39
|
+
async getAddress(path, display, chainCode, statusCodes = [StatusCodes.OK]) {
|
|
40
|
+
const paths = splitPath(path);
|
|
41
|
+
const buffer = Buffer.alloc(1 + paths.length * 4);
|
|
42
|
+
buffer[0] = paths.length;
|
|
43
|
+
paths.forEach((element, index) => {
|
|
44
|
+
buffer.writeUInt32BE(element, 1 + 4 * index);
|
|
74
45
|
});
|
|
46
|
+
const response = await this.transport.send(0xe0, 0x02, display ? 0x01 : 0x00, chainCode ? 0x01 : 0x00, buffer, statusCodes);
|
|
47
|
+
const publicKeyLength = response[0];
|
|
48
|
+
const addressLength = response[1 + publicKeyLength];
|
|
49
|
+
const acc = {
|
|
50
|
+
publicKey: response.slice(1, 1 + publicKeyLength).toString("hex"),
|
|
51
|
+
address: "0x" +
|
|
52
|
+
response
|
|
53
|
+
.slice(1 + publicKeyLength + 1, 1 + publicKeyLength + 1 + addressLength)
|
|
54
|
+
.toString("ascii")
|
|
55
|
+
.toLowerCase(),
|
|
56
|
+
};
|
|
57
|
+
if (chainCode) {
|
|
58
|
+
acc.chainCode = response
|
|
59
|
+
.slice(1 + publicKeyLength + 1 + addressLength, 1 + publicKeyLength + 1 + addressLength + 32)
|
|
60
|
+
.toString("hex");
|
|
61
|
+
}
|
|
62
|
+
return acc;
|
|
75
63
|
}
|
|
76
64
|
/**
|
|
77
65
|
* You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign.
|
|
@@ -79,24 +67,22 @@ export default class Vet {
|
|
|
79
67
|
* @param path: the BIP32 path to sign the transaction on
|
|
80
68
|
* @param rawTxHex: the raw vechain transaction in hexadecimal to sign
|
|
81
69
|
*/
|
|
82
|
-
signTransaction(path, rawTxHex) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return lastResponse.slice(0, 65);
|
|
99
|
-
});
|
|
70
|
+
async signTransaction(path, rawTxHex) {
|
|
71
|
+
const buffers = splitRaw(path, rawTxHex, true);
|
|
72
|
+
const responses = [];
|
|
73
|
+
for (let i = 0; i < buffers.length; i++) {
|
|
74
|
+
const data = buffers[i];
|
|
75
|
+
responses.push(await this.transport
|
|
76
|
+
.send(0xe0, 0x04, i === 0 ? 0x00 : 0x80, 0x00, data, [StatusCodes.OK])
|
|
77
|
+
.catch(e => {
|
|
78
|
+
throw remapTransactionRelatedErrors(e);
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
const lastResponse = responses[responses.length - 1];
|
|
82
|
+
if (lastResponse.length < 65) {
|
|
83
|
+
throw new Error("invalid signature");
|
|
84
|
+
}
|
|
85
|
+
return lastResponse.slice(0, 65);
|
|
100
86
|
}
|
|
101
87
|
}
|
|
102
88
|
//# sourceMappingURL=Vet.js.map
|
package/lib-es/Vet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vet.js","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Vet.js","sourceRoot":"","sources":["../src/Vet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,gDAAgD,EAAE,MAAM,UAAU,CAAC;AAE5E,MAAM,6BAA6B,GAAG,CAAC,CAAC,EAAE;IACxC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,IAAI,gDAAgD,CACzD,qDAAqD,CACtD,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,SAAS,CAAY;IAErB,YAAY,SAAoB,EAAE,WAAW,GAAG,KAAK;QACnD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,SAAS,CAAC,qBAAqB,CAC7B,IAAI,EACJ,CAAC,qBAAqB,EAAE,YAAY,EAAE,iBAAiB,CAAC,EACxD,WAAW,CACZ,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YAClF,WAAW,CAAC,EAAE;SACf,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;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d.ts
CHANGED
package/lib-es/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,EAW9C,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,MAAM,UAAU,MAAM,iBAAiB,OAAO,KAAG,MAAM,EA8BrF,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,EAW9C,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,MAAM,UAAU,MAAM,iBAAiB,OAAO,KAAG,MAAM,EA8BrF,CAAC"}
|
package/lib-es/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAY,EAAE;IAClD,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/hw-app-vet",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14-nightly.0",
|
|
4
4
|
"description": "Ledger Hardware Wallet VeChain Application API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"module": "lib-es/Vet.js",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"thor-devkit": "^2.0.6",
|
|
30
|
-
"@ledgerhq/cryptoassets": "^13.10.0",
|
|
30
|
+
"@ledgerhq/cryptoassets": "^13.10.1-nightly.0",
|
|
31
31
|
"@ledgerhq/errors": "^6.19.1",
|
|
32
32
|
"@ledgerhq/hw-transport": "^6.31.4",
|
|
33
33
|
"@ledgerhq/hw-transport-mocker": "^6.29.4",
|
|
@@ -35,22 +35,21 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/jest": "^29.5.10",
|
|
38
|
-
"@types/node": "^
|
|
38
|
+
"@types/node": "^22.10.10",
|
|
39
39
|
"documentation": "14.0.2",
|
|
40
40
|
"jest": "^29.7.0",
|
|
41
41
|
"source-map-support": "^0.5.21",
|
|
42
42
|
"ts-jest": "^29.1.1",
|
|
43
43
|
"ts-node": "^10.4.0",
|
|
44
|
-
"typescript": "^4",
|
|
45
44
|
"@ledgerhq/hw-transport-mocker": "^6.29.4"
|
|
46
45
|
},
|
|
47
46
|
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
|
|
48
47
|
"scripts": {
|
|
49
48
|
"clean": "rimraf lib lib-es",
|
|
50
|
-
"build": "tsc && tsc -m
|
|
49
|
+
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
|
|
51
50
|
"prewatch": "pnpm build",
|
|
52
51
|
"watch": "tsc --watch",
|
|
53
|
-
"watch:es": "tsc --watch -m
|
|
52
|
+
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
|
|
54
53
|
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
|
|
55
54
|
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx",
|
|
56
55
|
"lint:fix": "pnpm lint --fix",
|