Skip to content

Commit

Permalink
Merge pull request #3 from cryptoalgebra/dev
Browse files Browse the repository at this point in the history
Add Token Selector, Wrap button
  • Loading branch information
lilchizh authored Mar 13, 2024
2 parents d38626f + f1bace5 commit 2175e05
Show file tree
Hide file tree
Showing 34 changed files with 16,424 additions and 75 deletions.
15,248 changes: 15,248 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@apollo/client": "^3.8.4",
"@cryptoalgebra/integral-sdk": "^0.11.9",
"@cryptoalgebra/integral-sdk": "^0.11.11",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-hover-card": "^1.0.7",
Expand All @@ -28,22 +28,26 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"dayjs": "^1.11.10",
"fuse.js": "^7.0.0",
"graphql": "^16.8.1",
"jsbi": "^3.2.5",
"lightweight-charts": "^4.1.0",
"localforage": "^1.10.0",
"lodash.keyby": "^4.6.0",
"lodash.merge": "^4.6.2",
"lucide-react": "^0.279.0",
"match-sorter": "^6.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.16.0",
"react-window": "^1.8.10",
"recharts": "^2.8.0",
"sort-by": "^1.2.0",
"swr": "^2.2.4",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"usehooks-ts": "^2.9.1",
"vaul": "^0.9.0",
"viem": "^1.12.2",
"wagmi": "^1.4.2",
"zustand": "^4.4.1"
Expand All @@ -55,9 +59,11 @@
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-react-apollo": "^4.0.0",
"@types/lodash.keyby": "^4.6.7",
"@types/lodash.merge": "^4.6.9",
"@types/node": "^20.7.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/react-window": "^1.8.8",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.3.2",
Expand Down
3 changes: 2 additions & 1 deletion src/abis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export * from './algebraPositionManager'
export * from './algebraQuoter'
export * from './algebraQuoterV2'
export * from './algebraRouter'
export * from './plugins'
export * from './plugins'
export * from './tokens'
1 change: 1 addition & 0 deletions src/abis/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './wNative'
279 changes: 279 additions & 0 deletions src/abis/tokens/wNative.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
export const wNativeABI = [
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "guy",
"type": "address"
},
{
"name": "wad",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "src",
"type": "address"
},
{
"name": "dst",
"type": "address"
},
{
"name": "wad",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "wad",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "dst",
"type": "address"
},
{
"name": "wad",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "deposit",
"outputs": [],
"payable": true,
"stateMutability": "payable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "src",
"type": "address"
},
{
"indexed": true,
"name": "guy",
"type": "address"
},
{
"indexed": false,
"name": "wad",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "src",
"type": "address"
},
{
"indexed": true,
"name": "dst",
"type": "address"
},
{
"indexed": false,
"name": "wad",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "dst",
"type": "address"
},
{
"indexed": false,
"name": "wad",
"type": "uint256"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "src",
"type": "address"
},
{
"indexed": false,
"name": "wad",
"type": "uint256"
}
],
"name": "Withdrawal",
"type": "event"
}
] as const
11 changes: 8 additions & 3 deletions src/components/common/CurrencyLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from "react";
import { Address } from "wagmi";
import EthLogo from '@/assets/tokens/ether.svg'
import USDTLogo from '@/assets/tokens/usdt.png'
import USDCLogo from '@/assets/tokens/usdc.svg'
import { cn } from "@/lib/utils";
import { Skeleton } from "@/components/ui/skeleton";

Expand All @@ -21,17 +22,21 @@ export const specialTokens: { [key: Address]: { symbol: string; logo: string } }
['0x7d98346b3b000c55904918e3d9e2fc3f94683b01']: {
symbol: 'USDT',
logo: USDTLogo
},
['0x42e87bddd77b0c4122b5dd4a8c62872610dcefef']: {
symbol: 'USDC',
logo: USDCLogo
}
}


const CurrencyLogo = ({ currency, size, className, style = {} }: CurrencyLogoProps) => {

if (!currency) return <Skeleton className={cn(`min-w-[${size}px] min-h-[${size}px] flex rounded-full bg-card`, className)} style={{ width: `${size}px`, height: `${size}px`, ...style }} />
if (!currency) return <Skeleton className={cn(`flex rounded-full bg-card`, className)} style={{ minWidth: `${size}px`, minHeight: `${size}px`, width: `${size}px`, height: `${size}px`, ...style }} />

const address = currency.wrapped.address.toLowerCase() as Address;

const classString = cn(`min-w-[${size}px] min-h-[${size}px] bg-card-dark rounded-full`, className)
const classString = cn(`w-[${size}px] h-[${size}px] min-w-[${size}px] min-h-[${size}px] bg-card-dark rounded-full`, className)

if (address in specialTokens) {
return <img src={specialTokens[address].logo} alt={specialTokens[address].symbol} width={size} height={size} className={classString} style={style} />
Expand All @@ -41,7 +46,7 @@ const CurrencyLogo = ({ currency, size, className, style = {} }: CurrencyLogoPro
return <img src={EthLogo} alt={'ETH'} width={size} height={size} className={classString} style={style} />
}

return <div className={`${classString} bg-white text-black`} style={style}>
return <div className={`${classString} flex items-center justify-center bg-white text-black`} style={{ minWidth: `${size}px`, minHeight: `${size}px`, width: `${size}px`, height: `${size}px`, ...style }}>
{currency.symbol?.slice(0, 2)}
</div>

Expand Down
Loading

0 comments on commit 2175e05

Please sign in to comment.