Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Core uniswap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
3 changes: 3 additions & 0 deletions Core uniswap/Frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
40 changes: 40 additions & 0 deletions Core uniswap/Frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env files (can opt-in for commiting if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions Core uniswap/Frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
6 changes: 6 additions & 0 deletions Core uniswap/Frontend/app/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// src/client.ts
import { createThirdwebClient } from "thirdweb";

export const client = createThirdwebClient({
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
});
100 changes: 100 additions & 0 deletions Core uniswap/Frontend/app/components/ApproveButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"use client";
import { Button } from "@/components/ui/button";
import { defineChain, getContract, prepareContractCall } from "thirdweb";
import { client } from "../client";
import { useSendTransaction } from "thirdweb/react";
import { toast } from 'react-hot-toast';


const ApproveButton = ({
addressOne,
setAddressOne,
amountOne,
setAmountOne,
}: {addressOne: string, setAddressOne: (address: string) => void, amountOne: string, setAmountOne: (amount: string) => void}) => {


const chain = defineChain(1115);

const contract = getContract({
client,
address: addressOne,
chain: chain,
});

const { mutate: sendTransaction } = useSendTransaction();

const Approve = async (address: string, amount: bigint) => {
const approve = prepareContractCall({
contract,
method: "function approve(address to, uint256 amount)",
params: [address, amount],
});
return new Promise((resolve, reject) => {
sendTransaction(approve, {
onSuccess: () => resolve(true),
onError: (error) => reject(error),
});
});
};

return (
<>
<Button
className="w-full"
onClick={async () => {
const loadingToast = toast.loading('Approving Tokens...', {
position: 'top-left',
style: {
borderRadius: '10px',
background: '#333',
color: '#fff',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
},
});

try {
const amount = BigInt(Number(amountOne) * 10 ** 18);
const routerAddress = "0xb7e2979167e46A03Cf44171c349945D7041B6C2D";

await Approve(routerAddress, amount);
setAmountOne("");

toast.dismiss(loadingToast);
toast.success('Tokens Approved Successfully! ✅', {
position: 'top-left',
duration: 4000,
style: {
borderRadius: '10px',
background: '#333',
color: '#fff',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
},
iconTheme: {
primary: '#4ade80',
secondary: '#fff',
},
});
} catch (error: any) {
toast.dismiss(loadingToast);
toast.error(`Approval Failed: ${error.message}`, {
position: 'top-left',
duration: 5000,
style: {
borderRadius: '10px',
background: '#333',
color: '#fff',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
},
});
console.log("Error during approval:", error);
}
}}
>
Approve Tokens
</Button>
</>
);
};

export default ApproveButton;
54 changes: 54 additions & 0 deletions Core uniswap/Frontend/app/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"use client";
import { Button } from "@/components/ui/button";
import { Card, CardContent} from "@/components/ui/card";
import { RefreshCcw, Coins, BarChart3 } from "lucide-react";


const Cardd = ({activeTab, setActiveTab}: {activeTab: string, setActiveTab: (tab: string) => void}) => {


return (
<>
<Card>
<CardContent className="p-4">
<nav className="space-y-2">
<Button
variant={activeTab === "swap" ? "default" : "ghost"}
className="w-full justify-start"
onClick={() => setActiveTab("swap")}
>
<RefreshCcw className="mr-2 h-4 w-4" />
Swap
</Button>
<Button
variant={activeTab === "liquidity" ? "default" : "ghost"}
className="w-full justify-start"
onClick={() => setActiveTab("liquidity")}
>
<Coins className="mr-2 h-4 w-4" />
Liquidity
</Button>
<Button
variant={activeTab === "investments" ? "default" : "ghost"}
className="w-full justify-start"
onClick={() => setActiveTab("investments")}
>
<BarChart3 className="mr-2 h-4 w-4" />
Investments
</Button>
<Button
variant={activeTab === "mint" ? "default" : "ghost"}
className="w-full justify-start"
onClick={() => setActiveTab("mint")}
>
<BarChart3 className="mr-2 h-4 w-4" />
Mint
</Button>
</nav>
</CardContent>
</Card>
</>
);
};

export default Cardd;
30 changes: 30 additions & 0 deletions Core uniswap/Frontend/app/components/ConnectButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { useState } from "react";
import { Button } from "@/components/ui/button";
import { ConnectButton, lightTheme } from "thirdweb/react";
import { client } from "../client";

const ConnectButtons = () => {
return (
<>

<ConnectButton
client={client}
theme={lightTheme({
colors: {
primaryButtonBg: "white",
primaryButtonText: "black",
},
})}
connectButton={{
label: "Connect Wallet",
className:
"bg-white hover:bg-gray-100 text-black border border-gray-200 flex items-center",
}}
/>
</>
);
};

export default ConnectButtons;
15 changes: 15 additions & 0 deletions Core uniswap/Frontend/app/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";
import ConnectButton from "./ConnectButton";

const Header = () => {
return (
<>
<header className="flex justify-between items-center mb-8">
<h1 className="text-3xl font-bold text-indigo-700">DEX Platform</h1>
<ConnectButton />
</header>
</>
);
};

export default Header;
Empty file.
Loading