Fungible Tokens

Do more with your fungible tokens, efficiently.

Create

Create your own fungible tokens and mint/burn them on demand to manage their supply.

Use Cases:

  • Use these tokens as a currency for your NFT marketplace

  • Reward your users for certain actions on your dApp

  • You can also use these tokens to created gated experiences.

POST /sol/v1/token/create_detach

Body Params

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

  • wallet: Wallet address who will have the mint and freeze authority.

  • name: token name

  • symbol: token symbol

  • description: token description

  • decimals: (optional )token decimals, represents the smallest denomination for the token, default: 9.

  • Example for 9 decimals, 1000000000 = 1 token

  • file: token logo

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

Response

  • encoded_tranasction: a base-64 encoded transaction string that has to be signed and sent to the blockchain.

  • signers: a list of addresses that are supposed to sign this transaction.

  • mint: token address, that will be created if this transaction is successful.

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", "-3iYNcRok7Gm4EMl");

var formdata = new FormData();
formdata.append("network", "devnet");
formdata.append("wallet", "6onZzXdurac4ykUCqLewQLDPwfmgHRU9Cu9k6A6anPtx");
formdata.append("name", "Shit");
formdata.append("symbol", "SHT");
formdata.append("description", "This is a shit coin");
formdata.append("decimals", "0");
formdata.append("file", fileInput.files[0], "geeko.jpeg");
formdata.append("fee_payer", "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s");

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

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

Just like that, you have created and launched your own fungible token. 🎉

Create Token from Metadata

This API allows you to create Fungible Token/Semi-Fungible Token from an already uploaded metadata URI. The metadata_uri should open a JSON document complying with Metaplex Fungible/Fungible Asset Token Standard. If the JSON doesn't follow the Metaplex standard then the API returns an error.

POST /sol/v1/token/create_from_metadata

Body Params

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

  • wallet_address: Wallet address who will have the mint and freeze authority.

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

  • decimals: (optional )token decimals, represents the smallest denomination for the token, default: 9. To create SFT send 0 as decimals.

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

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

var raw = JSON.stringify({
  "network": "devnet",
  "wallet_address": "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
  "metadata_uri": "https://bafkreide7tbqd5al2lqebx4hijg76mcffshlsgkzx5dkgvtqxf36qkxkjm.ipfs.nftstorage.link",
  "decimals": 0,
  "fee_payer": "5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2"
});

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

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

To mint the created Fungible Token/SFT use Mint API.

Mint

This API lets you mint and create new units of your Fungible Token. This will increase the total supply of the token. In order to mint a token, you need to create it first.

POST /sol/v1/token/mint_detach

Body Params:

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

  • mint_authority: Wallet address having the mint authority,

  • token_address: Token address to be minted,

  • receiver: Wallet address of the receiver who will get the minted tokens.

  • amount: How many token to mint, we internally convert according to the decimals.

  • message: (optional) Add any arbitrary message as a memo to transaction.

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

We internally convert the amount according to the decimals a token has. For example, if USDC has 6 decimals and you want to transfer 10 USDC, you need to specify 10, and internally we convert it to 10,000,000 USDC for you😃.

Response

  • encoded_tranasction: a base-64 encoded transaction string that has to be signed and sent to the blockchain.

  • signers: a list of addresses that are supposed to sign this transaction.

  • mint: token address that gets minted

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", "-3iYNcRok7Gm4EMl");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "network": "devnet",
  "mint_authority": "BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx",
  "token_address": "7yPeRofJpfPkjLJ8CLB7czuk4sKG9toXWVq8CcHr4DcU",
  "receiver": "97a3giHcGsk8YoEgWv4rP1ooWwJBgS72fpckZM6mQiFH",
  "amount": 100,
  "message": "You have been awarded these tokens for being awesome!",
  "fee_payer": "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s"
});

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

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

You can use this feature to airdrop any created token to your community members.

Idea: You can use the create and mint APIs to create a multi-token Airdrop 🎉

Burn

This API lets you burn or decrease the supply of your Fungible Tokens.

DEL /sol/v1/token/burn_detach

Body Params:

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

  • wallet: Wallet address containing the tokens and the fee payer,

  • token_address: Token address to be burned,

  • amount: How many tokens to burn, we internally convert according to the decimals.

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

We internally convert the amount according to the decimals a token has. For example, if USDC has 6 decimals and you want to transfer 10 USDC, you need to specify 10, and internally we convert it to 10,000,000 USDC for you😃.

Response

  • encoded_tranasction: a base-64 encoded transaction string that has to be signed and sent to the blockchain.

  • signers: a list of addresses that are supposed to sign this transaction.

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", "-3iYNcRok7Gm4EMl");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "network": "devnet",
  "wallet": "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
  "token_address": "HBE5dEcFHiJtU8vmTyx7MhB43nFRMJt8ddC8Lupc3Jph",
  "amount": 10,
  "fee_payer": "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s"
});

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

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

Update

This API helps you to update token metadata.

POST /sol/v1/token/update

Body Params:

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

  • update_authority_address: Update authority of the token,

  • token_address: Token address to be burned,

  • name: (optional) Token name (maximum 32 char)

  • symbol: (optional) Token symbol (maximum 10 char)

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

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

var raw = JSON.stringify({
  "network": "devnet",
  "token_address": "1C3n35poNbm2di6W8YTKjG2BmhaFxmTtbScy1ox2xvY",
  "update_authority_address": "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
  "name": "Anexis Coin",
  "symbol": "ANEX",
  "metadata_uri": "https://bafkreiaqvxqy4s7j5usumsmcwbqcjwz7ahtaolnpkd6rp6vh5762na6eoq.ipfs.nftstorage.link",
  "fee_payer": "5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2"
});

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

