@gearbox-protocol/sdk 8.23.0 → 8.23.2

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.
@@ -23,9 +23,13 @@ __export(ZappersPlugin_exports, {
23
23
  module.exports = __toCommonJS(ZappersPlugin_exports);
24
24
  var import_compressors = require("../../abi/compressors.js");
25
25
  var import_sdk = require("../../sdk/index.js");
26
- var import_extraZappers = require("./extraZappers.js");
27
26
  class ZappersPlugin extends import_sdk.BasePlugin {
28
27
  #zappers;
28
+ #extraZappers;
29
+ constructor(extraZappers = [], loadOnAttach = false) {
30
+ super(loadOnAttach);
31
+ this.#extraZappers = extraZappers;
32
+ }
29
33
  async load(force) {
30
34
  if (!force && this.loaded) {
31
35
  return this.state;
@@ -70,8 +74,7 @@ class ZappersPlugin extends import_sdk.BasePlugin {
70
74
  return this.state;
71
75
  }
72
76
  #addExtraZappers() {
73
- const zaps = import_extraZappers.extraZappers[this.sdk.provider.networkType] ?? [];
74
- for (const z of zaps) {
77
+ for (const z of this.#extraZappers) {
75
78
  const existing = this.#zappers?.get(z.pool);
76
79
  if (existing) {
77
80
  const hasZapper = existing.some(
@@ -15,10 +15,12 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var zappers_exports = {};
17
17
  module.exports = __toCommonJS(zappers_exports);
18
+ __reExport(zappers_exports, require("./extraZappers.js"), module.exports);
18
19
  __reExport(zappers_exports, require("./types.js"), module.exports);
19
20
  __reExport(zappers_exports, require("./ZappersPlugin.js"), module.exports);
20
21
  // Annotate the CommonJS export names for ESM import in node:
21
22
  0 && (module.exports = {
23
+ ...require("./extraZappers.js"),
22
24
  ...require("./types.js"),
23
25
  ...require("./ZappersPlugin.js")
24
26
  });
@@ -72,10 +72,11 @@ const chains = {
72
72
  "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
73
73
  "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
74
74
  "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7",
75
- "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group",
75
+ "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group"
76
+ },
77
+ testMarketConfigurators: {
76
78
  "0x09d8305F49374AEA6A78aF6C996df2913e8f3b19": "Tulipa"
77
79
  },
78
- testMarketConfigurators: {},
79
80
  isPublic: true,
80
81
  wellKnownToken: {
81
82
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -6,9 +6,13 @@ import {
6
6
  hexEq,
7
7
  VERSION_RANGE_310
8
8
  } from "../../sdk/index.js";
9
- import { extraZappers } from "./extraZappers.js";
10
9
  class ZappersPlugin extends BasePlugin {
11
10
  #zappers;
11
+ #extraZappers;
12
+ constructor(extraZappers = [], loadOnAttach = false) {
13
+ super(loadOnAttach);
14
+ this.#extraZappers = extraZappers;
15
+ }
12
16
  async load(force) {
13
17
  if (!force && this.loaded) {
14
18
  return this.state;
@@ -53,8 +57,7 @@ class ZappersPlugin extends BasePlugin {
53
57
  return this.state;
54
58
  }
55
59
  #addExtraZappers() {
56
- const zaps = extraZappers[this.sdk.provider.networkType] ?? [];
57
- for (const z of zaps) {
60
+ for (const z of this.#extraZappers) {
58
61
  const existing = this.#zappers?.get(z.pool);
59
62
  if (existing) {
60
63
  const hasZapper = existing.some(
@@ -1,2 +1,3 @@
1
+ export * from "./extraZappers.js";
1
2
  export * from "./types.js";
2
3
  export * from "./ZappersPlugin.js";
@@ -56,10 +56,11 @@ const chains = {
56
56
  "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
57
57
  "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
58
58
  "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7",
59
- "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group",
59
+ "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group"
60
+ },
61
+ testMarketConfigurators: {
60
62
  "0x09d8305F49374AEA6A78aF6C996df2913e8f3b19": "Tulipa"
61
63
  },
62
- testMarketConfigurators: {},
63
64
  isPublic: true,
64
65
  wellKnownToken: {
65
66
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -7,6 +7,7 @@ export interface ZappersPluginState {
7
7
  }
8
8
  export declare class ZappersPlugin extends BasePlugin<ZappersPluginState> implements IGearboxSDKPlugin<ZappersPluginState> {
9
9
  #private;
10
+ constructor(extraZappers?: ZapperDataFull[], loadOnAttach?: boolean);
10
11
  load(force?: boolean): Promise<ZappersPluginState>;
11
12
  get zappers(): AddressMap<ZapperDataFull[]>;
12
13
  get loaded(): boolean;
@@ -1,6 +1,6 @@
1
1
  import type { NetworkType } from "../../sdk";
2
2
  import type { ZapperDataFull } from "./types";
3
3
  /**
4
- * Temprary zappers
4
+ * Temporary zappers
5
5
  */
6
6
  export declare const extraZappers: Partial<Record<NetworkType, ZapperDataFull[]>>;
@@ -1,2 +1,3 @@
1
+ export * from "./extraZappers.js";
1
2
  export * from "./types.js";
2
3
  export * from "./ZappersPlugin.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.23.0",
3
+ "version": "8.23.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",