This is a Node.js and Express backend project that facilitates moonshot swap transactions using moonshot-sdk, TypeScript, Solana web3, and solana/spl-token. It listens for swap (buy/sell) requests and creates transactions accordingly. The project is deployable to Vercel.
- Handle swap (buy/sell) requests.
- Create moonshot swap transactions.
- Integration with Solana blockchain.
- Deployable to Vercel.
- Node.js
- Express.js
- TypeScript
- moonshot-sdk
- @solana/web3.js
- @solana/spl-token
-
Clone the repository:
git clone https://github.com/dappsol/moonshot-swap.git cd moonshot-swap
-
Install dependencies:
npm install
-
Update the
config.ts
file with any additional configuration settings as needed.
To start the project, run:
npm start
or
yarn start
The project will run at:
http://localhost:9000
The swap endpoint is available at:
http://localhost:9000/api/moonshot/swap
To create a transaction, use the following parameters:
mintAddress
: Token mint address for buying/selling.amount
: When buying, input SOL amount; when selling, omit this value.tradeDirection
: Use"BUY"
for buying and"SELL"
for selling.slippageBps
: Default is100
and can be omitted.