fetch("https://api.shyft.to/sol/v1/token/update", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));```postman_json
{
    "success": true,
    "message": "Update token transaction generated successfully",
    "result": {
        "encoded_transaction": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgEBBEAsB5V/CSisCqWsB43x06fwl67ofi7eh8fMbPgWe1A/GMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxUssRK0a1M2z8zreRvQ0NZILqWkUDOxzraUfNDhge/o2QtwZbHj0XxFOJ1Sf2sEw81YuGxzGqD9tUm20bwD+ClGLxj6W9quIauK4hbXN6LqSyAqmk3oK/rD1uLXQV9Z1soBAwICAZ8BDwELAAAAQW5leGlzIENvaW4EAAAAQU5FWFgAAABodHRwczovL2JhZmtyZWlhcXZ4cXk0czdqNXVzdW1zbWN3YnFjand6N2FodGFvbG5wa2Q2cnA2dmg1NzYybmE2ZW9xLmlwZnMubmZ0c3RvcmFnZS5saW5rAAAAAAABGMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxUBAQEB",
        "signers": [
            "2fmz8SuNVyxEP6QwKQs6LNaT2ATszySPEJdhUDesxktc",
            "5KW2twHzRsAaiLeEx4zYNV35CV2hRrZGw7NYbwMfL4a2"
        ]
    }
}
```

Get Token Info

This API returns you the information about an already launched Token. (Supports Token 2022 token info 🆕)

GET /sol/v1/token/get_info

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/token/get_info?network=devnet&token_address=FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Get Token Owners (Deprecated)

Returns all owners hold the token, sorted by the amount they are holding (high to low).

This API supports pagination and only works with mainnet-beta network.

Query Params

  • network: Solana blockchain environment (mainnet-beta)

  • token_address: Mint address of the token

  • limit: How many records want to display (maximum 50)

  • offset: Determines how many records to retrieve starting from the offset

GET /sol/v1/token/get_owners

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

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

fetch("https://api.shyft.to/sol/v1/token/get_owners?network=mainnet-beta&token_address=4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R&limit=3&offset=0", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Transfer

Transfer already minted tokens from one wallet to another wallet address. This does not change the total supply of the token.

POST /sol/v1/token/transfer_detach

Body (raw)

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

  • from_address: Wallet address of the sender,

  • token_address: Address of the token to transfer,

  • to_address: Wallet address of the receiver,

  • amount: How many tokens to transfer. We internally convert according to the token decimals.

  • fee_payer: (optional) The account that pays the transaction gas fee.

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

We internally convert the amount according to the decimals a token has. For example, if USDC has 6 decimals and you want to transfer 10 USDC, you need to specify 10, and internally we convert it to 10,000,000 USDC for you😃.

Response

  • encoded_tranasction: a base-64 encoded transaction string that has to be signed and sent to the blockchain.

  • signers: a list of addresses that are supposed to sign this transaction.

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", "-3iYNcRok7Gm4EMl");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "network": "devnet",
  "from_address": "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s",
  "to_address": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
  "token_address": "qKi7RU529xuL1JhRp2We23NmNcLEoVJQmPgmdzHNbF9",
  "amount": 50,
  "fee_payer": "GE4kh5FsCDWeJfqLsKx7zC9ijkqKpCuYQxh8FYBiTJe"
});

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

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

Airdrop

Airdrop any SPL-20 token to the accounts of your choice, from 1 source account.

POST /sol/v1/token/airdrop

Input parameters:

  • network : string - either of [mainnet-beta, testnet, devnet]

  • token_address : string - mint address of the SPL-20 that has to be airdropped

  • from_address : string - source account address to be debited with SPL-20 tokens.

  • transfer_info : Object Array- an array of information objects (maximum 100, minimum 1), containing the destination addresses and the token amount.

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

Note: There is no limit on the number of destination addresses. 9 token transfer instructions are batched in 1 transaction. If there, are more than 9 addresses to airdrop the tokens, then multiple transactions will be returned.

"transfer_info": [
    {
      "to_address": "97a3giHcGsk8YoEgWv4rP1ooWwJBgS72fpckZM6mQiFH",
      "amount": 2
    },
    {
      "to_address": "GE4kh5FsCDWeJfqLsKx7zC9ijkqKpCuYQxh8FYBiTJe",
      "amount": 5
    }
  ]

Response:

This endpoint returns multiple encoded transactions for transferring tokens to destination accounts. All the returned transactions have to be signed and submitted to the blockchain for them to be executed.

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

var raw = JSON.stringify({
  "network": "devnet",
  "token_address": "4TLk2jocJuEysZubcMFCqsEFFu5jVGzTp14kAANDaEFv",
  "from_address": "AaYFExyZuMHbJHzjimKyQBAH1yfA9sKTxSzBc6Nr5X4s",
  "transfer_info": [
    {
      "to_address": "97a3giHcGsk8YoEgWv4rP1ooWwJBgS72fpckZM6mQiFH",
      "amount": 0.2
    },
    {
      "to_address": "GE4kh5FsCDWeJfqLsKx7zC9ijkqKpCuYQxh8FYBiTJe",
      "amount": 0.2
    },
    {
      "to_address": "EijtaNNHqqaPmWwAmUi8f1TC6gSPnqkoodQd2BLFpA8T",
      "amount": 0.2
    }
  ],
  "priority_fee": 1000
});

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

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

Last updated