fulfillOrder doesn't appear to work with getBestListing() #1483
Replies: 2 comments
-
Is your sdk initialized on the same chain you are trying to fulfill? Eg for hoolies-8, base That's weird getOrder works but not getBestListing, will look into why there might be a discrepancy. For the getOrder eth price, you should be able to inspect the protocolData returned, that will have the order details. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I can't recreate, this worked fine for me: import { ethers } from "ethers";
import { OpenSeaSDK, Chain } from "opensea-js";
const provider = new ethers.JsonRpcProvider(process.env.BASE_RPC_URL);
const walletWithProvider = new ethers.Wallet(String(process.env.PK), provider);
const sdk = new OpenSeaSDK(walletWithProvider, {
chain: Chain.Base,
apiKey: process.env.OPENSEA_API_KEY,
});
const main = async () => {
const accountAddress = await walletWithProvider.getAddress()
const order = await sdk.api.getBestListing('hoolies-8', 3329);
const transactionHash = await sdk.fulfillOrder({ order, accountAddress });
console.log("Transaction Hash: ", transactionHash);
}
main() ➜ ts-node index.ts
Transaction Hash: 0xc6c4fe3f2fe3307fa7b38de1d2d569ada7f1eb5ffa9b51e99855ea789fdf9960 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
var order = await sdk.api.getBestListing('hoolies-8', 3329); var transactionHash = await sdk.fulfillOrder({ order : order, accountAddress : address });
this, as an example, throws an
The order_hash you provided does not exist
error, despite the listing being successfully fetched.I would use getOrder instead, as that seems to work with fulfillOrder without issue, but I wanted to possibly run a check with the price before fulfillOrder, and I wasn't sure how to interpret the currentPrice from the OrderV2 that getOrder returns.
If someone could either help explain how one would go about converting the currentPrice into ETH, OR how to make fulfillOrder work with getBestListing(), that would be highly appreciated
Beta Was this translation helpful? Give feedback.
All reactions