Skip to content

Commit

Permalink
Merge with main to resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanNeiverth committed Oct 11, 2024
1 parent 0ecc2fc commit c3a9656
Show file tree
Hide file tree
Showing 67 changed files with 1,769 additions and 316 deletions.
12 changes: 6 additions & 6 deletions apps/claim-vesting/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
}
],
"orientation": "portrait",
"name": "Claim Vesting Hook",
"short_name": "Claim Vesting",
"name": "Claim LlamaPay Vesting Hook",
"short_name": "Claim LlamaPay Vesting",
"start_url": ".",
"theme_color": "#ffffff",
"cow_hook_dapp": {
"id": "177eda1e6d1d89f1777d60387f06e1fdcb2c11baad38c6f06c8a3404ebc7e03a",
"name": "Claim Vesting",
"descriptionShort": "Claim your vesting contract funds",
"description": "The Claim Vesting Hook is a powerful and user-friendly feature designed to streamline the process of claiming funds from LlamaPay vesting contracts. This tool empowers users to easily access and manage their vested tokens, ensuring a smooth and efficient experience in handling time-locked assets.",
"id": "5d2c081d11a01ca0b76e2fafbc0d3c62a4c9945ce404706fb1e49e826c0f99eb",
"name": "Claim LlamaPay Vesting",
"descriptionShort": "Claim your LlamaPay vesting contract funds",
"description": "The Claim LlampaPay Vesting Hook is a powerful and user-friendly feature designed to streamline the process of claiming funds from LlamaPay vesting contracts. This tool empowers users to easily access and manage their vested tokens, ensuring a smooth and efficient experience in handling time-locked assets.",
"version": "0.0.1",
"website": "https://github.com/bleu/cow-hooks-dapps",
"image": "https://cow-hooks-dapps-claim-vesting.vercel.app/llama-pay-icon.png",
Expand Down
3 changes: 2 additions & 1 deletion apps/claim-vesting/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default function Page() {
const {
errorMessage,
formattedClaimableAmount,
formattedClaimableAmountFullDecimals,
tokenSymbol,
loading,
callData,
Expand Down Expand Up @@ -89,7 +90,7 @@ export default function Page() {
<div className="flex flex-col w-full">
<ClaimableAmountContainer>
<span>Claimable amount</span>
<span>
<span title={formattedClaimableAmountFullDecimals}>
{formattedClaimableAmount} {tokenSymbol && tokenSymbol}
</span>
</ClaimableAmountContainer>
Expand Down
18 changes: 18 additions & 0 deletions apps/claim-vesting/src/hooks/useClaimVestingData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const useClaimVestingData = ({
}: useClaimVestingDataParams): {
errorMessage: string | undefined;
formattedClaimableAmount: string;
formattedClaimableAmountFullDecimals: string;
tokenSymbol: string;
loading: boolean;
callData: string | undefined;
Expand Down Expand Up @@ -86,6 +87,7 @@ export const useClaimVestingData = ({
errorVesting,
errorToken,
errorGasLimit,
claimableAmountWei,
});
const formattedClaimableAmount =
recipient === account && claimableAmountWei && decimals
Expand All @@ -97,6 +99,16 @@ export const useClaimVestingData = ({
0.000001
)
: "0.0";
const formattedClaimableAmountFullDecimals =
recipient === account && claimableAmountWei && decimals
? formatNumber(
Number(claimableAmountWei) / 10 ** Number(decimals),
Number(decimals),
"decimal",
"standard",
Number(`0.${"0".repeat(Number(decimals) - 1)}1`)
)
: "0.0";
const loading = isLoadingToken || isLoadingVesting || isLoadingGasLimit;

const callData =
Expand All @@ -111,6 +123,7 @@ export const useClaimVestingData = ({
return {
errorMessage,
formattedClaimableAmount,
formattedClaimableAmountFullDecimals,
tokenSymbol,
loading,
callData,
Expand All @@ -125,13 +138,15 @@ function getErrorMessage({
debouncedAddress,
errorToken,
errorGasLimit,
claimableAmountWei,
}: {
account: string | undefined;
recipient: string | undefined;
debouncedAddress: string;
errorVesting: Error;
errorToken: Error;
errorGasLimit: Error;
claimableAmountWei: bigint | undefined;
}) {
if (!(isAddress(debouncedAddress) || debouncedAddress === ""))
return "Insert a valid address";
Expand All @@ -141,6 +156,9 @@ function getErrorMessage({
if (recipient && account !== recipient)
return "You are not the contract recipient";

if (recipient && account === recipient && claimableAmountWei === BigInt(0))
return "You have already claimed your funds";

if (errorVesting) return errorVesting.message;

if (errorToken) return errorToken.message;
Expand Down
6 changes: 6 additions & 0 deletions apps/claim-vesting/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ module.exports = {
"animation-duration": "var(--cow-animation-duration)",
"animation-duration-slow": "var(--cow-animation-duration-slow)",
},
fontFamily: {
"inter-sans": '"Inter var", sans-serif',
},
screens: {
xsm: "420px",
},
},
},
plugins: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const VestAllFromSwapCheckbox = () => {
const { setValue } = useFormContext();

useEffect(() => {
console.log(vestAllFromSwap);
vestAllFromSwap ? setValue("amount", 1) : setValue("amount", 0);
setValue("vestAllFromSwap", vestAllFromSwap);
}, [vestAllFromSwap]);
Expand Down
58 changes: 58 additions & 0 deletions apps/deposit-pool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies

/node_modules
/.pnp
.pnp.js

# testing

/coverage

# next.js

/.next/
/out/

# production

/build

# misc

.DS_Store
\*.pem

# debug

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

# local env files

.env*

# vercel

.vercel

# typescript

\*.tsbuildinfo
next-env.d.ts

.vscode

# Sentry
.sentryclirc

.cache/

# Sentry Auth Token
.sentryclirc

# Sentry Config File
.sentryclirc
24 changes: 24 additions & 0 deletions apps/deposit-pool/lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @ts-check

/**
* This files overrides the base lint-staged.config.js present in the root directory.
* It allows to run eslint based the package specific requirements.
* {@link https://github.com/okonet/lint-staged#how-to-use-lint-staged-in-a-multi-package-monorepo}
* {@link https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-lint-staged.md}
*/

const {
concatFilesForPrettier,
getEslintFixCmd,
} = require("../../lint-staged.common.js");

/**
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
*/
const rules = {
"**/*.{json,md,mdx,css,html,yml,yaml,scss}": (filenames) => {
return [`pnpm biome check --write ${concatFilesForPrettier(filenames)}`];
},
};

module.exports = rules;
22 changes: 22 additions & 0 deletions apps/deposit-pool/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env node */
// eslint-disable-next-line @typescript-eslint/no-var-requires

/** @type {import('next').NextConfig} */
const moduleExports = {
transpilePackages: ["@bleu/cow-hooks-ui"],
async headers() {
return [
{
source: "/manifest.json",
headers: [
{
key: "Access-Control-Allow-Origin",
value: "*",
},
],
},
];
},
};

module.exports = moduleExports;
61 changes: 61 additions & 0 deletions apps/deposit-pool/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@bleu/deposit-pool",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev",
"start": "next start",
"lint": "eslint '**/*.{ts,tsx}'",
"lint:fix": "eslint '**/*.{ts,tsx}' --fix"
},
"dependencies": {
"@balancer-labs/sdk": "1.1.6",
"@balancer/sdk": "0.26.1",
"@bleu/cow-hooks-ui": "workspace:*",
"@bleu/tsconfig": "workspace:*",
"@bleu/ui": "0.1.131",
"@bleu/utils": "workspace:*",
"@cowprotocol/cow-sdk": "^5.5.1",
"@cowprotocol/hook-dapp-lib": "1.0.0-RC1",
"@cowprotocol/permit-utils": "0.3.1",
"@ethersproject/providers": "5.7.2",
"@hookform/resolvers": "3.9.0",
"@radix-ui/react-icons": "1.3.0",
"@uniswap/sdk-core": "5.4.0",
"class-variance-authority": "^0.7.0",
"date-fns": "^3.3.1",
"downshift": "^8.4.0",
"ethers": "^5.7.2",
"graphql": "^16.9.0",
"graphql-request": "^6.1.0",
"next": "15.0.0-rc.0",
"react": "19.0.0-rc-e4953922-20240919",
"react-dom": "19.0.0-rc-e4953922-20240919",
"react-hook-form": "7.53.0",
"server-only": "^0.0.1",
"swr": "2.2.5",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "1.0.7",
"tiny-invariant": "^1.3.3",
"url": "^0.11.4",
"viem": "2.21.14",
"zod": "^3.23.8"
},
"devDependencies": {
"@biomejs/biome": "1.9.2",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "14.5.2",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.20",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12",
"typescript": "5.6.2"
}
}
6 changes: 6 additions & 0 deletions apps/deposit-pool/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/deposit-pool/public/favicon.ico
Binary file not shown.
Binary file added apps/deposit-pool/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions apps/deposit-pool/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"background_color": "#ffffff",
"display": "standalone",
"homepage_url": "https://swap.cow.fi",
"description": "CoW hook dapp: Withdraw Liquidity",
"icons": [],
"orientation": "portrait",
"name": "Withdraw Liquidity",
"short_name": "Withdraw Liquidity",
"start_url": ".",
"theme_color": "#ffffff",
"cow_hook_dapp": {
"id": "5dc71fa5829d976c462bdf37b38b6fd9bbc289252a5a18e61525f8c8a3c775df",
"name": "CoW AMM Deposit",
"descriptionShort": "Add liquidity to any of the CoW AMM pools",
"description": "Easily increase your position in a liquidity pool, adding both tokens in the right ratio.\n\n Whether you're seeking to increase your exposure to specific tokens or maximize the returns from your assets, this tool offers a quick and efficient way to enhance your liquidity position after a token swap, all in a smooth, efficient process.",
"version": "0.0.1",
"website": "https://balancer.fi/pools/cow",
"image": "http://localhost:3000/icon.png",
"conditions": {
"position": "post",
"walletCompatibility": ["EOA"]
}
}
}
14 changes: 14 additions & 0 deletions apps/deposit-pool/src/app/global-error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

export default function GlobalError({ error }: { error: Error }) {
/* eslint-disable-next-line no-console */
console.error(error);

return (
<html lang="en">
<body>
<h2>Something went wrong!</h2>
</body>
</html>
);
}
20 changes: 20 additions & 0 deletions apps/deposit-pool/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client";

import { IFrameContextProvider } from "@bleu/cow-hooks-ui";
import "#/global.css";
import Head from "next/head";

import type * as React from "react";

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className="h-full">
<Head>
<link rel="manifest" href="/manifest.json" />
</Head>
<body className="flex h-full flex-col font-sans font-normal bg-background text-foreground">
<IFrameContextProvider>{children}</IFrameContextProvider>
</body>
</html>
);
}
Loading

0 comments on commit c3a9656

Please sign in to comment.