@gearbox-protocol/sdk 12.6.1 → 12.6.3

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.
@@ -148,12 +148,16 @@ class AccountOpener extends import_sdk.SDKConstruct {
148
148
  success += result.account ? 1 : 0;
149
149
  if (result.error) {
150
150
  this.#logger?.error(
151
- `failed to open account #${i + 1}/${targets.length}: ${result.error}`
151
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
152
+ cause: result.error
153
+ })
152
154
  );
153
155
  }
154
156
  } catch (e) {
155
157
  this.#logger?.error(
156
- `failed to open account #${i + 1}/${targets.length}: ${e}`
158
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
159
+ cause: e
160
+ })
157
161
  );
158
162
  accounts.push({
159
163
  input: target,
@@ -27,19 +27,23 @@ var import_PriceOracleV300Contract = require("./PriceOracleV300Contract.js");
27
27
  var import_PriceOracleV310Contract = require("./PriceOracleV310Contract.js");
28
28
  function getOrCreatePriceOracle(sdk, data) {
29
29
  const { version, addr } = data.baseParams;
30
- const existing = sdk.getContract(addr);
31
30
  let result;
32
- if (existing) {
33
- result = tryExtendExistingOracle(existing, data);
34
- } else if ((0, import_constants.isV300)(version)) {
35
- result = new import_PriceOracleV300Contract.PriceOracleV300Contract(sdk, data);
31
+ let action = "created";
32
+ if ((0, import_constants.isV300)(version)) {
33
+ const existing = sdk.getContract(addr);
34
+ if (existing) {
35
+ result = tryExtendExistingOracle(existing, data);
36
+ action = "extended";
37
+ } else {
38
+ result = new import_PriceOracleV300Contract.PriceOracleV300Contract(sdk, data);
39
+ }
36
40
  } else if ((0, import_constants.isV310)(version)) {
37
41
  result = new import_PriceOracleV310Contract.PriceOracleV310Contract(sdk, data);
38
42
  } else {
39
43
  throw new Error(`Unsupported oracle version ${version}`);
40
44
  }
41
45
  sdk.logger?.debug(
42
- `oracle ${addr} v${version} was ${existing ? "extended" : "created"} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`
46
+ `oracle ${addr} v${version} was ${action} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`
43
47
  );
44
48
  return result;
45
49
  }
@@ -139,12 +139,16 @@ class AccountOpener extends SDKConstruct {
139
139
  success += result.account ? 1 : 0;
140
140
  if (result.error) {
141
141
  this.#logger?.error(
142
- `failed to open account #${i + 1}/${targets.length}: ${result.error}`
142
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
143
+ cause: result.error
144
+ })
143
145
  );
144
146
  }
145
147
  } catch (e) {
146
148
  this.#logger?.error(
147
- `failed to open account #${i + 1}/${targets.length}: ${e}`
149
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
150
+ cause: e
151
+ })
148
152
  );
149
153
  accounts.push({
150
154
  input: target,
@@ -4,19 +4,23 @@ import { PriceOracleV300Contract } from "./PriceOracleV300Contract.js";
4
4
  import { PriceOracleV310Contract } from "./PriceOracleV310Contract.js";
5
5
  function getOrCreatePriceOracle(sdk, data) {
6
6
  const { version, addr } = data.baseParams;
7
- const existing = sdk.getContract(addr);
8
7
  let result;
9
- if (existing) {
10
- result = tryExtendExistingOracle(existing, data);
11
- } else if (isV300(version)) {
12
- result = new PriceOracleV300Contract(sdk, data);
8
+ let action = "created";
9
+ if (isV300(version)) {
10
+ const existing = sdk.getContract(addr);
11
+ if (existing) {
12
+ result = tryExtendExistingOracle(existing, data);
13
+ action = "extended";
14
+ } else {
15
+ result = new PriceOracleV300Contract(sdk, data);
16
+ }
13
17
  } else if (isV310(version)) {
14
18
  result = new PriceOracleV310Contract(sdk, data);
15
19
  } else {
16
20
  throw new Error(`Unsupported oracle version ${version}`);
17
21
  }
18
22
  sdk.logger?.debug(
19
- `oracle ${addr} v${version} was ${existing ? "extended" : "created"} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`
23
+ `oracle ${addr} v${version} was ${action} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`
20
24
  );
21
25
  return result;
22
26
  }
@@ -8,6 +8,8 @@ import type { IPriceOracleContract } from "./types.js";
8
8
  *
9
9
  * So this method bridges multiple compressor data pieces and single oracle contract isntance
10
10
  *
11
+ * @deprecated This will be removed when v300 is deprecated
12
+ *
11
13
  * @param sdk
12
14
  * @param data
13
15
  * @param underlying
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.6.1",
3
+ "version": "12.6.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",