Hi I am developing a mobile dapp. Everything seems to be on the right track however I need fake tokens on my Phantom app (devnet) to test my app. My application is not complete yet, I think need more functionality so I think I can't use real tokens. So is there any way for me to get fake tokens on Phantom mobile app? Thanks everyone!
2 Answers
Metaboss is the easiest way to create an SPL token with associated metadata on Solana right now: https://metaboss.rs/create.html#create
Once you create this, simply transfer it to your Phantom wallet
You can create a new token on Solana devnet. As you are creating the token on devnet, it can be used for development purposes.
Note:- We can create the new token on mainnet by pointing the network to mainnet-beta. Untill the token is listed on a trading platform, it's value is 0.
// snippet taken from https://spl.solana.com/token
import { createMint } from '@solana/spl-token';
import { clusterApiUrl, Connection, Keypair, LAMPORTS_PER_SOL } from '@solana/web3.js';
const payer = Keypair.generate();
const mintAuthority = Keypair.generate();
const freezeAuthority = Keypair.generate();
const connection = new Connection(
clusterApiUrl('devnet'),
'confirmed'
);
const mint = await createMint(
connection,
payer,
mintAuthority.publicKey,
freezeAuthority.publicKey,
9 // We are using 9 to match the CLI decimal default exactly
);
console.log(mint.toBase58());
-
Sorry I tried but failed, @solana/spl-token doesn't seem to work on react-native. It throws the error: ReferenceError: Can't find variable: BigInt. Can you give more clear instructions? Commented Oct 6, 2022 at 6:17
-
BigInt is not available on React Native. You can add a shim for that using big-integer package. Here are the details:- github.com/facebook/react-native/issues/28492 Commented Oct 6, 2022 at 7:13