Skip to content
Open
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
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/efp-actions/use-mint-efp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/lib/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
* 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]

export const LIST_OP_LIMITS: Record<number, number> = {
[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
8 changes: 4 additions & 4 deletions src/lib/constants/contracts.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -21,9 +21,9 @@ export const ListRecordContracts: Record<number, Address> = {
[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({
Expand Down
8 changes: 4 additions & 4 deletions src/lib/constants/rpc-providers.ts
Original file line number Diff line number Diff line change
@@ -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<number, string> = {
[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}`
}
134 changes: 67 additions & 67 deletions src/lib/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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({
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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 })
])
},
})

Expand Down
9 changes: 6 additions & 3 deletions src/utils/generate-slot.ts
Original file line number Diff line number Diff line change
@@ -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)
}