From 3e410907d2ee09f44e6cb541ee0d16c3362dcf0f Mon Sep 17 00:00:00 2001 From: Viki Val Date: Thu, 19 Oct 2023 13:32:37 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=9C=20more=20test=20examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyperdata/tests/examples/koda.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 hyperdata/tests/examples/koda.json diff --git a/hyperdata/tests/examples/koda.json b/hyperdata/tests/examples/koda.json new file mode 100644 index 00000000..a9118e72 --- /dev/null +++ b/hyperdata/tests/examples/koda.json @@ -0,0 +1,19 @@ +{ + "name": "Rare Dolphin", + "image": "ipfs://QmR3YP9ZryaxQLuoChRFe7Fnmw6sisLVdt54ep8y9dS8Vq", + "description": "", + "attributes": [ + { + "trait_type": "ID", + "value": "1082" + }, + { + "trait_type": "Type", + "value": "Dolphin" + }, + { + "trait_type": "Rarity", + "value": "Rare" + } + ] +} From a803a3f86fd0b87ee813cb989251d0a15b26b1d7 Mon Sep 17 00:00:00 2001 From: Viki Val Date: Thu, 19 Oct 2023 13:33:00 +0200 Subject: [PATCH 2/3] :test_tube: Valid parse of Koda Metadata --- hyperdata/tests/content.test.ts | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/hyperdata/tests/content.test.ts b/hyperdata/tests/content.test.ts index 04898fd0..154966ad 100644 --- a/hyperdata/tests/content.test.ts +++ b/hyperdata/tests/content.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest' -import { TezosMetadata, contentFrom } from '../src' +import { OpenSeaMetadata, TezosMetadata, contentFrom } from '../src' import fxhash from './examples/fxhash.json' +import koda from './examples/koda.json' describe('contentFrom', () => { it(`should parse FXhash metadata to Content correctly`, () => { @@ -19,4 +20,37 @@ describe('contentFrom', () => { type: '', }) }) + + it(`should parse Koda metadata to Content correctly`, () => { + const metadata = koda as OpenSeaMetadata + expect(contentFrom(metadata)).toStrictEqual({ + _raw: undefined, + name: metadata.name, + description: metadata.description, + image: metadata.image, + animationUrl: metadata.animation_url, + attributes: [ + { + display: '', + trait: 'ID', + value: '1082', + }, + { + display: '', + trait: 'Type', + value: 'Dolphin', + }, + { + display: '', + trait: 'Rarity', + value: 'Rare', + }, + ], + externalUrl: metadata.external_url, + generative: undefined, + tags: [], + thumbnail: undefined, + type: '', + }) + }) }) From c09c8eb8de9c7cfb80333463b760e50d865055af Mon Sep 17 00:00:00 2001 From: Viki Val Date: Thu, 19 Oct 2023 15:31:22 +0200 Subject: [PATCH 3/3] :test_tube: proof_of_chaos metadata --- hyperdata/tests/content.test.ts | 20 +++++++++++- hyperdata/tests/examples/proof-of-chaos.json | 32 ++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 hyperdata/tests/examples/proof-of-chaos.json diff --git a/hyperdata/tests/content.test.ts b/hyperdata/tests/content.test.ts index 154966ad..755d4cb9 100644 --- a/hyperdata/tests/content.test.ts +++ b/hyperdata/tests/content.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest' -import { OpenSeaMetadata, TezosMetadata, contentFrom } from '../src' +import { OpenSeaMetadata, TezosMetadata, contentFrom, attributeFrom } from '../src' import fxhash from './examples/fxhash.json' import koda from './examples/koda.json' +import poc from './examples/proof-of-chaos.json' describe('contentFrom', () => { it(`should parse FXhash metadata to Content correctly`, () => { @@ -53,4 +54,21 @@ describe('contentFrom', () => { type: '', }) }) + + it(`should parse Proof of Chaos metadata to Content correctly`, () => { + const metadata = poc as OpenSeaMetadata + expect(contentFrom(metadata)).toStrictEqual({ + _raw: undefined, + name: metadata.name, + description: metadata.description, + image: metadata.image, + animationUrl: metadata.animation_url, + attributes: metadata.attributes?.map(attributeFrom) || [], + externalUrl: metadata.external_url, + generative: undefined, + tags: [], + thumbnail: undefined, + type: 'video/mp4', + }) + }) }) diff --git a/hyperdata/tests/examples/proof-of-chaos.json b/hyperdata/tests/examples/proof-of-chaos.json new file mode 100644 index 00000000..20622392 --- /dev/null +++ b/hyperdata/tests/examples/proof-of-chaos.json @@ -0,0 +1,32 @@ +{ + "external_url": "https://www.proofofchaos.app/", + "mediaUri": "ipfs://ipfs/QmcfALNaGnYzujGiPWL2Q2PPBC7nBhr8JnT4bxFkFBH7gT", + "image": "ipfs://ipfs/Qmf1pn8Zsjk3NdgeVPufmRW68sMQH4MR5DqeSZ9UnqwD89", + "type": "video/mp4", + "animation_url": "ipfs://ipfs/QmcfALNaGnYzujGiPWL2Q2PPBC7nBhr8JnT4bxFkFBH7gT", + "name": "deef - afterlife review of moments in love - [epic]", + "description": "Herein lies the epic culmination, concealed yet not forgotten, in the form of 'deef - Afterlife Review of Moments in Love', the clandestine audiovisual finale from the forthcomming chronicles known as 'Love Loops Explorer' (2023/2024).\n\n[https://deef.xyz/](https://deef.xyz/)\n\n_This NFT was created with [proofofchaos.app](https://proofofchaos.app/referendum-rewards)_", + "attributes": [ + { "trait_type": "rarity", "value": "epic" }, + { + "trait_type": "name", + "value": "deef - afterlife review of moments in love - [epic]" + }, + { + "trait_type": "description", + "value": "Herein lies the epic culmination, concealed yet not forgotten, in the form of 'deef - Afterlife Review of Moments in Love', the clandestine audiovisual finale from the forthcomming chronicles known as 'Love Loops Explorer' (2023/2024)." + }, + { "trait_type": "artist", "value": "deef" }, + { "trait_type": "referendum", "value": 99 }, + { + "trait_type": "recipient", + "value": [ + ["HAPBZTbxZd4gtptAZwU3XjbFs2d1FnQ6sKd7W8FAAsJmKCw", 80], + ["Go8NpTvzdpfpK1rprXW1tE4TFTHtd2NDJCqZLw5V77GR8r4", 20] + ] + }, + { "trait_type": "totalSupply", "value": 427 }, + { "trait_type": "totalSupplyRarity", "value": 33 }, + { "trait_type": "royalty", "value": 30 } + ] +}