sorare / api

Sorare API documentation
154 stars 49 forks source link

bug: missing fields in subscription aCardWasUpdated { OwnerWithRates } #175

Open doublesavonette opened 2 years ago

doublesavonette commented 2 years ago

Hi @redox @eulbat ,

I might be wrong, but the it feels that Account is missing from OwnerWithRates when running a subscription on aCardWasUpdated. The subscription below does not return anything.

subscription { aCardWasUpdated(rarities: limited) { slug notContractOwners { account { id } } } } Although the query runs fine: query { card(slug: "paul-bernardoni-2021-limited-9") { slug notContractOwners { account { id } } } }

Any thoughts?

Cheers.

asilbalaban commented 2 years ago

@redox

i want to report a problem with notContractOwners scope. when a card sold. i read notContactOwners { id } from aCardWasUpdated subscription to save card history uniquely. But after 2-5 minutes. if i read notContractOwners from card notContactOwners { id } returns different id.

for example. this two so_id's return for same transaction

Owner:0x04004353888d544516f7368e0273c2811ea7ed09693f5e49d5ae398979a6059a_1649182701_0x03b4c97ae432b45f6bc06a818c674f4f24bd23adcc300b3ea984a7ec6b34ea4b

Owner:0x04004353888d544516f7368e0273c2811ea7ed09693f5e49d5ae398979a6059a_1649182797_0x03b4c97ae432b45f6bc06a818c674f4f24bd23adcc300b3ea984a7ec6b34ea4b

i think this is the sellers starkkey + timestamp + buyer starkkey why it's returns different id on different times.

asilbalaban commented 2 years ago

i was using dealId before the update.

asilbalaban commented 2 years ago

Now notContractOwners id's return value like Owner:8d789c5b-f031-4a62-96e4-bd080d572480 this. Also notContractOwners returns dealId is this temporary or did you get back this features?

eulbat commented 2 years ago

Hi @asilbalaban

For dealId the field is deprecated, we'll maintain the values for now, but it will be removed in the near future. For id, the target format will eventually be Owner:{asset_id}_{timestamp}_{address}, but we may return the Owner:{uuid} format for a while. What are you using the id for?

asilbalaban commented 2 years ago

We save all card histories to calculate AVG price for player in 3 days or 15 days or something like that.

We are ok Owner:{asset_id}_{timestamp}_{address} this format but the problem is the api send us different owner id for same transaction as i mentioned earlier. So this cause duplicate sale data and it's broke our calculations.

dealId is also unique key and we can get offer details with it. (for example if we want to buy a card but we missed it, we check who buy the card and when the card is sold.) We can see offer details with it but It's not so critical for us.

In new format i create a salt like this. md5(assetId + receiverWalletAdress + transferType + price + dateOnly) i reformat so_from 2022-04-06 like this so we can delete duplicate transactions with same seller, same price in same day. Sometimes they are really make same transaction twice in one day. So It's not a real solution. It's cause a lot of delete and rewrites.

It must be unique key in notContractOwners or userWithRates. So we can check is this record in our database or not.

asilbalaban commented 2 years ago

How to relate ended singleSaleOffer with cardHistory without dealId. To detect ended offers without buyers or cancelled offers for example?