fee1-dead / flow.rs

Rust SDK for the Flow blockchain network
8 stars 2 forks source link

Parsing error since the spork 21 #4

Closed AlexandreBarbier closed 1 year ago

AlexandreBarbier commented 1 year ago

Hello there, I experience an issue while trying to parse an event payload.

here is the error I get Some(Error("invalid string", line: 1, column: 8)). I suppose it's linked with the line I linked below. https://github.com/fee1-dead/flow.rs/blob/c5ddefbc5399d0521d312ecdf0ef77ea065e3a3b/cadence_json/src/de.rs#L83

If you need more information please fell free to contact me

fee1-dead commented 1 year ago

Could you please post the event payload json?

AlexandreBarbier commented 1 year ago

Yes of course

{
  "value": {
    "id": "A.4eb8a10cb9f87357.NFTStorefront.ListingAvailable",
    "fields": [
      {
        "value": { "value": "0x56ae7c899c443cf5", "type": "Address" },
        "name": "storefrontAddress"
      },
      {
        "value": { "value": "846859772", "type": "UInt64" },
        "name": "listingResourceID"
      },
      {
        "value": {
          "value": {
            "staticType": {
              "type": "",
              "kind": "Resource",
              "typeID": "A.e4cf4bdc1751c65d.AllDay.NFT",
              "fields": [
                { "type": { "kind": "UInt64" }, "id": "uuid" },
                { "type": { "kind": "UInt64" }, "id": "id" },
                { "type": { "kind": "UInt64" }, "id": "editionID" },
                { "type": { "kind": "UInt64" }, "id": "serialNumber" },
                { "type": { "kind": "UFix64" }, "id": "mintingDate" }
              ],
              "initializers": []
            }
          },
          "type": "Type"
        },
        "name": "nftType"
      },
      { "value": { "value": "3850331", "type": "UInt64" }, "name": "nftID" },
      {
        "value": {
          "value": {
            "staticType": {
              "type": "",
              "kind": "Resource",
              "typeID": "A.ead892083b3e2c6c.DapperUtilityCoin.Vault",
              "fields": [
                { "type": { "kind": "UInt64" }, "id": "uuid" },
                { "type": { "kind": "UFix64" }, "id": "balance" }
              ],
              "initializers": []
            }
          },
          "type": "Type"
        },
        "name": "ftVaultType"
      },
      { "value": { "value": "2.00000000", "type": "UFix64" }, "name": "price" }
    ]
  },
  "type": "Event"
}
fee1-dead commented 1 year ago

The representation for events has changed. It used to be like this. I do not have the time and interest to change this right now, but I would happily accept PRs.

AlexandreBarbier commented 1 year ago

All right, thank you very much for your help. Have a nice day.