NFT

Make magic happen with your NFT superpowers

Create

Create a master edition NFT.

POST /sol/v1/nft/create_detach

Creating an NFT is just 1 simple API call, which internally does all the heavy lifting for you.

  • Uploads the image or anything you want to your choice of storage (IPFS or S3).

  • Creates an appropriate Metadata json file.

  • Uploads the metadata json file again to your choice of storage (IPFS or S3).

  • Finally mints your favorite NFT.

Body Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • wallet: Your wallet address who will be signing and paying the transaction fee

  • name: NFT Name

  • symbol: NFT Symbol

  • description: (optional) NFT description

  • attributes: (optional) attributes associated to this NFT. (You can create the attributes as an array of objects and then stringify it using JSON.stringify)

  • external_url: (optional) any url to associate with the NFT

  • max_supply: (optional) Maximum number of clones/edition mints possible for this NFT. Default 0 for one-of-a-kind NFT.

  • royalty: (optional) represents how much percentage of secondary sales the original creator gets. Ranges from (0-100), 0 being the original creator gets nothing and 100 being the original creator gets the entire amount from the secondary sales

  • file: NFT Image

  • data: (Optional) Any digital data (.mp3/.wav/.mp4/.pdf/.json etc) that you want to put in the NFT

  • receiver: (optional) Account address which will receive the newly created NFT.

  • service_charge : (optional) - Transaction fee to be paid by the NFT creator for creating an NFT. This fee can be charged in SOL or any SPL-20 token. Below is the structure of the service_charge key.

    • receiver: string - An address that will receive the service charge amount.

    • amount: number - The amount of currency to be charged.

    • token(optional): string - The address of the SPL token, the service charge currency. By default SOL is charged.

Charging Service charge in USDC:

{
    "receiver": "499qpPLdqgvVeGvvNjsWi27QHpC8GPkPfuL5Cn2DtZJe", 
    "token": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", 
    "amount": 0.01
}

Charging Service charge in SOL:

{
    "receiver": "499qpPLdqgvVeGvvNjsWi27QHpC8GPkPfuL5Cn2DtZJe",
    "amount": 0.01
}

Response

You will get an encoded transaction in response which you can sign in your front end or back end using the same wallet used in the API.

We have already deployed a dev tool to sign and send transactions for quick testing https://shyft-insider.vercel.app/

var myHeaders = new Headers();
myHeaders.append("x-api-key", "QEbMrBRQEP92ToRo");
myHeaders.append("Content-Type", "multipart/form-data");

var formdata = new FormData();
formdata.append("network", "devnet");
formdata.append("wallet", "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc");
formdata.append("name", "SHYFT NFT");
formdata.append("symbol", "SH");
formdata.append("description", "Shyft makes Web3 so easy!");
formdata.append("attributes", '[{"trait_type":"dev power","value":"over 900"}]');
formdata.append("external_url", "https://shyft.to");
formdata.append("max_supply", "0");
formdata.append("royalty", "5");
formdata.append("file", fileInput.files[0], "index.png");
formdata.append("nft_receiver", "5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2");
formdata.append('service_charge', '{ "receiver": "499qpPLdqgvVeGvvNjsWi27QHpC8GPkPfuL5Cn2DtZJe",  "token": "DjMA5cCK95X333t7SgkpsG5vC9wMk7u9JV4w8qipvFE8",  "amount": 0.01}');

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/nft/create_detach", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Ta-da πŸŽ‰, a transaction has been created for you to sign and send to the blockchain after which your NFT will be created. The metadata is stored in an immutable form in decentralized storage (IPFS).

Create V2

This API call allows an external wallet to pay the gas fee for creating NFT on behalf of the NFT creator. Moreover, this API is capable of performing everything that the V1 Create NFT API does.

This API is an improved version of the original Create NFT API. This API request allows an external wallet to pay the gas fee for creating NFT on behalf of the NFT creator.

NOTE: If your product is creating an end-user-facing platform for creating NFTs, then this API will be your best friend for onboarding users initially where, you can pay the gas fees for the NFTs that your users will create.

POST /sol/v2/nft/create

Creating an NFT, and is just 1 simple API call, which internally does all the heavy lifting for you.

  • Uploads the image or anything you want to your choice of storage (IPFS or S3).

  • Creates an appropriate Metadata json file.

  • Uploads the metadata json file again to your choice of storage (IPFS or S3).

  • If mentioned also pays the gas fee for the transaction from the mentioned account.

  • Finally mints your favorite NFT.

