Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michealfortunatus/solana-swap
https://github.com/michealfortunatus/solana-swap
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/michealfortunatus/solana-swap
- Owner: michealfortunatus
- License: mit
- Created: 2024-04-12T21:45:34.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-13T09:31:46.000Z (7 months ago)
- Last Synced: 2024-04-14T21:07:40.240Z (7 months ago)
- Language: TypeScript
- Homepage: https://solana-swap-sigma.vercel.app
- Size: 1.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Solana Swap
Decentralized exchange on solana
**Jupiter Terminal vs API**
[Jupiter Terminal](https://terminal.jup.ag/) is a UI that you can plug into your app by linking it in your HTML. The API is uses Jupiter's quote and swap endpoints and requires you build your own front-end/UI.## Usage
The code in this repo is a reference imeplementation, it's not built for direct usage.- Get an API key from Helius - https://www.helius.dev/
- Add your key to the the HTML OR create-solana-dapp implementation
- For create-solana-dapp, you'll need NPM. The swap implementation is at `localhost:3000/swap`I recommend watching the video linked above to get an idea of the layout of the code and how the Jupiter swap API works.
### HTML
Plain HTML file that imports the terminal via CDN.### Create-solana-dapp
Uses the [create-solana-dapp](https://github.com/solana-developers/create-solana-dapp) template to create a new project, then imports the terminal via CDN.#### Setup
Run these in your terminal:
```
git clone https://github.com/AlmostEfficient/jupiter-swap/
cd create-solana-dapp
cd web
npm i
npm run dev
```Open `localhost:3000` in your browser. The swap is at `localhost:3000/swap`
### API Implementation
The API implementation is at [create-solana-dapp/web/app/swap/page.tsx](https://github.com/AlmostEfficient/jupiter-swap/blob/main/create-solana-dapp/web/app/swap/page.tsx). It's configured to only have 4 assets - USDC, SOL, BONK, WIF. You'll need to add your own token mint addresses, or you can use the [token list API](https://station.jup.ag/docs/token-list/token-list-api) for validated tokens.