Description
Component
API
Have you ensured that all of these are up to date?
- opensea-js
- Node (minimum v16)
What version of opensea-js are you on?
7.1.18
What function is the bug in?
No response
Operating System
Windows 10
Describe the bug
this is my code to buy some nft
const handleBuy = (item: any) => async () => {
if (!openseaSDK || !signer) return
const order = await openseaSDK.api.getOrder({
assetContractAddress: item.protocol_data.parameters.offer[0].token,
tokenId: item.protocol_data.parameters.offer[0].identifierOrCriteria,
side: OrderSide.LISTING
})
const accountAddress = await signer.getAddress()
const transactionHash = await openseaSDK.fulfillOrder({ order, accountAddress })
}
function useOpenSeaSDK() {
const [value, setValue] = useState<{ openseaSDK?: OpenSeaSDK, signer?: JsonRpcSigner }>({ openseaSDK: undefined, signer: undefined })
const getOpenseaSDK = async () => {
const provider = new ethers.BrowserProvider(window.ethereum, "any");
await provider.send("eth_requestAccounts", []);
const signer = await provider.getSigner();
const params = new URLSearchParams(window.location.search);
const openSeaKey = params.get('openSeaKey') ?? '';
const sdk = new OpenSeaSDK(signer, {
chain: Chain.Base,
apiKey: openSeaKey,
})
setValue({ openseaSDK: sdk, signer });
}
useEffect(() => {
getOpenseaSDK()
}, [])
return value
}
when i call handleBuy i get this error "could not decode result data (value="0x", info={ "method": "isApprovedForAll", "signature": "isApprovedForAll(address,address)" }, code=BAD_DATA, version=6.14.3)
at makeError (http://localhost:3000/openseabit/static/js/bundle.js:72713:15)
at assert (http://localhost:3000/openseabit/static/js/bundle.js:72737:11)
at Interface.decodeFunctionResult (http://localhost:3000/openseabit/static/js/bundle.js:53644:27)
at staticCallResult (http://localhost:3000/openseabit/static/js/bundle.js:55743:31)
at async staticCall (http://localhost:3000/openseabit/static/js/bundle.js:55703:20)
at async Proxy.isApprovedForAll (http://localhost:3000/openseabit/static/js/bundle.js:55748:14)
at async approvedItemAmount (http://localhost:3000/openseabit/static/js/bundle.js:29635:30)
at async http://localhost:3000/openseabit/static/js/bundle.js:29772:24
at async Promise.all (index 0)
at async Promise.all (index 1)"