@gearbox-protocol/sdk 12.3.4 → 12.3.6

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.
@@ -51,7 +51,8 @@ class ZappersPlugin extends import_sdk.BasePlugin {
51
51
  args: [m.configurator.address, m.pool.pool.address]
52
52
  })
53
53
  ),
54
- allowFailure: true
54
+ allowFailure: true,
55
+ batchSize: 0
55
56
  });
56
57
  this.#zappers = new import_sdk.AddressMap(void 0, "zappers");
57
58
  for (let i = 0; i < resp.length; i++) {
@@ -62,11 +62,15 @@ function createClient(opts, network) {
62
62
  async function attachClient(options, network) {
63
63
  let { chainId, networkType } = network;
64
64
  const attachClient2 = createClient(options);
65
- if (!networkType) {
65
+ if (networkType) {
66
+ if (!chainId) {
67
+ chainId = (0, import_chain.getChain)(networkType).id;
68
+ }
69
+ } else {
66
70
  networkType = await (0, import_chain.detectNetwork)(attachClient2);
67
- }
68
- if (!chainId) {
69
- chainId = await attachClient2.getChainId();
71
+ if (!chainId) {
72
+ chainId = await attachClient2.getChainId();
73
+ }
70
74
  }
71
75
  return createClient(options, { networkType, chainId });
72
76
  }
@@ -24,14 +24,20 @@ __export(createAddressProvider_exports, {
24
24
  module.exports = __toCommonJS(createAddressProvider_exports);
25
25
  var import_iVersion = require("../../../abi/iVersion.js");
26
26
  var import_constants = require("../../constants/index.js");
27
+ var import_hex = require("../../utils/hex.js");
27
28
  var import_AddressProviderV300Contract = require("./AddressProviderV300Contract.js");
28
29
  var import_AddressProviderV310Contract = require("./AddressProviderV310Contract.js");
29
30
  async function createAddressProvider(sdk, address) {
30
- const v = await sdk.client.readContract({
31
- address,
32
- abi: import_iVersion.iVersionAbi,
33
- functionName: "version"
34
- });
31
+ let v;
32
+ if ((0, import_hex.hexEq)(address, import_constants.ADDRESS_PROVIDER_V310)) {
33
+ v = 310n;
34
+ } else {
35
+ v = await sdk.client.readContract({
36
+ address,
37
+ abi: import_iVersion.iVersionAbi,
38
+ functionName: "version"
39
+ });
40
+ }
35
41
  return newAddressProvider(sdk, address, Number(v));
36
42
  }
37
43
  function hydrateAddressProvider(sdk, state) {
@@ -34,7 +34,8 @@ class ZappersPlugin extends BasePlugin {
34
34
  args: [m.configurator.address, m.pool.pool.address]
35
35
  })
36
36
  ),
37
- allowFailure: true
37
+ allowFailure: true,
38
+ batchSize: 0
38
39
  });
39
40
  this.#zappers = new AddressMap(void 0, "zappers");
40
41
  for (let i = 0; i < resp.length; i++) {
@@ -61,11 +61,15 @@ function createClient(opts, network) {
61
61
  async function attachClient(options, network) {
62
62
  let { chainId, networkType } = network;
63
63
  const attachClient2 = createClient(options);
64
- if (!networkType) {
64
+ if (networkType) {
65
+ if (!chainId) {
66
+ chainId = getChain(networkType).id;
67
+ }
68
+ } else {
65
69
  networkType = await detectNetwork(attachClient2);
66
- }
67
- if (!chainId) {
68
- chainId = await attachClient2.getChainId();
70
+ if (!chainId) {
71
+ chainId = await attachClient2.getChainId();
72
+ }
69
73
  }
70
74
  return createClient(options, { networkType, chainId });
71
75
  }
@@ -1,13 +1,23 @@
1
1
  import { iVersionAbi } from "../../../abi/iVersion.js";
2
- import { isV300, isV310 } from "../../constants/index.js";
2
+ import {
3
+ ADDRESS_PROVIDER_V310,
4
+ isV300,
5
+ isV310
6
+ } from "../../constants/index.js";
7
+ import { hexEq } from "../../utils/hex.js";
3
8
  import { AddressProviderV300Contract } from "./AddressProviderV300Contract.js";
4
9
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
5
10
  async function createAddressProvider(sdk, address) {
6
- const v = await sdk.client.readContract({
7
- address,
8
- abi: iVersionAbi,
9
- functionName: "version"
10
- });
11
+ let v;
12
+ if (hexEq(address, ADDRESS_PROVIDER_V310)) {
13
+ v = 310n;
14
+ } else {
15
+ v = await sdk.client.readContract({
16
+ address,
17
+ abi: iVersionAbi,
18
+ functionName: "version"
19
+ });
20
+ }
11
21
  return newAddressProvider(sdk, address, Number(v));
12
22
  }
13
23
  function hydrateAddressProvider(sdk, state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.3.4",
3
+ "version": "12.3.6",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",