Body Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • creator_wallet: Your NFT creator's wallet address. By default, this address pays the transaction gas fee.

  • name: NFT Name

  • symbol: NFT Symbol

  • description: (optional) NFT description

  • collection_address: (optional) on-chain address of the collection represented by an NFT, with max_supply of 0.

  • attributes: (optional) attributes associated to this NFT. (You can create the attributes as an array of objects and then stringify it using JSON.stringify)

  • external_url: (optional) any url to associate with the NFT

  • max_supply: (optional) Maximum number of clones/edition mints possible for this NFT. Default 0 for one-of-a-kind NFT.

  • royalty: (optional) represents how much percentage of secondary sales the original creator gets. Ranges from (0-100), 0 being the original creator gets nothing and 100 being the original creator gets the entire amount from the secondary sales

  • image: NFT Image

  • data: (Optional) Any digital data (.mp3/.wav/.mp4/.pdf/.json etc) that you want to put in the NFT

  • receiver: (optional) Account address which will receive the newly created NFT.

  • fee_payer: (optonal) If mentioned this is the account that will be used for paying the transaction gas fee.

  • service_charge : (optional) - Transaction fee to be paid by the NFT creator for creating an NFT. This fee can be charged in SOL or any SPL-20 token. Below is the structure of the service_charge key.

    • receiver: string - An address that will receive the service charge amount.

    • amount: number - The amount of currency to be charged.

    • token(optional): string - The address of the SPL token, the service charge currency. By default SOL is charged.

Charging Service charge in USDC:

{
    "receiver": "499qpPLdqgvVeGvvNjsWi27QHpC8GPkPfuL5Cn2DtZJe", 
    "token": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", 
    "amount": 0.01
}

Charging Service charge in SOL:

{
    "receiver": "499qpPLdqgvVeGvvNjsWi27QHpC8GPkPfuL5Cn2DtZJe",
    "amount": 0.01
}

Response

You will get an encoded transaction in response which you can sign in your front end or back end. 2 wallet address are needed to sign this txn:

  1. creator_wallet

  2. fee_payer, only if specified in the API request.

  3. collection_address's collection_authority address, which is the update Authority of the collection NFT. Needed when, the txn was created with collection_address.

We have already deployed a dev tool to sign and send transactions for quick testing https://shyft-insider.vercel.app/

var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");

