Skip to content

Commit

Permalink
Ensure pubkey is a PublicKey
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Oct 19, 2023
1 parent 907e73d commit 2ec8253
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/features/collectables/HotspotDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useIotInfo } from '@hooks/useIotInfo'
import { useMakerApproval } from '@hooks/useMakerApproval'
import { useMetaplexMetadata } from '@hooks/useMetaplexMetadata'
import { useMobileInfo } from '@hooks/useMobileInfo'
import { usePublicKey } from '@hooks/usePublicKey'
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
import { Transaction } from '@solana/web3.js'
import { useSpacing } from '@theme/themeHooks'
Expand Down Expand Up @@ -85,7 +86,8 @@ const HotspotDetailsScreen = () => {
const collection = collectable.grouping.find(
(k) => k.group_key === 'collection',
)?.group_value
const { metadata } = useMetaplexMetadata(collection)
const collectionKey = usePublicKey(collection)
const { metadata } = useMetaplexMetadata(collectionKey)
const [iotMakerApproval, mobileMakerApproval] = useMemo(() => {
if (!metadata) {
return [undefined, undefined]
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePublicKey.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PublicKey } from '@solana/web3.js'
import { useMemo } from 'react'

export const usePublicKey = (publicKey: string | undefined) => {
export const usePublicKey = (publicKey: PublicKey | string | undefined) => {
return useMemo(() => {
if (publicKey) {
return new PublicKey(publicKey)
Expand Down

0 comments on commit 2ec8253

Please sign in to comment.