market icon indicating copy to clipboard operation
market copied to clipboard

less duplication in getAssets methods in `@utils/aquarius`

Open kremalicious opened this issue 3 years ago • 1 comments

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

kremalicious avatar Mar 03 '22 14:03 kremalicious

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

mihaisc avatar Mar 03 '22 14:03 mihaisc