๐Getting tokens
Specific devnet SPL tokens are required to test fermi
First, create and initialise your associated token account, and your openorders account:
const authorityPCTokenAccount = await spl.getAssociatedTokenAddress(
new anchor.web3.PublicKey(pcMint),
connectedPublicKey,
false,
);
console.log(authorityPCTokenAccount.toString());
let openOrdersPda;
let openOrdersPdaBump;
[openOrdersPda, openOrdersPdaBump] =
await anchor.web3.PublicKey.findProgramAddress(
[
Buffer.from('open-orders', 'utf-8'),
new anchor.web3.PublicKey(marketPda).toBuffer(),
connectedPublicKey.toBuffer(),
],
program.programId,
);
Next, ask the admin to mint some spl tokens to your accounts. Alternatively, if you're testing on your own deployment, you can use the adapted code in branch 'wallet-admin' to give yourself airdrops of SPL tokens
const custom = new anchor.web3.PublicKey("42Dg1Y97EQuwAfj4ovzD76myhRE5ZJkCySuTzHoRcxxH");
const custom_ata_coin = new anchor.web3.PublicKey("H2cZK8LEgqEBUL52Px6fkTWMVAHrhVPi5VWwztRmRw6u");
const custom_ata_pc = new anchor.web3.PublicKey("54EjXUWQitej4UZYYbb4QNJLN1nAFmwW7AkuC19UGQoV");
console.log("sent to");
console.log(custom_ata_pc.toString());
await createAssociatedTokenAccount(
provider,
pcMint,
custom_ata_pc,
custom,
);
await mintTo(
provider,
pcMint,
custom_ata_coin,
BigInt('10000000000'),
);
await createAssociatedTokenAccount(
provider,
pcMint,
custom_ata_pc,
custom,
);
await mintTo(
provider,
coinMint,
customCoinTokenAccount,
BigInt('100000000000'),
);
console.log("airdrop done");
That's it! You're all set up. Head on over to the Fermi DEX UI at https://www.fermilabs.xyz/ and start trading!
Last updated