"cannot estimate gas" error occurs when calling the openeaSDK createSellOrder->fulfillOrder function.
const accounts = await window.ethereum.request({method:'eth_requestAccounts'});
const openseaSDK = new OpenSeaSDK(window.ethereum, {
networkName: Network.Goerli,
apiKey: ""
});
const tokenId = 2;
const tokenAddress = "0x4d...";
// Reserve for specific buyer
const buyerAddress = "0x9F"; // Address allowed to buy from you
const listing = await openseaSDK.createSellOrder({
asset: {
tokenId,
tokenAddress,
},
accountAddress:accounts[0], // OWNERS_WALLET_ADDRESS
startAmount: 0.01,
buyerAddress
});
// Buying Items
const accountAddress = accounts[0]; // The buyer's wallet address, also the taker
const order = await openseaSDK.api.getOrder({
assetContractAddress: tokenAddress,
tokenId,
side: "ask",
taker: accountAddress
});
const transactionHash = await openseaSDK.fulfillOrder({ order, accountAddress });

I sold a NFT from the OpenSea Goerli testnet to the system wallet. (using openseaSDK.createSellOrder) I also reserved user who will buy this NFT. (buyerAddress) This process worked successfully and was confirmed by OpenSea.
The problem arises when trying to buy NFT with the buyer's account. // openseaSDK.fulfillOrder The order information is acquired correctly, but I have not been able to find the cause and solution for why this problem occurs in the execution of the function.
Anybody please help. Thank you in advance.
Sorry, I've found the cause of the problem. The problem was with the createSellOrder function, not fulfillOrder. NFTs sold directly by OpenSea could be purchased using the fulfillOrder function. However, NFTs sold using the createSellOrder function could not be purchased on the OpenSea website. Please let me know what is wrong with my method of calling the createSellOrder function.
@CoolDevMan I have compared the action data of createSellOrder with the action data of sell by opensea testnet. I found the orderType is different. createSellOrder is 3 and opensea action is 0. So I change the params of this.seaport.createOrder in the sdk.js.
restrictedByZone: false,
allowPartialFills: false,

@CoolDevMan I have compared the action data of createSellOrder with the action data of sell by opensea testnet. I found the orderType is different. createSellOrder is 3 and opensea action is 0. So I change the params of this.seaport.createOrder in the sdk.js.
restrictedByZone: false, allowPartialFills: false,
I can confirm this worked for me!
@CoolDevMan I have compared the action data of createSellOrder with the action data of sell by opensea testnet. I found the orderType is different. createSellOrder is 3 and opensea action is 0. So I change the params of this.seaport.createOrder in the sdk.js.
restrictedByZone: false, allowPartialFills: false,
@DamonXiong Thank you and Happy new year. I also confirmed that the orderType is different. It's really unfortunate that we can only fix this issue by modifying the code inside the node module. I hope the OpenSea team will release a new version that fixes this issue as soon as possible.
I will close this issue when we can fix this problem without modifying the node module.
The opensea-js hardcoded restrictedByZone to true, this makes the order unable to be filled in Goerli, restricted-order has to pass the check of the zone, and zone is set to zero-address by default on Goerli, so when checked against this zero address, the validation will always fail, hence the revert: InvalidRestrictedOrder(bytes32) (0xfb5014fc3a1129d33a6839c811ddad41d22809e3f5d38cee6ff28c0f027a43b9e5bb1eb8)
@DiveInto Are there any problems using opensea-js on the Goerli testnet? I am currently using this SDK on Goerli testnet and Ethereum mainnet. On the testnet, it was confirmed that continuous API calls failed due to OpenSea being overloaded. (for example: createSellOrder) In the mainnet, this problem does not seem to occur because the API_KEY issued by OpenSea is used.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.