diff --git a/bun.lockb b/bun.lockb index 5a2722d9..f7ddf6d0 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 69953d8d..1be0afbb 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@use-gesture/react": "^10.3.1", "caniuse-lite": "^1.0.30001687", "clsx": "^2.1.0", - "ethereum-identity-kit": "^0.1.6", + "ethereum-identity-kit": "0xthrpw/ethereum-identity-kit#f326b07", "i18next": "^23.11.5", "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.5.2", diff --git a/src/components/list-settings/hooks/use-save-list-settings.ts b/src/components/list-settings/hooks/use-save-list-settings.ts index 893f7385..1c1d4127 100644 --- a/src/components/list-settings/hooks/use-save-list-settings.ts +++ b/src/components/list-settings/hooks/use-save-list-settings.ts @@ -87,7 +87,7 @@ const useSaveListSettings = ({ const { data: walletClient } = useWalletClient() const { actions, addActions, resetActions, handleNextAction, handleInitiateActions } = useActions() - const newSlot = useMemo(() => generateListStorageLocationSlot(), []) + const newSlot = useMemo(() => generateListStorageLocationSlot(userAddress), []) const setListStorageLocationTx = useCallback(async () => { if (!newChain) return diff --git a/src/hooks/efp-actions/use-mint-efp.ts b/src/hooks/efp-actions/use-mint-efp.ts index a4740e5d..142e2bc0 100644 --- a/src/hooks/efp-actions/use-mint-efp.ts +++ b/src/hooks/efp-actions/use-mint-efp.ts @@ -12,7 +12,7 @@ export function useMintEFP() { const { data: walletClient } = useWalletClient() const { address: accountAddress } = useAccount() - const nonce = useMemo(() => generateListStorageLocationSlot(), []) + const nonce = useMemo(() => generateListStorageLocationSlot(accountAddress), []) const mint = async ({ selectedChainId, diff --git a/src/lib/constants/chains.ts b/src/lib/constants/chains.ts index 1ca99a1b..01fdb673 100644 --- a/src/lib/constants/chains.ts +++ b/src/lib/constants/chains.ts @@ -2,10 +2,10 @@ * All constants related to blockchain chain go here */ -import { base, mainnet, optimism } from 'viem/chains' +import { base, mainnet, optimism, baseSepolia, optimismSepolia, sepolia } from 'viem/chains' -export const chains = ['mainnet', 'optimism', 'base'] as const -export const DEFAULT_CHAIN = base +export const chains = ['mainnet', 'optimism', 'base', 'baseSepolia'] as const +export const DEFAULT_CHAIN = baseSepolia export type Chain = (typeof chains)[number] @@ -13,7 +13,7 @@ export const LIST_OP_LIMITS: Record = { [mainnet.id]: Number(process.env.NEXT_PUBLIC_MAINNET_LIMIT || 500), [optimism.id]: Number(process.env.NEXT_PUBLIC_OPTIMISM_LIMIT || 500), [base.id]: Number(process.env.NEXT_PUBLIC_BASE_LIMIT || 500), - // [sepolia.id]: Number(process.env.NEXT_PUBLIC_SEPOLIA_LIMIT || 500), - // [optimismSepolia.id]: Number(process.env.NEXT_PUBLIC_OPTIMISM_SEPOLIA_LIMIT || 500), - // [baseSepolia.id]: Number(process.env.NEXT_PUBLIC_BASE_SEPOLIA_LIMIT || 500), + [sepolia.id]: Number(process.env.NEXT_PUBLIC_SEPOLIA_LIMIT || 500), + [optimismSepolia.id]: Number(process.env.NEXT_PUBLIC_OPTIMISM_SEPOLIA_LIMIT || 500), + [baseSepolia.id]: Number(process.env.NEXT_PUBLIC_BASE_SEPOLIA_LIMIT || 500), } as const diff --git a/src/lib/constants/contracts.ts b/src/lib/constants/contracts.ts index bb55eae4..0b9a4c32 100644 --- a/src/lib/constants/contracts.ts +++ b/src/lib/constants/contracts.ts @@ -1,4 +1,4 @@ -import { base, mainnet, optimism } from 'viem/chains' +import { base, mainnet, optimism, baseSepolia, optimismSepolia, sepolia } from 'viem/chains' import { createPublicClient, getContract, http, type Address } from 'viem' import { efpListRegistryAbi } from '../abi' @@ -21,9 +21,9 @@ export const ListRecordContracts: Record = { [base.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS'] as Address, [optimism.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_OP'] as Address, [mainnet.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_MAINNET'] as Address, - // [baseSepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS'] as Address, - // [optimismSepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_OP_SEPOLIA'] as Address, - // [sepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_SEPOLIA'] as Address + [baseSepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS'] as Address, + [optimismSepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_OP_SEPOLIA'] as Address, + [sepolia.id]: process.env['NEXT_PUBLIC_EFP_LIST_RECORDS_SEPOLIA'] as Address } export const listRegistryContract = getContract({ diff --git a/src/lib/constants/rpc-providers.ts b/src/lib/constants/rpc-providers.ts index fa4893b5..6575eb4a 100644 --- a/src/lib/constants/rpc-providers.ts +++ b/src/lib/constants/rpc-providers.ts @@ -1,10 +1,10 @@ -import { base, mainnet, optimism } from 'viem/chains' +import { base, mainnet, optimism, baseSepolia, optimismSepolia, sepolia } from 'viem/chains' export const rpcProviders: Record = { [mainnet.id]: `https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_MAINNET_ALCHEMY_ID}`, - // [sepolia.id]: `https://eth-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_SEPOLIA_ALCHEMY_ID}`, + [sepolia.id]: `https://eth-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_SEPOLIA_ALCHEMY_ID}`, [optimism.id]: `https://opt-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OPTIMISM_ALCHEMY_ID}`, - // [optimismSepolia.id]: `https://opt-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OP_SEPOLIA_ALCHEMY_ID}`, + [optimismSepolia.id]: `https://opt-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OP_SEPOLIA_ALCHEMY_ID}`, [base.id]: `https://base-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_ALCHEMY_ID}`, - // [baseSepolia.id]: `https://base-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_SEPOLIA_ALCHEMY_ID}` + [baseSepolia.id]: `https://base-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_SEPOLIA_ALCHEMY_ID}` } diff --git a/src/lib/wagmi.ts b/src/lib/wagmi.ts index 9f2628fc..6272979e 100644 --- a/src/lib/wagmi.ts +++ b/src/lib/wagmi.ts @@ -7,7 +7,7 @@ import { walletConnectWallet, safeWallet, } from '@rainbow-me/rainbowkit/wallets' -import { mainnet, optimism, base } from 'wagmi/chains' +import { mainnet, optimism, base, baseSepolia, optimismSepolia, sepolia } from 'wagmi/chains' import { type Chain, connectorsForWallets } from '@rainbow-me/rainbowkit' import { http, fallback, createStorage, cookieStorage, createConfig } from 'wagmi' @@ -109,31 +109,31 @@ export const chains: [ChainWithDetails, ...ChainWithDetails[]] = [ }, }, }, - // { - // ...baseSepolia, - // iconUrl: '/assets/chains/base.svg', - // custom: { - // chainDetail: 'Ethereum L2 Testnet', - // gasFeeDetail: 'Super Low gas fees' - // } - // }, - // { - // ...optimismSepolia, - // iconUrl: '/assets/chains/optimism.svg', - // custom: { - // chainDetail: 'Ethereum L2 Testnet', - // gasFeeDetail: 'Low gas fees' - // } - // }, - // { - // ...sepolia, - // iconBackground: 'bg-zinc-200', - // iconUrl: '/assets/chains/ethereum.svg', - // custom: { - // chainDetail: 'Ethereum Testnet', - // gasFeeDetail: 'Low gas fees' - // } - // } + { + ...baseSepolia, + iconUrl: '/assets/chains/base.svg', + custom: { + chainDetail: 'Ethereum L2 Testnet', + gasFeeDetail: 'Super Low gas fees' + } + }, + { + ...optimismSepolia, + iconUrl: '/assets/chains/optimism.svg', + custom: { + chainDetail: 'Ethereum L2 Testnet', + gasFeeDetail: 'Low gas fees' + } + }, + { + ...sepolia, + iconBackground: 'bg-zinc-200', + iconUrl: '/assets/chains/ethereum.svg', + custom: { + chainDetail: 'Ethereum Testnet', + gasFeeDetail: 'Low gas fees' + } + } ] const config = createConfig({ @@ -155,17 +155,17 @@ const config = createConfig({ batch: true, }), ]), - // [sepolia.id]: fallback([ - // http(`https://eth-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_SEPOLIA_ALCHEMY_ID}`, { - // batch: true - // }), - // http( - // `https://smart-cosmological-telescope.ethereum-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, - // { - // batch: true - // } - // ) - // ]), + [sepolia.id]: fallback([ + http(`https://eth-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_SEPOLIA_ALCHEMY_ID}`, { + batch: true + }), + http( + `https://smart-cosmological-telescope.ethereum-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, + { + batch: true + } + ) + ]), [optimism.id]: fallback([ http(`https://opt-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OPTIMISM_ALCHEMY_ID}`, { batch: true, @@ -177,21 +177,21 @@ const config = createConfig({ batch: true, }), ]), - // [optimismSepolia.id]: fallback([ - // http( - // `https://opt-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OP_SEPOLIA_ALCHEMY_ID}`, - // { - // batch: true - // } - // ), - // http( - // `https://smart-cosmological-telescope.optimism-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, - // { - // batch: true - // } - // ), - // http('https://sepolia.optimism.io', { batch: true }) - // ]), + [optimismSepolia.id]: fallback([ + http( + `https://opt-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_OP_SEPOLIA_ALCHEMY_ID}`, + { + batch: true + } + ), + http( + `https://smart-cosmological-telescope.optimism-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, + { + batch: true + } + ), + http('https://sepolia.optimism.io', { batch: true }) + ]), [base.id]: fallback([ http(`https://base-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_ALCHEMY_ID}`, { batch: true, @@ -201,21 +201,21 @@ const config = createConfig({ }), http('https://mainnet.base.org/', { batch: true }), ]), - // [baseSepolia.id]: fallback([ - // http( - // `https://base-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_SEPOLIA_ALCHEMY_ID}`, - // { - // batch: true - // } - // ), - // http( - // `https://smart-cosmological-telescope.base-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, - // { - // batch: true - // } - // ), - // http('https://sepolia.base.org', { batch: true }) - // ]) + [baseSepolia.id]: fallback([ + http( + `https://base-sepolia.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_BASE_SEPOLIA_ALCHEMY_ID}`, + { + batch: true + } + ), + http( + `https://smart-cosmological-telescope.base-sepolia.quiknode.pro/${process.env.NEXT_PUBLIC_QUICKNODE_ID}`, + { + batch: true + } + ), + http('https://sepolia.base.org', { batch: true }) + ]) }, }) diff --git a/src/utils/generate-slot.ts b/src/utils/generate-slot.ts index b041ae45..769c63bc 100644 --- a/src/utils/generate-slot.ts +++ b/src/utils/generate-slot.ts @@ -1,6 +1,9 @@ import { keccak256, toHex } from 'viem/utils' -export function generateListStorageLocationSlot() { - const hash = keccak256(toHex(Date.now() * Math.floor(Math.random() * 1000))) - return BigInt(hash.slice(0, 66)) & ((1n << 255n) - 1n) +export function generateListStorageLocationSlot(address: `0x${string}` | undefined) { + const hash = keccak256(toHex(Date.now() * Math.floor(Math.random() * 1000))) + const trimmedHash = BigInt(hash.slice(0, 26)) & ((1n << 96n) - 1n) + return BigInt(address + trimmedHash.toString(16)) +// const hash = keccak256(toHex(Date.now() * Math.floor(Math.random() * 1000))) +// return BigInt(hash.slice(0, 66)) & ((1n << 255n) - 1n) }