blockfrost / blockfrost-go

Golang SDK for Blockfrost.io
Apache License 2.0
23 stars 9 forks source link

Invalid data type for Image field for AssetOnchainMetadata struct #63

Closed michael-loc009 closed 10 months ago

michael-loc009 commented 2 years ago

I have tried to request to the following endpoint from Blockfrost API:

https://cardano-mainnet.blockfrost.io/api/v0/assets/14696a4676909f4e3cb1f2e60e2e08e5abed70caf5c02699be97113943554259

And I got the following response: _{ ...., "onchainmetadata": { "name": "$CUBY", "image": [ "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTE4MSIgaGVpZ2h0PSIxMz", "gyIiB2aWV3Qm94PSIwIDAgMTE4MSAxMzgyIiBmaWxsPSJub25lIiB4bWxucz0iaH", "R0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0zOC44MDAxIDMxOS", "41NDZMNTUyLjYzNiAyMy4wMzc3QzU3Ni42NjMgOS4xNzMxOCA2MDYuMjY0IDkuMT", "k0MiA2MzAuMjcxIDIzLjA5MjlMMTE0Mi4zIDMxOS41MjhDMTE2Ni4yNSAzMzMuMz", "k3IDExODEgMzU4Ljk3OSAxMTgxIDM4Ni42NTlWOTk1LjM0MUMxMTgxIDEwMjMuMD", "IgMTE2Ni4yNSAxMDQ4LjYgMTE0Mi4zIDEwNjIuNDdMNjMwLjI3MSAxMzU4LjkxQz", "YwNi4yNjQgMTM3Mi44MSA1NzYuNjYzIDEzNzIuODMgNTUyLjYzNiAxMzU4Ljk2TD", "M4LjgwMDEgMTA2Mi40NUMxNC43OTEzIDEwNDguNiAwIDEwMjIuOTkgMCA5OTUuMj", "Y3VjM4Ni43MzNDMCAzNTkuMDEzIDE0Ljc5MTQgMzMzLjQwMSAzOC44MDAxIDMxOS", "41NDZaIiBmaWxsPSIjMTAxMDEwIi8+PHBhdGggZD0iTTU4OS4yMDUgNjMxLjA3OE", "w5Ni45NjI0IDM0Ni44ODNMNTg5LjIwNSA2Mi42ODQ3TDEwODEuNDUgMzQ2Ljg4M0", "w1ODkuMjA1IDYzMS4wNzhaIiBmaWxsPSIjRTMwMDFDIi8+PHBhdGggZD0iTTUyLj", "M1OTkgMTAwMi40M0w1Mi4zNTk5IDQzNC4wMzZMNTQ0LjYwMiA3MTguMjMxVjEyOD", "YuNjJMNTIuMzU5OSAxMDAyLjQzWiIgZmlsbD0iIzQ0RkYwMiIvPjxwYXRoIGQ9Ik", "02MzIuMjcxIDcyMS43OThWMTI5MC4xOUwxMTI0LjUxIDEwMDZWNDM3LjYwM0w2Mz", "IuMjcxIDcyMS43OThaIiBmaWxsPSIjRkZGNTAyIi8+PC9zdmc+Cg==" ], "id": "CUBY", "supply": "43,252,003,274,489,856,000", "project": "Cubes CNFT", "website": "http://cuby.cubescnft.com", "IPFSClone": "ipfs://QmWyTkmAEdB5LAjELRKD4ACD4GdmrPiVa1Jk5u5EWPMJQS", "mediaType": "image/svg+xml", "description": "Highest supply on-Chain token on Cardano" }, .... }

Based on the response above the image field from onchain_metadata is an array type while the AssetOnchainMetadata struct specifies the Image field as string in the api_asset.go file

As a result, the function Asset cannot decode the response from http request.

I look forward to your resolution on this issue soon.