templates icon indicating copy to clipboard operation
templates copied to clipboard

CoW Swap Plugin

Open bh2smith opened this issue 5 months ago • 3 comments

User description

Implements API for order quoting and creation.

This project is really just a minimal wrapper for https://api.cow.fi/docs/#/default/post_api_v1_quote

Test Plan

yarn && yarn dev
curl -X 'POST' \
  'http://localhost:3000/api/quote' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "network": "mainnet"
  "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "buyToken": "0x6810e776880c02933d47db1b9fc05908e5386b96",
  "receiver": "0x6810e776880c02933d47db1b9fc05908e5386b96",
  "from": "0x6810e776880c02933d47db1b9fc05908e5386b96",
  "kind": "sell",
  "sellAmountBeforeFee": "1234567890"
}'

Dune Query for CoW Traded Tokens with volume > 10k USD: https://dune.com/queries/4055949


PR Type

Enhancement, Documentation, Configuration changes


Description

  • Added a health check endpoint that returns a JSON response with a status message.
  • Implemented POST endpoint for order quoting, validating network parameter and forwarding request to CoW Swap API.
  • Added API reference configuration for the CoW Swap AI Plugin.
  • Configured TailwindCSS and PostCSS for the project.
  • Added ESLint configuration extending Next.js core web vitals.
  • Added README with project description, setup, and deployment instructions.
  • Configured Next.js headers for API routes.
  • Added project dependencies and scripts.
  • Added OpenAPI specification for CoW Swap Assistant API.
  • Added TypeScript configuration for the project.

Changes walkthrough 📝

Relevant files
Enhancement
3 files
route.ts
Add health check endpoint                                                               

cowswap-ai-plugin/app/api/health/route.ts

  • Added a health check endpoint that returns a JSON response with a
    status message.
  • +6/-0     
    route.ts
    Implement order quoting endpoint                                                 

    cowswap-ai-plugin/app/api/quote/route.ts

  • Implemented POST endpoint for order quoting.
  • Validates network parameter.
  • Forwards request to CoW Swap API and returns the response.
  • +27/-0   
    route.ts
    Add API reference configuration                                                   

    cowswap-ai-plugin/app/route.ts

    • Added API reference configuration for the CoW Swap AI Plugin.
    +27/-0   
    Configuration changes
    6 files
    tailwind.config.ts
    Configure TailwindCSS                                                                       

    cowswap-ai-plugin/tailwind.config.ts

  • Configured TailwindCSS for the project.
  • Added custom theme extensions.
  • +20/-0   
    .eslintrc.json
    Add ESLint configuration                                                                 

    cowswap-ai-plugin/.eslintrc.json

    • Added ESLint configuration extending Next.js core web vitals.
    +3/-0     
    next.config.mjs
    Configure Next.js headers                                                               

    cowswap-ai-plugin/next.config.mjs

    • Configured Next.js headers for API routes.
    +25/-0   
    package.json
    Add project dependencies and scripts                                         

    cowswap-ai-plugin/package.json

    • Added project dependencies and scripts.
    +41/-0   
    postcss.config.mjs
    Configure PostCSS                                                                               

    cowswap-ai-plugin/postcss.config.mjs

    • Configured PostCSS with TailwindCSS plugin.
    +8/-0     
    tsconfig.json
    Add TypeScript configuration                                                         

    cowswap-ai-plugin/tsconfig.json

    • Added TypeScript configuration for the project.
    +39/-0   
    Documentation
    2 files
    README.md
    Add project README                                                                             

    cowswap-ai-plugin/README.md

  • Added README with project description, setup, and deployment
    instructions.
  • +50/-0   
    ai-plugin.json
    Add OpenAPI specification                                                               

    cowswap-ai-plugin/public/.well-known/ai-plugin.json

    • Added OpenAPI specification for CoW Swap Assistant API.
    +206/-0 

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions


    • To see the specific tasks where the Asana app for GitHub is being used, see below:
      • https://app.asana.com/0/0/1208105509044769

    bh2smith avatar Aug 30 '24 10:08 bh2smith