Solana: how to update metadata of spl-tokens using cli

Solana: how to update metadata of spl-tokens using cli

Update Spl token metadata using MetaMask and Solana CLI

As a developer working on the Solana ecosystem, you need to keep Spl token metadata up to date. In this article, we will look at how to update the metadata of Spl tokens using the Solana (SOL) Chaincode blockchain API and the MetaMask browser extension.

Prerequisites

  • Solana CLI: Make sure you have the latest version of Solana CLI installed. You can download it from Solana’s official website.
  • MetaMask: Install MetaMask on your computer to interact with the Solana blockchain.
  • Spl Token Contract

    Solana: how to update metadata of spl-tokens using cli

    : Create a new Spl Token Contract using Solidity (SOL) and deploy it to the Solana network.

  • Chaincode: Configure Chaincode on Solana to update metadata.

Step 1: Update Metadata with MetaMask

  • Start MetaMask on your computer.
  • Connect your account to the MetaMask browser extension.
  • Go to MetaMask settings and select “Chaincode” in the menu.
  • Search for Solana and create a new chaincode contract, for example metadata-updater.
  • Update the metadata for your Spl token contract with the following command:

solana update-chaincode metadata-updater 0x... YOUR ID Chaincode...

Replace 0x... YOUR ID Chaincode... with the actual ID of your chaincode.

Step 2: Solana CLI and Chaincode Integration

  • Install the Solana command line CLI using npm or yarn:

npm install solana-cli -g

yarn global add solana-cli

  • Connect to the Solana network using the solana CLI command:

solana connect

  • Compile and deploy your chaincode contract on the Solana network using the following commands:

npx solana compile metadata-updater --target solana-ops-sdk-v0.43.1

npx solana build-metadata-updater 0x...YOUR Chaincode ID...

Step 3: Update Metadata with MetaMask

  • Start MetaMask on your computer.
  • Connect your account to the MetaMask browser extension.
  • Go to MetaMask settings and select “Chaincode” in the menu.
  • Search for Solana and create a new chaincode contract, for example metadata-updater.
  • Update the metadata for your Spl token contract with the following command:

solana update-chaincode metadata-updater 0x...YOUR Chaincode ID...

Replace 0x...YOUR Chaincode ID... with your actual chaincode ID.

Troubleshooting

If you’re having trouble updating your metadata, check the following:

  • Make sure you have installed the Solana CLI command line tool correctly.
  • Make sure your contract chaincode and metadata file are up to date.
  • Check for errors in MetaMask settings or chaincode configuration.
  • When using the blockchain LAN, make sure you are connected to it and have the correct ID.

Conclusion

Updating Spl token metadata using Chaincode’s Solana API is a simple process. By following these steps and troubleshooting tips, you should be able to successfully update your metadata using MetaMask and the Solana CLI. Happy development!

bitcoin limit transactions

Share:

Leave comment

Marrakech 40000

160, Angle Avenue Mohamed V, Rue de la Liberté.

05 24 43 74 54

Appelez-nous aujourd'hui!

Heures d'ouverture

Lun - Ven : 8h30 - 12h30 / 15h00 - 19h00 Samedi : 8h30 - 13h00

Prenez rendez-vous

contact@drbichra.com