Nothing happens on createSellOrder() (code: -32000, message: 'execution reverted')
Hello, I'm trying to re-sell an existing token on OpenSea with a new price, using node.js
I followed the example from this link: https://github.com/ProjectOpenSea/opensea-creatures/blob/master/scripts/sell.js But, nothing happens after running the createSellOrder() method (and no any errors). Please tell me what is my mistake?
PS: In Metamask, I created a custom RPC network, where I indicated the Infura API. Also I don't have OpenSea API KEY. And I installed "@0x/subproviders" manualy with npm. Thank you for your attention, I am a new in NFT. I am hope for your help. Since I have already spent 2 days looking for a solution to the problem
Here is my code:
// Imports
const opensea = require("opensea-js");
const { WyvernSchemaName } = require('opensea-js/lib/types')
const OpenSeaPort = opensea.OpenSeaPort;
const Network = opensea.Network;
const MnemonicWalletSubprovider = require("@0x/subproviders").MnemonicWalletSubprovider;
const RPCSubprovider = require("web3-provider-engine/subproviders/rpc");
const Web3ProviderEngine = require("web3-provider-engine");
require('dotenv').config({ path: "C:/Users/Test/Documents/test/.env" })
// Values
const MNEMONIC = process.env.MNEMONIC;
const NODE_API_KEY = process.env.INFURA_KEY;
const NFT_CONTRACT_ADDRESS = process.env.NFT_CONTRACT_ADDRESS;
const OWNER_ADDRESS = process.env.OWNER_ADDRESS;
const NETWORK = process.env.NETWORK; // mainnet
if (!MNEMONIC || !NODE_API_KEY || !NETWORK || !OWNER_ADDRESS) {
console.error(
"Please set a mnemonic, Alchemy/Infura key, owner, network, API key, nft contract, and factory contract address."
);
return;
}
if (!NFT_CONTRACT_ADDRESS) {
console.error("Please either set a factory or NFT contract address.");
return;
}
const BASE_DERIVATION_PATH = `44'/60'/0'/0`;
const mnemonicWalletSubprovider = new MnemonicWalletSubprovider({
mnemonic: MNEMONIC,
baseDerivationPath: BASE_DERIVATION_PATH,
});
const infuraRpcSubprovider = new RPCSubprovider({
rpcUrl: "https://" + NETWORK + ".infura.io/v3/" + NODE_API_KEY,
});
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(mnemonicWalletSubprovider);
providerEngine.addProvider(infuraRpcSubprovider);
providerEngine.start();
const seaport = new OpenSeaPort(
providerEngine,
{
networkName: Network.Main,
// apiKey: API_KEY, /* i dont have (opensea) API_KEY */
},
(arg) => console.log(arg)
);
async function sellItem() {
try {
console.log("Auctioning an item for a fixed price...");
const fixedPriceSellOrder = await seaport.createSellOrder({
asset: {
tokenId: "98534702324345435981883704817319191110429273040727973456443680", // example token id
tokenAddress: NFT_CONTRACT_ADDRESS,
schemaName: WyvernSchemaName.ERC1155, // Also not work without schemaName
},
startAmount: 2,
expirationTime: 0,
accountAddress: OWNER_ADDRESS,
});
console.log(
"Successfully created a fixed-price sell order!", fixedPriceSellOrder.asset.openseaLink // This line not displaed after run code
);
} catch (e) {
console.log(e); // This line not displaed after run code
}
}
sellItem()
Well now on 'createSellOrder' i get:
{ code: -32000, message: 'execution reverted' }
Error: API Error 400: ['Failed to extract transfer calldata']
Same error
I am getting an error back in the console that says:
Error: Must specify a string method. Received: object
I've tried a few different ways (fixed price, etc.) and I looked in the ship log example project only to find that there is no implementation of this.
I am on latest.
I have a similar problem. I can get an asset but not createSellOrder. I don't have an Api key and the code is nearly identical to the posted one.
from the logs:
{ code: -32000, message: 'execution reverted' }
Error: execution reverted
Error: API Error 400: ['Failed to extract transfer calldata']
Already approved proxy for all tokens
Order hashes match
(node:21270) UnhandledPromiseRejectionWarning: Error: API Error 400: ['Failed to extract transfer calldata']
@StrawberryChocolateFudge, Now I have a similar error. Did you find a solution?
Everything works for me now! In my case:
- Install node 8.11.2 (you can use nvm).
- Using "schemaName: WyvernSchemaName.ERC1155"
Hope this helps someone!)