Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wagmi versioning #147

Merged
merged 68 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e9b452f
style: make background not pure black
ZakMooney Jan 15, 2024
57673e5
style: create vault card
ZakMooney Jan 16, 2024
5313728
style: table type icons
ZakMooney Jan 16, 2024
41dad05
style: fix collateral loader full width on small screens
ZakMooney Jan 16, 2024
ae0cb7e
style: fix table title align on small screen
ZakMooney Jan 16, 2024
91b9189
Merge pull request #137 from the-standard/202401-styling
ZakMooney Jan 16, 2024
a21fe62
feat: update abi
ZakMooney Jan 16, 2024
c2a72b4
feat: update swap for v3 with new minReturn field
ZakMooney Jan 16, 2024
726399c
feat: swap v3
ZakMooney Jan 18, 2024
acd0189
chore: remove unused
ZakMooney Jan 18, 2024
f9586e6
feat: skip approval if >= V3
ZakMooney Jan 18, 2024
6d57cf9
feat: fix unused var
ZakMooney Jan 18, 2024
ae1d8a2
Merge pull request #138 from the-standard/202401-vaults-v3
ZakMooney Jan 18, 2024
f3e5bec
feat: remove uneeded skip in staking
ZakMooney Jan 18, 2024
70250f7
Merge pull request #139 from the-standard/202401-vaults-v3
ZakMooney Jan 18, 2024
33d5ec4
feat: fix input 0.0 error
ZakMooney Jan 18, 2024
6441483
Merge pull request #140 from the-standard/202401-vaults-v3
ZakMooney Jan 18, 2024
9be3523
feat: sorry ewan
ZakMooney Jan 18, 2024
2e66636
Merge pull request #141 from the-standard/202401-vaults-v3
ZakMooney Jan 18, 2024
1d09710
fix: possible fix for status error
ZakMooney Jan 19, 2024
751973b
Merge pull request #143 from the-standard/202401-vaults-v3
ZakMooney Jan 19, 2024
4e65c67
test: console logs
ZakMooney Jan 19, 2024
ba6967c
Merge pull request #144 from the-standard/202401-vaults-v3
ZakMooney Jan 19, 2024
7f87838
test: remove console logs
ZakMooney Jan 19, 2024
df6b063
Merge pull request #145 from the-standard/202401-vaults-v3
ZakMooney Jan 19, 2024
608b6ae
chore: cleanup
ZakMooney Jan 19, 2024
6f1f698
start upgrading wagmi interactions
ewansheldon Jan 24, 2024
bfdbfd3
chore: cleanup
ZakMooney Jan 24, 2024
e937aa3
Merge pull request #146 from the-standard/202401-vaults-table
ZakMooney Jan 24, 2024
0a09532
chore: tidy and merge
ZakMooney Jan 24, 2024
0d7b468
feat: replace vaultlist chainids
ZakMooney Jan 24, 2024
c602053
feat: update wagmi abi function names
ZakMooney Jan 24, 2024
f118927
feat: update vaultlist watch
ZakMooney Jan 24, 2024
3b91201
chore: cleanup
ZakMooney Jan 24, 2024
1257746
feat: upgrade stakingmodal
ZakMooney Jan 24, 2024
bc36773
feat: upgrade stakingtst
ZakMooney Jan 24, 2024
1793414
feat: upgrade stakingearn
ZakMooney Jan 24, 2024
d5638b2
feat: upgrade staking liquidations stake and withdraw modal
ZakMooney Jan 24, 2024
96b1a8a
fix: update stage clearing
ZakMooney Jan 25, 2024
1ec63ad
feat: upgrade useWaitForTransaction to useWaitForTransactionReceipt
ZakMooney Jan 25, 2024
80d68f4
feat: upgrade collatoral page
ZakMooney Jan 25, 2024
4bfe3b9
feat: upgrade debt page
ZakMooney Jan 25, 2024
b2ec1ab
feat: upgrade addeuros
ZakMooney Jan 25, 2024
3c5d653
feat: upgrade compareeuros
ZakMooney Jan 25, 2024
e980cdb
feat: upgrade index
ZakMooney Jan 25, 2024
0a11917
chore: delete unused datagrid
ZakMooney Jan 25, 2024
652b13d
chore: WIP collatoral reconnect
ZakMooney Jan 26, 2024
7eb9a93
chore: fix wagmi reconnect
ZakMooney Jan 29, 2024
02ab3df
chore: tidy
ZakMooney Jan 29, 2024
31fb24d
chore: tidy
ZakMooney Jan 29, 2024
01cd4ee
feat: upgrade deposit
ZakMooney Jan 29, 2024
bfe5fb2
feat: upgrade withdraw
ZakMooney Jan 29, 2024
ac67ddc
feat: upgrade swap
ZakMooney Jan 29, 2024
246fe40
feat: upgrade history
ZakMooney Jan 29, 2024
347c65c
chore: tidy
ZakMooney Jan 29, 2024
21f8193
feat: upgrade claimingmodal
ZakMooney Jan 29, 2024
f7490f8
feat: ignore ts err for watch block
ZakMooney Jan 29, 2024
b08410b
feat: improve polling for vault deploy watch
ZakMooney Jan 29, 2024
43eb36a
chore: cleanup typescript errors
ZakMooney Jan 29, 2024
2f6b431
chore: tidy
ZakMooney Jan 29, 2024
dec210a
feat: refactor homepriv auto update
ZakMooney Jan 30, 2024
22065cd
TEMP: testing collateral stat update
ZakMooney Jan 30, 2024
a0851dd
feat: debt use passed down data not store
ZakMooney Jan 30, 2024
3d4c5c2
feat: collat charts use passed down data not store
ZakMooney Jan 30, 2024
a6b3040
feat: add true false catch
ZakMooney Jan 31, 2024
c7eb126
style: center login button
ZakMooney Jan 31, 2024
336cb87
style: center login button
ZakMooney Jan 31, 2024
037d920
chore: fix build err
ZakMooney Jan 31, 2024
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
34,996 changes: 25,090 additions & 9,906 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"@types/react-transition-group": "^4.4.6",
"@walletconnect/ethereum-provider": "^2.9.1",
"@walletconnect/modal": "^2.6.1",
"@web3modal/ethereum": "^2.7.1",
"@web3modal/react": "^2.7.1",
"@web3modal/wagmi": "^4.0.0-alpha.0",
"apexcharts": "^3.40.0",
"axios": "^1.4.0",
"dompurify": "^3.0.5",
Expand All @@ -41,10 +40,10 @@
"react-transition-group": "^4.4.5",
"typeface-poppins": "^1.1.13",
"universal-cookie": "^6.1.1",
"wagmi": "^1.3.9",
"zustand": "^4.3.8"
},
"devDependencies": {
"@tanstack/react-query": "^5.17.19",
"@types/react": "^18.0.28",
"@types/react-burger-menu": "^2.8.3",
"@types/react-dom": "^18.0.11",
Expand All @@ -55,6 +54,8 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"typescript": "^5.0.2",
"vite": "^4.3.2"
"viem": "^2.5.0",
"vite": "^4.3.2",
"wagmi": "^2.5.0"
}
}
113 changes: 30 additions & 83 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,18 @@
import { Routes, Route } from "react-router-dom";
import { WagmiProvider } from "wagmi";
import {
EthereumClient,
w3mConnectors
} from "@web3modal/ethereum";
import { Web3Modal } from "@web3modal/react";
import { Chain, configureChains, createConfig, WagmiConfig } from "wagmi";
import {
arbitrum
arbitrum,
arbitrumSepolia
} from "wagmi/chains";

