Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

619
Visualizações
How can I solve 404 issue using the OpenSea JavaScript SDK?

I am trying to use OpenSea API with the JS SDK. I am getting two types of errors. One is a deprecated warning. Another is a 404 error. This is the error I am getting no matter what request is performed,

DEPRECATED: Please use providerUtils.standardizeOrThrow() instead
DEPRECATED: Please use providerUtils.standardizeOrThrow() instead
/home/sayeed/projects/SmartxNFT-main/node_modules/opensea-js/lib/api.js:509
                        throw new Error("API Error ".concat(response.status, ": ").concat(errorMessage));
                              ^

Error: API Error 404: Not found. Full message was '{"success":false}'
    at OpenSeaAPI.<anonymous> (/home/sayeed/projects/SmartxNFT-main/node_modules/opensea-js/lib/api.js:509:31)
    at step (/home/sayeed/projects/SmartxNFT-main/node_modules/opensea-js/lib/api.js:63:23)
    at Object.next (/home/sayeed/projects/SmartxNFT-main/node_modules/opensea-js/lib/api.js:44:53)
    at fulfilled (/home/sayeed/projects/SmartxNFT-main/node_modules/opensea-js/lib/api.js:35:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Here is my code following the documentation,


const Web3 = require("web3");
const { OpenSeaPort, Network } = require("opensea-js");

const HDWalletProvider = require("@truffle/hdwallet-provider");

const privateKeys = [
    "private key",
];

const provider = new HDWalletProvider(
    privateKeys,
    "https://polygon-mainnet.g.alchemy.com/v2/aclchemy - key",
    0,
    2
);

const seaport = new OpenSeaPort(provider, {
    networkName: Network.Main,
    apiKey: "api key",
});

const getAsset = async () => {
    const asset = {
        tokenAddress: "0x0ee7d6519a475a35e5c65dd0193dd1b9800e4db0", // CryptoKitties
        tokenId: "129", // Token ID
    };

    const listing = await seaport.api.getAsset(asset);

    console.log(listing);
};

getAsset();

The RPC API key is from Alchemy.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The problem lies in the fact that opensea-js only has two network options. The Ethereum mainnet and the rinkeby testnet.

In the following line you can see that you are setting your seaport to be using the Ethereum Mainnet.

networkName: Network.Main,

The returning value of Network.Main it's a string which contains the word main and while this might seem to imply that you could simply change Network.Main to "polygon" the sdk will just throw error.

Right now neither the OpenSea API, nor the opensea-sdk support Polygon, but they've announced that for V2 OpenSea API will support Polygon.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda