简体   繁体   中英

Listing NFT on OpenSea via JS API: Failed to extract transfer calldata Error 400

I am trying to use the OpenSea JavaScript API in order to list NFTs for sale automatically. I can't seem to figure out why I keep getting the error Error: API Error 400: ['Failed to extract transfer calldata'] . Perhaps I have not entered some data correctly? My code is adapted from this example .

SOURCE

const opensea = require("opensea-js");
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");

const MNEMONIC = "SECRET ...";
const NODE_API_KEY = "FROM INFURA";
const isInfura = true;
//const FACTORY_CONTRACT_ADDRESS = process.env.FACTORY_CONTRACT_ADDRESS;
const NFT_CONTRACT_ADDRESS = "0x495f947276749Ce646f68AC8c248420045cb7b5e";
const OWNER_ADDRESS = "0x3eb8eea9565418281f4cae934dd69e7ff2bb5949";
const NETWORK = "mainnet";
const API_KEY = process.env.API_KEY || ""; // API key is optional but useful if you're doing a high volume of requests.

const BASE_DERIVATION_PATH = `44'/60'/0'/0`;

const mnemonicWalletSubprovider = new MnemonicWalletSubprovider({
  mnemonic: MNEMONIC,
  baseDerivationPath: BASE_DERIVATION_PATH,
});
const network =
  NETWORK === "mainnet" || NETWORK === "live" ? "mainnet" : "rinkeby";
const infuraRpcSubprovider = new RPCSubprovider({
  rpcUrl: isInfura
    ? "https://" + network + ".infura.io/v3/" + NODE_API_KEY
    : "https://eth-" + network + ".alchemyapi.io/v2/" + NODE_API_KEY,
});

const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(mnemonicWalletSubprovider);
providerEngine.addProvider(infuraRpcSubprovider);
providerEngine.start();

const seaport = new OpenSeaPort(
  providerEngine,
  {
    networkName:
      NETWORK === "mainnet" || NETWORK === "live"
        ? Network.Main
        : Network.Rinkeby,
    apiKey: API_KEY,
  },
  (arg) => console.log(arg)
);

exports.helloWorld = async (req, res) => {
  // Example: simple fixed-price sale of an item owned by a user.
  console.log("Auctioning an item for a fixed price...");

  try {
    const fixedPriceSellOrder = await seaport.createSellOrder({
      asset: {
        tokenId: "28370143653034713195993216915191765879963367987017833025925208213530804748289",
        tokenAddress: NFT_CONTRACT_ADDRESS,
      },
      startAmount: 0.1,
      expirationTime: 0,
      accountAddress: OWNER_ADDRESS,
    });
    console.log(
      `Successfully created a fixed-price sell order! ${fixedPriceSellOrder.asset.openseaLink}\n`
    );
  }
  catch (error) {
    console.log("ERROR",error);
  }

};

FULL LOGS

在此处输入图像描述

WHERE I GOT DATA

在此处输入图像描述

ASSET URL

What is your Token Standard?

If it is not ERC721, you need to specify it as your schemaName inside the asset object, like this:

const fixedPriceSellOrder = await seaport.createSellOrder({
      asset: {
        tokenId: "28370143653034713195993216915191765879963367987017833025925208213530804748289",
        tokenAddress: NFT_CONTRACT_ADDRESS,
        schemaName: "ERC1155"
      },
      startAmount: 0.1,
      expirationTime: 0,
      accountAddress: OWNER_ADDRESS,
    });

You can find Token Standard in Details tab, on Opensea asset page:

提取转接呼叫数据失败 错误 400

Remove the dash and you're good. ERC1155 was fine for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM