@merkl/api 0.20.174 → 0.20.175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -238,6 +238,8 @@ export class CampaignRepository {
238
238
  },
239
239
  subType: campaign.subType,
240
240
  DistributionChain: { connect: { id: campaign.distributionChainId } },
241
+ parentCampaign: campaign.parentCampaignId ? { connect: { id: campaign.parentCampaignId } } : undefined,
242
+ rootCampaign: campaign.rootCampaignId ? { connect: { id: campaign.rootCampaignId } } : undefined,
241
243
  };
242
244
  return await apiDbClient.campaign.upsert({
243
245
  where: {
@@ -32,16 +32,18 @@ export class MerklRootRepository {
32
32
  return { live, tree, lastTree, endOfDisputePeriod, disputer };
33
33
  }
34
34
  catch (e) {
35
+ let errorMessage = null;
35
36
  // If the error is a timeout, log a warning and return a void object
36
37
  if (e.message === `Timed out after ${RPC_CALL_TIMEOUT}ms`) {
37
- const errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} timed out`;
38
- log.warn(errorMessage);
39
- return {};
38
+ errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} timed out`;
40
39
  }
40
+ // If the error is a rpc failure, log a warning and return a void object
41
41
  if (e.message === "EVMDistributorService: fetchUpdateData multicall failed") {
42
- const errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} multicall failed`;
42
+ errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} multicall failed`;
43
+ }
44
+ if (errorMessage) {
43
45
  log.warn(errorMessage);
44
- return {};
46
+ return {}; // Return an empty object to indicate failure and prevent further trials of fetching this
45
47
  }
46
48
  throw e;
47
49
  }