seaport.createBuyOrder is not working - returns 429 error every time.
See original GitHub issueHi 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:
- Created 2 years ago
- Comments:16
Top GitHub Comments
This one should probably get closed since there’s no solution other than to slow down.
Your API key is overused by dozen of bots, no wonder you were throttled. Change opensea api key.