@gearbox-protocol/sdk 11.8.8 → 11.8.9
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.
|
@@ -49,12 +49,19 @@ class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
|
49
49
|
this.#withdrawableAssets = new import_sdk.AddressMap(void 0, MAP_LABEL);
|
|
50
50
|
resp.forEach((r, index) => {
|
|
51
51
|
const cm = creditManagers[index];
|
|
52
|
-
if (r.status === "success") {
|
|
52
|
+
if (r.status === "success" && r.result?.length > 0) {
|
|
53
|
+
const configsToShow = r.result;
|
|
53
54
|
this.#withdrawableAssets?.upsert(
|
|
54
55
|
cm.creditManager.address,
|
|
55
|
-
|
|
56
|
+
configsToShow.map((cfg) => ({
|
|
56
57
|
...cfg,
|
|
57
|
-
creditManager: cm.creditManager.address
|
|
58
|
+
creditManager: cm.creditManager.address,
|
|
59
|
+
disabled: isConfigToOmit({
|
|
60
|
+
creditManager: cm.creditManager.address,
|
|
61
|
+
token: cfg.token,
|
|
62
|
+
withdrawalPhantomToken: cfg.withdrawalPhantomToken,
|
|
63
|
+
underlying: cfg.underlying
|
|
64
|
+
})
|
|
58
65
|
}))
|
|
59
66
|
);
|
|
60
67
|
} else {
|
|
@@ -99,6 +106,74 @@ class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
|
99
106
|
);
|
|
100
107
|
}
|
|
101
108
|
}
|
|
109
|
+
function getConfigKey(config) {
|
|
110
|
+
return `${config.creditManager}-${config.token}-${config.withdrawalPhantomToken}-${config.underlying}`.toLowerCase();
|
|
111
|
+
}
|
|
112
|
+
function isConfigToOmit(config) {
|
|
113
|
+
return !!CONFIGS_TO_OMIT_RECORD[getConfigKey(config)];
|
|
114
|
+
}
|
|
115
|
+
const CONFIGS_TO_OMIT_LIST = [
|
|
116
|
+
{
|
|
117
|
+
// checked
|
|
118
|
+
creditManager: "0xf5edc34204e67e592bdcb84114571c9e4bd0bdf7",
|
|
119
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
120
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
121
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
// checked
|
|
125
|
+
creditManager: "0xb79d6544839d169869476589d2e54014a074317b",
|
|
126
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
127
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
128
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
// checked
|
|
132
|
+
creditManager: "0x79c6c1ce5b12abcc3e407ce8c160ee1160250921",
|
|
133
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
134
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
135
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
// checked
|
|
139
|
+
creditManager: "0xc307a074bd5aec2d6ad1d9b74465c24a59b490fd",
|
|
140
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
141
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
142
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
// zero debt limit + no opened positions
|
|
146
|
+
creditManager: "0x9a0fdf7cdab4604fc27ebeab4b3d57bd825e8ebe",
|
|
147
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
148
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
149
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
// cant load
|
|
153
|
+
creditManager: "0x06c0df5ac1f24bc2097b59ed8ee1db86bf0b09df",
|
|
154
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
155
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
156
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
// cant load
|
|
160
|
+
creditManager: "0x1128860755c6d452d9326e35d1672ca7c920b7c1",
|
|
161
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
162
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
163
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
// cant load
|
|
167
|
+
creditManager: "0x35e154be3c856c37d539aae90178fe5ac6d37644",
|
|
168
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
169
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
170
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
const CONFIGS_TO_OMIT_RECORD = CONFIGS_TO_OMIT_LIST.reduce((acc, config) => {
|
|
174
|
+
acc[getConfigKey(config)] = config;
|
|
175
|
+
return acc;
|
|
176
|
+
}, {});
|
|
102
177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
103
178
|
0 && (module.exports = {
|
|
104
179
|
DelayedWithdrawalPlugin
|
|
@@ -30,12 +30,19 @@ class DelayedWithdrawalPlugin extends BasePlugin {
|
|
|
30
30
|
this.#withdrawableAssets = new AddressMap(void 0, MAP_LABEL);
|
|
31
31
|
resp.forEach((r, index) => {
|
|
32
32
|
const cm = creditManagers[index];
|
|
33
|
-
if (r.status === "success") {
|
|
33
|
+
if (r.status === "success" && r.result?.length > 0) {
|
|
34
|
+
const configsToShow = r.result;
|
|
34
35
|
this.#withdrawableAssets?.upsert(
|
|
35
36
|
cm.creditManager.address,
|
|
36
|
-
|
|
37
|
+
configsToShow.map((cfg) => ({
|
|
37
38
|
...cfg,
|
|
38
|
-
creditManager: cm.creditManager.address
|
|
39
|
+
creditManager: cm.creditManager.address,
|
|
40
|
+
disabled: isConfigToOmit({
|
|
41
|
+
creditManager: cm.creditManager.address,
|
|
42
|
+
token: cfg.token,
|
|
43
|
+
withdrawalPhantomToken: cfg.withdrawalPhantomToken,
|
|
44
|
+
underlying: cfg.underlying
|
|
45
|
+
})
|
|
39
46
|
}))
|
|
40
47
|
);
|
|
41
48
|
} else {
|
|
@@ -80,6 +87,74 @@ class DelayedWithdrawalPlugin extends BasePlugin {
|
|
|
80
87
|
);
|
|
81
88
|
}
|
|
82
89
|
}
|
|
90
|
+
function getConfigKey(config) {
|
|
91
|
+
return `${config.creditManager}-${config.token}-${config.withdrawalPhantomToken}-${config.underlying}`.toLowerCase();
|
|
92
|
+
}
|
|
93
|
+
function isConfigToOmit(config) {
|
|
94
|
+
return !!CONFIGS_TO_OMIT_RECORD[getConfigKey(config)];
|
|
95
|
+
}
|
|
96
|
+
const CONFIGS_TO_OMIT_LIST = [
|
|
97
|
+
{
|
|
98
|
+
// checked
|
|
99
|
+
creditManager: "0xf5edc34204e67e592bdcb84114571c9e4bd0bdf7",
|
|
100
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
101
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
102
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
// checked
|
|
106
|
+
creditManager: "0xb79d6544839d169869476589d2e54014a074317b",
|
|
107
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
108
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
109
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
// checked
|
|
113
|
+
creditManager: "0x79c6c1ce5b12abcc3e407ce8c160ee1160250921",
|
|
114
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
115
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
116
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
// checked
|
|
120
|
+
creditManager: "0xc307a074bd5aec2d6ad1d9b74465c24a59b490fd",
|
|
121
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
122
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
123
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
// zero debt limit + no opened positions
|
|
127
|
+
creditManager: "0x9a0fdf7cdab4604fc27ebeab4b3d57bd825e8ebe",
|
|
128
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
129
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
130
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
// cant load
|
|
134
|
+
creditManager: "0x06c0df5ac1f24bc2097b59ed8ee1db86bf0b09df",
|
|
135
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
136
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
137
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
// cant load
|
|
141
|
+
creditManager: "0x1128860755c6d452d9326e35d1672ca7c920b7c1",
|
|
142
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
143
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
144
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
// cant load
|
|
148
|
+
creditManager: "0x35e154be3c856c37d539aae90178fe5ac6d37644",
|
|
149
|
+
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
150
|
+
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
151
|
+
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
152
|
+
}
|
|
153
|
+
];
|
|
154
|
+
const CONFIGS_TO_OMIT_RECORD = CONFIGS_TO_OMIT_LIST.reduce((acc, config) => {
|
|
155
|
+
acc[getConfigKey(config)] = config;
|
|
156
|
+
return acc;
|
|
157
|
+
}, {});
|
|
83
158
|
export {
|
|
84
159
|
DelayedWithdrawalPlugin
|
|
85
160
|
};
|
|
@@ -4,6 +4,7 @@ import type { BaseContractStateHuman } from "../../sdk/index.js";
|
|
|
4
4
|
type WithdrawalCompressorV310InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV310Abi, PublicClient>;
|
|
5
5
|
export type WithdrawableAsset = Awaited<ReturnType<WithdrawalCompressorV310InstanceType["read"]["getWithdrawableAssets"]>>[number] & {
|
|
6
6
|
creditManager: Address;
|
|
7
|
+
disabled: boolean;
|
|
7
8
|
};
|
|
8
9
|
export interface WithdrawableAssetStateHuman extends WithdrawableAsset, BaseContractStateHuman {
|
|
9
10
|
}
|