export const arbitrumSepolia = {
id: 421614,
name: 'Arbitrum Sepolia',
network: 'arbitrumSepolia',
nativeCurrency: {
decimals: 18,
name: 'Ether',
symbol: 'ETH',
},
rpcUrls: {
public: { http: [`https://arb-sepolia.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_SEPOLIA_API_KEY}`] },
default: { http: [`https://arb-sepolia.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_SEPOLIA_API_KEY}`] },
},
blockExplorers: {
etherscan: { name: 'Arbiscan', url: 'https://sepolia.arbiscan.io/' },
default: { name: 'Arbiscan', url: 'https://sepolia.arbiscan.io/' },
}
} as const satisfies Chain

const projectId = "67027f91c1db8751c6ea2ed13b9cdc55";

const { chains, publicClient } = configureChains(
[arbitrum, arbitrumSepolia],
[alchemyProvider({ apiKey: import.meta.env.VITE_ALCHEMY_API_KEY }), publicProvider()],
)

const config = createConfig({
autoConnect: true,
connectors: w3mConnectors({ projectId, chains }),
publicClient,
})
const ethereumClient = new EthereumClient(config, chains);

import { createWeb3Modal } from '@web3modal/wagmi/react'
import HomePage from "./pages/HomePage.tsx";
//import navbar
import Navbar from "./components/Navbar.tsx";
import Footer from "./components/Footer.tsx";
import { Box } from "@mui/material";
import { Routes, Route } from "react-router-dom";
import Collateral from "./pages/Collateral.tsx";
import CircularProgressComponent from "./components/CircularProgressComponent.tsx";
import '@walletconnect/ethereum-provider';
import {
// useCircularProgressStore,
useRenderAppCounterStore,
Expand All @@ -62,16 +26,19 @@ import Staking from "./pages/Staking.tsx";
import VaultHistory from "./pages/VaultHistory.tsx";
import TermsOfUse from "./pages/TermsOfUse.tsx";
import Disclaimer from "./components/Disclaimer.tsx";
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import wagmiConfig from "./WagmiConfig";

import { alchemyProvider } from '@wagmi/core/providers/alchemy'
import { publicProvider } from "wagmi/providers/public";
const projectId = "67027f91c1db8751c6ea2ed13b9cdc55";

function App() {
// const { circularProgress } = useCircularProgressStore();
useBackgroundImage();
// console.log(circularProgress);
const { renderAppCounter } = useRenderAppCounterStore();

const queryClient = new QueryClient()

createWeb3Modal({ wagmiConfig, projectId, chains: [arbitrum, arbitrumSepolia] });

return (
<Box
sx={{
Expand All @@ -84,43 +51,23 @@ function App() {
{/* <button onClick={handleRemountClick}>Remount</button>{" "} */}
<CircularProgressComponent />
<SnackbarComponent />
<WagmiConfig config={config}>
<Navbar />
<Disclaimer />
<Routes key={renderAppCounter}>
<Route path="/" element={<HomePage />} />
<Route path="termsofuse" element={<TermsOfUse />} />
<Route path="collateral/:vaultId" element={<Collateral />} />
<Route path="collateral/:vaultId/history" element={<VaultHistory />} />
<Route path="stats" element={<Stats />} />
<Route path="yield/*" element={<Yield />} />
<Route path="dex/*" element={<Dex />} />
<Route path="staking/*" element={<Staking />} />
</Routes>
<Footer />
</WagmiConfig>
<Web3Modal
projectId={projectId}
ethereumClient={ethereumClient}
themeVariables={{
"--w3m-font-family": "Poppins, sans-serif",
"--w3m-container-border-radius": "10px",
"--w3m-text-medium-regular-size": "10px",
// "--w3m-accent-color": "transparent",
"--w3m-accent-color": "rgba(0,0,0,0.2)",
}}
// mobileWallets={[
// {
// id: "1",
// name: "MetaMask",
// links: {
// native: "https://metamask.app.link/dapp/standardio.vercel.app/",
// universal:
// "https://metamask.app.link/dapp/standardio.vercel.app/",
// },
// },
// ]}
/>
<WagmiProvider config={wagmiConfig} reconnectOnMount={true}>
<QueryClientProvider client={queryClient}>
<Navbar />
<Disclaimer />
<Routes key={renderAppCounter}>
<Route path="/" element={<HomePage />} />
<Route path="termsofuse" element={<TermsOfUse />} />
<Route path="stats" element={<Stats />} />
<Route path="yield/*" element={<Yield />} />
<Route path="dex/*" element={<Dex />} />
<Route path="staking/*" element={<Staking />} />
<Route path="collateral/:vaultId" element={<Collateral />} />
<Route path="collateral/:vaultId/history" element={<VaultHistory />} />
</Routes>
<Footer />
</QueryClientProvider>
</WagmiProvider>
</Box>
);
}
Expand Down
19 changes: 19 additions & 0 deletions src/WagmiConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createConfig, http } from "wagmi";
import {
arbitrum,
arbitrumSepolia
} from "wagmi/chains";
import { walletConnect } from "wagmi/connectors";

const projectId = "67027f91c1db8751c6ea2ed13b9cdc55";

export const wagmiConfig = createConfig({
chains: [arbitrum, arbitrumSepolia],
transports: {
[arbitrum.id]: http(`https://arb-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_API_KEY}`),
[arbitrumSepolia.id]: http(`https://arb-sepolia.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_SEPOLIA_API_KEY}`)
},
connectors: [ walletConnect({projectId}) ],
});

export default wagmiConfig;
35 changes: 20 additions & 15 deletions src/abis/smartVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,28 +238,33 @@ export const abi = [
},
{ stateMutability: "payable", type: "receive" },
{
inputs: [
"inputs": [
{
internalType: "bytes32",
name: "_inToken",
type: "bytes32"
"internalType": "bytes32",
"name": "_inToken",
"type": "bytes32"
},
{
internalType: "bytes32",
name: "_outToken",
type: "bytes32"
"internalType": "bytes32",
"name": "_outToken",
"type": "bytes32"
},
{
internalType: "uint256",
name: "_amount",
type: "uint256"
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_requestedMinOut",
"type": "uint256"
}
],
name: "swap",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}
"name": "swap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
];

export default abi;
8 changes: 4 additions & 4 deletions src/components/Exchange.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { LiFiWidget, WidgetConfig, WidgetWalletManagement, WidgetVariant } from '@lifi/widget';
import { Address, useWalletClient } from "wagmi";
import { useWalletClient } from "wagmi";
import { providers } from "ethers";

interface ExchangeProps {
variant?: WidgetVariant,
fromChain?: number,
toChain?: number,
fromToken?: Address,
toToken?: Address
fromToken?: any,
toToken?: any
}
const Exchange: React.FC<ExchangeProps> = ({
variant = 'default',
Expand All @@ -31,7 +31,7 @@ const Exchange: React.FC<ExchangeProps> = ({

const walletConfig:WidgetWalletManagement = {
signer,
disconnect: async () => {},
disconnect: async () => {null},
connect: async () => signer,
}

Expand Down
6 changes: 4 additions & 2 deletions src/components/LoginCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Typography } from "@mui/material";
import { Web3Button } from "@web3modal/react";
// import { Web3Button } from "@web3modal/react";
import Card from "./Card";

const LoginCard = () => {
Expand Down Expand Up @@ -45,9 +45,11 @@ const LoginCard = () => {
<Box
sx={{
marginTop: "1em",
display: "flex",
justifyContent: "center",
}}
>
<Web3Button />
<w3m-button />
</Box>
</Card>
</>
Expand Down
Loading
Loading