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:
Also on Solscan, these tokens are displayed as "Unrecognized 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.
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);