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.

seaport.createBuyOrder is not working - returns 429 error every time.

See original GitHub issue

Hi Team

I’m using code from the opensea-creatures project (sell.js) to create an OpenSeaPort instance and call seaport.createBuyOrder()

My Node & npm versions C:\Users\Owner>node -v v12.18.4

C:\Users\Owner>npm -v 6.14.6

Script const {OpenSeaPort,Network} = require(‘opensea-js’) const RPCSubprovider = require(‘web3-provider-engine/subproviders/rpc’) const Web3ProviderEngine = require(‘web3-provider-engine’) const {MnemonicWalletSubprovider} = require(‘@0x/subproviders’); const accountAddress = “0x2c649A72529FfB801825a52136e0D5C8F171f6Bd” const API_KEY = “”; const NFT_CONTRACT_ADDRESS_SVS = “0x219b8ab790decc32444a6600971c7c3718252539”; const NFT_TOKEN_ID = “3400”; const NETWORK = “mainnet”; const NODE_API_KEY = “e1d6858ba67049bc934a9b764efb9c31”; const isInfura = true;//!!process.env.INFURA_KEY; const MNEMONIC = “My Metamask Mneumonic here”; const BASE_DERIVATION_PATH = 44'/60'/0'/0; const network = NETWORK === “mainnet” || NETWORK === “live” ? “mainnet” : “rinkeby”;

const mnemonicWalletSubprovider = new MnemonicWalletSubprovider({ mnemonic: MNEMONIC, baseDerivationPath: BASE_DERIVATION_PATH, });

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) );

placeOffer(NFT_CONTRACT_ADDRESS_SVS, NFT_TOKEN_ID, 0.0000001, Math.round(Date.now() / 1000 + 60 * 3))

async function placeOffer(address, tokenId, price , expirationTime) {
const asset = { tokenId: tokenId, tokenAddress: address, } try{
const makeOffer = await seaport.createBuyOrder({ asset: asset, accountAddress,
startAmount: price, expirationTime })
console.log(Successfully created a offer! ${makeOffer.asset.openseaLink}); } catch(ex) { console.log(ex) }
}

packages.json

{ “name”: “newscript”, “version”: “1.0.0”, “description”: “”, “main”: “test.js”, “scripts”: { “test”: “echo "Error: no test specified" && exit 1” }, “author”: “”, “license”: “ISC”, “dependencies”: { “@0x/subproviders”: “^6.4.1”, “opensea-js”: “^1.1.5” }, “engines”: { “node”: “^12.18.x”
} }

When i run the script the sdk outputs the following log to console :- Already approved enough currency for trading Order hashes match

but then it always returns the 429 Error: API Error 429: Message: {“detail”:“Request was throttled.”}

I understand throttling. Why is it that I’m getting the 429 when I have never once called this function successfully. I’ve most certainly not called it multiple times a second or at any rate to induce throttling limits… In fact even when I leave it for 24 hrs plus and try again it give me the 429.

I have the correct node version installed as specified in the engines section in the opensea-creatures package.json.

I also have the same node module dependencies as opensea-creatures

@0x/subproviders”: “^6.4.1”, “opensea-js”: “^1.1.5”

My code to create the OpenSeaPort client is identical to the opensea-creatures script file. Yet it still return 429.

I know all the the code is OK because when I run the same code from a react-app the buy order is placed successfully. But I cannot get it to run from script.

I know that I don’t need an API key because the code runs successfully from my react-app.

please help ! I much appreciate the sdk but why the persistent 429?

Also what is the magic combination of latest node and opensea modules that I can use to place a buy order ??

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

3reactions
pguardiariocommented, Oct 7, 2021

This one should probably get closed since there’s no solution other than to slow down.

1reaction
ismcommented, Oct 18, 2021

Your API key is overused by dozen of bots, no wonder you were throttled. Change opensea api key.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix 429 Too Many Requests Error - Kinsta
The HTTP 429 error is returned when too many requests are made to a page within a short period of time. Find out...
Read more >
How to Fix 429 Too Many Requests Error Code - Hostinger
Don't know how to deal with the 429 too many requests error? We'll share the six effective solutions to diagnose and resolve it!...
Read more >
Unhandled Rejection Opensea error while making Buying Items
Is this the problem? // This example provider won't let you make transactions, only read-only calls: const provider = new Web3.providers.
Read more >
429 Error: How to Fix & Avoid It in the Future - Naturaily
Technically, it's not an error but one of the many HTTP status codes; a response that is sent from either a web server...
Read more >
cannot read properties of undefined (reading 'defaults')
The problem is that dataTable is not defined at the point you are calling this ... I have a freshly created symfony application...
Read more >

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