Skip to content

Latest commit

 

History

History
408 lines (279 loc) · 19.2 KB

SolanaNFTApi.md

File metadata and controls

408 lines (279 loc) · 19.2 KB

theblockchainapi.SolanaNFTApi

All URIs are relative to https://api.blockchainapi.com/v1

Method HTTP request Description
solanaCreateNFT POST /solana/nft Create an NFT on Solana
solanaGetNFT GET /solana/nft/{network}/{mint_address} Get an NFT's metadata
solanaGetNFTMintFee GET /solana/nft/mint/fee Get the NFT mint fee
solanaGetNFTOwner GET /solana/nft/{network}/{mint_address}/owner Get owner of an NFT
solanaGetNFTOwnerAdvanced GET /solana/nft/{network}/{mint_address}/owner_advanced Get owner of an NFT (advanced)
solanaGetNFTsCandyMachineId POST /solana/nft/candy_machine_id Get the ID of the candy machine of an NFT
solanaSearchNFTs POST /solana/nft/search Search NFTs on Solana

solanaCreateNFT

NFT solanaCreateNFT(opts)

Create an NFT on Solana

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/create-an-nft\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Create a Metaplex NFT on Solana. Read more on this <a href=&quot;https://blog.blockchainapi.com/2021/11/16/a-note-on-nfts.html\" target=&quot;_blank&quot;>here</a>. Note: Please see <a href=&quot;https://blog.blockchainapi.com/2022/01/18/how-to-format-off-chain-nft-metadata.html\" target=&quot;_blank&quot;>this article</a> to learn more about what `nft_upload_method` means and how storing the metadata of an NFT works. If you're using `nft_upload_method = &quot;LINK&quot;`, then to add attributes to the NFT or an image, add them to a JSON file and upload that to Arweave/IPFS/Filecoin. See the JSON format <a href=&quot;https://blog.blockchainapi.com/2022/01/18/how-to-format-off-chain-nft-metadata.html\&quot;&gt;here&lt;/a>. Then supply the link to the JSON file in `nft_url`. NOTE: Don't use `nft_metadata`. Values provided here do not do anything at the moment. We are fixing this soon. `Cost: 5 Credits` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let opts = {
  'nFTMintRequest': new theblockchainapi.NFTMintRequest() // NFTMintRequest | 
};
apiInstance.solanaCreateNFT(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
nFTMintRequest NFTMintRequest [optional]

Return type

NFT

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

solanaGetNFT

NFT solanaGetNFT(network, mintAddress)

Get an NFT's metadata

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/get-nft-metadata\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Get the metadata of an NFT. If you're looking for metadata such as attributes and others, you can retrieve them from the link in the URI field of the NFT metadata returned. See the example on the right. The URI is an Arweave URL. That contains the attributes and other information about the NFT. That URL is stored on the Solana blockchain. `Cost: 0.25 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let network = mainnet-beta; // String | The network ID
let mintAddress = EEr5yQpNXf7Bru6Rt5podx56HGW9CEehXqgRGh2wa71w; // String | The mint address of the NFT
apiInstance.solanaGetNFT(network, mintAddress).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
network String The network ID
mintAddress String The mint address of the NFT

Return type

NFT

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

solanaGetNFTMintFee

NFTMintFee solanaGetNFTMintFee()

Get the NFT mint fee

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/get-nft-mint-fee\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Get the estimated fee for minting an NFT on the Solana blockchain using the Metaplex protocol. `Cost: 0 Credit` (Free) (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
apiInstance.solanaGetNFTMintFee().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

NFTMintFee

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

solanaGetNFTOwner

NFTOwnerResponse solanaGetNFTOwner(network, mintAddress)

Get owner of an NFT

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/get-nft-owner\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Get the owner of an NFT. This returns the public key of the wallet that owns the associated token account that owns the NFT. If you want to get the associated token account that literally owns the NFT, derive the associated token account address from the public key returned and the NFT mint address using <a href=&quot;#operation/solanaDeriveAssociatedTokenAccountAddress&quot;>this endpoint</a>. `Cost: 0.25 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let network = devnet; // String | The network ID
let mintAddress = 4zH3Rwm1QXdfTSUqsYmeUBY4QqQmQEXJVbv4ErSK736Q; // String | The mint address of the NFT
apiInstance.solanaGetNFTOwner(network, mintAddress).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
network String The network ID
mintAddress String The mint address of the NFT

Return type

NFTOwnerResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

solanaGetNFTOwnerAdvanced

NFTOwnerAdvancedResponse solanaGetNFTOwnerAdvanced(network, mintAddress)

Get owner of an NFT (advanced)

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/get-nft-owner\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Get the owner, state, listed price, and listed marketplace (if any) of an NFT. Here's are a couple of example responses: ``` { 'contract': { 'contract_blockchain_identifier': 'M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K', 'contract_id': 'magic-eden-v2', 'contract_name': 'Magic Eden v2', 'contract_type': 'marketplace' }, 'owner': '25UJMR3FiMM6noQtPEaCJ6eDU2YQ7myDhikVQXmMuSRW', 'price': 50000000, 'state': 'listing' } ``` ``` { 'contract': null, 'owner': 'C37PJiJU8WTgoUoFqmB1Maw8hkuENDZoGDQA1pm54Fdd', 'price': null, 'state': 'holding' } ``` This function will return whether the NFT is `listed`, `loaned` (Yawww NFT loans), `otc`, `staked`, `burned`, or `held`. If listed, it will return the contract, the readable name of the contract (e.g., Magic Eden, OpenSea), the contract ID (if any; e.g., open-sea), the owner, and the listed price. From this, you can get the floor of a collection. We currently support Magic Eden (v1, v2), Exchange.Art (auction, singles), CoralCube, Solanart (v1, v2), Yawww Loans, Yawww OTC, OpenSea, Fractal, SolSea, and AlphaArt. If loaned, it will return the loan requester as the owner, the loan amount, and the loan contract. We only support the Yawww loaning contract. If listed on an OTC marketplace, it will return the same information as `listed`. OTC is used to distinguish between marketplaces that respect royalties (OTC) and those that don't (normal ones). The only `OTC` contract we track is Yawwww, at the moment. We do not yet track Solanart v3. If staked, it will return the owner and the staking contract public key. If burned, it will return the `burner` as the `owner`. If held, it will simply return the owner. If you want to get the literal owner, which may or may not be the same as the owner returned here, call the simplified get NFT owner function. For example, Bob might own the NFT, but if it is listed on Magic Eden, then the NFT is held in escrow and &quot;owned&quot; by Magic Eden. The simplified function will return Magic Eden as the owner (the literal owner). This advanced function will tell you the implied owner, which would be Bob. `Cost: 1.0 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let network = devnet; // String | The network ID
let mintAddress = 4zH3Rwm1QXdfTSUqsYmeUBY4QqQmQEXJVbv4ErSK736Q; // String | The mint address of the NFT
apiInstance.solanaGetNFTOwnerAdvanced(network, mintAddress).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
network String The network ID
mintAddress String The mint address of the NFT

Return type

NFTOwnerAdvancedResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

solanaGetNFTsCandyMachineId

GetCandyMachineIDResponse solanaGetNFTsCandyMachineId(opts)

Get the ID of the candy machine of an NFT

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/get-nft-candy-machine-id\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. Get the candy machine ID from where the NFT came, if any. NFTs can also be minted without a candy machine. It's also possible that we return &quot;Not Found&quot; when the NFT actually did come from a version of a candy machine. We check for the most popular versions of candy machine, but it is possible that someone creates their own candy machine version and mints NFTs from it. `Cost: 1 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let opts = {
  'getCandyMachineIDRequest': new theblockchainapi.GetCandyMachineIDRequest() // GetCandyMachineIDRequest | 
};
apiInstance.solanaGetNFTsCandyMachineId(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
getCandyMachineIDRequest GetCandyMachineIDRequest [optional]

Return type

GetCandyMachineIDResponse

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

solanaSearchNFTs

[NFTSearchResponse] solanaSearchNFTs(opts)

Search NFTs on Solana

<a href=&quot;https://github.com/BL0CK-X/the-blockchain-api/tree/main/examples/solana-nft/search-nfts\" target=&quot;_blank&quot;>See examples (Python, JavaScript)</a>. With this endpoint, you can search for NFTs by their symbol, name of NFTs, uuid, configuration address, and update authority. The output is a list of NFTs that match your query. You can also provide multiple search clauses, such as the update authority (`update_authority=&quot;G17UmNGnMJ851x3M1JXocgpft1afcYedjPuFpo1ohhCk&quot;`) and symbol begins with &quot;Sol&quot; (`symbol=&quot;Sol&quot;, symbol_search_method='begins_with'`). `Cost: 1 Credit` (<a href=&quot;#section/Pricing&quot;>See Pricing</a>)

Example

import theblockchainapi from 'theblockchainapi';
let defaultClient = theblockchainapi.ApiClient.instance;
// Configure API key authorization: APIKeyID
let APIKeyID = defaultClient.authentications['APIKeyID'];
APIKeyID.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APIKeyID.apiKeyPrefix = 'Token';
// Configure API key authorization: APISecretKey
let APISecretKey = defaultClient.authentications['APISecretKey'];
APISecretKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//APISecretKey.apiKeyPrefix = 'Token';

let apiInstance = new theblockchainapi.SolanaNFTApi();
let opts = {
  'nFTSearchRequest': new theblockchainapi.NFTSearchRequest() // NFTSearchRequest | 
};
apiInstance.solanaSearchNFTs(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
nFTSearchRequest NFTSearchRequest [optional]

Return type

[NFTSearchResponse]

Authorization

APIKeyID, APISecretKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json