Skip to content

Commit

Permalink
fix: missing import
Browse files Browse the repository at this point in the history
  • Loading branch information
graykode committed Apr 17, 2024
1 parent 5bc0b51 commit be5c79c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/approval.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { WalletClient } from 'viem'

import { account } from '../test/utils/constants'

import { CHAIN_IDS, CHAIN_MAP } from './constants/chain'
import { CONTRACT_ADDRESSES } from './constants/addresses'
import { fetchIsApprovedForAll } from './utils/approval'
Expand Down Expand Up @@ -71,15 +69,18 @@ export const setApprovalOfOpenOrdersForAll = decorator(
walletClient: WalletClient
options?: DefaultOptions
}): Promise<`0x${string}` | undefined> => {
if (!walletClient.account) {
throw new Error('Account is not found')
}
const isApprovedForAll = await fetchIsApprovedForAll(
chainId,
account.address,
walletClient.account.address,
)
if (isApprovedForAll) {
return undefined
}
return walletClient.writeContract({
account,
account: walletClient.account,
chain: CHAIN_MAP[chainId],
address: CONTRACT_ADDRESSES[chainId]!.BookManager,
abi: _abi,
Expand Down

0 comments on commit be5c79c

Please sign in to comment.