honungsburk / atomic-swap

A trustless p2p trading dApp on Cardano
https://atomic-swap.io/
GNU General Public License v3.0
19 stars 9 forks source link

Can not add NFTs from the 'Clumsy Valley' collection #2

Open honungsburk opened 1 year ago

honungsburk commented 1 year ago

Describe the bug Can not add clumsy valley NFTs to the trading view in Atomic Swap. Every other asset seems to be working fine

jpegStore: https://www.jpg.store/collection/clumsyvalley PolicyID: b00041d7dc086d33e0f7777c4fccaf3ef06720543d4ff4e750d8f123

To Reproduce Steps to reproduce the behavior:

  1. Be in a Atomic Swap trading session
  2. Try to add a NFT from the Clumsy Valley collection

Expected behavior That you can add NFTs from the Clumsy Valley collection

Screenshots

Disco Solaris works

Clumsy Valley does not work

Additional context Originally reported on discord.

honungsburk commented 1 year ago

The 'Clumsy Valley' Collection was created after Vasil hard fork. We need to check if the format of NFTs has changed somehow.

honungsburk commented 1 year ago

My guess is that we assume the onchain_metadata to have a certain shape. And when it doesn't it crashes. This is speculative at the moment.

NFT from the 'MOTION' collection:

{
  "asset": "27706b242382999c8cb7e79c4bc7171a37a57768cf8f4b44754d39064648574d4f54494f4e303033",
  "policy_id": "27706b242382999c8cb7e79c4bc7171a37a57768cf8f4b44754d3906",
  "asset_name": "4648574d4f54494f4e303033",
  "fingerprint": "asset1xkpt5esj8m3all0utat9c3fy6rtjns0f6y33j7",
  "quantity": "1",
  "initial_mint_tx_hash": "c8b660be632d7b12dbece1eb5df5899cd0bb98a06f368b5538c44044202719a8",
  "mint_or_burn_count": 1,
  "onchain_metadata": {
    "name": "FHWMOTION003",
    "image": "ipfs://QmZ2mW76fV15N1XwKaihpQ7i9N1W28YQjDyowvv5rGfRR2",
    "code": {
      "cid": "QmbtiBKmCKtZWve8SkV94WDhVr8J7ZKQhbiDYwbZ329tdS",
      "gateway": "https://gateway.pinata.cloud/ipfs/"
    },
    "files": [
      {
        "src": "ipfs://QmeZQkmKvDzgEuK5A7VZAyZaSDMLUsJGafZHaxBHF4nAFZ",
        "name": "FHWMOTION003",
        "mediaType": "video/mp4"
      }
    ],
    "license": {
      "cid": "Qmc39oiUJCrM6ZKYbVyewzoFXvVUzaVnaCDnTek6Mq6sJZ",
      "type": "NFT License 2.0",
      "gateway": "https://gateway.pinata.cloud/ipfs/"
    },
    "mediaType": "image/png",
    "seriesName": "MOTION",
    "description": "MOTION is a series of 128 unique generative artworks."
  },
  "metadata": null
}

NFT from the 'Clumsy Valley' collection


{
  "asset": "b00041d7dc086d33e0f7777c4fccaf3ef06720543d4ff4e750d8f123436c756d73792056616c6c6579204c616e6420506c6f74202332393437",
  "policy_id": "b00041d7dc086d33e0f7777c4fccaf3ef06720543d4ff4e750d8f123",
  "asset_name": "436c756d73792056616c6c6579204c616e6420506c6f74202332393437",
  "fingerprint": "asset1a956y78t29x4hyxmuj4zfa0jvl9xx87jvrs6ue",
  "quantity": "1",
  "initial_mint_tx_hash": "818fc42f93138a588bc3d5957640019bb356a22be05765c32dac2aa400bca179",
  "mint_or_burn_count": 1,
  "onchain_metadata": {
    "image": [
      "bafybeif37umi6d5ww3vhski26wcnjkvg7esm5gxsnmzatfo56mklklrtme/",
      "final/",
      "ClumsyValleyLandPlot2947_ipfs.svg"
    ],
    "id": "2947",
    "rank": "5012",
    "biome": "dunes",
    "grass": "5",
    "items": "7",
    "rocks": "1",
    "palace": "1",
    "project": "Clumsy Valley",
    "special": "no",
    "terrain": "sand1",
    "mediaType": "image/svg+xml",
    "side_terrain": "cavern/bones"
  },
  "metadata": null
}
honungsburk commented 1 year ago

Same problem was reported for this asset asset130hd36fvt47k5j0f8cs2m8yhr5y2c9v07lmu0z

honungsburk commented 11 months ago

Same for assets in the Jellycubes collection.

honungsburk commented 11 months ago

The problem is that my code assumes the image is a string but it can be an array:

{
  "image": [
      "bafybeif37umi6d5ww3vhski26wcnjkvg7esm5gxsnmzatfo56mklklrtme/",
      "final/",
      "ClumsyValleyLandPlot2947_ipfs.svg"
    ],
}

This causes an error to be thrown when trying to display it!