5

Since June 20, 2022, the rules for registering tokens have changed: https://github.com/solana-labs/token-list

I have tried the following:

1). Create new tokens through the services:

After creating these tokens and attempting to transfer them to another wallet via a web app(web3js), they are defined as NFT:

NFT Solana transfer

Also on Solscan, these tokens are displayed as "Unrecognized Token":

Unrecognized Solana Token

2). Then I tried to register the token via Metaplex, but I constantly encountered various errors. My code(JavaScript):

import { createCreateMetadataAccountV2Instruction} from '@metaplex-foundation/mpl-token-metadata';

    const tokenMetadata = {
      name: 'EUR demo-stablecoin',
      symbol: 'EURX',
      uri: {
        name: 'EUR demo-stablecoin',
        symbol: 'EURX',
        description: 'Fully for testing purposes only',
        image: 'https://raw.githubusercontent.com/.../logo.png',
      },
      sellerFeeBasisPoints: 0,
      creators: null,
      collection: null,
      uses: null,
    };

    const createNewTokenTransaction = new solanaWeb3.Transaction().add(
        createCreateMetadataAccountV2Instruction(
          {
            metadata: 'https://vxmxabesb3yfewwf4jcplmstg2fe3cngsphlgnrvwp46iftqdm.arweave.net/.../arweave-metadata-JSON',
            mint: mintKeypair.publicKey,
            mintAuthority: provider.publicKey,
            payer: provider.publicKey,
            updateAuthority: provider.publicKey,
          },
          {
            createMetadataAccountArgsV2:
              {
                data: tokenMetadata,
                isMutable: true,
              },
          },
        ),
      );

   await sendTransaction(
      createNewTokenTransaction,
      connection,
      { signers: [mintKeypair] },
    );

Maybe someone knows how to register a Fungible token in Solana now? It will be especially useful if the example is with the registration of an existing token.

Alexandr Kazakov
  • 682
  • 1
  • 7
  • 15

1 Answers1

2

Your URI is incorrect. It should be the metadata link.

import { DataV2, createCreateMetadataAccountV2Instruction } from '@metaplex-foundation/mpl-token-metadata';
import { findMetadataPda } from '@metaplex-foundation/js';

const metadataPDA = await findMetadataPda(mintKeypair.publicKey); // This is derived from the mint account's public key
const tokenMetadata = {
        name: "Test Token", 
        symbol: "TEST",
        uri: https://token-creator-lac.vercel.app/token_metadata.json,
        sellerFeeBasisPoints: 0,
        creators: null,
        collection: null,
        uses: null
      } as DataV2;
const createNewTokenTransaction = new Transaction().add(
        createCreateMetadataAccountV2Instruction({
            metadata: metadataPDA,
            mint: mintPublicKey,
            mintAuthority: userPublicKey,
            payer: userPublicKey,
            updateAuthority: userPublicKey,
          },
          { createMetadataAccountArgsV2: 
            { 
              data: tokenMetadata, 
              isMutable: true 
            } 
          }
        )
await sendTransaction(createNewTokenTransaction, connection);
Jacob Creech
  • 1,797
  • 2
  • 11
  • https://solana.stackexchange.com/questions/216/how-do-you-add-symbol-name-and-logo-to-a-token – Jacob Creech Jul 30 '22 at 11:50
  • Thanks Jacob. Can you explain this line: `import { findMetadataPda } from '@metaplex-foundation/js';` I don't have a JS file/folder there at all, screenshot https://www.dropbox.com/s/n9kl37y0mnlm91o/Code_ENCVY0f8dG.png?dl=0 FYI I write in javascript, not typescript. I can't import the findMetadataPda method. – Alexandr Kazakov Jul 31 '22 at 13:48
  • Jacob I registered a token using your code: https://solscan.io/token/Bw7JD5Rz7tfENbpw18y4dKe4VP8N8bGRSANuFgnw7RzK but the problem is that it is still defined as an NFT transfer. I need an fungible SPL token. – Alexandr Kazakov Jul 31 '22 at 17:15
  • Mildly confused - shows up as fungible token – Jacob Creech Jul 31 '22 at 18:18
  • Yes. See screesnhot: https://www.dropbox.com/s/4stfb2w64916tb6/chrome_wqQ00lMkGC.png?dl=0 Do you have any ideas how to get around this? – Alexandr Kazakov Aug 03 '22 at 08:53
  • Not sure how exactly Phantom is detecting it but one idea could be to excplicitly set the token standard: https://docs.metaplex.com/programs/token-metadata/instructions#set-token-standard – Mark Sackerberg Aug 05 '22 at 09:20