This project is a Node.js application that allows you to create and manage custom tokens on the Solana devnet. It provides functionality to create a new token, mint it to a distributor wallet, transfer tokens to recipient wallets, and perform additional operations like buying tokens, checking balances, and creating wallets.
solana-token-app
├── .env # Environment variables
├── info.txt # Example curl command for testing
├── package.json # NPM dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── README.md # Project documentation
├── src
│ ├── app.ts # Express app setup
│ ├── createToken.ts # Logic for creating a new token on Solana devnet
│ ├── transferToken.ts # HTTP endpoint for transferring tokens
│ ├── transferEquinox.ts # HTTP endpoint for transferring Equinox tokens
│ ├── buyEquinoxToken.ts # HTTP endpoint for buying Equinox tokens
│ ├── standaloneTransfer.js # Standalone script for transferring tokens
│ ├── controllers
│ │ └── tokenController.ts # Controller for token operations
│ ├── routes
│ │ └── tokenRoutes.ts # Routes for token operations
│ ├── types
│ │ └── index.ts # Type definitions for requests
│ └── transferEquinoxToken.ts.old # Legacy script for transferring Equinox tokens
-
Clone the repository:
git clone <repository-url> cd solana-token-app
-
Install the dependencies:
npm install
Set up the .env
file with the following variables:
SOLANA_NETWORK=https://api.devnet.solana.com
PAYER_SECRET_KEY=<your-payer-secret-key>
EQUINOX_MINT_ADDRESS=<equinox-mint-address>
MINT_ADDRESS=<your-mint-address>
DISTRIBUTOR_WALLET=<distributor-wallet-address>
To create a new token, run the following command:
npm start
This will generate a mint address and a distributor wallet, and mint tokens into the distributor wallet. The details will be saved in the .env
file.
To transfer tokens, you can use the HTTP endpoint defined in tokenRoutes.ts
. Start the server by running:
npm run dev
Then, make a POST request to http://localhost:3000/api/transfer
with the following JSON body:
{
"multiplier": 2
}
To transfer Equinox tokens, make a POST request to:
http://localhost:3000/api/transferequinox
with the following JSON body:
{
"payerSecretArray": [<your-payer-secret-array>],
"recipientWalletAddress": "<recipient-wallet-address>",
"amount": 1000
}
To buy Equinox tokens, make a POST request to:
http://localhost:3000/api/buyequinox
with the following JSON body:
{
"recipientWalletAddress": "<recipient-wallet-address>",
"amount": 500
}
To check the balance of Equinox tokens for a specific wallet, make a GET request to:
http://localhost:3000/api/equinoxbalance/<wallet-address>
To create a new wallet, make a GET request to:
http://localhost:3000/api/createwallet
This will generate a new wallet and attempt to airdrop SOL to it.
You can also use the standalone script for transferring tokens. Start the standalone server by running:
node src/standaloneTransfer.js
Then, make a POST request to http://localhost:3030/transfer-tokens
with the following JSON body:
{
"wallet": "recipient-wallet-address",
"multiplyingFactor": 2
}
To start the application, run:
npm start
or define env vars in solana-token-app/.env
and run:
npm run dev
transferEquinoxToken.ts.old
: A legacy script for transferring Equinox tokens. This script is no longer actively maintained but can be used for reference.
This project is licensed under the MIT License.