var formdata = new FormData();
formdata.append("network", "devnet");
formdata.append("creator_wallet", "8hDQqsj9o2LwMk2FPBs7Rz5jPuzqKpRvkeeo6hMJm5Cv");
formdata.append("name", "papaya");
formdata.append("symbol", "P2");
formdata.append("description", "papita");
formdata.append("attributes", '[{"trait_type":"dev power","value":"over 900"}]');
formdata.append("external_url", "https://shyft.to");
formdata.append("max_supply", "1");
formdata.append("royalty", "5");
formdata.append("image", fileInput.files[0], "papaya.jpeg");
formdata.append("fee_payer", "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v2/nft/create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Ta-da πŸŽ‰, a transaction has been created for you to sign and send to the blockchain after which your user would have created an NFT without having any SOL in his/her account.

Create NFT from Metadata

This API allows you to create an NFT from an already uploaded metadata URI. The metadata_uri should open a JSON document complying with Metaplex Non-Fungible Token Standard. If the JSON doesn't follow the Metaplex standard then the API returns an error. The on-chain metadata of the NFT is fetched from the off-chain metadata present at the given URI.

POST /sol/v1/nft/create_from_metadata

Body Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • metadata_uri: URI that contains metadata of the NFT (metaplex non-fungible-standard) in JSON file format.

  • max_supply: (optional) Maximum number of clones/edition mints possible for this NFT. Default 0 for one-of-a-kind NFT.

  • collection_address: (optional) on-chain address of the collection represented by an NFT, with max_supply of 0.

  • receiver: (optional) Account address which will receive the newly created NFT.

  • fee_payer: (optional) If mentioned this is the account that will be used for paying the transaction gas fee.

  • service_charge : (optional) - Transaction fee to be paid by the NFT creator for creating an NFT. This fee can be charged in SOL or any SPL-20 token. Below is the structure of the service_charge key.

    • receiver: string - An address that will receive the service charge amount.

    • amount: number - The amount of currency to be charged.

    • token(optional): string - The address of the SPL token, the service charge currency. By default, SOL is charged.

  • priority_fee: (optional) Prioritization fee of transaction in micro Lamports. A micro Lamport is 0.000001 Lamports.

This API followed some rules and has some limitations:

Rules:

  • Inside metadata JSON the properties key should have a creators array. The 0th index of the creator address is the verified creator and if the array holds more than one creator inside it then others also are added in the on-chain metadata creators array with { verified: false }.

  • 0th index creator is also considered the update_authority of the NFT.

Limitation:

Solana transaction size is limited to 1232 bytes. This might result into Transaction too large error if creators are present in the JSON and collection_address is mentioned in the API request. Below are some limitations of the API:

  • If the API request has service_charge, collection_address then metadata at the URI should have at max 2 creators.

  • If the API request has service_charge, and no collection_address, then metadata at URI can have up to 8 creators.

  • If the API request has collection_address and no service_charge then the metadata URI can have up to 5 creators.

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR-API-KEY>");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "network": "devnet",
  "metadata_uri": "https://brown-loyal-stoat-734.mypinata.cloud/ipfs/QmR5Tyx3MvpiCKtjTVC4wVzRigpujCv9bnvQKU4ZMQzN5N",
  "max_supply": 0,
  "collection_address": "3F3G122hfRQ6E7aRQLhdXvabxtfhGHF89UVLvHR4pmn9",
  "receiver": "3yTKSCKoDcjBFpbgxyJUh4cM1NG77gFXBimkVBx2hKrf",
  "fee_payer": "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
  "service_charge": {
    "receiver": "BFefyp7jNF5Xq2A4JDLLFFGpxLq5oPEFKBAQ46KJHW2R",
    "amount": 0.01
  },
  "priority_fee": 100
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/nft/create_from_metadata", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Read All

Returns on chain and off chain data of all NFTs in the wallet.

First call might be slightly slow, we cache automatically so that subsequent calls are lightning-fast.

Query Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • address: Your wallet address

  • update_authority: (optional) Public key of update authority. Filters only those nfts in your wallet which have this update_authority.

  • refresh:(optional) Include this if the cached NFTs for this wallet need to be refreshed.

GET /sol/v1/nft/read_all

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/nft/read_all?network=devnet&address=BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Read Wallet Nfts

Paginated version of Read All API, returns the list of NFTs in a wallet. A maximum of 50 NFTs are returned in a single API request.

Query Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • address: Your wallet address

  • update_authority: (optional) Public key of update authority. Filters only those NFTs in your wallet that have this update_authority.

  • refresh:(optional) Include this if the cached NFTs for this wallet need to be refreshed.

  • page:(optional) Default value is 1.

  • size:(optional) Default value is 50.

GET /sol/v2/nft/read_all

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v2/nft/read_all?network=mainnet-beta&address=Bme4LRYLq199vosFJcP2YrHSduMj27tmqdTNadYDma9A&page=1&size=32&update_authority=vfF76HkUH4pF6Uoc1WZ8BcViiQVkazcQuC6fkeLMWvi", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Read

Returns on-chain and off-chain NFT data. We also cache NFT images in our CDN for super fast reads and an amazing UX, which web3 sorely needs.

First call might be slightly slow, we cache automatically so that subsequent calls are lightning-fast.

Query Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • token_address: address of the NFT that you want to read

  • token_record: (optional) Set it true if need to get additional token_record info along with requested NFTs.

GET /sol/v1/nft/read

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/nft/read?network=mainnet-beta&token_address=Dx2XXfTUoTRsqRrBmB4dESraEeQy8Uby2XsLCtHW7GNS&refresh=true&token_record=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Read Selected NFTs

Returns on-chain and off-chain data of selected NFTs.

First call might be slightly slow, we cache automatically so that subsequent calls are lightning-fast.

Body Params

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • token_addresses: (array of strings) Selected token addresses (minimum 1 and maximum 10 NFTs could be fetched)

  • refresh:(optional) Include this if the cached NFTs need to be refreshed.

  • token_record: (optional) Set it true if need to get additional token_record info along with requested NFTs.

POST /sol/v1/nft/read_selected

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "<YOUR_API_KEY>");

var raw = JSON.stringify({
  "network": "mainnet-beta",
  "token_addresses": [
    "3nd5gaYmu1oVdqthPrv8SWzvBaHgWPjn2npAGwPjhuQz",
    "FW5peLvKtJhCykHqfA2E1GDGVCLsJrJYKkWPKXa8SZuL",
    "Dx2XXfTUoTRsqRrBmB4dESraEeQy8Uby2XsLCtHW7GNS"
  ],
  "refresh": false,
  "token_record": true
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/nft/read_selected", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));