Skip to content

Generic Search Function for finding parties of deals #508

@NikolasHaimerl

Description

@NikolasHaimerl

Implementing a Generic Search Function

Description

Currently, our codebase contains specialized search functions like findDealActors and findDealClients. This creates duplication and increases the complexity of our codebase.

Proposal

Replace these specialized functions with a more generic search function, such as findPartyDeal. This would:

  1. Simplify the codebase
  2. Reduce code duplication
  3. Provide more flexibility

Example implementation:

const findPartyDeal = (retrievalTasks, minerId, cid, partyName) => {
  const deal = retrievalTasks.find(t => t.cid === cid && t.minerId === minerId);
  
  return deal ? deal[partyName] : undefined;
}

References

Original discussion from PR comments between @pyropy and @bajtos.

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

📥 candidate

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions