question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

{ code: -32603, message: "execution reverted" } when try to buy NFT

See original GitHub issue

I 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:closed
  • Created a year ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
alandotcomcommented, Oct 20, 2022

Try this when listing for sale:

  openseaSDK.seaport.createOrder = async (input) => {
    const override = {
      restrictedByZone: false,
      allowPartialFills: false,
    };

    const newInput = { ...input, ...override };

    return await ogCreate.call(openseaSDK.seaport, newInput);
  };
2reactions
Smeagolworms4commented, Oct 24, 2022

This bug is not closed. The solution has hack for fix. Not final solution @creed-dev Can you reopen this ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found