1. Configure Token Details
First, create aconstants.ts file to store the details of the tokens you want to create a pool for. This makes it easy to reuse token information across your project.
For this example, we’ll configure PYUSD and WSOL on the devnet.
constants.ts
2. Find Associated Token Accounts (ATAs)
Next, we need to find the ATAs for these tokens for a specific wallet. Create a new file namedget-ata.ts and add the following script.
This script uses the @solana/spl-token library to find the ATAs for our configured tokens.
get-ata.ts
The
loadWalletFromCLI() function is a placeholder for your own wallet loading logic. You can use any method you prefer to provide a keypair, such as importing from a JSON file or using Keypair.generate() for a new wallet.3. Run the Script
Now, compile your TypeScript files and run the script to get the ATAs.4. Update Token Configuration
Finally, update yourconstants.ts file with the ATAs you just retrieved. This will be useful when you interact with the pool.
constants.ts
