-
Notifications
You must be signed in to change notification settings - Fork 10
HUBS-124 adds more relevant ipnft metadata fields to the subgraph #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,6 @@ node_modules | |
|
|
||
| build/ | ||
| generated | ||
|
|
||
| tests/.bin | ||
| .latest.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,9 @@ type Ipnft @entity { | |
| ipts: [IPT!] @derivedFrom(field: "ipnft") | ||
| metadata: IpnftMetadata | ||
| updatedAtTimestamp: BigInt | ||
|
|
||
| # as of 1.3 the Tokenizer only will create 1 ipt instance, in contrast to the ipts field above. | ||
| ipToken: Bytes | ||
elmariachi111 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the reason to add this field when we have the ipts field? for the Tokenizer 1.3 we would have an array with only one element
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly. That's what the comment says. This is here as we since 1.3 only need 1 IPT instance but never updated the subgraph accordingly. Mainly as we need to also upgrade the frontend. If we'd agree that the only IPT is just one field, we can easily adopt the frontend and switch off the ipts array. The more pragmatic reason for this field being a plain address is that Tom can simply use it for ordering IPNFTs. |
||
| } | ||
|
|
||
| type IpnftMetadata @entity { | ||
|
|
@@ -17,8 +20,21 @@ type IpnftMetadata @entity { | |
| image: String! | ||
| description: String! | ||
| externalURL: String! | ||
|
|
||
| initialSymbol: String | ||
| organization: String | ||
| topic: String | ||
|
|
||
| researchLead_name: String | ||
| researchLead_email: String | ||
|
|
||
| fundingAmount_value: String | ||
| fundingAmount_decimals: Int8 | ||
| fundingAmount_currency: String | ||
| fundingAmount_currencyType: String | ||
| } | ||
|
|
||
|
|
||
| type IPT @entity { | ||
| id: ID! # ipt address | ||
| name: String! | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| { | ||
| "schema_version": "0.0.1", | ||
| "name": "Our awesome test IP-NFT", | ||
| "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...", | ||
| "image": "ipfs://bafkreih5d2453qzkprn35zm4gj5ff6ezroevnaaygxqlwcbqq2tg7ebbe4", | ||
| "external_url": "https://testnet.mint.molecule.to/ipnft/76", | ||
| "terms_signature": "0x1f030b9f1a91d74610cb296aa87f12b2207d2b336766fffad8c53b825f1bee7d30f3665076102fe635dd3664d564ae1e5e746794b58e8861feafacfa6767ea491b", | ||
| "properties": { | ||
| "type": "IP-NFT", | ||
| "initial_symbol": "AWSOME", | ||
| "agreements": [ | ||
| { | ||
| "type": "Research Agreement", | ||
| "url": "ipfs://bafkreigqttkfe2vsgddhy4ohf3qs3eyacdz2vwindo33y7jefox3377yqq", | ||
| "mime_type": "application/pdf", | ||
| "content_hash": "bagaaiera7ftqs3jmnoph3zgq67bgjrszlqtxkk5ygadgjvnihukrqioipndq", | ||
| "encryption": { | ||
| "protocol": "lit", | ||
| "encrypted_sym_key": "abcdefedcba0123443210", | ||
| "access_control_conditions": [ | ||
| { | ||
| "conditionType": "evmContract", | ||
| "contractAddress": "0x152B444e60C526fe4434C721561a077269FcF61a", | ||
| "chain": "sepolia", | ||
| "functionName": "canRead", | ||
| "functionParams": [":userAddress", "76"], | ||
| "functionAbi": { | ||
| "inputs": [ | ||
| { | ||
| "internalType": "address", | ||
| "name": "reader", | ||
| "type": "address" | ||
| }, | ||
| { | ||
| "internalType": "uint256", | ||
| "name": "tokenId", | ||
| "type": "uint256" | ||
| } | ||
| ], | ||
| "name": "canRead", | ||
| "outputs": [ | ||
| { | ||
| "internalType": "bool", | ||
| "name": "", | ||
| "type": "bool" | ||
| } | ||
| ], | ||
| "stateMutability": "view", | ||
| "type": "function" | ||
| }, | ||
| "returnValueTest": { | ||
| "key": "", | ||
| "comparator": "=", | ||
| "value": "true" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "type": "Assignment Agreement", | ||
| "url": "ipfs://bafkreihzm4ew2ldltz66juhxyjsmmwk4e52sxobqazsnlkb5cumcdsd3i4", | ||
| "mime_type": "application/pdf", | ||
| "content_hash": "bagaaiera7ftqs3jmnoph3zgq67bgjrszlqtxkk5ygadgjvnihukrqioipndq" | ||
| } | ||
| ], | ||
| "project_details": { | ||
| "industry": "Space Exploration", | ||
| "organization": "NASA", | ||
| "topic": "Wormholes", | ||
| "funding_amount": { | ||
| "value": 1234.5678, | ||
| "decimals": 2, | ||
| "currency": "USD", | ||
| "currency_type": "ISO4217" | ||
| }, | ||
| "research_lead": { | ||
| "name": "Carl Sagan", | ||
| "email": "[email protected]" | ||
| } | ||
elmariachi111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { ipfs } from "@graphprotocol/graph-ts" | ||
| import { assert, describe, mockIpfsFile, test } from 'matchstick-as/assembly/index' | ||
| import { handleMetadata } from '../src/metadataMapping' | ||
|
|
||
| const IPNFT_METADATA = "IpnftMetadata" | ||
|
|
||
| describe('Metadata', () => { | ||
| //https://thegraph.com/docs/en/subgraphs/developing/creating/unit-testing-framework/#mocking-ipfs-files-from-matchstick-041 | ||
|
|
||
| test('reads ipnft metadata', () => { | ||
|
|
||
| mockIpfsFile('ipfsCatBaseIpnft', 'tests/fixtures/ipnft_1.json') | ||
|
|
||
| let rawData = ipfs.cat("ipfsCatBaseIpnft") | ||
| if (!rawData) { | ||
| throw new Error("Failed to fetch ipfs data") | ||
| } | ||
|
|
||
| handleMetadata(rawData) | ||
| assert.entityCount(IPNFT_METADATA, 1) | ||
| assert.fieldEquals(IPNFT_METADATA, '', 'topic', 'Wormholes') | ||
| assert.fieldEquals(IPNFT_METADATA, '', 'fundingAmount_value', '1234.5678') | ||
| assert.fieldEquals(IPNFT_METADATA, '', 'fundingAmount_currency', 'USD') | ||
|
|
||
| //logStore() | ||
| }) | ||
| }) | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.