Skip to content

Commit

Permalink
fix: lower case keys
Browse files Browse the repository at this point in the history
  • Loading branch information
NeOMakinG committed Jan 17, 2025
1 parent 366429d commit 0c49aec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export const FoxWifHatClaimConfirm: FC<FoxWifHatClaimConfirmProps> = ({
const foxWifHatAsset = useAppSelector(state => selectAssetById(state, foxWifHatAssetId))
const getFoxWifHatClaimsQuery = useGetFoxWifHatClaims()

console.log({ getFoxWifHatClaimsQuery })

const claimQuote = useMemo(() => {
const claim = getFoxWifHatClaimsQuery.data?.claims[accountId]
const claim = getFoxWifHatClaimsQuery.data?.claims[fromAccountId(accountId).account]
if (!claim) return null

return claim
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CheckCircleIcon, WarningIcon } from '@chakra-ui/icons'
import type { AccountId } from '@shapeshiftoss/caip'
import { fromAccountId } from '@shapeshiftoss/caip'
import { TxStatus } from '@shapeshiftoss/unchained-client'
import type { InterpolationOptions } from 'node-polyglot'
import React, { useMemo } from 'react'
Expand Down Expand Up @@ -40,7 +41,7 @@ export const FoxWifHatClaimStatus: React.FC<FoxWifHatClaimStatusProps> = ({
const getFoxWifHatClaimsQuery = useGetFoxWifHatClaims()

const claimQuote = useMemo(() => {
const claim = getFoxWifHatClaimsQuery.data?.claims[accountId]
const claim = getFoxWifHatClaimsQuery.data?.claims[fromAccountId(accountId).account]
if (!claim) return null

return claim
Expand Down
13 changes: 12 additions & 1 deletion src/pages/Fox/hooks/useGetFoxWifHatClaims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ export const foxWifHatClaimsQueryKey = ['getFoxWifHatClaims']

export const useGetFoxWifHatClaims = () => {
const getFoxWifHatClaims = useCallback(async () => {
return await Promise.resolve(merkleData)
const addressLowercasedClaims = Object.entries(merkleData.claims).reduce(
(acc, [address, claim]) => {
acc[address.toLowerCase()] = claim
return acc
},
{} as typeof merkleData.claims,
)

return await Promise.resolve({
...merkleData,
claims: addressLowercasedClaims,
})
}, [])

return useQuery({
Expand Down

0 comments on commit 0c49aec

Please sign in to comment.