-
Notifications
You must be signed in to change notification settings - Fork 125
Feat/tokens metadata #576
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
Merged
Merged
Feat/tokens metadata #576
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
7600560
docs: add schema for token metadata
asimm241 89c2b89
chore: add sample response for token metadata
asimm241 2cdcccc
chore: wip: write template for contract handler
asimm241 b9714a6
refactor: refactor ft and nft names
asimm241 b97399c
feat: handle FT/NFT compliance contract deployment for metadata
asimm241 3cba055
chore: add symbol and decimals field in FT metadata table
asimm241 3e7ce47
refactor: change function name
asimm241 ec8c3d7
chore: handle ft token uri and metadata differently
asimm241 0209303
test: add integration and datastore test cases for token metadata
asimm241 127d6cc
refactor: change directory name
asimm241 4edb49f
chore: miscellaneous fixes
asimm241 d131244
chore: added tokens test to github actions
asimm241 530f964
feat: initial contract token handler queue
zone117x f186b96
test: add tokensUpdate event to test the contract functionality
asimm241 9750368
chore: use URL instead of uri-js and support ipns
asimm241 8480903
refactor: removed unwanted log
asimm241 4f48f56
chore: rebase fix
zone117x b3f5ed1
chore: fix NFT/FT variable casing
zone117x e2a1b5e
chore: store token_uri in db, fix image_canonical_uri value
zone117x fbd5c79
fix: add token-uri in datastore tests
asimm241 ab870c5
feat: support Data URLs for json metadata and token images
zone117x 2c6ef96
chore: add max fetch byte size for metadata files
zone117x 88581fb
feat: added a route to enumerate the list of ft and nft tokens
asimm241 9c2a3ca
test: fixed test cases with mock responses and added test cases for t…
asimm241 001d57b
docs: update docs for ft and nft metadata endpoints
asimm241 67fce8b
test: add unit test case to mock and test large response payload
asimm241 427e651
test: generate random data run time instead of a file to test large p…
asimm241 8a8955a
fix: fix rebase issue
asimm241 0f980b5
fix: make fungible tokens handling fail safe
asimm241 b34e461
chore: added tx_id and deployers address in tokens
asimm241 f2a67a9
chore(test): minor test fixes
zone117x b43f861
chore: less strict metadata image property parsing due to inconsisten…
zone117x b7da74c
chore: increase fault tolerance when fetching readonly contract data
zone117x 55a7bab
chore: add notification events to the token process instance
zone117x abcf70f
chore: add metadata fetch timeout
zone117x 16935b8
feat: implement external image processor script for use with ingestin…
zone117x d91fb7e
chore: fix token metadata tx_id postgres data type
zone117x 8a17223
feat: implement token contract queue in postgres to fix metadata proc…
zone117x 2ed53c0
chore: simplify initial version of nft-class metadata fetching
zone117x 9c79fec
chore: add shutdown config for the token metadata processor
zone117x 5f50ac8
chore: cleanup token json schema examples
zone117x ef7bccf
chore: cleanup unused imports
zone117x 8127607
feat: make token metadata processing opt-in
zone117x ce5b76c
chore: post-rebase lint fixes
zone117x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ src/tests-rosetta/ | |
| src/tests-rosetta-cli/ | ||
| src/tests-bns/ | ||
| client/src/ | ||
| config/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env node | ||
| const imgUrl = process.argv[2]; | ||
| const encodedUrl = encodeURIComponent(imgUrl); | ||
| const [imgixDomain, imgixToken] = [process.env['IMGIX_DOMAIN'], process.env['IMGIX_TOKEN']]; | ||
| const signature = require('crypto').createHash('md5').update(imgixToken + '/' + encodedUrl).digest('hex'); | ||
| const resultUrl = new URL(encodedUrl + '?s=' + signature, imgixDomain); | ||
| console.log(resultUrl.toString()); |
18 changes: 18 additions & 0 deletions
18
docs/api/tokens/get-fungible-tokens-metadata-list.example.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "limit": 1, | ||
| "offset": 0, | ||
| "total": 500, | ||
| "results": [ | ||
| { | ||
| "token_uri": "https://heystack.xyz/token-metadata.json", | ||
| "name": "Heystack", | ||
| "description": "Heystack is a SIP-010-compliant fungible token on the Stacks Blockchain, used on the Heystack app", | ||
| "image_uri": "https://heystack.xyz/assets/Stacks128w.png", | ||
| "image_canonical_uri": "https://heystack.xyz/assets/Stacks128w.png", | ||
| "tx_id": "0xef2ac1126e16f46843228b1dk4830e19eb7599129e4jf392cab9e65ae83a45c0", | ||
| "sender_address": "ST399W7Z9WS0GMSNQGJGME5JAENKN56D65VGMGKGA", | ||
| "symbol": "HEY", | ||
| "decimals": 5 | ||
| } | ||
| ] | ||
| } | ||
33 changes: 33 additions & 0 deletions
33
docs/api/tokens/get-fungible-tokens-metadata-list.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "description": "List of fungible tokens metadata", | ||
| "title": "FungibleTokensMetadataList", | ||
| "type": "object", | ||
| "required": [ | ||
| "results", | ||
| "limit", | ||
| "offset", | ||
| "total" | ||
| ], | ||
| "properties": { | ||
| "limit": { | ||
| "type": "integer", | ||
| "maximum": 200, | ||
| "description": "The number of tokens metadata to return" | ||
| }, | ||
| "offset": { | ||
| "type": "integer", | ||
| "description": "The number to tokens metadata to skip (starting at `0`)" | ||
| }, | ||
| "total": { | ||
| "type": "integer", | ||
| "description": "The number of tokens metadata available" | ||
| }, | ||
| "results": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "../../entities/tokens/fungible-token.schema.json" | ||
| } | ||
| } | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
docs/api/tokens/get-non-fungible-tokens-metadata-list.example.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "limit": 1, | ||
| "offset": 0, | ||
| "total": 500, | ||
| "results": [ | ||
| { | ||
| "token_uri": "https://pool.friedger.de/nft.json", | ||
| "name": "Friedger Pool", | ||
| "description": "Enjoying the stacking pool.", | ||
| "image_uri": "https://pool.friedger.de/nft.webp", | ||
| "image_canonical_uri": "https://pool.friedger.de/nft.webp", | ||
| "tx_id": "0xef2ac1126e16f46843228b1dk4830e19eb7599129e4jf392cab9e65ae83a45c0", | ||
| "sender_address": "ST399W7Z9WS0GMSNQGJGME5JAENKN56D65VGMGKGA" | ||
| } | ||
| ] | ||
| } |
33 changes: 33 additions & 0 deletions
33
docs/api/tokens/get-non-fungible-tokens-metadata-list.schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "description": "List of non fungible tokens metadata", | ||
| "title": "NonFungibleTokensMetadataList", | ||
| "type": "object", | ||
| "required": [ | ||
| "results", | ||
| "limit", | ||
| "offset", | ||
| "total" | ||
| ], | ||
| "properties": { | ||
| "limit": { | ||
| "type": "integer", | ||
| "maximum": 200, | ||
| "description": "The number of tokens metadata to return" | ||
| }, | ||
| "offset": { | ||
| "type": "integer", | ||
| "description": "The number to tokens metadata to skip (starting at `0`)" | ||
| }, | ||
| "total": { | ||
| "type": "integer", | ||
| "description": "The number of tokens metadata available" | ||
| }, | ||
| "results": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "../../entities/tokens/non-fungible-token.schema.json" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "token_uri": "https://heystack.xyz/token-metadata.json", | ||
| "name": "Heystack", | ||
| "description": "Heystack is a SIP-010-compliant fungible token on the Stacks Blockchain, used on the Heystack app", | ||
| "image_uri": "https://heystack.xyz/assets/Stacks128w.png", | ||
| "image_canonical_uri": "https://heystack.xyz/assets/Stacks128w.png", | ||
| "tx_id": "0xef2ac1126e16f46843228b1dk4830e19eb7599129e4jf392cab9e65ae83a45c0", | ||
| "sender_address": "ST399W7Z9WS0GMSNQGJGME5JAENKN56D65VGMGKGA", | ||
| "symbol": "HEY", | ||
| "decimals": 5 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema", | ||
| "$id": "fungible-token-metadata", | ||
| "title": "FungibleTokenMetadata", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": [ | ||
| "token_uri", | ||
| "name", | ||
| "description", | ||
| "image_uri", | ||
| "image_canonical_uri", | ||
| "symbol", | ||
| "decimals", | ||
| "tx_id", | ||
| "sender_address" | ||
| ], | ||
| "properties": { | ||
| "token_uri": { | ||
| "type": "string", | ||
| "description": "An optional string that is a valid URI which resolves to this token's metadata. Can be empty." | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "Identifies the asset to which this token represents" | ||
| }, | ||
| "description": { | ||
| "type": "string", | ||
| "description": "Describes the asset to which this token represents" | ||
| }, | ||
| "image_uri": { | ||
| "type": "string", | ||
| "description": "A URI pointing to a resource with mime type image/* representing the asset to which this token represents. The API may provide a URI to a cached resource, dependending on configuration. Otherwise, this can be the same value as the canonical image URI." | ||
| }, | ||
| "image_canonical_uri": { | ||
| "type": "string", | ||
| "description": "The original image URI specified by the contract. A URI pointing to a resource with mime type image/* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive." | ||
| }, | ||
| "symbol": { | ||
| "type": "string", | ||
| "description": "A shorter representation of a token. This is sometimes referred to as a \"ticker\". Examples: \"STX\", \"COOL\", etc. Typically, a token could be referred to as $SYMBOL when referencing it in writing." | ||
| }, | ||
| "decimals": { | ||
| "type": "number", | ||
| "description": "The number of decimal places in a token." | ||
| }, | ||
| "tx_id": { | ||
| "type": "string", | ||
| "description": "Tx id that deployed the contract" | ||
| }, | ||
| "sender_address": { | ||
| "type": "string", | ||
| "description": "principle that deployed the contract" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "token_uri": "https://pool.friedger.de/nft.json", | ||
| "name": "Friedger Pool", | ||
| "description": "Enjoying the stacking pool.", | ||
| "image_uri": "https://pool.friedger.de/nft.webp", | ||
| "image_canonical_uri": "https://pool.friedger.de/nft.webp", | ||
| "tx_id": "0xef2ac1126e16f46843228b1dk4830e19eb7599129e4jf392cab9e65ae83a45c0", | ||
| "sender_address": "ST399W7Z9WS0GMSNQGJGME5JAENKN56D65VGMGKGA" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema", | ||
| "$id": "non-fungible-token-metadata", | ||
| "title": "NonFungibleTokenMetadata", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": [ | ||
| "token_uri", | ||
| "name", | ||
| "description", | ||
| "image_uri", | ||
| "image_canonical_uri", | ||
| "tx_id", | ||
| "sender_address" | ||
| ], | ||
| "properties": { | ||
| "token_uri": { | ||
| "type": "string", | ||
| "description": "An optional string that is a valid URI which resolves to this token's metadata. Can be empty." | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "Identifies the asset to which this token represents" | ||
| }, | ||
| "description": { | ||
| "type": "string", | ||
| "description": "Describes the asset to which this token represents" | ||
| }, | ||
| "image_uri": { | ||
| "type": "string", | ||
| "description": "A URI pointing to a resource with mime type image/* representing the asset to which this token represents. The API may provide a URI to a cached resource, dependending on configuration. Otherwise, this can be the same value as the canonical image URI." | ||
| }, | ||
| "image_canonical_uri": { | ||
| "type": "string", | ||
| "description": "The original image URI specified by the contract. A URI pointing to a resource with mime type image/* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive." | ||
| }, | ||
| "tx_id": { | ||
| "type": "string", | ||
| "description": "Tx id that deployed the contract" | ||
| }, | ||
| "sender_address": { | ||
| "type": "string", | ||
| "description": "principle that deployed the contract" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.