market
market copied to clipboard
less duplication in getAssets methods in `@utils/aquarius`
With ... we have:
-
getAssetsFromDidList() -
getAssetsFromDtList() -
retrieveDDOListByDIDs()
Where all of them have exact same fetch code with a slightly different filter being sent, and retrieveDDOListByDIDs() just returns results in different order.
This could be one method getAssets() or getAssetsFromList() or getAssetsFromIds():
export async function getAssets(
list: string[], // list of DIDs or Datatoken addresses
filter: string, //
chainIds: number[],
cancelToken: CancelToken
): Promise<Asset[]> {...}
But as utility methods they could be handy to keep separate, in that case we should at least have them all use a shared fetching method, and then only modify input/output differently in separate methods
They make sense as util functions because they all create the filter and then use queryMetadata , except retrieveDDOListByDIDs that has some weird filters after fetching the data