Skip to content

Commit

Permalink
fix canceling an order with the settle funds
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjohn1028 committed Jul 23, 2021
1 parent c598624 commit fd736ac
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/hooks/Serum/useSettleFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const useSettleFunds = (
useOwnedTokenAccounts()
const openOrders = useSerumOpenOrderAccounts(serumMarketAddress, true)
const serumMarket = serumMarkets[serumMarketAddress]?.serumMarket
const [baseMintAddress, quoteMintAddress] =
serumMarketAddress?.split('-') ?? []
const baseMintAddress = serumMarket.baseMintAddress.toString()
const quoteMintAddress = serumMarket.quoteMintAddress.toString()
const baseTokenAccounts = ownedTokenAccounts[baseMintAddress] ?? []
const quoteTokenAccounts = ownedTokenAccounts[quoteMintAddress] ?? []
const { pubKey: baseTokenAccountKey } = getHighestAccount(baseTokenAccounts)
Expand All @@ -52,7 +52,7 @@ export const useSettleFunds = (
await createAssociatedTokenAccountInstruction({
payer: pubKey,
owner: pubKey,
mintPublicKey: new PublicKey(baseMintAddress),
mintPublicKey: serumMarket.baseMintAddress,
})

transaction.add(createOptAccountTx)
Expand All @@ -66,7 +66,7 @@ export const useSettleFunds = (
await createAssociatedTokenAccountInstruction({
payer: pubKey,
owner: pubKey,
mintPublicKey: new PublicKey(quoteMintAddress),
mintPublicKey: serumMarket.quoteMintAddress,
})

transaction.add(createOptAccountTx)
Expand Down Expand Up @@ -106,9 +106,7 @@ export const useSettleFunds = (
connection,
USDCPublicKey,
pubKey,
baseMintAddress,
subscribeToTokenAccount,
quoteMintAddress,
])

const settleFunds = useCallback(async () => {
Expand Down

0 comments on commit fd736ac

Please sign in to comment.