@gearbox-protocol/sdk 3.0.0-vfour.352 → 3.0.0-vfour.353

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.
@@ -68,18 +68,28 @@ async function simulateWithPriceUpdates(client, parameters) {
68
68
  batchSize: 0
69
69
  // we cannot have price updates and compressor request in different batches
70
70
  });
71
+ let hasError = false;
72
+ let mustThrow = false;
71
73
  for (let i = 0; i < resp.length; i++) {
72
74
  if (resp[i].status === "failure") {
75
+ hasError = true;
73
76
  if (i > priceUpdates.length || i > 0 && strictPrices) {
74
- throw getSimulateWithPriceUpdatesError(
75
- void 0,
76
- priceUpdates,
77
- restContracts,
78
- resp
79
- );
77
+ mustThrow = true;
80
78
  }
81
79
  }
82
80
  }
81
+ if (hasError) {
82
+ const err = getSimulateWithPriceUpdatesError(
83
+ void 0,
84
+ priceUpdates,
85
+ restContracts,
86
+ resp
87
+ );
88
+ if (mustThrow) {
89
+ throw err;
90
+ }
91
+ console.warn(err);
92
+ }
83
93
  const restResults = resp.slice(priceUpdates.length + 1).map((r) => r.result);
84
94
  return restResults;
85
95
  } catch (e) {
@@ -125,7 +135,7 @@ function getSimulateWithPriceUpdatesError(cause, priceUpdates, calls, results) {
125
135
  const callsResults = results.slice(1 + priceUpdates.length);
126
136
  const prettyPriceUpdates = priceUpdates.map((p, i) => {
127
137
  const result = priceUpdatesResults[i];
128
- let tsValid = timestamp ? p.validateTimestamp(timestamp) : "";
138
+ let tsValid = timestamp ? p.validateTimestamp(timestamp) : "missing";
129
139
  tsValid = tsValid === "valid" ? "" : `[timestamp ${tsValid}]`;
130
140
  return [extractCallError(result), p.pretty, tsValid].filter(Boolean).join(" ");
131
141
  });
@@ -48,18 +48,28 @@ async function simulateWithPriceUpdates(client, parameters) {
48
48
  batchSize: 0
49
49
  // we cannot have price updates and compressor request in different batches
50
50
  });
51
+ let hasError = false;
52
+ let mustThrow = false;
51
53
  for (let i = 0; i < resp.length; i++) {
52
54
  if (resp[i].status === "failure") {
55
+ hasError = true;
53
56
  if (i > priceUpdates.length || i > 0 && strictPrices) {
54
- throw getSimulateWithPriceUpdatesError(
55
- void 0,
56
- priceUpdates,
57
- restContracts,
58
- resp
59
- );
57
+ mustThrow = true;
60
58
  }
61
59
  }
62
60
  }
61
+ if (hasError) {
62
+ const err = getSimulateWithPriceUpdatesError(
63
+ void 0,
64
+ priceUpdates,
65
+ restContracts,
66
+ resp
67
+ );
68
+ if (mustThrow) {
69
+ throw err;
70
+ }
71
+ console.warn(err);
72
+ }
63
73
  const restResults = resp.slice(priceUpdates.length + 1).map((r) => r.result);
64
74
  return restResults;
65
75
  } catch (e) {
@@ -105,7 +115,7 @@ function getSimulateWithPriceUpdatesError(cause, priceUpdates, calls, results) {
105
115
  const callsResults = results.slice(1 + priceUpdates.length);
106
116
  const prettyPriceUpdates = priceUpdates.map((p, i) => {
107
117
  const result = priceUpdatesResults[i];
108
- let tsValid = timestamp ? p.validateTimestamp(timestamp) : "";
118
+ let tsValid = timestamp ? p.validateTimestamp(timestamp) : "missing";
109
119
  tsValid = tsValid === "valid" ? "" : `[timestamp ${tsValid}]`;
110
120
  return [extractCallError(result), p.pretty, tsValid].filter(Boolean).join(" ");
111
121
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.352",
3
+ "version": "3.0.0-vfour.353",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",