Closed allenchuang closed 2 years ago
i figred out why this is the case- i think it is because of the JSON parsing that happens in getServerSideProps
:
const asset = JSON.parse(JSON.stringify(assetResponse));
causing some property type mismatch when doing the validation on OpenseaPort side.
@nawangwe do you have a work around for this? so far i've just moved the getOrder
call directly inside initiatePurchase
but now seeing CORS issue 🤦🏻♂️
@allenchuang i'll get around to this today, it seems that the opensea is library and api require frequent monitoring and I haven't maintained this repo in a while.
no worries thanks so much for taking the time to create this repo! I've looked into it a bit, and i found orderToJSON
and orderFromJson
exported as part of opensea-js
.
I'm looking into it as we speak but hope that give you a headstart! also, might worth looking into updating the opensea-js
package to a later version, as to which one i'm not sure.
also- from their API it seems that you no longer need to use getAsset
you can use getOrder
function and pass in the returned object to fulfillOrder
as updated in their README. Sorry for dumping all this info on you if it's too much, just trying to help the best i can :D
No worries @allenchuang I really appreciate the help! As I'm currently tied down with other projects. Feel free to contribute as well. I'll definitely begin maintaining this on a regular basis.
sure! If I get to it before you do i'll file a PR for your approval. Cheers! 🙌🏼
update: opensea-js
is ridiculous to work with- after several hours of digging, i realized that they are rehauling their API but didn't update their SDKs. the orderToJSON
and orderFromJSON
don't even work in conjunction.
orderToJSON
returns camelCaseProps while orderToJSON
expects snake_case_props 🤦🏻♂️
Based on the little information on OS dev blogs, I think its best to migrate over to ^2.0.2 for now.
https://opensea.io/blog/developers/wyvern-2-3-developer-upgrade-guide/ https://docs.opensea.io/changelog
so far i'm working on getting the buy function to work again, but i keep getting errors submitting the transaction, haven't got a working version for PR yet.
What i've done so far
I'm a bit confused because using fetch order API from https://docs.opensea.io/reference/retrieving-orders returns snake_case_props
but using getAsset
or getOrder
from the SDK returns camelCaseProps
so i'm not sure if the way to go is:
getAsset
with directly calling the API in getStateFromProps
in [tokenId].tsx
orderToJSON
GalleryItemDetails
component using orderFromJSON
and pass it to the SDK OpenSeaPort
for actually submitting buy ordertesting it rn, will let you know
i tried to push a new branch for the API support but i don't have access to the repo, any chance you can give me contributor access?
update: i've tried using the fetch approach- but it's giving me the same error as the title states again...
Failed to validate buy order parameters. Make sure you're on the right network!
i'm a bit stumped. i can open [WIP] PR and add some comments, you can pull and take a look at teh changes i've done so far, perhaps you can make better progress!
noted @allenchuang
I've been trying to buy asset by invoking fulfillOrder in
[tokenid].js
but I'm getting error:Error: Failed to validate buy order parameters. Make sure you're on the right network!
seaport creation code:
in
initiatePurchase
fulfillOrder code:What could be the cause?