|
| 1 | +--- |
| 2 | +title: "getAsset" |
| 3 | +--- |
| 4 | + |
| 5 | +import Tabs from '@theme/Tabs'; |
| 6 | +import TabItem from '@theme/TabItem'; |
| 7 | +import CreditCost from '@site/src/components/CreditCost/CreditCostPrice.js'; |
| 8 | + |
| 9 | +# `getAsset` |
| 10 | + |
| 11 | +Returns the metadata information of a compressed or standard asset. <CreditCost network="solana" method="getAsset" /> |
| 12 | + |
| 13 | +## Parameters |
| 14 | + |
| 15 | +- `id`: (string) _[required]_ - The `base58` encoded public key of the asset to query. |
| 16 | +- `config`: (object) _[optional]_ - Optional flags to return additional information about the asset: |
| 17 | + - `showFungible`: (boolean) - Whether to return the `token_info` object about the asset. |
| 18 | + - `showUnverifiedCollections`: (boolean) - Whether to return an asset from an unverified collection. |
| 19 | + - `showCollectionMetadata`: (boolean) - Whether to return the collection metadata. |
| 20 | + |
| 21 | +## Returns |
| 22 | + |
| 23 | +`result` - An object with the following fields: |
| 24 | + |
| 25 | +- `interface` - The interface type of the asset. Return types |
| 26 | + include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. |
| 27 | +- `id` - The ID of the asset. |
| 28 | +- `content` - Metadata and content information: |
| 29 | + - `$schema` - The schema URI. |
| 30 | + - `json_uri` - The URI pointing to the asset's JSON metadata. |
| 31 | + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. |
| 32 | + - `metadata` - Metadata fields: |
| 33 | + - `name` - The name of the asset. |
| 34 | + - `symbol` - The symbol of the asset. |
| 35 | + - `description` - A description of the asset. |
| 36 | + - `attributes` - List of attributes with `trait_type` and `value`. |
| 37 | + - `token_standard` - The token standard of the asset. |
| 38 | +- `ownership` - An object containing the ownership details: |
| 39 | + - `owner` - The owner's public key. |
| 40 | + - `frozen` - Whether the asset is frozen. |
| 41 | + - `delegated` - Whether the asset is delegated. |
| 42 | + - `delegate` - The delegate's public key. |
| 43 | + - `ownership_model` - The ownership model, for example `single` or `token`. |
| 44 | +- `compression` - An object containing the asset compression details: |
| 45 | + - `eligible` - Whether the asset is eligible for compression. |
| 46 | + - `compressed` - Whether the asset is compressed. |
| 47 | + - `data_hash` - The data hash of the asset. |
| 48 | + - `creator_hash` - The creator hash of the asset. |
| 49 | + - `asset_hash` - The asset hash. |
| 50 | + - `tree` - The Merkle tree ID. |
| 51 | + - `seq` - The sequence number. |
| 52 | + - `leaf_id` - The leaf ID. |
| 53 | +- `royalty` - An object containing the royalty details: |
| 54 | + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). |
| 55 | + - `target` - The target address for royalties. |
| 56 | + - `percent` - The royalty percentage. |
| 57 | + - `basis_points` - The royalty in basis points. |
| 58 | + - `primary_sale_happened` - Whether the primary sale has occurred. |
| 59 | + - `locked` - Whether the royalty is locked. |
| 60 | +- `creators` - List of creators: |
| 61 | + - `address` - The creator's public key. |
| 62 | + - `share` - The creator's share percentage. |
| 63 | + - `verified` - Whether the creator is verified. |
| 64 | +- `grouping` - Grouping details: |
| 65 | + - `group_key` - The group key (for example, `collection`). |
| 66 | + - `group_value` - The group value. |
| 67 | +- `uses` - An object containing the usage details: |
| 68 | + - `use_method` - The usage method (`burn`, `multiple`, or `single`). |
| 69 | + - `remaining` - The remaining uses. |
| 70 | + - `total` - The total uses. |
| 71 | +- `supply` - Supply details: |
| 72 | + - `print_max_supply` - The maximum supply for prints. |
| 73 | + - `print_current_supply` - The current supply for prints. |
| 74 | + - `edition_nonce` - The edition nonce. |
| 75 | +- `mutable` - Whether the asset is mutable. |
| 76 | +- `burnt` - Whether the asset is burnt. |
| 77 | +- `token_info` - Additional token info which is returned via the `showFungible` parameter: |
| 78 | + - `supply` - The supply of the asset. |
| 79 | + - `decimals` - The decimals supported by the asset. |
| 80 | + - `token_program` - The token program of the asset. |
| 81 | + - `mint_authority` - The mint authority of the asset. |
| 82 | + - `freeze_authority` - The freeze authority of the asset. |
| 83 | + |
| 84 | +## Example |
| 85 | + |
| 86 | +Replace `<YOUR-API-KEY>` with your API key. |
| 87 | + |
| 88 | +### Request |
| 89 | + |
| 90 | +<Tabs> |
| 91 | + <TabItem value="curl"> |
| 92 | + |
| 93 | + ```bash |
| 94 | + curl https://solana-mainnet.infura.io/v3/<YOUR-API-KEY> \ |
| 95 | + -X POST \ |
| 96 | + -H "Content-Type: application/json" \ |
| 97 | + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAsset", "params": ["GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD"]}' |
| 98 | + ``` |
| 99 | + |
| 100 | + </TabItem> |
| 101 | +</Tabs> |
| 102 | + |
| 103 | +### Response |
| 104 | + |
| 105 | +<Tabs> |
| 106 | + <TabItem value="JSON"> |
| 107 | + |
| 108 | + ```bash |
| 109 | + { |
| 110 | + "jsonrpc": "2.0", |
| 111 | + "result": { |
| 112 | + "interface": "Custom", |
| 113 | + "id": "GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD", |
| 114 | + "content": { |
| 115 | + "$schema": "https://schema.metaplex.com/nft1.0.json", |
| 116 | + "json_uri": "https://arweave.net/I657C0VaPHIN7G4iL8Lr_8nctJhoIecFIyzlMCVF6IQ", |
| 117 | + "files": [ |
| 118 | + { |
| 119 | + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es", |
| 120 | + "mime": "image/png" |
| 121 | + }, |
| 122 | + { |
| 123 | + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es?ext=png", |
| 124 | + "mime": "image/png" |
| 125 | + } |
| 126 | + ], |
| 127 | + "metadata": { |
| 128 | + "attributes": [ |
| 129 | + { |
| 130 | + "value": "Green", |
| 131 | + "trait_type": "Background" |
| 132 | + }, |
| 133 | + { |
| 134 | + "value": "Green / Green", |
| 135 | + "trait_type": "Fur / Skin" |
| 136 | + }, |
| 137 | + { |
| 138 | + "value": "Policeman's Cap", |
| 139 | + "trait_type": "Head" |
| 140 | + }, |
| 141 | + { |
| 142 | + "value": "Sandwich", |
| 143 | + "trait_type": "Mouth" |
| 144 | + }, |
| 145 | + { |
| 146 | + "value": "No Traits", |
| 147 | + "trait_type": "Teeth" |
| 148 | + }, |
| 149 | + { |
| 150 | + "value": "Police Uniform", |
| 151 | + "trait_type": "Clothing" |
| 152 | + }, |
| 153 | + { |
| 154 | + "value": "No Traits", |
| 155 | + "trait_type": "Eyewear" |
| 156 | + }, |
| 157 | + { |
| 158 | + "value": 1, |
| 159 | + "trait_type": "generation", |
| 160 | + "display_type": "number" |
| 161 | + }, |
| 162 | + { |
| 163 | + "value": 2463, |
| 164 | + "trait_type": "sequence", |
| 165 | + "display_type": "number" |
| 166 | + } |
| 167 | + ], |
| 168 | + "description": "Deep in the heart of Dingus Forest echoes the sleepless cries of a troop of 10,000 apes. These aren’t just regular apes, however. These are degenerate apes.", |
| 169 | + "name": "Degen Ape #2463", |
| 170 | + "symbol": "DAPE" |
| 171 | + }, |
| 172 | + "links": { |
| 173 | + "external_url": "", |
| 174 | + "image": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es" |
| 175 | + } |
| 176 | + }, |
| 177 | + "authorities": [ |
| 178 | + { |
| 179 | + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", |
| 180 | + "scopes": [ |
| 181 | + "full" |
| 182 | + ] |
| 183 | + } |
| 184 | + ], |
| 185 | + "compression": { |
| 186 | + "eligible": false, |
| 187 | + "compressed": false, |
| 188 | + "data_hash": "", |
| 189 | + "creator_hash": "", |
| 190 | + "asset_hash": "", |
| 191 | + "tree": "", |
| 192 | + "seq": 0, |
| 193 | + "leaf_id": 0 |
| 194 | + }, |
| 195 | + "grouping": [ |
| 196 | + { |
| 197 | + "group_key": "collection", |
| 198 | + "group_value": "DSwfRF1jhhu6HpSuzaig1G19kzP73PfLZBPLofkw6fLD" |
| 199 | + } |
| 200 | + ], |
| 201 | + "royalty": { |
| 202 | + "royalty_model": "creators", |
| 203 | + "target": null, |
| 204 | + "percent": 0.042, |
| 205 | + "basis_points": 420, |
| 206 | + "primary_sale_happened": true, |
| 207 | + "locked": false |
| 208 | + }, |
| 209 | + "creators": [ |
| 210 | + { |
| 211 | + "address": "9BKWqDHfHZh9j39xakYVMdr6hXmCLHH5VfCpeq2idU9L", |
| 212 | + "share": 39, |
| 213 | + "verified": false |
| 214 | + }, |
| 215 | + { |
| 216 | + "address": "9FYsKrNuEweb55Wa2jaj8wTKYDBvuCG3huhakEj96iN9", |
| 217 | + "share": 25, |
| 218 | + "verified": false |
| 219 | + }, |
| 220 | + { |
| 221 | + "address": "HNGVuL5kqjDehw7KR63w9gxow32sX6xzRNgLb8GkbwCM", |
| 222 | + "share": 25, |
| 223 | + "verified": false |
| 224 | + }, |
| 225 | + { |
| 226 | + "address": "7FzXBBPjzrNJbm9MrZKZcyvP3ojVeYPUG2XkBPVZvuBu", |
| 227 | + "share": 10, |
| 228 | + "verified": false |
| 229 | + }, |
| 230 | + { |
| 231 | + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", |
| 232 | + "share": 1, |
| 233 | + "verified": true |
| 234 | + } |
| 235 | + ], |
| 236 | + "ownership": { |
| 237 | + "frozen": false, |
| 238 | + "delegated": false, |
| 239 | + "delegate": null, |
| 240 | + "ownership_model": "single", |
| 241 | + "owner": "1BWutmTvYPwDtmw9abTkS4Ssr8no61spGAvW1X6NDix" |
| 242 | + }, |
| 243 | + "supply": { |
| 244 | + "print_max_supply": 0, |
| 245 | + "print_current_supply": 0, |
| 246 | + "edition_nonce": 255 |
| 247 | + }, |
| 248 | + "mutable": false, |
| 249 | + "burnt": false |
| 250 | + }, |
| 251 | + "id": 0 |
| 252 | + } |
| 253 | + ``` |
| 254 | + |
| 255 | + </TabItem> |
| 256 | +</Tabs> |
0 commit comments