app icon indicating copy to clipboard operation
app copied to clipboard

Getting `latestMetadataIpfsHash` from the correct API endpoint

Open jtourkos opened this issue 7 months ago • 0 comments

After some operations, we await waitForAccountMetadata.

This performs the following query:

query LatestAccountMetadataHash($accountId: ID!) {
            userById(accountId: $accountId) {
              latestMetadataIpfsHash
	 }
 }

At the app, the emitter's accountId could be of any type (AddressDriver, RepoDriver, DripList), but at the API, userById is dedicated to AddressDriver accounts.

Currently, this works because only one field (the latestMetadataIpfsHash) is requested, and the implementation of the API can handle all types of IDs.

But with the multi-chain changes, this is failing with a type assertion error (as expected). I've made the assertion more generic (instead of expecting an AddressDriverId, it now expects the more generic AccountId). But still, it just happens to work.

The solution is either for the app to query the latestMetadataIpfsHash from a specific endpoint based on the emitter account ID type (i.e., userById, projectById, dripList), or for the API to expose a generic dedicated latestMetadataIpfsHash endpoint.

Wdyt @efstajas?

jtourkos avatar Jul 12 '24 12:07 jtourkos