@cityofzion/bs-neo3 0.13.0 → 0.13.1
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/LedgerServiceNeo3.js +19 -13
- package/package.json +3 -3
|
@@ -42,21 +42,27 @@ class LedgerServiceNeo3 {
|
|
|
42
42
|
}
|
|
43
43
|
getSignature(transport, serializedTransaction, networkMagic, addressIndex = 0) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
try {
|
|
46
|
+
this.emitter.emit('getSignatureStart');
|
|
47
|
+
const bip44Buffer = this.toBip44Buffer(addressIndex);
|
|
48
|
+
yield transport.send(0x80, 0x02, 0, 0x80, bip44Buffer, [0x9000]);
|
|
49
|
+
yield transport.send(0x80, 0x02, 1, 0x80, Buffer.from(neon_dappkit_1.NeonParser.numToHex(networkMagic, 4, true), 'hex'), [
|
|
50
|
+
0x9000,
|
|
51
|
+
]);
|
|
52
|
+
const chunks = serializedTransaction.match(/.{1,510}/g) || [];
|
|
53
|
+
for (let i = 0; i < chunks.length - 1; i++) {
|
|
54
|
+
yield transport.send(0x80, 0x02, 2 + i, 0x80, Buffer.from(chunks[i], 'hex'), [0x9000]);
|
|
55
|
+
}
|
|
56
|
+
const response = yield transport.send(0x80, 0x02, 2 + chunks.length, 0x00, Buffer.from(chunks[chunks.length - 1], 'hex'), [0x9000]);
|
|
57
|
+
if (response.length <= 2) {
|
|
58
|
+
throw new Error(`No more data but Ledger did not return signature!`);
|
|
59
|
+
}
|
|
60
|
+
const signature = this.derSignatureToHex(response.toString('hex'));
|
|
61
|
+
return signature;
|
|
52
62
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
throw new Error(`No more data but Ledger did not return signature!`);
|
|
63
|
+
finally {
|
|
64
|
+
this.emitter.emit('getSignatureEnd');
|
|
56
65
|
}
|
|
57
|
-
const signature = this.derSignatureToHex(response.toString('hex'));
|
|
58
|
-
this.emitter.emit('getSignatureEnd');
|
|
59
|
-
return signature;
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
68
|
getPublicKey(transport, addressIndex = 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@cityofzion/neon-dappkit": "0.4.1",
|
|
20
20
|
"@cityofzion/neon-dappkit-types": "~0.3.1",
|
|
21
21
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|
|
22
|
-
"@cityofzion/
|
|
23
|
-
"@cityofzion/
|
|
22
|
+
"@cityofzion/bs-asteroid-sdk": "0.8.1",
|
|
23
|
+
"@cityofzion/blockchain-service": "0.12.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/jest": "29.5.3",
|