@gearbox-protocol/sdk 13.4.0-beta.3 → 13.5.0-kyc.1
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/abi/310/iSecuritizeDegenNFT.js +263 -0
- package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +278 -0
- package/dist/cjs/{sdk/pools/PoolServiceV310.js → abi/iStateSerializer.js} +14 -8
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +411 -27
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +255 -32
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/{constants/phantom-tokens.js → base/token-types.js} +9 -3
- package/dist/cjs/sdk/chain/chains.js +2 -1
- package/dist/cjs/sdk/constants/index.js +0 -2
- package/dist/cjs/sdk/market/MarketRegister.js +5 -2
- package/dist/cjs/sdk/market/MarketSuite.js +6 -0
- package/dist/cjs/{plugins/zappers/extraZappers.js → sdk/market/ZapperRegister.js} +110 -6
- package/dist/cjs/sdk/market/index.js +3 -1
- package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +97 -0
- package/dist/cjs/sdk/market/pool/index.js +4 -0
- package/dist/cjs/sdk/pools/PoolService.js +391 -0
- package/dist/cjs/sdk/pools/index.js +2 -4
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/abi/310/iSecuritizeDegenNFT.js +239 -0
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +254 -0
- package/dist/esm/abi/iStateSerializer.js +12 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +411 -27
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +261 -32
- package/dist/esm/sdk/base/index.js +1 -0
- package/dist/esm/sdk/{constants/phantom-tokens.js → base/token-types.js} +4 -0
- package/dist/esm/sdk/chain/chains.js +2 -1
- package/dist/esm/sdk/constants/index.js +0 -1
- package/dist/esm/sdk/market/MarketRegister.js +5 -2
- package/dist/esm/sdk/market/MarketSuite.js +6 -0
- package/dist/esm/{plugins/zappers/extraZappers.js → sdk/market/ZapperRegister.js} +109 -2
- package/dist/esm/sdk/market/index.js +1 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +73 -0
- package/dist/esm/sdk/market/pool/index.js +2 -0
- package/dist/esm/sdk/pools/PoolService.js +371 -0
- package/dist/esm/sdk/pools/index.js +1 -2
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +324 -0
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +322 -0
- package/dist/types/abi/iStateSerializer.d.ts +11 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +115 -4
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +107 -7
- package/dist/types/sdk/base/TokensMeta.d.ts +34 -21
- package/dist/types/sdk/base/index.d.ts +1 -0
- package/dist/types/sdk/base/token-types.d.ts +33 -0
- package/dist/types/sdk/base/types.d.ts +0 -7
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/constants/index.d.ts +0 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/MarketSuite.d.ts +3 -0
- package/dist/types/sdk/market/ZapperRegister.d.ts +17 -0
- package/dist/types/sdk/market/index.d.ts +1 -0
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
- package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +345 -0
- package/dist/types/sdk/market/pool/index.d.ts +2 -0
- package/dist/types/sdk/market/types.d.ts +10 -0
- package/dist/types/sdk/pools/PoolService.d.ts +14 -0
- package/dist/types/sdk/pools/index.d.ts +1 -2
- package/dist/types/sdk/pools/types.d.ts +85 -111
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +1 -1
- package/dist/cjs/plugins/zappers/ZappersPlugin.js +0 -144
- package/dist/cjs/plugins/zappers/index.js +0 -26
- package/dist/cjs/plugins/zappers/package.json +0 -1
- package/dist/cjs/sdk/pools/AbstractPoolService.js +0 -143
- package/dist/cjs/sdk/pools/createPoolService.js +0 -35
- package/dist/esm/plugins/zappers/ZappersPlugin.js +0 -126
- package/dist/esm/plugins/zappers/index.js +0 -3
- package/dist/esm/plugins/zappers/package.json +0 -1
- package/dist/esm/sdk/pools/AbstractPoolService.js +0 -119
- package/dist/esm/sdk/pools/PoolServiceV310.js +0 -6
- package/dist/esm/sdk/pools/createPoolService.js +0 -11
- package/dist/types/plugins/zappers/ZappersPlugin.d.ts +0 -18
- package/dist/types/plugins/zappers/extraZappers.d.ts +0 -6
- package/dist/types/plugins/zappers/index.d.ts +0 -3
- package/dist/types/plugins/zappers/types.d.ts +0 -12
- package/dist/types/sdk/constants/phantom-tokens.d.ts +0 -2
- package/dist/types/sdk/pools/AbstractPoolService.d.ts +0 -21
- package/dist/types/sdk/pools/PoolServiceV310.d.ts +0 -4
- package/dist/types/sdk/pools/createPoolService.d.ts +0 -3
- /package/dist/cjs/{plugins/zappers → sdk/market}/types.js +0 -0
- /package/dist/esm/{plugins/zappers → sdk/market}/types.js +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ConstructOptions } from "../../base/index.js";
|
|
3
|
+
import { BaseContract } from "../../base/index.js";
|
|
4
|
+
import type { MultiCall, RawTx } from "../../types/index.js";
|
|
5
|
+
declare const abi: readonly [{
|
|
6
|
+
readonly type: "function";
|
|
7
|
+
readonly name: "contractType";
|
|
8
|
+
readonly inputs: readonly [];
|
|
9
|
+
readonly outputs: readonly [{
|
|
10
|
+
readonly name: "";
|
|
11
|
+
readonly type: "bytes32";
|
|
12
|
+
readonly internalType: "bytes32";
|
|
13
|
+
}];
|
|
14
|
+
readonly stateMutability: "view";
|
|
15
|
+
}, {
|
|
16
|
+
readonly type: "function";
|
|
17
|
+
readonly name: "getCreditAccounts";
|
|
18
|
+
readonly inputs: readonly [{
|
|
19
|
+
readonly name: "investor";
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
readonly internalType: "address";
|
|
22
|
+
}];
|
|
23
|
+
readonly outputs: readonly [{
|
|
24
|
+
readonly name: "";
|
|
25
|
+
readonly type: "address[]";
|
|
26
|
+
readonly internalType: "address[]";
|
|
27
|
+
}];
|
|
28
|
+
readonly stateMutability: "view";
|
|
29
|
+
}, {
|
|
30
|
+
readonly type: "function";
|
|
31
|
+
readonly name: "getDegenNFT";
|
|
32
|
+
readonly inputs: readonly [];
|
|
33
|
+
readonly outputs: readonly [{
|
|
34
|
+
readonly name: "";
|
|
35
|
+
readonly type: "address";
|
|
36
|
+
readonly internalType: "address";
|
|
37
|
+
}];
|
|
38
|
+
readonly stateMutability: "view";
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "function";
|
|
41
|
+
readonly name: "getInvestor";
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly name: "creditAccount";
|
|
44
|
+
readonly type: "address";
|
|
45
|
+
readonly internalType: "address";
|
|
46
|
+
}];
|
|
47
|
+
readonly outputs: readonly [{
|
|
48
|
+
readonly name: "";
|
|
49
|
+
readonly type: "address";
|
|
50
|
+
readonly internalType: "address";
|
|
51
|
+
}];
|
|
52
|
+
readonly stateMutability: "view";
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "function";
|
|
55
|
+
readonly name: "getWallet";
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly name: "creditAccount";
|
|
58
|
+
readonly type: "address";
|
|
59
|
+
readonly internalType: "address";
|
|
60
|
+
}];
|
|
61
|
+
readonly outputs: readonly [{
|
|
62
|
+
readonly name: "";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
readonly internalType: "address";
|
|
65
|
+
}];
|
|
66
|
+
readonly stateMutability: "view";
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
readonly name: "isCreditAccount";
|
|
70
|
+
readonly inputs: readonly [{
|
|
71
|
+
readonly name: "creditAccount";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
readonly internalType: "address";
|
|
74
|
+
}];
|
|
75
|
+
readonly outputs: readonly [{
|
|
76
|
+
readonly name: "";
|
|
77
|
+
readonly type: "bool";
|
|
78
|
+
readonly internalType: "bool";
|
|
79
|
+
}];
|
|
80
|
+
readonly stateMutability: "view";
|
|
81
|
+
}, {
|
|
82
|
+
readonly type: "function";
|
|
83
|
+
readonly name: "isFrozen";
|
|
84
|
+
readonly inputs: readonly [{
|
|
85
|
+
readonly name: "creditAccount";
|
|
86
|
+
readonly type: "address";
|
|
87
|
+
readonly internalType: "address";
|
|
88
|
+
}];
|
|
89
|
+
readonly outputs: readonly [{
|
|
90
|
+
readonly name: "";
|
|
91
|
+
readonly type: "bool";
|
|
92
|
+
readonly internalType: "bool";
|
|
93
|
+
}];
|
|
94
|
+
readonly stateMutability: "view";
|
|
95
|
+
}, {
|
|
96
|
+
readonly type: "function";
|
|
97
|
+
readonly name: "multicall";
|
|
98
|
+
readonly inputs: readonly [{
|
|
99
|
+
readonly name: "creditAccount";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
readonly internalType: "address";
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "calls";
|
|
104
|
+
readonly type: "tuple[]";
|
|
105
|
+
readonly internalType: "struct MultiCall[]";
|
|
106
|
+
readonly components: readonly [{
|
|
107
|
+
readonly name: "target";
|
|
108
|
+
readonly type: "address";
|
|
109
|
+
readonly internalType: "address";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "callData";
|
|
112
|
+
readonly type: "bytes";
|
|
113
|
+
readonly internalType: "bytes";
|
|
114
|
+
}];
|
|
115
|
+
}, {
|
|
116
|
+
readonly name: "tokensToRegister";
|
|
117
|
+
readonly type: "address[]";
|
|
118
|
+
readonly internalType: "address[]";
|
|
119
|
+
}];
|
|
120
|
+
readonly outputs: readonly [];
|
|
121
|
+
readonly stateMutability: "nonpayable";
|
|
122
|
+
}, {
|
|
123
|
+
readonly type: "function";
|
|
124
|
+
readonly name: "openCreditAccount";
|
|
125
|
+
readonly inputs: readonly [{
|
|
126
|
+
readonly name: "creditManager";
|
|
127
|
+
readonly type: "address";
|
|
128
|
+
readonly internalType: "address";
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "calls";
|
|
131
|
+
readonly type: "tuple[]";
|
|
132
|
+
readonly internalType: "struct MultiCall[]";
|
|
133
|
+
readonly components: readonly [{
|
|
134
|
+
readonly name: "target";
|
|
135
|
+
readonly type: "address";
|
|
136
|
+
readonly internalType: "address";
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "callData";
|
|
139
|
+
readonly type: "bytes";
|
|
140
|
+
readonly internalType: "bytes";
|
|
141
|
+
}];
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "tokensToRegister";
|
|
144
|
+
readonly type: "address[]";
|
|
145
|
+
readonly internalType: "address[]";
|
|
146
|
+
}];
|
|
147
|
+
readonly outputs: readonly [{
|
|
148
|
+
readonly name: "creditAccount";
|
|
149
|
+
readonly type: "address";
|
|
150
|
+
readonly internalType: "address";
|
|
151
|
+
}, {
|
|
152
|
+
readonly name: "wallet";
|
|
153
|
+
readonly type: "address";
|
|
154
|
+
readonly internalType: "address";
|
|
155
|
+
}];
|
|
156
|
+
readonly stateMutability: "nonpayable";
|
|
157
|
+
}, {
|
|
158
|
+
readonly type: "function";
|
|
159
|
+
readonly name: "precomputeWalletAddress";
|
|
160
|
+
readonly inputs: readonly [{
|
|
161
|
+
readonly name: "creditManager";
|
|
162
|
+
readonly type: "address";
|
|
163
|
+
readonly internalType: "address";
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "investor";
|
|
166
|
+
readonly type: "address";
|
|
167
|
+
readonly internalType: "address";
|
|
168
|
+
}];
|
|
169
|
+
readonly outputs: readonly [{
|
|
170
|
+
readonly name: "";
|
|
171
|
+
readonly type: "address";
|
|
172
|
+
readonly internalType: "address";
|
|
173
|
+
}];
|
|
174
|
+
readonly stateMutability: "view";
|
|
175
|
+
}, {
|
|
176
|
+
readonly type: "function";
|
|
177
|
+
readonly name: "serialize";
|
|
178
|
+
readonly inputs: readonly [];
|
|
179
|
+
readonly outputs: readonly [{
|
|
180
|
+
readonly name: "serializedData";
|
|
181
|
+
readonly type: "bytes";
|
|
182
|
+
readonly internalType: "bytes";
|
|
183
|
+
}];
|
|
184
|
+
readonly stateMutability: "view";
|
|
185
|
+
}, {
|
|
186
|
+
readonly type: "function";
|
|
187
|
+
readonly name: "setFrozenStatus";
|
|
188
|
+
readonly inputs: readonly [{
|
|
189
|
+
readonly name: "creditAccount";
|
|
190
|
+
readonly type: "address";
|
|
191
|
+
readonly internalType: "address";
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "frozen";
|
|
194
|
+
readonly type: "bool";
|
|
195
|
+
readonly internalType: "bool";
|
|
196
|
+
}];
|
|
197
|
+
readonly outputs: readonly [];
|
|
198
|
+
readonly stateMutability: "nonpayable";
|
|
199
|
+
}, {
|
|
200
|
+
readonly type: "function";
|
|
201
|
+
readonly name: "setInvestor";
|
|
202
|
+
readonly inputs: readonly [{
|
|
203
|
+
readonly name: "creditAccount";
|
|
204
|
+
readonly type: "address";
|
|
205
|
+
readonly internalType: "address";
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "investor";
|
|
208
|
+
readonly type: "address";
|
|
209
|
+
readonly internalType: "address";
|
|
210
|
+
}];
|
|
211
|
+
readonly outputs: readonly [];
|
|
212
|
+
readonly stateMutability: "nonpayable";
|
|
213
|
+
}, {
|
|
214
|
+
readonly type: "function";
|
|
215
|
+
readonly name: "version";
|
|
216
|
+
readonly inputs: readonly [];
|
|
217
|
+
readonly outputs: readonly [{
|
|
218
|
+
readonly name: "";
|
|
219
|
+
readonly type: "uint256";
|
|
220
|
+
readonly internalType: "uint256";
|
|
221
|
+
}];
|
|
222
|
+
readonly stateMutability: "view";
|
|
223
|
+
}, {
|
|
224
|
+
readonly type: "event";
|
|
225
|
+
readonly name: "CreateWallet";
|
|
226
|
+
readonly inputs: readonly [{
|
|
227
|
+
readonly name: "creditAccount";
|
|
228
|
+
readonly type: "address";
|
|
229
|
+
readonly indexed: true;
|
|
230
|
+
readonly internalType: "address";
|
|
231
|
+
}, {
|
|
232
|
+
readonly name: "wallet";
|
|
233
|
+
readonly type: "address";
|
|
234
|
+
readonly indexed: true;
|
|
235
|
+
readonly internalType: "address";
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "investor";
|
|
238
|
+
readonly type: "address";
|
|
239
|
+
readonly indexed: true;
|
|
240
|
+
readonly internalType: "address";
|
|
241
|
+
}];
|
|
242
|
+
readonly anonymous: false;
|
|
243
|
+
}, {
|
|
244
|
+
readonly type: "event";
|
|
245
|
+
readonly name: "SetFrozenStatus";
|
|
246
|
+
readonly inputs: readonly [{
|
|
247
|
+
readonly name: "creditAccount";
|
|
248
|
+
readonly type: "address";
|
|
249
|
+
readonly indexed: true;
|
|
250
|
+
readonly internalType: "address";
|
|
251
|
+
}, {
|
|
252
|
+
readonly name: "frozen";
|
|
253
|
+
readonly type: "bool";
|
|
254
|
+
readonly indexed: false;
|
|
255
|
+
readonly internalType: "bool";
|
|
256
|
+
}];
|
|
257
|
+
readonly anonymous: false;
|
|
258
|
+
}, {
|
|
259
|
+
readonly type: "event";
|
|
260
|
+
readonly name: "SetInvestor";
|
|
261
|
+
readonly inputs: readonly [{
|
|
262
|
+
readonly name: "creditAccount";
|
|
263
|
+
readonly type: "address";
|
|
264
|
+
readonly indexed: true;
|
|
265
|
+
readonly internalType: "address";
|
|
266
|
+
}, {
|
|
267
|
+
readonly name: "oldInvestor";
|
|
268
|
+
readonly type: "address";
|
|
269
|
+
readonly indexed: true;
|
|
270
|
+
readonly internalType: "address";
|
|
271
|
+
}, {
|
|
272
|
+
readonly name: "newInvestor";
|
|
273
|
+
readonly type: "address";
|
|
274
|
+
readonly indexed: true;
|
|
275
|
+
readonly internalType: "address";
|
|
276
|
+
}];
|
|
277
|
+
readonly anonymous: false;
|
|
278
|
+
}, {
|
|
279
|
+
readonly type: "error";
|
|
280
|
+
readonly name: "CallerIsNotInvestorException";
|
|
281
|
+
readonly inputs: readonly [{
|
|
282
|
+
readonly name: "caller";
|
|
283
|
+
readonly type: "address";
|
|
284
|
+
readonly internalType: "address";
|
|
285
|
+
}, {
|
|
286
|
+
readonly name: "creditAccount";
|
|
287
|
+
readonly type: "address";
|
|
288
|
+
readonly internalType: "address";
|
|
289
|
+
}];
|
|
290
|
+
}, {
|
|
291
|
+
readonly type: "error";
|
|
292
|
+
readonly name: "FrozenCreditAccountException";
|
|
293
|
+
readonly inputs: readonly [{
|
|
294
|
+
readonly name: "creditAccount";
|
|
295
|
+
readonly type: "address";
|
|
296
|
+
readonly internalType: "address";
|
|
297
|
+
}];
|
|
298
|
+
}, {
|
|
299
|
+
readonly type: "error";
|
|
300
|
+
readonly name: "InvalidCreditManagerException";
|
|
301
|
+
readonly inputs: readonly [{
|
|
302
|
+
readonly name: "creditManager";
|
|
303
|
+
readonly type: "address";
|
|
304
|
+
readonly internalType: "address";
|
|
305
|
+
}];
|
|
306
|
+
}, {
|
|
307
|
+
readonly type: "error";
|
|
308
|
+
readonly name: "InvalidUnderlyingTokenException";
|
|
309
|
+
readonly inputs: readonly [{
|
|
310
|
+
readonly name: "underlying";
|
|
311
|
+
readonly type: "address";
|
|
312
|
+
readonly internalType: "address";
|
|
313
|
+
}];
|
|
314
|
+
}, {
|
|
315
|
+
readonly type: "error";
|
|
316
|
+
readonly name: "UnknownCreditAccountException";
|
|
317
|
+
readonly inputs: readonly [{
|
|
318
|
+
readonly name: "creditAccount";
|
|
319
|
+
readonly type: "address";
|
|
320
|
+
readonly internalType: "address";
|
|
321
|
+
}];
|
|
322
|
+
}, {
|
|
323
|
+
readonly type: "error";
|
|
324
|
+
readonly name: "ZeroAddressException";
|
|
325
|
+
readonly inputs: readonly [];
|
|
326
|
+
}];
|
|
327
|
+
type abi = typeof abi;
|
|
328
|
+
export declare class SecuritizeKYCFactory extends BaseContract<abi> {
|
|
329
|
+
#private;
|
|
330
|
+
private investorCache;
|
|
331
|
+
constructor(options: ConstructOptions, address: Address);
|
|
332
|
+
precomputeWalletAddress(creditManager: Address, investor: Address): Promise<Address>;
|
|
333
|
+
getWallet(creditAccount: Address): Promise<Address>;
|
|
334
|
+
/**
|
|
335
|
+
* Returns the investor address for a credit account.
|
|
336
|
+
* @param creditAccount - Credit account address
|
|
337
|
+
* @param fromCache - If true, use and update an in-memory cache (creditAccount -> investor). On cache miss, loads from contract and stores the result for future calls.
|
|
338
|
+
*/
|
|
339
|
+
getInvestor(creditAccount: Address, fromCache?: boolean): Promise<Address>;
|
|
340
|
+
getDSTokens(): Promise<Address[]>;
|
|
341
|
+
multicall(creditAccount: Address, calls: MultiCall[], tokensToRegister: Address[]): RawTx;
|
|
342
|
+
openCreditAccount(creditManager: Address, calls: MultiCall[], tokensToRegister: Address[]): RawTx;
|
|
343
|
+
getDegenNFT(): Promise<Address>;
|
|
344
|
+
}
|
|
345
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
4
|
+
import type { Unarray } from "../base/index.js";
|
|
5
|
+
type CompressorZapperData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof peripheryCompressorAbi, "getZappers">["outputs"]>>;
|
|
6
|
+
export interface ZapperData extends CompressorZapperData {
|
|
7
|
+
pool: Address;
|
|
8
|
+
type: "migration" | "kyc" | "base";
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import { SDKConstruct } from "../base/index.js";
|
|
3
|
+
import type { AddLiquidityProps, DepositMetadata, IPoolsService, PoolServiceCall, RemoveLiquidityProps, WithdrawalMetadata } from "./types.js";
|
|
4
|
+
export declare class PoolService extends SDKConstruct implements IPoolsService {
|
|
5
|
+
#private;
|
|
6
|
+
getDepositTokensIn(pool: Address): Address[];
|
|
7
|
+
getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
8
|
+
getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
|
|
9
|
+
addLiquidity(props: AddLiquidityProps): PoolServiceCall | undefined;
|
|
10
|
+
getWithdrawalTokensIn(pool: Address): Address[];
|
|
11
|
+
getWithdrawalTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
12
|
+
removeLiquidity(props: RemoveLiquidityProps): PoolServiceCall;
|
|
13
|
+
getWithdrawalMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): WithdrawalMetadata;
|
|
14
|
+
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
|
|
5
|
-
import type { iZapperAbi } from "../../abi/iZapper.js";
|
|
1
|
+
import type { Abi } from "abitype";
|
|
2
|
+
import type { Address, ContractFunctionArgs, ContractFunctionName } from "viem";
|
|
3
|
+
import type { ZapperData } from "../market/index.js";
|
|
6
4
|
import type { Asset } from "../router/index.js";
|
|
7
|
-
interface IZapper {
|
|
8
|
-
zapper: Address;
|
|
9
|
-
tokenIn: Address;
|
|
10
|
-
tokenOut: Address;
|
|
11
|
-
}
|
|
12
5
|
interface PermitResult {
|
|
13
6
|
r: Address;
|
|
14
7
|
s: Address;
|
|
@@ -20,14 +13,13 @@ interface PermitResult {
|
|
|
20
13
|
deadline: bigint;
|
|
21
14
|
nonce: bigint;
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**/
|
|
16
|
+
export type PoolServiceCall<abi extends Abi | readonly unknown[] = Abi, functionName extends ContractFunctionName<abi, "nonpayable" | "payable"> = ContractFunctionName<abi, "nonpayable" | "payable">, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName> = ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>> = {
|
|
17
|
+
abi: abi;
|
|
18
|
+
functionName: functionName;
|
|
19
|
+
args: args;
|
|
20
|
+
target: Address;
|
|
21
|
+
value?: bigint;
|
|
22
|
+
};
|
|
31
23
|
export interface AddLiquidityProps {
|
|
32
24
|
/**
|
|
33
25
|
* Token and amount to deposit.
|
|
@@ -37,61 +29,11 @@ export interface AddLiquidityProps {
|
|
|
37
29
|
* Address of the Gearbox lending pool.
|
|
38
30
|
**/
|
|
39
31
|
pool: Address;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Whether this deposit is part of a pool migration.
|
|
46
|
-
* When `true`, a zapper is required.
|
|
47
|
-
**/
|
|
48
|
-
migrate: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Optional zapper to route the deposit through.
|
|
51
|
-
**/
|
|
52
|
-
zapper: IZapper | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Optional ERC-2612 permit for gasless token approval.
|
|
55
|
-
**/
|
|
56
|
-
permit: PermitResult | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Address of the chain's native-token wrapper (e.g. WETH).
|
|
59
|
-
**/
|
|
60
|
-
nativeTokenAddress: Address;
|
|
61
|
-
/**
|
|
62
|
-
* Optional referral code for tracking the deposit source.
|
|
63
|
-
**/
|
|
64
|
-
referralCode: bigint | undefined;
|
|
32
|
+
wallet: Address;
|
|
33
|
+
meta: DepositMetadata;
|
|
34
|
+
permit?: PermitResult;
|
|
35
|
+
referralCode?: bigint;
|
|
65
36
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Tuple describing a single contract call to execute an add-liquidity
|
|
68
|
-
* operation. The exact variant depends on whether a zapper and/or
|
|
69
|
-
* permit is used.
|
|
70
|
-
**/
|
|
71
|
-
export type AddLiquidityCall = [
|
|
72
|
-
{
|
|
73
|
-
target: Address;
|
|
74
|
-
abi: typeof iethZapperDepositsAbi;
|
|
75
|
-
functionName: "depositWithReferral";
|
|
76
|
-
args: [Address, bigint];
|
|
77
|
-
value: bigint;
|
|
78
|
-
} | {
|
|
79
|
-
target: Address;
|
|
80
|
-
abi: typeof ierc20ZapperDepositsAbi;
|
|
81
|
-
functionName: "depositWithReferralAndPermit";
|
|
82
|
-
args: [bigint, Address, bigint, bigint, number, Address, Address];
|
|
83
|
-
} | {
|
|
84
|
-
target: Address;
|
|
85
|
-
abi: typeof ierc20ZapperDepositsAbi;
|
|
86
|
-
functionName: "depositWithReferral";
|
|
87
|
-
args: [bigint, Address, bigint];
|
|
88
|
-
} | {
|
|
89
|
-
target: Address;
|
|
90
|
-
abi: typeof iPoolV310Abi;
|
|
91
|
-
functionName: "depositWithReferral";
|
|
92
|
-
args: [bigint, Address, bigint];
|
|
93
|
-
}
|
|
94
|
-
];
|
|
95
37
|
/**
|
|
96
38
|
* Parameters for withdrawing liquidity from a Gearbox lending pool.
|
|
97
39
|
*
|
|
@@ -107,59 +49,91 @@ export interface RemoveLiquidityProps {
|
|
|
107
49
|
* Amount of pool shares (diesel tokens) to redeem.
|
|
108
50
|
**/
|
|
109
51
|
amount: bigint;
|
|
52
|
+
wallet: Address;
|
|
53
|
+
permit: PermitResult | undefined;
|
|
54
|
+
meta: WithdrawalMetadata;
|
|
55
|
+
}
|
|
56
|
+
export interface DepositMetadata {
|
|
110
57
|
/**
|
|
111
|
-
*
|
|
112
|
-
|
|
113
|
-
|
|
58
|
+
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
59
|
+
*/
|
|
60
|
+
zapper?: ZapperData;
|
|
114
61
|
/**
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
62
|
+
* Before deposit user will nedd to call approve method on token that he wants to deposit,
|
|
63
|
+
* this is the spender address that will be used to call approve method.
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
approveTarget: Address;
|
|
118
67
|
/**
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
68
|
+
* If true, user can avoid approval step and deposit with permit
|
|
69
|
+
*/
|
|
70
|
+
permissible: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Type of deposit
|
|
73
|
+
*/
|
|
74
|
+
type: "kyc-on-demand" | "kyc-default" | "classic";
|
|
75
|
+
}
|
|
76
|
+
export interface WithdrawalMetadata {
|
|
77
|
+
/**
|
|
78
|
+
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
79
|
+
*/
|
|
80
|
+
zapper?: ZapperData;
|
|
81
|
+
/**
|
|
82
|
+
* Before deposit user will nedd to call approve method on token that he wants to deposit,
|
|
83
|
+
* this is the spender address that will be used to call approve method.
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
approveTarget?: Address;
|
|
87
|
+
/**
|
|
88
|
+
* If true, user can avoid approval step and deposit with permit
|
|
89
|
+
*/
|
|
90
|
+
permissible: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Type of deposit
|
|
93
|
+
*/
|
|
94
|
+
type: "kyc-on-demand" | "kyc-default" | "classic";
|
|
122
95
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Tuple describing a single contract call to execute a remove-liquidity
|
|
125
|
-
* operation. The exact variant depends on whether a permit is used and
|
|
126
|
-
* whether the withdrawal goes through a zapper or directly to the pool.
|
|
127
|
-
**/
|
|
128
|
-
export type RemoveLiquidityCall = [
|
|
129
|
-
{
|
|
130
|
-
target: Address;
|
|
131
|
-
abi: typeof iZapperAbi;
|
|
132
|
-
functionName: "redeemWithPermit";
|
|
133
|
-
args: [bigint, Address, bigint, number, Address, Address];
|
|
134
|
-
} | {
|
|
135
|
-
target: Address;
|
|
136
|
-
abi: typeof iZapperAbi;
|
|
137
|
-
functionName: "redeem";
|
|
138
|
-
args: [bigint, Address];
|
|
139
|
-
} | {
|
|
140
|
-
target: Address;
|
|
141
|
-
abi: typeof iPoolV310Abi;
|
|
142
|
-
functionName: "redeem";
|
|
143
|
-
args: [bigint, Address, Address];
|
|
144
|
-
}
|
|
145
|
-
];
|
|
146
96
|
/**
|
|
147
97
|
* Service interface for pool liquidity operations.
|
|
148
98
|
**/
|
|
149
99
|
export interface IPoolsService {
|
|
150
100
|
/**
|
|
151
|
-
*
|
|
101
|
+
* Returns list of tokens that can be deposited to a pool
|
|
102
|
+
* @param pool
|
|
103
|
+
*/
|
|
104
|
+
getDepositTokensIn(pool: Address): Address[];
|
|
105
|
+
/**
|
|
106
|
+
* Returns list of tokens that user can receive after depositing to a pool,
|
|
107
|
+
* depends on the pool type and the token being deposited (one of returned by {@link getDepositTokensIn}).
|
|
108
|
+
*
|
|
109
|
+
* Can return empty array if no tokens can be received (e.g. for KYC underlying on demand)
|
|
110
|
+
*
|
|
111
|
+
* @param pool
|
|
112
|
+
* @param tokenIn
|
|
113
|
+
*/
|
|
114
|
+
getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
115
|
+
/**
|
|
116
|
+
* After user chooses tokenIn from {@link getDepositTokensIn} and tokenOut from {@link getDepositTokensOut},
|
|
117
|
+
* this method returns metadata that will be used to perform the deposit.
|
|
152
118
|
*
|
|
119
|
+
* @param pool
|
|
120
|
+
* @param tokenIn
|
|
121
|
+
* @param tokenOut can be undefined if deposit is not resulting in a token out (e.g. for KYC underlying on demand)
|
|
122
|
+
*/
|
|
123
|
+
getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
|
|
124
|
+
/**
|
|
125
|
+
* Returns contract call parameters for adding liquidity to a pool
|
|
126
|
+
* Or undefined if no deposit action is required (e.g. for KYC underlying on demand)
|
|
153
127
|
* @param props - {@link AddLiquidityProps}
|
|
154
|
-
* @returns
|
|
155
|
-
|
|
156
|
-
addLiquidity(props: AddLiquidityProps):
|
|
128
|
+
* @returns - {@link AddLiquidityCall}
|
|
129
|
+
*/
|
|
130
|
+
addLiquidity(props: AddLiquidityProps): PoolServiceCall | undefined;
|
|
157
131
|
/**
|
|
158
132
|
* Construct a call to remove liquidity from a Gearbox lending pool.
|
|
159
133
|
*
|
|
160
134
|
* @param props - {@link RemoveLiquidityProps}
|
|
161
|
-
* @returns
|
|
162
|
-
|
|
163
|
-
removeLiquidity(props: RemoveLiquidityProps):
|
|
135
|
+
* @returns - {@link RemoveLiquidityCall}
|
|
136
|
+
*/
|
|
137
|
+
removeLiquidity(props: RemoveLiquidityProps): PoolServiceCall;
|
|
164
138
|
}
|
|
165
139
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Account, Chain, Client, SendTransactionRequest, SendTransactionReturnType, Transport } from "viem";
|
|
2
|
-
import { type SendTransactionParameters } from "viem/actions";
|
|
2
|
+
import { type EstimateGasParameters, type SendTransactionParameters } from "viem/actions";
|
|
3
3
|
import type { RawTx } from "../../types/index.js";
|
|
4
4
|
export type SendRawTxParameters<chain extends Chain, account extends Account | undefined, request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends Chain | undefined = undefined> = Omit<SendTransactionParameters<chain, account, chainOverride, request>, "data" | "to" | "value"> & {
|
|
5
5
|
tx: Pick<RawTx, "to" | "callData" | "value">;
|
|
6
6
|
};
|
|
7
7
|
export declare function sendRawTx<chain extends Chain, account extends Account | undefined, const request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends Chain | undefined>(client: Client<Transport, chain, account>, params: SendRawTxParameters<chain, account, request, chainOverride>): Promise<SendTransactionReturnType>;
|
|
8
|
+
export type EstimateRawTxGasParameters<chain extends Chain> = Omit<EstimateGasParameters<chain>, "data" | "to" | "value"> & {
|
|
9
|
+
tx: Pick<RawTx, "to" | "callData" | "value">;
|
|
10
|
+
};
|
|
11
|
+
export declare function estimateRawTxGas<chain extends Chain, account extends Account | undefined>(client: Client<Transport, chain, account>, params: EstimateRawTxGasParameters<chain>): Promise<bigint>;
|