Closed JJSEONG closed 1 year ago
Please update to the latest version, v5
I have already updated to version 5. Still, the error continues to occur. "opensea-js": "^5.0.0",
I've solved this problem!! After updating to v5, deleting node_modules and installing again solved the error. Thank you for your reply.
I also get this error in v5.0.0 even after removing and installing node_modules. Does anyone have a solution?
@creed-dev please try with v6, and please share a code snippet to recreate so we can see the problem, the protocol address should be supplied by the SDK by default
@ryanio When i use v6: Firstly: I can't use HDWalletProvider and get "Error: Either a provider or custom signer with provider must be provided." Secondly: When i use JsonRpcProvider, i get:
Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32601,\"message\":\"The method eth_signTypedData_v4 does not exist/is not available\"}}", error={"stack":"Error: The method eth_signTypedData_v4 does not exist/is not available\n at getResult (/home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:191:21)\n at processJsonFunc (/home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/web/lib/index.js:356:22)\n at /home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/web/lib/index.js:288:46\n at step (/home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/web/lib/index.js:33:23)\n at Object.next (/home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/web/lib/index.js:14:53)\n at fulfilled (/home/creed/projects/aliens/aliens-worker/node_modules/@ethersproject/web/lib/index.js:5:58)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)","message":"The method eth_signTypedData_v4 does not exist/is not available","code":-32601}, requestBody="{\"method\":\"eth_signTypedData_v4\",\"params\":[\"0x2ed8bcc42a8458627fa198037294fac6a835547b\",\"{\\\"types\\\":{\\\"OrderComponents\\\":[{\\\"name\\\":\\\"offerer\\\",\\\"type\\\":\\\"address\\\"},{\\\"name\\\":\\\"zone\\\",\\\"type\\\":\\\"address\\\"},{\\\"name\\\":\\\"offer\\\",\\\"type\\\":\\\"OfferItem[]\\\"},{\\\"name\\\":\\\"consideration\\\",\\\"type\\\":\\\"ConsiderationItem[]\\\"},{\\\"name\\\":\\\"orderType\\\",\\\"type\\\":\\\"uint8\\\"},{\\\"name\\\":\\\"startTime\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"endTime\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"zoneHash\\\",\\\"type\\\":\\\"bytes32\\\"},{\\\"name\\\":\\\"salt\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"conduitKey\\\",\\\"type\\\":\\\"bytes32\\\"},{\\\"name\\\":\\\"counter\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"OfferItem\\\":[{\\\"name\\\":\\\"itemType\\\",\\\"type\\\":\\\"uint8\\\"},{\\\"name\\\":\\\"token\\\",\\\"type\\\":\\\"address\\\"},{\\\"name\\\":\\\"identifierOrCriteria\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"startAmount\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"endAmount\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"ConsiderationItem\\\":[{\\\"name\\\":\\\"itemType\\\",\\\"type\\\":\\\"uint8\\\"},{\\\"name\\\":\\\"token\\\",\\\"type\\\":\\\"address\\\"},{\\\"name\\\":\\\"identifierOrCriteria\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"startAmount\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"endAmount\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"recipient\\\",\\\"type\\\":\\\"address\\\"}],\\\"EIP712Domain\\\":[{\\\"name\\\":\\\"name\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"version\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"chainId\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"verifyingContract\\\",\\\"type\\\":\\\"address\\\"}]},\\\"domain\\\":{\\\"name\\\":\\\"Seaport\\\",\\\"version\\\":\\\"1.5\\\",\\\"chainId\\\":\\\"5\\\",\\\"verifyingContract\\\":\\\"0x00000000000000adc04c56bf30ac9d3c0aaf14dc\\\"},\\\"primaryType\\\":\\\"OrderComponents\\\",\\\"message\\\":{\\\"offerer\\\":\\\"0x2ed8bcc42a8458627fa198037294fac6a835547b\\\",\\\"zone\\\":\\\"0x0000000000000000000000000000000000000000\\\",\\\"offer\\\":[{\\\"itemType\\\":\\\"2\\\",\\\"token\\\":\\\"0x58362f36c39d3e88d9f10165a9c61791278b5fda\\\",\\\"identifierOrCriteria\\\":\\\"10\\\",\\\"startAmount\\\":\\\"1\\\",\\\"endAmount\\\":\\\"1\\\"}],\\\"consideration\\\":[{\\\"itemType\\\":\\\"0\\\",\\\"token\\\":\\\"0x0000000000000000000000000000000000000000\\\",\\\"identifierOrCriteria\\\":\\\"0\\\",\\\"startAmount\\\":\\\"1704037500000000\\\",\\\"endAmount\\\":\\\"1704037500000000\\\",\\\"recipient\\\":\\\"0x2ed8bcc42a8458627fa198037294fac6a835547b\\\"},{\\\"itemType\\\":\\\"0\\\",\\\"token\\\":\\\"0x0000000000000000000000000000000000000000\\\",\\\"identifierOrCriteria\\\":\\\"0\\\",\\\"startAmount\\\":\\\"45562500000000\\\",\\\"endAmount\\\":\\\"45562500000000\\\",\\\"recipient\\\":\\\"0x0000a26b00c1f0df003000390027140000faa719\\\"},{\\\"itemType\\\":\\\"0\\\",\\\"token\\\":\\\"0x0000000000000000000000000000000000000000\\\",\\\"identifierOrCriteria\\\":\\\"0\\\",\\\"startAmount\\\":\\\"72900000000000\\\",\\\"endAmount\\\":\\\"72900000000000\\\",\\\"recipient\\\":\\\"0x58362f36c39d3e88d9f10165a9c61791278b5fda\\\"}],\\\"orderType\\\":\\\"1\\\",\\\"startTime\\\":\\\"1686891055\\\",\\\"endTime\\\":\\\"1689396656\\\",\\\"zoneHash\\\":\\\"0x0000000000000000000000000000000000000000000000000000000000000000\\\",\\\"salt\\\":\\\"0\\\",\\\"conduitKey\\\":\\\"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000\\\",\\\"counter\\\":\\\"0\\\"}}\"],\"id\":49,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://goerli.infura.io/v3/{key}", code=SERVER_ERROR, version=web/5.7.1)
As far as I understand, I need to sign a transaction to put an item up for sale. And for this I need to use HDWalletProvider as before.
Code:
require('dotenv').config();
const OpenSea = require("opensea-js");
const Web3 = require('web3');
const logger = require("./logger");
const ethers = require("ethers");
const {
NETWORK,
INFURA_KEY,
NFT_CONTRACT_ADDRESS
} = process.env;
const OpenSeaSDK = OpenSea.OpenSeaSDK;
async function listing(tokenId, to, price) {
try {
logger.log('info', `Start listing function for token ID ${tokenId}`);
const provider = new ethers.providers.JsonRpcProvider(
"https://" + NETWORK + ".infura.io/v3/" + INFURA_KEY
);
const seaport = new OpenSeaSDK(
provider,
{
chain: "goerli"
}
);
tokenId = tokenId.toString();
const priceOnWei = price.toString();
const priceOnEth = Number(Web3.utils.fromWei(priceOnWei, 'ether')).toFixed(10);
logger.log('info', `Request to OpenSea API for token ID ${tokenId}`);
await seaport.createSellOrder({
asset: {
tokenId: tokenId,
tokenAddress: NFT_CONTRACT_ADDRESS
},
startAmount: priceOnEth,
accountAddress: to
});
} catch (err) {
throw err;
}
}
module.exports = {listing};
package.json:
{
"type": "commonjs",
"scripts": {
"start": "nodemon index.js"
},
"dependencies": {
"@opensea/seaport-js": "^1.0.8",
"@truffle/hdwallet-provider": "^2.1.8",
"axios": "^0.27.2",
"bull": "^4.10.3",
"cors": "^2.8.5",
"dotenv": "^16.0.2",
"ethers": "^5.7.2",
"express": "^4.18.2",
"nodemon": "^2.0.22",
"opensea-js": "^6.0.5",
"web3": "^1.8.0",
"winston": "^3.8.2",
"wyvern-schemas": "^0.6.15"
}
}
I am currently using createSellOrder of opensea-sdk. The listing, which worked fine just a few days ago, is currently not running because there is no protocol address. How can i solve this error? Below is the code I am currently using. If you have solved the same error or know, please reply.
const expirationTime = Math.round(Date.now() / 1000 + 60 60 24); const listing = await getSeaport().createSellOrder({ asset: { tokenId, tokenAddress: REACT_APP_ETHEREUM_MINTING_CONTRACT_ADDRESS, }, accountAddress: account, startAmount: price, endAmount: price, expirationTime, });