-
Notifications
You must be signed in to change notification settings - Fork 39
CoW Swap Plugin #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bh2smith
wants to merge
13
commits into
main
Choose a base branch
from
cowswap-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CoW Swap Plugin #179
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
82c047f
project scaffolding and quote endpoint
bh2smith 1730335
udate readme
bh2smith 09503af
small updates
bh2smith 7867ed8
fix server URL
bh2smith 2369d67
Update README.md cowswap images (#181)
sainthiago a415c0a
revert parameters
bh2smith 004910d
try add parameters
bh2smith db7833e
modify favicon
bh2smith 225d38f
quote endpoint working
bh2smith 48ea474
load token map
bh2smith 68cac75
add token map handling
bh2smith a375084
add comment on token source
bh2smith de88e80
request parsing
bh2smith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "extends": "next/core-web-vitals" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.js | ||
| .yarn/install-state.gz | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # next.js | ||
| /.next/ | ||
| /out/ | ||
|
|
||
| # production | ||
| /build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # debug | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # local env files | ||
| .env*.local | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # CoinGecko-AI | ||
|
|
||
| <img src="https://i.imgur.com/s9HSENw.jpg" alt="cover_image" width="0" /> | ||
|
|
||
| ## Description | ||
|
|
||
| CoinGecko-AI: Your intelligent companion for real-time cryptocurrency insights and price tracking provided Coingecko API's. | ||
|
|
||
| CoinGecko-AI is a cutting-edge project that combines the power of artificial intelligence with real-time cryptocurrency data from CoinGecko. This innovative tool provides users with intelligent insights on crypto market data. CoinGecko-AI offers a unique and intuitive way to navigate the complex world of digital assets, making it an invaluable resource for both novice and experienced crypto enthusiasts. | ||
|
|
||
| [](https://wallet.bitte.ai/smart-actions/prompt/what%20can%20you%20help%20me%20with?mode=debug&agentId=coingecko-ai.vercel.app) | ||
| [](https://coingecko-ai.vercel.app/) | ||
| [](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FMintbase%2Ftemplates%2Ftree%2Fmain%2Fcoingecko-ai-plugin) | ||
|
|
||
|
|
||
| **Tooling:** | ||
|
|
||
| [](#) | ||
| [](#) | ||
| [](#) | ||
|
|
||
| ## Project Walkthrough | ||
|
|
||
| <img src="https://github.com/user-attachments/assets/c59dcf62-fdfe-40d6-a128-073c16a9479f" alt="detail_image" width="500"/> | ||
|
|
||
| CoinGecko-AI is built using Next.js 14 and exposes an API Reference using [Scalar](https://scalar.com/). | ||
|
|
||
| To run the project locally: | ||
|
|
||
| 1. Clone this template from the repository tree: `git clone git clone --no-checkout https://github.com/Mintbase/templates.git && cd templates && git sparse-checkout set coingecko-ai-plugin && git checkout && cd coingecko-ai-plugin` | ||
| 2. Install dependencies: `pnpm install` | ||
| 3. Set up environment variables: Copy `.env.example` to `.env.local` and fill in your CoinGecko API key. | ||
| 4. Run the development server: `pnpm run dev` | ||
| 5. Open `http://localhost:3000` in your browser to view the application. | ||
|
|
||
| ## Deployment | ||
|
|
||
| To deploy CoinGecko-AI on Vercel: | ||
|
|
||
| 1. Fork the repository to your GitHub account. | ||
| 2. Sign up for a Vercel account if you haven't already. | ||
| 3. Click the "Deploy" button above or go to https://vercel.com/new. | ||
| 4. Select your forked repository. | ||
| 5. Configure the following environment variables: | ||
| - `COINGECKO_API_KEY`: Your CoinGecko API key | ||
| 6. Click "Deploy" and wait for the build to complete. | ||
|
|
||
| Once deployed, you can access your CoinGecko-AI instance at the provided Vercel URL. You can customize the application by modifying the source code and pushing changes to your repository. Vercel will automatically redeploy your application with the latest changes. | ||
|
|
||
| For any issues or questions regarding deployment, please refer to the Vercel documentation or open an issue in the project repository. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { NextResponse } from "next/server"; | ||
|
|
||
| // This is a proxy route that forwards requests to the CoinGecko API | ||
| export async function GET(): Promise<NextResponse> { | ||
| return NextResponse.json({ok: true, message: "Ok lets go!"}); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { type NextRequest, NextResponse } from "next/server"; | ||
|
|
||
| const COW_API = "https://api.cow.fi" | ||
| type Network = "mainnet" | "xdai" | "arbitrum_one"; | ||
|
|
||
| export async function POST(req: NextRequest): Promise<NextResponse> { | ||
| const requestBody = await req.json(); | ||
| console.log("POST Request for quote:", requestBody) | ||
|
|
||
| const network: Network = requestBody.network; | ||
|
|
||
| if (!["mainnet", "xdai", "arbitrum_one"].includes(network)) { | ||
| return NextResponse.json({ error: `Invalid network '${network}'. Must be one of 'mainnet', 'xdai' OR 'arbitrum_one'` }, { status: 400 }); | ||
| } | ||
|
|
||
| const response = await fetch(`${COW_API}/${network}/api/v1/quote`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json' | ||
| }, | ||
| body: JSON.stringify(requestBody) | ||
| }); | ||
|
|
||
| const data = await response.json(); | ||
|
|
||
| return NextResponse.json(data); | ||
| } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { ReferenceConfiguration } from "@scalar/api-reference"; | ||
| import { ApiReference } from "@scalar/nextjs-api-reference"; | ||
| import { DEPLOYMENT_URL } from "vercel-url"; | ||
|
|
||
| const config: ReferenceConfiguration = { | ||
| spec: { | ||
| url: "/.well-known/ai-plugin.json", | ||
| }, | ||
| theme: "moon", | ||
| metaData: { | ||
| title: "CowSwap AI Plugin", | ||
| description: "Bitte.ai Plugin for CowSwap API's", | ||
| ogDescription: "AI Compatible API endpoints for RFQ (quotes) and order placement", | ||
| ogTitle: "CoW AI", | ||
| ogImage: "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/images/1/0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab/logo.png", | ||
| twitterCard: "summary_large_image", | ||
| }, | ||
| servers: [ | ||
| { | ||
| // Override server URLs using Vercel system env variables | ||
| // Defaults to http://localhost:3000 on local development | ||
| url: `${DEPLOYMENT_URL}/api/v3`, | ||
| } | ||
| ] | ||
| }; | ||
|
|
||
| export const GET = ApiReference(config); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| async headers() { | ||
| return [ | ||
| { | ||
| source: "/api/:path*", | ||
| headers: [ | ||
| { key: "Access-Control-Allow-Credentials", value: "true" }, | ||
| { key: "Access-Control-Allow-Origin", value: "*" }, | ||
| { | ||
| key: "Access-Control-Allow-Methods", | ||
| value: "GET,OPTIONS,POST", | ||
| }, | ||
| { | ||
| key: "Access-Control-Allow-Headers", | ||
| value: | ||
| "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version", | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
| }, | ||
| }; | ||
|
|
||
| export default nextConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "name": "cowswap-ai-mintbase-template", | ||
| "keywords": [ | ||
| "bitte", | ||
| "templates", | ||
| "ai", | ||
| "agents", | ||
| "openapi", | ||
| "web3" | ||
| ], | ||
| "repository": "https://github.com/mintbase/templates.git", | ||
| "homepage": "https;//templates.mintbase.xyz/coingecko-ai-plugin", | ||
| "author": "Mintbase Team <eng@mintbase.xyz>", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev --turbo", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "lint": "next lint" | ||
| }, | ||
| "dependencies": { | ||
| "@cowprotocol/cow-sdk": "^5.4.1", | ||
| "@scalar/api-reference": "^1.24.75", | ||
| "@scalar/nextjs-api-reference": "^0.4.73", | ||
| "ethers": "^5", | ||
| "next": "^14.2.7", | ||
| "react": "^18", | ||
| "react-dom": "^18", | ||
| "vercel-url": "^0.2.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22", | ||
| "@types/react": "^18", | ||
| "@types/react-dom": "^18", | ||
| "eslint": "^8", | ||
| "eslint-config-next": "14.2.7", | ||
| "postcss": "^8", | ||
| "tailwindcss": "^3.4.1", | ||
| "typescript": "^5" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /** @type {import('postcss-load-config').Config} */ | ||
| const config = { | ||
| plugins: { | ||
| tailwindcss: {}, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.