Skip to content

Commit

Permalink
Code split out web3 bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtisassad committed Feb 7, 2024
1 parent da49e47 commit 993f459
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function lazyLoadCommunityStakes() {
return await import('./CommunityStakesAbi');
}
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/Abi/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/Abi/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/Abi/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/Abi/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/Abi/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/Abi/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

0 comments on commit 993f459

Please sign in to comment.