Skip to content

Commit d95bcf5

Browse files
authored
Merge pull request #1372 from input-output-hk/ffakenz/fix-hydraw-hydra-0.16
Fix hydraw new tx cboHex decoding
2 parents 706a66f + a26e5b5 commit d95bcf5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

hydraw/static/bundle.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ client.addEventListener("message", e => {
1515
switch (msg.tag) {
1616
case "TxValid":
1717
// TODO: Should only draw pixels on SnapshotConfirmed
18-
console.log("New transaction seen", msg.transaction.id);
19-
if (msg.transaction.auxiliaryData != null) {
20-
console.log("Transaction has auxiliary data", msg.transaction.auxiliaryData);
21-
const aux = cbor.decodeFirstSync(msg.transaction.auxiliaryData).value;
18+
const cborHex = msg.transaction.cborHex;
19+
console.log("New transaction cborHex seen", cborHex);
20+
const transaction = cbor.decodeFirstSync(cborHex);
21+
const auxiliaryData = transaction[3]
22+
if (auxiliaryData !== undefined && auxiliaryData !== null) {
23+
console.log("Transaction has auxiliary data", auxiliaryData);
24+
const aux = auxiliaryData.value;
2225
const [x, y, r, g, b] = (aux.get(0) || aux.get(1)).get(metadataLabel);
2326
n += delay;
2427
setTimeout(() => drawPixel(x, y, [r, g, b]), n);
@@ -47,7 +50,6 @@ const drawPixel = (x, y, rgb) => {
4750
ctx.fillRect(x, y, 1, 1);
4851
}
4952

50-
5153
canvas.addEventListener('click', function(e) {
5254
console.log("event", e);
5355
const canvasPosition = {

0 commit comments

Comments
 (0)