@gearbox-protocol/sdk 12.6.2 → 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.
@@ -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
  }
@@ -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.2",
3
+ "version": "12.6.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",