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

Code split out web3 bundles #6623

Merged
merged 1 commit into from
Feb 7, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function lazyLoadCommunityStakes() {
return (await import('./CommunityStakes')).default;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useMutation } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods, queryClient } from 'state/api/config';
import { setActiveAccountOnTransactionSuccess } from 'views/modals/ManageCommunityStakeModal/utils';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

interface BuyStakeProps {
namespace: string;
Expand All @@ -19,6 +19,7 @@ const buyStake = async ({
chainRpc,
walletAddress,
}: BuyStakeProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useQuery } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

const GET_BUY_PRICE_STALE_TIME = 2 * 1_000; // 2 sec

Expand All @@ -13,6 +13,7 @@ const getBuyPrice = async ({
amount,
chainRpc,
}: GetBuyPriceProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useQuery } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

const GET_SELL_PRICE_STALE_TIME = 2 * 1_000; // 2 sec

Expand All @@ -13,6 +13,7 @@ const getSellPrice = async ({
amount,
chainRpc,
}: GetSellPriceProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useQuery } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

const GET_USER_ETH_BALANCE_STALE_TIME = 60 * 1_000; // 1 min

Expand All @@ -14,6 +14,7 @@ const getUserEthBalance = async ({
chainRpc,
walletAddress,
}: GetUserEthBalanceProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useQuery } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods } from 'state/api/config';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

const GET_USER_STAKE_BALANCE_STALE_TIME = 5 * 1_000; // 5 sec

Expand All @@ -16,6 +16,7 @@ const getUserStakeBalance = async ({
chainRpc,
walletAddress,
}: GetUserStakeBalanceProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { commonProtocol } from '@hicommonwealth/core';
import { useMutation } from '@tanstack/react-query';
import CommunityStakes from 'helpers/ContractHelpers/CommunityStakes';
import { ContractMethods, queryClient } from 'state/api/config';
import { setActiveAccountOnTransactionSuccess } from 'views/modals/ManageCommunityStakeModal/utils';
import { lazyLoadCommunityStakes } from '../../../helpers/ContractHelpers/LazyCommunityStakes';

interface SellStakeProps {
namespace: string;
Expand All @@ -19,6 +19,7 @@ const sellStake = async ({
chainRpc,
walletAddress,
}: SellStakeProps) => {
const CommunityStakes = await lazyLoadCommunityStakes();
const communityStakes = new CommunityStakes(
commonProtocol.factoryContracts[
commonProtocol.ValidChains.Sepolia
Expand Down
Loading