@gearbox-protocol/sdk 8.29.0 → 8.30.0

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.
@@ -93,7 +93,8 @@ class ZappersPlugin extends import_sdk.BasePlugin {
93
93
  }
94
94
  get extraZappers() {
95
95
  if (!this.#extraZappers) {
96
- throw new Error("zappers plugin not attached");
96
+ console.error("extra zappers not attached");
97
+ return new import_sdk.AddressMap();
97
98
  }
98
99
  return this.#extraZappers;
99
100
  }
@@ -52,12 +52,31 @@ const ADDRESS_PROVIDER_BLOCK = {
52
52
  Lisk: 18934260n
53
53
  // arbitrary not deployed yet
54
54
  };
55
- const BLOCK_DURATION_LOCAL = {};
55
+ const BLOCK_DURATION_LOCAL = {
56
+ Mainnet: 12050,
57
+ Arbitrum: 260,
58
+ Optimism: 2e3,
59
+ Base: 2010,
60
+ Sonic: 910,
61
+ // New networks
62
+ MegaETH: 10,
63
+ // <10ms/block, on testnet
64
+ Monad: 1e3,
65
+ // on testnet
66
+ Berachain: 1900,
67
+ Avalanche: 1700,
68
+ BNB: 3e3,
69
+ WorldChain: 2e3,
70
+ Etherlink: 1e3,
71
+ Hemi: 12e3,
72
+ Lisk: 2e3
73
+ };
74
+ const DEFAULT_DURATION = 12e3;
56
75
  const BLOCK_DURATION = Object.values(import_chain.chains).reduce(
57
76
  (acc, chain) => {
58
- const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || 0;
59
- if (blockTime === 0)
77
+ if (!chain.blockTime || chain.blockTime === 0)
60
78
  console.error(`Block time for ${chain.name} is unknown`);
79
+ const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || DEFAULT_DURATION;
61
80
  acc[chain.network] = blockTime / 1e3;
62
81
  return acc;
63
82
  },
@@ -66,7 +85,9 @@ const BLOCK_DURATION = Object.values(import_chain.chains).reduce(
66
85
  const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
67
86
  const RAMP_DURATION_BY_NETWORK = import_mappers.TypedObjectUtils.entries(BLOCK_DURATION).reduce(
68
87
  (acc, [n, duration]) => {
69
- acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
88
+ if (duration !== 0) {
89
+ acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
90
+ }
70
91
  return acc;
71
92
  },
72
93
  {}
@@ -26,6 +26,7 @@ __reExport(sdk_exports, require("./gauges/index.js"), module.exports);
26
26
  __reExport(sdk_exports, require("./market/index.js"), module.exports);
27
27
  __reExport(sdk_exports, require("./options.js"), module.exports);
28
28
  __reExport(sdk_exports, require("./plugins/index.js"), module.exports);
29
+ __reExport(sdk_exports, require("./poolMigration/index.js"), module.exports);
29
30
  __reExport(sdk_exports, require("./router/index.js"), module.exports);
30
31
  __reExport(sdk_exports, require("./sdk-gov-legacy/index.js"), module.exports);
31
32
  __reExport(sdk_exports, require("./sdk-legacy/index.js"), module.exports);
@@ -45,6 +46,7 @@ __reExport(sdk_exports, require("./utils/viem/index.js"), module.exports);
45
46
  ...require("./market/index.js"),
46
47
  ...require("./options.js"),
47
48
  ...require("./plugins/index.js"),
49
+ ...require("./poolMigration/index.js"),
48
50
  ...require("./router/index.js"),
49
51
  ...require("./sdk-gov-legacy/index.js"),
50
52
  ...require("./sdk-legacy/index.js"),
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var poolMigration_exports = {};
20
+ __export(poolMigration_exports, {
21
+ POOL_DELAYED_MIGRATION_CONTRACTS: () => POOL_DELAYED_MIGRATION_CONTRACTS
22
+ });
23
+ module.exports = __toCommonJS(poolMigration_exports);
24
+ const POOL_DELAYED_MIGRATION_CONTRACTS = {
25
+ Mainnet: [
26
+ {
27
+ // TODO: fix address
28
+ address: "0xc155444481854c60e7a29f4150373f479988f32d",
29
+ // "dUSDCV3" "Trade USDC v3"
30
+ poolIn: "0xda00000035fef4082f78def6a8903bee419fbf8e",
31
+ // "USDC" "invariant"
32
+ poolOut: "0xc155444481854c60e7a29f4150373f479988f32d"
33
+ },
34
+ {
35
+ // TODO: fix address
36
+ address: "0xf0795c47fa58d00f5f77f4d5c01f31ee891e21b4",
37
+ // "dUSDCV3" "Trade USDC v3"
38
+ poolIn: "0xda00000035fef4082f78def6a8903bee419fbf8e",
39
+ // "USDC" "tulipa"
40
+ poolOut: "0xf0795c47fa58d00f5f77f4d5c01f31ee891e21b4"
41
+ },
42
+ {
43
+ // TODO: fix address
44
+ address: "0xf00b548f1b69cb5ee559d891e03a196fb5101d4a",
45
+ // "dWETHV3" "Trade WETH v3"
46
+ poolIn: "0xda0002859b2d05f66a753d8241fcde8623f26f4f",
47
+ // "dWETHV3-cp0x" "Gearbox WETH v3"
48
+ poolOut: "0xf00b548f1b69cb5ee559d891e03a196fb5101d4a"
49
+ }
50
+ ]
51
+ };
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ POOL_DELAYED_MIGRATION_CONTRACTS
55
+ });
@@ -76,7 +76,8 @@ class ZappersPlugin extends BasePlugin {
76
76
  }
77
77
  get extraZappers() {
78
78
  if (!this.#extraZappers) {
79
- throw new Error("zappers plugin not attached");
79
+ console.error("extra zappers not attached");
80
+ return new AddressMap();
80
81
  }
81
82
  return this.#extraZappers;
82
83
  }
@@ -27,12 +27,31 @@ const ADDRESS_PROVIDER_BLOCK = {
27
27
  Lisk: 18934260n
28
28
  // arbitrary not deployed yet
29
29
  };
30
- const BLOCK_DURATION_LOCAL = {};
30
+ const BLOCK_DURATION_LOCAL = {
31
+ Mainnet: 12050,
32
+ Arbitrum: 260,
33
+ Optimism: 2e3,
34
+ Base: 2010,
35
+ Sonic: 910,
36
+ // New networks
37
+ MegaETH: 10,
38
+ // <10ms/block, on testnet
39
+ Monad: 1e3,
40
+ // on testnet
41
+ Berachain: 1900,
42
+ Avalanche: 1700,
43
+ BNB: 3e3,
44
+ WorldChain: 2e3,
45
+ Etherlink: 1e3,
46
+ Hemi: 12e3,
47
+ Lisk: 2e3
48
+ };
49
+ const DEFAULT_DURATION = 12e3;
31
50
  const BLOCK_DURATION = Object.values(CHAINS).reduce(
32
51
  (acc, chain) => {
33
- const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || 0;
34
- if (blockTime === 0)
52
+ if (!chain.blockTime || chain.blockTime === 0)
35
53
  console.error(`Block time for ${chain.name} is unknown`);
54
+ const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || DEFAULT_DURATION;
36
55
  acc[chain.network] = blockTime / 1e3;
37
56
  return acc;
38
57
  },
@@ -41,7 +60,9 @@ const BLOCK_DURATION = Object.values(CHAINS).reduce(
41
60
  const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
42
61
  const RAMP_DURATION_BY_NETWORK = TypedObjectUtils.entries(BLOCK_DURATION).reduce(
43
62
  (acc, [n, duration]) => {
44
- acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
63
+ if (duration !== 0) {
64
+ acc[n] = BigInt(Math.floor(RAMP_TIME / duration));
65
+ }
45
66
  return acc;
46
67
  },
47
68
  {}
@@ -9,6 +9,7 @@ export * from "./gauges/index.js";
9
9
  export * from "./market/index.js";
10
10
  export * from "./options.js";
11
11
  export * from "./plugins/index.js";
12
+ export * from "./poolMigration/index.js";
12
13
  export * from "./router/index.js";
13
14
  export * from "./sdk-gov-legacy/index.js";
14
15
  export * from "./sdk-legacy/index.js";
@@ -0,0 +1,31 @@
1
+ const POOL_DELAYED_MIGRATION_CONTRACTS = {
2
+ Mainnet: [
3
+ {
4
+ // TODO: fix address
5
+ address: "0xc155444481854c60e7a29f4150373f479988f32d",
6
+ // "dUSDCV3" "Trade USDC v3"
7
+ poolIn: "0xda00000035fef4082f78def6a8903bee419fbf8e",
8
+ // "USDC" "invariant"
9
+ poolOut: "0xc155444481854c60e7a29f4150373f479988f32d"
10
+ },
11
+ {
12
+ // TODO: fix address
13
+ address: "0xf0795c47fa58d00f5f77f4d5c01f31ee891e21b4",
14
+ // "dUSDCV3" "Trade USDC v3"
15
+ poolIn: "0xda00000035fef4082f78def6a8903bee419fbf8e",
16
+ // "USDC" "tulipa"
17
+ poolOut: "0xf0795c47fa58d00f5f77f4d5c01f31ee891e21b4"
18
+ },
19
+ {
20
+ // TODO: fix address
21
+ address: "0xf00b548f1b69cb5ee559d891e03a196fb5101d4a",
22
+ // "dWETHV3" "Trade WETH v3"
23
+ poolIn: "0xda0002859b2d05f66a753d8241fcde8623f26f4f",
24
+ // "dWETHV3-cp0x" "Gearbox WETH v3"
25
+ poolOut: "0xf00b548f1b69cb5ee559d891e03a196fb5101d4a"
26
+ }
27
+ ]
28
+ };
29
+ export {
30
+ POOL_DELAYED_MIGRATION_CONTRACTS
31
+ };
@@ -9,6 +9,7 @@ export * from "./gauges/index.js";
9
9
  export * from "./market/index.js";
10
10
  export * from "./options.js";
11
11
  export * from "./plugins/index.js";
12
+ export * from "./poolMigration/index.js";
12
13
  export * from "./router/index.js";
13
14
  export * from "./sdk-gov-legacy/index.js";
14
15
  export * from "./sdk-legacy/index.js";
@@ -0,0 +1,11 @@
1
+ import type { Address } from "abitype";
2
+ import type { NetworkType } from "../chain/chains.js";
3
+ export interface PoolMigrationContract {
4
+ address: Address;
5
+ poolIn: Address;
6
+ poolOut: Address;
7
+ }
8
+ /**
9
+ * Temporary contracts
10
+ */
11
+ export declare const POOL_DELAYED_MIGRATION_CONTRACTS: Partial<Record<NetworkType, PoolMigrationContract[]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.29.0",
3
+ "version": "8.30.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",