Skip to content

Commit

Permalink
bugs: [UI] - update well withdraw UI + add Safe to wagmi config (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
Space-Bean committed Aug 15, 2024
2 parents 7fb9736 + 686ba79 commit 6af75da
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
3 changes: 2 additions & 1 deletion projects/ui/src/components/Silo/Actions/Withdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ const WithdrawForm: FC<
);

const claimableTokens = useMemo(
// FIXME: Temporarily disabled Withdraws of Bean:ETH LP in Bean/WETH, needs routing code
// FIXME: Disable remove single sided liquidity for Well tokens for now.
() => [
whitelistedToken,
...((whitelistedToken.isLP &&
whitelistedToken !== sdk.tokens.BEAN_ETH_WELL_LP &&
whitelistedToken !== sdk.tokens.BEAN_WSTETH_WELL_LP &&
pool?.tokens) ||
[]),
],
Expand Down
4 changes: 0 additions & 4 deletions projects/ui/src/hooks/beanstalk/useAvgSeedsPerBDV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ function getNumQueries(range: Range<Time> | undefined): number {
SEED_GAUGE_DEPLOYMENT_TIMESTAMP
);

console.log('from: ', from);
// always fetch to the latest season
const to = Number(Date.now() / 1000).valueOf();
console.log('to: ', to);
const numSeasons = Math.floor((to - from) / 3600);
console.log('numSeasons: ', numSeasons);
console.log('numQueries: ', Math.ceil(numSeasons / MAX_DATA_PER_QUERY));

return Math.ceil(numSeasons / MAX_DATA_PER_QUERY);
}
Expand Down
29 changes: 19 additions & 10 deletions projects/ui/src/util/wagmi/config.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
import { http, createConfig } from 'wagmi';
import { mainnet } from 'wagmi/chains';
import { injected, walletConnect } from 'wagmi/connectors';

import { injected, safe, walletConnect } from 'wagmi/connectors';
import { Chain, type Transport } from 'viem';
import { localFork } from './chains';

const ALCHEMY_KEY = import.meta.env.VITE_ALCHEMY_API_KEY;

const WALLET_CONNECT_PROJECT_ID = import.meta.env.VITE_WALLETCONNECT_PROJECT_ID;
if (!ALCHEMY_KEY) throw new Error('VITE_ALCHEMY_API_KEY is not set');
if (!WALLET_CONNECT_PROJECT_ID)

if (!ALCHEMY_KEY) {
throw new Error('VITE_ALCHEMY_API_KEY is not set');
}
if (!WALLET_CONNECT_PROJECT_ID) {
throw new Error('VITE_WALLETCONNECT_PROJECT_ID is not set');
}

const MAINNET_RPC = `https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`;

const SHOW_DEV = import.meta.env.VITE_SHOW_DEV_CHAINS;

const chains = !SHOW_DEV ? [mainnet] : [localFork, mainnet];
const transports = !SHOW_DEV
const chains: readonly [Chain, ...Chain[]] = !SHOW_DEV
? ([mainnet] as const)
: ([localFork, mainnet] as const);

const transports: Record<number, Transport> = !SHOW_DEV
? { [mainnet.id]: http(MAINNET_RPC) }
: {
[localFork.id]: http(localFork.rpcUrls.default.http[0]),
[mainnet.id]: http(MAINNET_RPC),
};

export const config = createConfig({
// @ts-ignore
chains,
// @ts-ignore
transports,
connectors: [
injected(),
walletConnect({ projectId: WALLET_CONNECT_PROJECT_ID }),
// safe(),
walletConnect({
projectId: WALLET_CONNECT_PROJECT_ID,
}),
safe(),
],
});

Expand Down

0 comments on commit 6af75da

Please sign in to comment.