Skip to content

Commit

Permalink
Fix "property x of undefined" error
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Pipta committed Jul 28, 2021
1 parent f407491 commit 4ce6f9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hooks/Serum/useSettleFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export const useSettleFunds = (
useOwnedTokenAccounts()
const openOrders = useSerumOpenOrderAccounts(serumMarketAddress, true)
const serumMarket = serumMarkets[serumMarketAddress]?.serumMarket
const baseMintAddress = serumMarket.baseMintAddress.toString()
const quoteMintAddress = serumMarket.quoteMintAddress.toString()
const baseMintAddress =
serumMarket?.baseMintAddress && serumMarket.baseMintAddress.toString()
const quoteMintAddress =
serumMarket?.quoteMintAddress && serumMarket.quoteMintAddress.toString()
const baseTokenAccounts = ownedTokenAccounts[baseMintAddress] ?? []
const quoteTokenAccounts = ownedTokenAccounts[quoteMintAddress] ?? []
const { pubKey: baseTokenAccountKey } = getHighestAccount(baseTokenAccounts)
Expand All @@ -52,7 +54,7 @@ export const useSettleFunds = (
await createAssociatedTokenAccountInstruction({
payer: pubKey,
owner: pubKey,
mintPublicKey: serumMarket.baseMintAddress,
mintPublicKey: serumMarket?.baseMintAddress,
})

transaction.add(createOptAccountTx)
Expand Down

0 comments on commit 4ce6f9a

Please sign in to comment.