├── apps ├── .shadow_swap_mxe_native_attempt │ ├── encrypted-ixs │ │ ├── lib.rs │ │ ├── src │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── Cargo.toml │ ├── .gitignore │ ├── Anchor.toml │ ├── programs │ │ └── shadow_swap │ │ │ └── Cargo.toml │ ├── package.json │ └── Arcium.toml ├── anchor_program │ ├── .gitignore │ ├── .prettierignore │ ├── Cargo.toml │ ├── Anchor.toml │ ├── programs │ │ └── shadow_swap │ │ │ └── Cargo.toml │ ├── scripts │ │ ├── cancel-all-orders.js │ │ ├── clear-orders.js │ │ └── clear-orderbook.js │ └── README.md ├── settlement_bot │ ├── .gitignore │ ├── tsconfig.json │ ├── .env.example │ ├── package.json │ └── src │ │ └── types.ts ├── frontend │ ├── pages │ │ ├── admin │ │ │ └── index.tsx │ │ └── api │ │ │ ├── admin │ │ │ └── analytics.ts │ │ │ └── coingecko │ │ │ ├── prices.ts │ │ │ └── market_chart.ts │ ├── lib │ │ ├── mocks.ts │ │ ├── coingecko.ts │ │ ├── marketData.ts │ │ └── apiClient.ts │ ├── components │ │ ├── primitives │ │ │ └── Card.tsx │ │ ├── PillButton.tsx │ │ ├── IntervalTabs.tsx │ │ ├── icons │ │ │ └── CloseX.tsx │ │ └── UserAnalytics.tsx │ └── hooks │ │ └── useMarketChart.ts └── README.md ├── ShadowSwap SPA Design ├── public │ ├── icons │ │ ├── x-icon.png │ │ ├── ETH-logo.png │ │ ├── JLP-logo.png │ │ ├── JUP-logo.png │ │ ├── MET-logo.png │ │ ├── SOL-logo.png │ │ ├── CASH-logo.png │ │ ├── PAYAI-logo.webp │ │ ├── PUMP-logo.png │ │ ├── TRUMP-logo.jpg │ │ ├── USD1-logo.png │ │ ├── USDC-logo.png │ │ ├── USDG-logo.png │ │ ├── USDT-logo.png │ │ ├── WBTC-logo.png │ │ ├── cbBTC-logo.png │ │ ├── jiUSDC.logo.png │ │ ├── mSOL-logo.png │ │ ├── JitoSOL-logo.png │ │ ├── USELESS-logo.png │ │ └── syrupUSDC-logo.png │ ├── placeholder.jpg │ ├── placeholder-logo.png │ ├── placeholder-user.jpg │ ├── placeholder-logo.svg │ └── placeholder.svg ├── postcss.config.mjs ├── lib │ ├── utils.ts │ ├── admin.ts │ ├── shadowSwapIdlLoader.ts │ └── admin │ │ ├── metrics.ts │ │ └── mockData.ts ├── app │ ├── api │ │ ├── idl │ │ │ └── shadow_swap │ │ │ │ └── route.ts │ │ ├── price │ │ │ ├── route.ts │ │ │ └── history │ │ │ │ └── route.ts │ │ ├── docs │ │ │ └── [slug] │ │ │ │ └── route.ts │ │ └── jupiter │ │ │ ├── swap │ │ │ └── route.ts │ │ │ └── quote │ │ │ └── route.ts │ ├── loading.tsx │ ├── trade │ │ ├── loading.tsx │ │ └── page.tsx │ ├── layout.tsx │ └── page.tsx ├── components │ ├── ui │ │ ├── aspect-ratio.tsx │ │ ├── skeleton.tsx │ │ ├── spinner.tsx │ │ ├── use-mobile.tsx │ │ ├── sonner.tsx │ │ ├── label.tsx │ │ ├── input.tsx │ │ ├── separator.tsx │ │ ├── textarea.tsx │ │ ├── progress.tsx │ │ ├── toaster.tsx │ │ ├── collapsible.tsx │ │ ├── kbd.tsx │ │ ├── card.tsx │ │ ├── switch.tsx │ │ ├── avatar.tsx │ │ ├── loader.tsx │ │ ├── checkbox.tsx │ │ ├── radio-group.tsx │ │ ├── pill.tsx │ │ ├── button.tsx │ │ ├── hover-card.tsx │ │ ├── toggle.tsx │ │ ├── badge.tsx │ │ ├── popover.tsx │ │ ├── scroll-area.tsx │ │ ├── alert.tsx │ │ ├── tooltip.tsx │ │ ├── tabs.tsx │ │ ├── toggle-group.tsx │ │ ├── slider.tsx │ │ ├── resizable.tsx │ │ ├── accordion.tsx │ │ ├── button-group.tsx │ │ ├── input-otp.tsx │ │ ├── breadcrumb.tsx │ │ ├── empty.tsx │ │ ├── table.tsx │ │ └── pagination.tsx │ ├── theme-provider.tsx │ ├── icons │ │ └── XLogo.tsx │ ├── admin │ │ ├── KpiCards.tsx │ │ ├── AdminActions.tsx │ │ ├── OrdersChart.tsx │ │ ├── RiskPanel.tsx │ │ ├── AlertsFeed.tsx │ │ ├── VolumeCharts.tsx │ │ ├── OrderbookHealth.tsx │ │ ├── LpAnalytics.tsx │ │ └── ProgramHealth.tsx │ ├── TradeForm.tsx │ └── particle-background.tsx ├── hooks │ ├── use-mobile.ts │ ├── useOrderBook.ts │ ├── useSwap.ts │ └── useCurrentPrice.ts ├── .gitignore ├── next.config.mjs ├── tsconfig.json ├── env.template ├── docs │ └── README.md ├── README.md ├── setup-wallet.sh ├── package.json.bak └── package.json ├── packages ├── shared_types │ ├── .gitignore │ ├── package.json │ ├── tsconfig.json │ ├── README.md │ └── src │ │ └── index.ts └── README.md ├── .npmrc ├── get-devnet-usdc.sh ├── .gitignore ├── env.example ├── scripts ├── README.md └── create-token-accounts.sh └── package.json /apps/.shadow_swap_mxe_native_attempt/encrypted-ixs/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod match_orders; 2 | 3 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/encrypted-ixs/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod match_orders; 2 | 3 | -------------------------------------------------------------------------------- /apps/anchor_program/.gitignore: -------------------------------------------------------------------------------- 1 | .anchor 2 | .DS_Store 3 | target 4 | **/*.rs.bk 5 | node_modules 6 | test-ledger 7 | .yarn 8 | -------------------------------------------------------------------------------- /apps/anchor_program/.prettierignore: -------------------------------------------------------------------------------- 1 | .anchor 2 | .DS_Store 3 | target 4 | node_modules 5 | dist 6 | build 7 | test-ledger 8 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/x-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/x-icon.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/placeholder.jpg -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/ETH-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/ETH-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/JLP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/JLP-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/JUP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/JUP-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/MET-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/MET-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/SOL-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/SOL-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/CASH-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/CASH-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/PAYAI-logo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/PAYAI-logo.webp -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/PUMP-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/PUMP-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/TRUMP-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/TRUMP-logo.jpg -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/USD1-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/USD1-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/USDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/USDC-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/USDG-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/USDG-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/USDT-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/USDT-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/WBTC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/WBTC-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/cbBTC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/cbBTC-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/jiUSDC.logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/jiUSDC.logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/mSOL-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/mSOL-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/placeholder-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/placeholder-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/placeholder-user.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/placeholder-user.jpg -------------------------------------------------------------------------------- /packages/shared_types/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules/ 3 | 4 | # Build output 5 | dist/ 6 | 7 | # TypeScript 8 | *.tsbuildinfo 9 | 10 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/JitoSOL-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/JitoSOL-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/USELESS-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/USELESS-logo.png -------------------------------------------------------------------------------- /ShadowSwap SPA Design/public/icons/syrupUSDC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohit-1710/Shadow_Swap/HEAD/ShadowSwap SPA Design/public/icons/syrupUSDC-logo.png -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # Enable workspaces 2 | workspaces=true 3 | 4 | # Hoist dependencies to root 5 | hoist=true 6 | 7 | # Strict peer dependencies 8 | strict-peer-dependencies=false 9 | 10 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | '@tailwindcss/postcss': {}, 5 | }, 6 | } 7 | 8 | export default config 9 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/app/api/idl/shadow_swap/route.ts: -------------------------------------------------------------------------------- 1 | import idl from '@/lib/idl/shadow_swap.json' 2 | 3 | export const dynamic = 'force-dynamic' 4 | 5 | export async function GET() { 6 | return Response.json(idl) 7 | } 8 | 9 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/encrypted-ixs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "encrypted-ixs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib", "lib"] 8 | 9 | [dependencies] 10 | arcis-imports = "0.3.0" 11 | 12 | -------------------------------------------------------------------------------- /apps/anchor_program/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "programs/shadow_swap" 4 | ] 5 | 6 | [profile.release] 7 | overflow-checks = true 8 | lto = "fat" 9 | codegen-units = 1 10 | 11 | [profile.release.build-override] 12 | opt-level = 3 13 | incremental = false 14 | codegen-units = 1 15 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/app/loading.tsx: -------------------------------------------------------------------------------- 1 | import { LoaderInline } from "@/components/ui/loader" 2 | 3 | export default function Loading() { 4 | return ( 5 |
6 | 7 |
8 | ) 9 | } 10 | 11 | -------------------------------------------------------------------------------- /apps/settlement_bot/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules/ 3 | 4 | # Build output 5 | dist/ 6 | 7 | # Environment variables 8 | .env 9 | .env.local 10 | 11 | # Keypairs 12 | *.json 13 | !package.json 14 | !tsconfig.json 15 | 16 | # Logs 17 | logs/ 18 | *.log 19 | 20 | # IDE 21 | .vscode/ 22 | .idea/ 23 | 24 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "programs/shadow_swap", 4 | "encrypted-ixs" 5 | ] 6 | 7 | [profile.release] 8 | overflow-checks = true 9 | lto = "fat" 10 | codegen-units = 1 11 | 12 | [profile.release.build-override] 13 | opt-level = 3 14 | incremental = false 15 | codegen-units = 1 16 | 17 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/lib/admin.ts: -------------------------------------------------------------------------------- 1 | export const ADMIN_KEYS = new Set([ 2 | "GJzFkncuPPCQCNszjDDHTfzm5857xcLEE9Mbb2r4qvXD", 3 | "3QsnGf33PAhSpXGSpZzRnPHvNAwHDUQ7jdPu71Le5jue", 4 | ]) 5 | 6 | export function isAdminAddress(address?: string | null): boolean { 7 | if (!address) return false 8 | return ADMIN_KEYS.has(address) 9 | } 10 | 11 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio' 4 | 5 | function AspectRatio({ 6 | ...props 7 | }: React.ComponentProps) { 8 | return 9 | } 10 | 11 | export { AspectRatio } 12 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '@/lib/utils' 2 | 3 | function Skeleton({ className, ...props }: React.ComponentProps<'div'>) { 4 | return ( 5 |
10 | ) 11 | } 12 | 13 | export { Skeleton } 14 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | type ThemeProviderProps, 7 | } from 'next-themes' 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children} 11 | } 12 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/app/trade/loading.tsx: -------------------------------------------------------------------------------- 1 | import { LoaderInline } from "@/components/ui/loader" 2 | 3 | export default function TradeLoading() { 4 | return ( 5 |
6 |
7 | 8 |
9 |
10 | ) 11 | } 12 | 13 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/spinner.tsx: -------------------------------------------------------------------------------- 1 | import { Loader2Icon } from 'lucide-react' 2 | 3 | import { cn } from '@/lib/utils' 4 | 5 | function Spinner({ className, ...props }: React.ComponentProps<'svg'>) { 6 | return ( 7 | 13 | ) 14 | } 15 | 16 | export { Spinner } 17 | -------------------------------------------------------------------------------- /apps/frontend/pages/admin/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { UserAnalytics } from '../../components/UserAnalytics'; 3 | import { mockAdminAnalytics } from '../../lib/mocks'; 4 | 5 | export default function AdminDashboard() { 6 | return ( 7 |
8 |

Admin Dashboard (source: mock)

9 | 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /packages/shared_types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@shadowswap/shared-types", 3 | "version": "0.1.0", 4 | "private": true, 5 | "description": "Shared TypeScript types for ShadowSwap monorepo", 6 | "main": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc --watch" 11 | }, 12 | "devDependencies": { 13 | "typescript": "^5.0.0" 14 | }, 15 | "dependencies": { 16 | "@solana/web3.js": "^1.87.6" 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /packages/shared_types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "outDir": "./dist", 8 | "rootDir": "./src", 9 | "strict": true, 10 | "esModuleInterop": true, 11 | "skipLibCheck": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "resolveJsonModule": true 14 | }, 15 | "include": ["src/**/*", "index.ts"], 16 | "exclude": ["node_modules", "dist"] 17 | } 18 | 19 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/.gitignore: -------------------------------------------------------------------------------- 1 | # Anchor 2 | .anchor 3 | target/ 4 | test-ledger/ 5 | 6 | # IDL 7 | idl/ 8 | 9 | # Keys 10 | *.key 11 | *.json.bak 12 | wallet/ 13 | 14 | # Logs 15 | *.log 16 | program-logs/ 17 | 18 | # Dependencies 19 | node_modules/ 20 | yarn.lock 21 | package-lock.json 22 | 23 | # TypeScript 24 | *.tsbuildinfo 25 | 26 | # Build outputs 27 | dist/ 28 | build/ 29 | 30 | # OS 31 | .DS_Store 32 | Thumbs.db 33 | 34 | # Editor 35 | .vscode/ 36 | .idea/ 37 | *.swp 38 | *.swo 39 | *~ 40 | 41 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/Anchor.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | package_manager = "yarn" 3 | 4 | [features] 5 | resolution = true 6 | skip-lint = false 7 | 8 | [programs.localnet] 9 | shadow_swap = "Dk9p88PPmrApGwhpTZAYQkuZApVHEnquxxeng1sCndci" 10 | 11 | [programs.devnet] 12 | shadow_swap = "Dk9p88PPmrApGwhpTZAYQkuZApVHEnquxxeng1sCndci" 13 | 14 | [registry] 15 | url = "https://api.apr.dev" 16 | 17 | [provider] 18 | cluster = "devnet" 19 | 20 | wallet = "~/.config/solana/id.json" 21 | 22 | [scripts] 23 | test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 \"tests/**/*.ts\"" 24 | -------------------------------------------------------------------------------- /apps/frontend/lib/mocks.ts: -------------------------------------------------------------------------------- 1 | export interface AdminAnalyticsMock { 2 | dau: number; 3 | wau: number; 4 | mau: number; 5 | newUsers: number; 6 | topTraders: { wallet: string; trades: number; volume: number }[]; 7 | } 8 | 9 | export const mockAdminAnalytics: AdminAnalyticsMock = { 10 | dau: 1234, 11 | wau: 5432, 12 | mau: 20123, 13 | newUsers: 89, 14 | topTraders: [ 15 | { wallet: '7G...abc', trades: 142, volume: 1250000 }, 16 | { wallet: '9H...def', trades: 97, volume: 830000 }, 17 | { wallet: '3K...xyz', trades: 76, volume: 640000 }, 18 | ], 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /get-devnet-usdc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get devnet USDC for testing ShadowSwap 4 | # Run: bash get-devnet-usdc.sh 5 | 6 | WALLET="YOUR-WALLET-KEY-HERE" 7 | USDC_MINT="USDC-MINT" 8 | 9 | echo "🔧 Setting up devnet USDC for wallet: $WALLET" 10 | echo "" 11 | 12 | # Create USDC token account 13 | echo "📦 Creating USDC token account..." 14 | spl-token create-account $USDC_MINT --owner $WALLET --url devnet 15 | 16 | echo "" 17 | echo "✅ USDC account created!" 18 | echo "" 19 | echo "📨 Now ask your backend engineer to send USDC to:" 20 | echo " Wallet: $WALLET" 21 | echo " Mint: $USDC_MINT" 22 | echo "" 23 | 24 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/hooks/use-mobile.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener('change', onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener('change', onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules/ 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage/ 10 | 11 | # next.js 12 | .next/ 13 | out/ 14 | build/ 15 | dist/ 16 | 17 | # production 18 | *.log 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | pnpm-debug.log* 23 | lerna-debug.log* 24 | 25 | # env files 26 | .env 27 | .env*.local 28 | .env.production 29 | 30 | # vercel 31 | .vercel 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | next-env.d.ts 36 | 37 | # IDE 38 | .vscode/ 39 | .idea/ 40 | *.swp 41 | *.swo 42 | .DS_Store 43 | 44 | # OS 45 | Thumbs.db -------------------------------------------------------------------------------- /apps/frontend/pages/api/admin/analytics.ts: -------------------------------------------------------------------------------- 1 | import type { NextApiRequest, NextApiResponse } from 'next'; 2 | 3 | // Simulate a slow API to validate timeout + fallback behavior 4 | export default async function handler(_req: NextApiRequest, res: NextApiResponse) { 5 | // Introduce an artificial delay (e.g., 5s) so the 4s timeout triggers 6 | await new Promise((r) => setTimeout(r, 5000)); 7 | res.status(200).json({ 8 | dau: 2345, 9 | wau: 6543, 10 | mau: 22111, 11 | newUsers: 102, 12 | topTraders: [ 13 | { wallet: 'AA...111', trades: 180, volume: 2100000 }, 14 | { wallet: 'BB...222', trades: 120, volume: 910000 }, 15 | ], 16 | }); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener('change', onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener('change', onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /apps/anchor_program/Anchor.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | package_manager = "yarn" 3 | 4 | [features] 5 | resolution = true 6 | skip-lint = false 7 | 8 | [programs.localnet] 9 | shadow_swap = "ESHkd14KmUUJthjVqKoh7JP1oVVMFJCqPPkpsrJrT5Kt" 10 | 11 | [programs.devnet] 12 | shadow_swap = "ESHkd14KmUUJthjVqKoh7JP1oVVMFJCqPPkpsrJrT5Kt" 13 | 14 | [registry] 15 | url = "https://api.apr.dev" 16 | 17 | [provider] 18 | cluster = "devnet" 19 | wallet = "~/.config/solana/id.json" 20 | 21 | [scripts] 22 | test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 \"tests/**/*.ts\"" 23 | setup = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 \"scripts/setup-devnet.ts\"" 24 | clear = "node scripts/clear-orders.js" 25 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/sonner.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { useTheme } from 'next-themes' 4 | import { Toaster as Sonner, ToasterProps } from 'sonner' 5 | 6 | const Toaster = ({ ...props }: ToasterProps) => { 7 | const { theme = 'system' } = useTheme() 8 | 9 | return ( 10 | 22 | ) 23 | } 24 | 25 | export { Toaster } 26 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/icons/XLogo.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | import * as React from "react" 3 | 4 | type Props = React.SVGProps & { 5 | size?: number 6 | } 7 | 8 | export function XLogo({ size = 20, className, ...rest }: Props) { 9 | return ( 10 | 22 | ) 23 | } 24 | 25 | -------------------------------------------------------------------------------- /apps/anchor_program/programs/shadow_swap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "shadow_swap" 3 | version = "0.1.0" 4 | description = "ShadowSwap - Privacy-preserving DEX on Solana" 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["cdylib", "lib"] 9 | name = "shadow_swap" 10 | 11 | [features] 12 | default = [] 13 | cpi = ["no-entrypoint"] 14 | no-entrypoint = [] 15 | no-idl = [] 16 | no-log-ix-name = [] 17 | idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] 18 | anchor-debug = [] 19 | custom-heap = [] 20 | custom-panic = [] 21 | 22 | [dependencies] 23 | anchor-lang = "0.31.1" 24 | anchor-spl = "0.31.1" 25 | 26 | [lints.rust] 27 | unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } 28 | 29 | -------------------------------------------------------------------------------- /apps/frontend/lib/coingecko.ts: -------------------------------------------------------------------------------- 1 | import { getJSONWithCache } from './apiClient'; 2 | 3 | export type CoinGeckoSimplePrice = Record>; 4 | 5 | export async function getCoinGeckoSimplePrice(ids: string[], vsCurrency = 'usd', opts?: { timeoutMs?: number; ttlMs?: number }) { 6 | const idsParam = ids.join(','); 7 | const url = `/api/coingecko/prices?ids=${encodeURIComponent(idsParam)}&vs_currency=${encodeURIComponent(vsCurrency)}${opts?.ttlMs ? `&ttl_ms=${opts.ttlMs}` : ''}`; 8 | return getJSONWithCache(url, { 9 | timeoutMs: opts?.timeoutMs ?? 3000, 10 | // If both network and cache fail, return empty object as a safe fallback 11 | mockFallback: {}, 12 | }); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import * as LabelPrimitive from '@radix-ui/react-label' 5 | 6 | import { cn } from '@/lib/utils' 7 | 8 | function Label({ 9 | className, 10 | ...props 11 | }: React.ComponentProps) { 12 | return ( 13 | 21 | ) 22 | } 23 | 24 | export { Label } 25 | -------------------------------------------------------------------------------- /apps/settlement_bot/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "commonjs", 5 | "lib": ["ES2020"], 6 | "outDir": "./dist", 7 | "rootDir": "./src", 8 | "strict": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "resolveJsonModule": true, 13 | "moduleResolution": "node", 14 | "declaration": true, 15 | "declarationMap": true, 16 | "sourceMap": true, 17 | "noUnusedLocals": true, 18 | "noUnusedParameters": true, 19 | "noImplicitReturns": true, 20 | "noFallthroughCasesInSwitch": true 21 | }, 22 | "include": ["src/**/*"], 23 | "exclude": ["node_modules", "dist", "**/*.test.ts"] 24 | } 25 | -------------------------------------------------------------------------------- /apps/.shadow_swap_mxe_native_attempt/programs/shadow_swap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "shadow_swap" 3 | version = "0.1.0" 4 | description = "Created with Anchor" 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["cdylib", "lib"] 9 | name = "shadow_swap" 10 | 11 | [features] 12 | default = [] 13 | cpi = ["no-entrypoint"] 14 | no-entrypoint = [] 15 | no-idl = [] 16 | no-log-ix-name = [] 17 | idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] 18 | anchor-debug = [] 19 | custom-heap = [] 20 | custom-panic = [] 21 | 22 | 23 | [dependencies] 24 | anchor-lang = "0.31.1" 25 | anchor-spl = "0.31.1" 26 | arcium-anchor = "0.3.0" 27 | 28 | 29 | [lints.rust] 30 | unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } 31 | -------------------------------------------------------------------------------- /apps/settlement_bot/.env.example: -------------------------------------------------------------------------------- 1 | # ShadowSwap Keeper Bot 2 | RPC_URL=https://api.devnet.solana.com 3 | WSS_URL=wss://api.devnet.solana.com 4 | PROGRAM_ID=CwE5KHSTsStjt2pBYjK7G7vH5T1dk3tBvePb1eg26uhA 5 | ORDER_BOOK_PUBKEY=63kRwuBA7VZHrP4KU97g1B218fKMShuvKk7qLZjGqBqJ 6 | KEEPER_KEYPAIR_PATH=~/.config/solana/id.json 7 | 8 | # Arcium MPC (set real credentials in prod) 9 | ARCIUM_MPC_URL=https://mpc.arcium.com 10 | ARCIUM_CLIENT_ID=demo 11 | ARCIUM_CLIENT_SECRET=demo 12 | 13 | # Sanctum / submission strategy 14 | SANCTUM_GATEWAY_URL=https://gateway.sanctum.so 15 | SANCTUM_API_KEY=demo 16 | USE_DIRECT_RPC=true 17 | USE_MOCK_ARCIUM=true 18 | USE_MOCK_SANCTUM=false 19 | 20 | # Bot behavior 21 | MATCH_INTERVAL=10000 22 | MAX_RETRIES=3 23 | RETRY_DELAY_MS=1000 24 | LOG_LEVEL=info 25 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/next.config.mjs: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import { fileURLToPath } from 'url' 3 | 4 | const __dirname = path.dirname(fileURLToPath(import.meta.url)) 5 | 6 | /** @type {import('next').NextConfig} */ 7 | const nextConfig = { 8 | typescript: { 9 | ignoreBuildErrors: true, 10 | }, 11 | images: { 12 | unoptimized: true, 13 | }, 14 | turbopack: { 15 | // Explicitly set root to this directory to avoid monorepo detection 16 | root: __dirname, 17 | }, 18 | // Bundle markdown docs located in the monorepo root so the API route can 19 | // serve them when deployed to Vercel/Netlify (serverless envs). 20 | outputFileTracingIncludes: { 21 | '/api/docs/[slug]': ['./docs/**/*'], 22 | }, 23 | } 24 | 25 | export default nextConfig 26 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cn } from "@/lib/utils" 3 | 4 | interface InputProps extends React.InputHTMLAttributes {} 5 | 6 | const Input = React.forwardRef(({ className, type, ...props }, ref) => ( 7 | 19 | )) 20 | Input.displayName = "Input" 21 | 22 | export { Input } 23 | -------------------------------------------------------------------------------- /apps/frontend/components/primitives/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | interface CardProps { 4 | title: string; 5 | right?: React.ReactNode; 6 | children: React.ReactNode; 7 | } 8 | 9 | export function Card({ title, right, children }: CardProps) { 10 | return ( 11 |
12 |
13 |

{title}

14 | {right ?
{right}
: null} 15 |
16 |
{children}
17 | 22 |
23 | ); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import * as React from 'react' 4 | import * as SeparatorPrimitive from '@radix-ui/react-separator' 5 | 6 | import { cn } from '@/lib/utils' 7 | 8 | function Separator({ 9 | className, 10 | orientation = 'horizontal', 11 | decorative = true, 12 | ...props 13 | }: React.ComponentProps) { 14 | return ( 15 | 25 | ) 26 | } 27 | 28 | export { Separator } 29 | -------------------------------------------------------------------------------- /ShadowSwap SPA Design/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | import { cn } from '@/lib/utils' 4 | 5 | function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) { 6 | return ( 7 |