@gearbox-protocol/sdk 8.29.1 → 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.
- package/dist/cjs/plugins/zappers/ZappersPlugin.js +2 -1
- package/dist/cjs/sdk/constants/networks.js +3 -2
- package/dist/cjs/sdk/index.js +2 -0
- package/dist/cjs/sdk/poolMigration/index.js +55 -0
- package/dist/esm/plugins/zappers/ZappersPlugin.js +2 -1
- package/dist/esm/sdk/constants/networks.js +3 -2
- package/dist/esm/sdk/index.js +1 -0
- package/dist/esm/sdk/poolMigration/index.js +31 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/poolMigration/index.d.ts +11 -0
- package/package.json +1 -1
|
@@ -93,7 +93,8 @@ class ZappersPlugin extends import_sdk.BasePlugin {
|
|
|
93
93
|
}
|
|
94
94
|
get extraZappers() {
|
|
95
95
|
if (!this.#extraZappers) {
|
|
96
|
-
|
|
96
|
+
console.error("extra zappers not attached");
|
|
97
|
+
return new import_sdk.AddressMap();
|
|
97
98
|
}
|
|
98
99
|
return this.#extraZappers;
|
|
99
100
|
}
|
|
@@ -71,11 +71,12 @@ const BLOCK_DURATION_LOCAL = {
|
|
|
71
71
|
Hemi: 12e3,
|
|
72
72
|
Lisk: 2e3
|
|
73
73
|
};
|
|
74
|
+
const DEFAULT_DURATION = 12e3;
|
|
74
75
|
const BLOCK_DURATION = Object.values(import_chain.chains).reduce(
|
|
75
76
|
(acc, chain) => {
|
|
76
|
-
|
|
77
|
-
if (blockTime === 0)
|
|
77
|
+
if (!chain.blockTime || chain.blockTime === 0)
|
|
78
78
|
console.error(`Block time for ${chain.name} is unknown`);
|
|
79
|
+
const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || DEFAULT_DURATION;
|
|
79
80
|
acc[chain.network] = blockTime / 1e3;
|
|
80
81
|
return acc;
|
|
81
82
|
},
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -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
|
-
|
|
79
|
+
console.error("extra zappers not attached");
|
|
80
|
+
return new AddressMap();
|
|
80
81
|
}
|
|
81
82
|
return this.#extraZappers;
|
|
82
83
|
}
|
|
@@ -46,11 +46,12 @@ const BLOCK_DURATION_LOCAL = {
|
|
|
46
46
|
Hemi: 12e3,
|
|
47
47
|
Lisk: 2e3
|
|
48
48
|
};
|
|
49
|
+
const DEFAULT_DURATION = 12e3;
|
|
49
50
|
const BLOCK_DURATION = Object.values(CHAINS).reduce(
|
|
50
51
|
(acc, chain) => {
|
|
51
|
-
|
|
52
|
-
if (blockTime === 0)
|
|
52
|
+
if (!chain.blockTime || chain.blockTime === 0)
|
|
53
53
|
console.error(`Block time for ${chain.name} is unknown`);
|
|
54
|
+
const blockTime = chain.blockTime || BLOCK_DURATION_LOCAL[chain.network] || DEFAULT_DURATION;
|
|
54
55
|
acc[chain.network] = blockTime / 1e3;
|
|
55
56
|
return acc;
|
|
56
57
|
},
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -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[]>>;
|