{ code: -32603, message: "execution reverted" } when try to buy NFT
See original GitHub issueI get an error { code: -32603, message: "execution reverted" }
from console when try to buy nft which was put up for sale through the OpenSeaSDK through createSellOrder function. If put it up for sale through the UI, there is no such problem.
Code:
require('dotenv').config();
const opensea = require("opensea-js");
const Network = require("opensea-js").Network;
const OpenSeaSDK = opensea.OpenSeaSDK;
const HDWalletProvider = require("@truffle/hdwallet-provider");
const {WyvernSchemaName} = require('opensea-js/lib/types');
const MNEMONIC = process.env.MNEMONIC;
const NODE_API_KEY = process.env.INFURA_KEY || process.env.ALCHEMY_KEY;
const NFT_CONTRACT_ADDRESS = process.env.NFT_CONTRACT_ADDRESS;
const OWNER_ADDRESS = process.env.OWNER_ADDRESS;
const NETWORK = process.env.NETWORK;
const API_KEY = process.env.API_KEY || ""; // API key is optional but useful if you're doing a high volume of requests.
const provider = new HDWalletProvider({
mnemonic: MNEMONIC,
providerOrUrl: "https://" + NETWORK + ".infura.io/v3/" + NODE_API_KEY,
chainId: 5
});
const seaport = new OpenSeaSDK(
provider,
{
networkName: Network.Goerli
},
(arg) => console.log(arg)
);
async function listing(tokenId) {
try {
await seaport.createSellOrder({
asset: {
tokenId: tokenId,
tokenAddress: NFT_CONTRACT_ADDRESS,
schemaName: WyvernSchemaName.ERC721
},
startAmount: .001,
accountAddress: OWNER_ADDRESS
});
return "Success!";
} catch (err) {
return err;
}
}
listing("0").then(res => {
console.log(res);
}).catch(rej => {
console.log(rej);
});
package.json:
{
"type": "commonjs",
"dependencies": {
"@truffle/hdwallet-provider": "^2.0.15",
"axios": "^0.27.2",
"dotenv": "^16.0.2",
"ethers": "^5.7.1",
"opensea-js": "^4.0.12",
"web3": "^1.8.0",
"wyvern-schemas": "^0.6.15"
}
}
Node version: v16.17.1
Issue Analytics
- State:
- Created a year ago
- Comments:23 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this when listing for sale:
This bug is not closed. The solution has hack for fix. Not final solution @creed-dev Can you reopen this ?