Skip to content

Commit

Permalink
Merge pull request #1372 from input-output-hk/ffakenz/fix-hydraw-hydr…
Browse files Browse the repository at this point in the history
…a-0.16

Fix hydraw new tx cboHex decoding
  • Loading branch information
ffakenz committed Mar 25, 2024
2 parents 706a66f + a26e5b5 commit d95bcf5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hydraw/static/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ client.addEventListener("message", e => {
switch (msg.tag) {
case "TxValid":
// TODO: Should only draw pixels on SnapshotConfirmed
console.log("New transaction seen", msg.transaction.id);
if (msg.transaction.auxiliaryData != null) {
console.log("Transaction has auxiliary data", msg.transaction.auxiliaryData);
const aux = cbor.decodeFirstSync(msg.transaction.auxiliaryData).value;
const cborHex = msg.transaction.cborHex;
console.log("New transaction cborHex seen", cborHex);
const transaction = cbor.decodeFirstSync(cborHex);
const auxiliaryData = transaction[3]
if (auxiliaryData !== undefined && auxiliaryData !== null) {
console.log("Transaction has auxiliary data", auxiliaryData);
const aux = auxiliaryData.value;
const [x, y, r, g, b] = (aux.get(0) || aux.get(1)).get(metadataLabel);
n += delay;
setTimeout(() => drawPixel(x, y, [r, g, b]), n);
Expand Down Expand Up @@ -47,7 +50,6 @@ const drawPixel = (x, y, rgb) => {
ctx.fillRect(x, y, 1, 1);
}


canvas.addEventListener('click', function(e) {
console.log("event", e);
const canvasPosition = {
Expand Down

0 comments on commit d95bcf5

Please sign in to comment.