SiaFoundation / walletd

A new Sia wallet
https://sia.tech/software/walletd
MIT License
14 stars 9 forks source link

Add Type field for wallet events #122

Closed n8maninger closed 4 months ago

n8maninger commented 4 months ago

Removes the eventData interface and the custom json encoding in favor of a field on the Event struct. This does remove the limited guarantees we have about the data aligning with the type, but in practice its not a significant enough downside to justify the custom marshalling.

@alexfreska this will break the UI... Again.. Actually, it will not

{
  "id": "h:a0f44763dbb2d2f95eec0f20f18bda75e7026297b6172f73449f3c3d67c2099c",
  "index": {
    "height": 997,
    "id": "bid:000000004d7b155547e163ea4933c28cf2171c43c0c02e50c04f6718f6af37f0"
  },
  "timestamp": "2023-01-16T02:06:49Z",
  "maturityHeight": 997,
  "relevant": null,
  "type": "transaction",
  "data": {
    "siacoinInputs": [
      {
        "id": "h:35b81e41f594d7faeb88bd8eaac2eaa68ce99fe1c8fe5f0cba8fafa65ab3a70e",
        "leafIndex": 0,
        "merkleProof": null,
        "siacoinOutput": {
          "value": "1000000000000000000000000000000000000",
          "address": "addr:3d7f707d05f2e0ec7ccc9220ed7c8af3bc560fbee84d068c2cc28151d617899e1ee8bc069946"
        },
        "maturityHeight": 0
      }
    ],
    "siacoinOutputs": [
      {
        "id": "h:674c765a9708e24528549c2ecf9c6cc99501a1d4909b9aa18ec64f14bccfef41",
        "leafIndex": 2133,
        "merkleProof": null,
        "siacoinOutput": {
          "value": "100000000000022500000000000000000000",
          "address": "addr:70cd9249053dc5d575aa74385a730fbe16b1c7997ddadc37a5d9abc8dbf12017cbd4bb3c48da"
        },
        "maturityHeight": 0
      },
      {
        "id": "h:4e4dc8a4b2147ba5783d803e645be14c54f1276f45a76c1cad060e41ded3733f",
        "leafIndex": 2134,
        "merkleProof": null,
        "siacoinOutput": {
          "value": "899999999999977500000000000000000000",
          "address": "addr:6f2ff24633525e854d0106031daf6cc666d5b8610ff9fbbd676a1d1a95903c794e054de7a634"
        },
        "maturityHeight": 0
      }
    ],
    "siafundInputs": [],
    "siafundOutputs": [],
    "fileContracts": null,
    "v2FileContracts": null,
    "hostAnnouncements": null,
    "fee": "0"
  }
}