@paxoslabs/amplify-sdk 0.5.2 → 0.5.3
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/{chain-utils-BdJecHBA.d.mts → chain-utils-5r2UnCDS.d.mts} +47 -1
- package/dist/{chain-utils-BdJecHBA.d.ts → chain-utils-5r2UnCDS.d.ts} +47 -1
- package/dist/{chunk-5OK753GA.js → chunk-4NQPS3JC.js} +470 -358
- package/dist/chunk-4NQPS3JC.js.map +1 -0
- package/dist/chunk-6JLKHV6O.js +128 -0
- package/dist/chunk-6JLKHV6O.js.map +1 -0
- package/dist/{chunk-NNDY5TID.js → chunk-FHE43NKY.js} +12 -12
- package/dist/{chunk-NNDY5TID.js.map → chunk-FHE43NKY.js.map} +1 -1
- package/dist/chunk-GOJQYEJQ.js +3212 -0
- package/dist/chunk-GOJQYEJQ.js.map +1 -0
- package/dist/{chunk-HU5CTL4C.mjs → chunk-LMNADWTH.mjs} +364 -253
- package/dist/chunk-LMNADWTH.mjs.map +1 -0
- package/dist/chunk-ODXJYXUH.mjs +3168 -0
- package/dist/chunk-ODXJYXUH.mjs.map +1 -0
- package/dist/{chunk-QZHI2T7O.mjs → chunk-QMFYPHX5.mjs} +280 -47
- package/dist/chunk-QMFYPHX5.mjs.map +1 -0
- package/dist/{chunk-Q5FXJU5Y.mjs → chunk-UY2WD7MF.mjs} +3 -3
- package/dist/{chunk-Q5FXJU5Y.mjs.map → chunk-UY2WD7MF.mjs.map} +1 -1
- package/dist/chunk-WD6QFSXZ.js +701 -0
- package/dist/chunk-WD6QFSXZ.js.map +1 -0
- package/dist/chunk-Y5LBT2WT.mjs +118 -0
- package/dist/chunk-Y5LBT2WT.mjs.map +1 -0
- package/dist/core.d.mts +50 -7
- package/dist/core.d.ts +50 -7
- package/dist/core.js +32 -16
- package/dist/core.mjs +4 -4
- package/dist/display.d.mts +211 -2
- package/dist/display.d.ts +211 -2
- package/dist/display.js +26 -10
- package/dist/display.mjs +4 -4
- package/dist/{index-DXXA8gEA.d.mts → index-D8RtV9cB.d.mts} +498 -410
- package/dist/{index-aE5lTOUH.d.ts → index-ev_V5sjt.d.ts} +498 -410
- package/dist/index.d.mts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +80 -60
- package/dist/index.mjs +5 -5
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +7 -7
- package/dist/utils.mjs +2 -2
- package/dist/vaults.d.mts +2 -2
- package/dist/vaults.d.ts +2 -2
- package/dist/vaults.js +25 -25
- package/dist/vaults.mjs +4 -4
- package/package.json +1 -1
- package/dist/chunk-5OK753GA.js.map +0 -1
- package/dist/chunk-7JQQ2TH4.mjs +0 -1231
- package/dist/chunk-7JQQ2TH4.mjs.map +0 -1
- package/dist/chunk-HU5CTL4C.mjs.map +0 -1
- package/dist/chunk-QZHI2T7O.mjs.map +0 -1
- package/dist/chunk-SWUG4PTB.js +0 -464
- package/dist/chunk-SWUG4PTB.js.map +0 -1
- package/dist/chunk-WK7EJRBB.mjs +0 -1482
- package/dist/chunk-WK7EJRBB.mjs.map +0 -1
- package/dist/chunk-WYBYBPX5.js +0 -1518
- package/dist/chunk-WYBYBPX5.js.map +0 -1
- package/dist/chunk-ZKDXRGI5.js +0 -1239
- package/dist/chunk-ZKDXRGI5.js.map +0 -1
|
@@ -0,0 +1,3212 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var viem = require('viem');
|
|
4
|
+
var chains = require('viem/chains');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
+
|
|
10
|
+
// src/abi/distributor-code-depositor-abi-v0.ts
|
|
11
|
+
var DistributorCodeDepositorAbiV0 = [
|
|
12
|
+
{
|
|
13
|
+
inputs: [
|
|
14
|
+
{
|
|
15
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
16
|
+
name: "_teller",
|
|
17
|
+
type: "address"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
internalType: "contract INativeWrapper",
|
|
21
|
+
name: "_nativeWrapper",
|
|
22
|
+
type: "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
internalType: "contract Authority",
|
|
26
|
+
name: "_rolesAuthority",
|
|
27
|
+
type: "address"
|
|
28
|
+
},
|
|
29
|
+
{ internalType: "bool", name: "_isNativeDepositSupported", type: "bool" },
|
|
30
|
+
{ internalType: "address", name: "_owner", type: "address" }
|
|
31
|
+
],
|
|
32
|
+
stateMutability: "nonpayable",
|
|
33
|
+
type: "constructor"
|
|
34
|
+
},
|
|
35
|
+
{ inputs: [], name: "IncorrectNativeDepositAmount", type: "error" },
|
|
36
|
+
{ inputs: [], name: "NativeDepositNotSupported", type: "error" },
|
|
37
|
+
{
|
|
38
|
+
inputs: [],
|
|
39
|
+
name: "NativeWrapperAccountantDecimalsMismatch",
|
|
40
|
+
type: "error"
|
|
41
|
+
},
|
|
42
|
+
{ inputs: [], name: "PermitFailedAndAllowanceTooLow", type: "error" },
|
|
43
|
+
{ inputs: [], name: "ZeroAddress", type: "error" },
|
|
44
|
+
{
|
|
45
|
+
anonymous: false,
|
|
46
|
+
inputs: [
|
|
47
|
+
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
48
|
+
{
|
|
49
|
+
indexed: true,
|
|
50
|
+
internalType: "contract Authority",
|
|
51
|
+
name: "newAuthority",
|
|
52
|
+
type: "address"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
name: "AuthorityUpdated",
|
|
56
|
+
type: "event"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
anonymous: false,
|
|
60
|
+
inputs: [
|
|
61
|
+
{
|
|
62
|
+
indexed: true,
|
|
63
|
+
internalType: "address",
|
|
64
|
+
name: "depositor",
|
|
65
|
+
type: "address"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
indexed: true,
|
|
69
|
+
internalType: "contract ERC20",
|
|
70
|
+
name: "depositAsset",
|
|
71
|
+
type: "address"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
indexed: false,
|
|
75
|
+
internalType: "uint256",
|
|
76
|
+
name: "depositAmount",
|
|
77
|
+
type: "uint256"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
indexed: false,
|
|
81
|
+
internalType: "uint256",
|
|
82
|
+
name: "minimumMint",
|
|
83
|
+
type: "uint256"
|
|
84
|
+
},
|
|
85
|
+
{ indexed: false, internalType: "address", name: "to", type: "address" },
|
|
86
|
+
{
|
|
87
|
+
indexed: false,
|
|
88
|
+
internalType: "bytes32",
|
|
89
|
+
name: "depositHash",
|
|
90
|
+
type: "bytes32"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
indexed: true,
|
|
94
|
+
internalType: "bytes",
|
|
95
|
+
name: "distributorCode",
|
|
96
|
+
type: "bytes"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
name: "DepositWithDistributorCode",
|
|
100
|
+
type: "event"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
anonymous: false,
|
|
104
|
+
inputs: [
|
|
105
|
+
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
106
|
+
{
|
|
107
|
+
indexed: true,
|
|
108
|
+
internalType: "address",
|
|
109
|
+
name: "newOwner",
|
|
110
|
+
type: "address"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
name: "OwnershipTransferred",
|
|
114
|
+
type: "event"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
inputs: [],
|
|
118
|
+
name: "authority",
|
|
119
|
+
outputs: [
|
|
120
|
+
{ internalType: "contract Authority", name: "", type: "address" }
|
|
121
|
+
],
|
|
122
|
+
stateMutability: "view",
|
|
123
|
+
type: "function"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
inputs: [],
|
|
127
|
+
name: "boringVault",
|
|
128
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
129
|
+
stateMutability: "view",
|
|
130
|
+
type: "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
inputs: [
|
|
134
|
+
{ internalType: "contract ERC20", name: "depositAsset", type: "address" },
|
|
135
|
+
{ internalType: "uint256", name: "depositAmount", type: "uint256" },
|
|
136
|
+
{ internalType: "uint256", name: "minimumMint", type: "uint256" },
|
|
137
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
138
|
+
{ internalType: "bytes", name: "distributorCode", type: "bytes" }
|
|
139
|
+
],
|
|
140
|
+
name: "deposit",
|
|
141
|
+
outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
|
|
142
|
+
stateMutability: "nonpayable",
|
|
143
|
+
type: "function"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
inputs: [
|
|
147
|
+
{ internalType: "uint256", name: "depositAmount", type: "uint256" },
|
|
148
|
+
{ internalType: "uint256", name: "minimumMint", type: "uint256" },
|
|
149
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
150
|
+
{ internalType: "bytes", name: "distributorCode", type: "bytes" }
|
|
151
|
+
],
|
|
152
|
+
name: "depositNative",
|
|
153
|
+
outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
|
|
154
|
+
stateMutability: "payable",
|
|
155
|
+
type: "function"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
inputs: [],
|
|
159
|
+
name: "depositNonce",
|
|
160
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
161
|
+
stateMutability: "view",
|
|
162
|
+
type: "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
inputs: [
|
|
166
|
+
{ internalType: "contract ERC20", name: "depositAsset", type: "address" },
|
|
167
|
+
{ internalType: "uint256", name: "depositAmount", type: "uint256" },
|
|
168
|
+
{ internalType: "uint256", name: "minimumMint", type: "uint256" },
|
|
169
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
170
|
+
{ internalType: "bytes", name: "distributorCode", type: "bytes" },
|
|
171
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
172
|
+
{ internalType: "uint8", name: "v", type: "uint8" },
|
|
173
|
+
{ internalType: "bytes32", name: "r", type: "bytes32" },
|
|
174
|
+
{ internalType: "bytes32", name: "s", type: "bytes32" }
|
|
175
|
+
],
|
|
176
|
+
name: "depositWithPermit",
|
|
177
|
+
outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
|
|
178
|
+
stateMutability: "nonpayable",
|
|
179
|
+
type: "function"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
inputs: [],
|
|
183
|
+
name: "feeModule",
|
|
184
|
+
outputs: [
|
|
185
|
+
{ internalType: "contract IFeeModule", name: "", type: "address" }
|
|
186
|
+
],
|
|
187
|
+
stateMutability: "view",
|
|
188
|
+
type: "function"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
inputs: [],
|
|
192
|
+
name: "feeRecipient",
|
|
193
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
194
|
+
stateMutability: "view",
|
|
195
|
+
type: "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
inputs: [],
|
|
199
|
+
name: "isNativeDepositSupported",
|
|
200
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
201
|
+
stateMutability: "view",
|
|
202
|
+
type: "function"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
inputs: [],
|
|
206
|
+
name: "nativeWrapper",
|
|
207
|
+
outputs: [
|
|
208
|
+
{ internalType: "contract INativeWrapper", name: "", type: "address" }
|
|
209
|
+
],
|
|
210
|
+
stateMutability: "view",
|
|
211
|
+
type: "function"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
inputs: [],
|
|
215
|
+
name: "owner",
|
|
216
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
217
|
+
stateMutability: "view",
|
|
218
|
+
type: "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
inputs: [],
|
|
222
|
+
name: "supplyCapInBase",
|
|
223
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
224
|
+
stateMutability: "view",
|
|
225
|
+
type: "function"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
inputs: [
|
|
229
|
+
{
|
|
230
|
+
internalType: "contract Authority",
|
|
231
|
+
name: "newAuthority",
|
|
232
|
+
type: "address"
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
name: "setAuthority",
|
|
236
|
+
outputs: [],
|
|
237
|
+
stateMutability: "nonpayable",
|
|
238
|
+
type: "function"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
inputs: [],
|
|
242
|
+
name: "teller",
|
|
243
|
+
outputs: [
|
|
244
|
+
{
|
|
245
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
246
|
+
name: "",
|
|
247
|
+
type: "address"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
stateMutability: "view",
|
|
251
|
+
type: "function"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
255
|
+
name: "transferOwnership",
|
|
256
|
+
outputs: [],
|
|
257
|
+
stateMutability: "nonpayable",
|
|
258
|
+
type: "function"
|
|
259
|
+
}
|
|
260
|
+
];
|
|
261
|
+
|
|
262
|
+
// src/abi/fee-module-abi.ts
|
|
263
|
+
var DCDAssetSpecificFeeModuleAbi = [
|
|
264
|
+
{
|
|
265
|
+
inputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
|
|
266
|
+
name: "depositTokenFeeData",
|
|
267
|
+
outputs: [
|
|
268
|
+
{ internalType: "uint256", name: "feePercentage", type: "uint256" },
|
|
269
|
+
{ internalType: "uint256", name: "flatFee", type: "uint256" }
|
|
270
|
+
],
|
|
271
|
+
stateMutability: "view",
|
|
272
|
+
type: "function"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
inputs: [],
|
|
276
|
+
name: "ONE_HUNDRED_PERCENT",
|
|
277
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
278
|
+
stateMutability: "view",
|
|
279
|
+
type: "function"
|
|
280
|
+
}
|
|
281
|
+
];
|
|
282
|
+
var FeeModuleAbi = [
|
|
283
|
+
{
|
|
284
|
+
inputs: [
|
|
285
|
+
{ internalType: "uint256", name: "_offerFeePercentage", type: "uint256" }
|
|
286
|
+
],
|
|
287
|
+
stateMutability: "nonpayable",
|
|
288
|
+
type: "constructor"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
inputs: [
|
|
292
|
+
{ internalType: "uint256", name: "feePercentage", type: "uint256" },
|
|
293
|
+
{ internalType: "uint256", name: "maxAllowed", type: "uint256" }
|
|
294
|
+
],
|
|
295
|
+
name: "FeePercentageTooHigh",
|
|
296
|
+
type: "error"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
inputs: [
|
|
300
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
301
|
+
{ internalType: "contract IERC20", name: "offerAsset", type: "address" },
|
|
302
|
+
{ internalType: "contract IERC20", name: "wantAsset", type: "address" },
|
|
303
|
+
{ internalType: "address", name: "receiver", type: "address" }
|
|
304
|
+
],
|
|
305
|
+
name: "calculateOfferFees",
|
|
306
|
+
outputs: [{ internalType: "uint256", name: "feeAmount", type: "uint256" }],
|
|
307
|
+
stateMutability: "view",
|
|
308
|
+
type: "function"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
inputs: [],
|
|
312
|
+
name: "offerFeePercentage",
|
|
313
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
314
|
+
stateMutability: "view",
|
|
315
|
+
type: "function"
|
|
316
|
+
}
|
|
317
|
+
];
|
|
318
|
+
|
|
319
|
+
// src/abi/withdraw-queue-abi.ts
|
|
320
|
+
var WithdrawQueueAbi = [
|
|
321
|
+
{
|
|
322
|
+
inputs: [
|
|
323
|
+
{ internalType: "string", name: "_name", type: "string" },
|
|
324
|
+
{ internalType: "string", name: "_symbol", type: "string" },
|
|
325
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
326
|
+
{
|
|
327
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
328
|
+
name: "_tellerWithMultiAssetSupport",
|
|
329
|
+
type: "address"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
internalType: "contract IFeeModule",
|
|
333
|
+
name: "_feeModule",
|
|
334
|
+
type: "address"
|
|
335
|
+
},
|
|
336
|
+
{ internalType: "uint256", name: "_minimumOrderSize", type: "uint256" },
|
|
337
|
+
{ internalType: "address", name: "_owner", type: "address" }
|
|
338
|
+
],
|
|
339
|
+
stateMutability: "nonpayable",
|
|
340
|
+
type: "constructor"
|
|
341
|
+
},
|
|
342
|
+
{ inputs: [], name: "ECDSAInvalidSignature", type: "error" },
|
|
343
|
+
{
|
|
344
|
+
inputs: [{ internalType: "uint256", name: "length", type: "uint256" }],
|
|
345
|
+
name: "ECDSAInvalidSignatureLength",
|
|
346
|
+
type: "error"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
inputs: [{ internalType: "bytes32", name: "s", type: "bytes32" }],
|
|
350
|
+
name: "ECDSAInvalidSignatureS",
|
|
351
|
+
type: "error"
|
|
352
|
+
},
|
|
353
|
+
{ inputs: [], name: "ERC721EnumerableForbiddenBatchMint", type: "error" },
|
|
354
|
+
{
|
|
355
|
+
inputs: [
|
|
356
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
357
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" },
|
|
358
|
+
{ internalType: "address", name: "owner", type: "address" }
|
|
359
|
+
],
|
|
360
|
+
name: "ERC721IncorrectOwner",
|
|
361
|
+
type: "error"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
inputs: [
|
|
365
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
366
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" }
|
|
367
|
+
],
|
|
368
|
+
name: "ERC721InsufficientApproval",
|
|
369
|
+
type: "error"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
inputs: [{ internalType: "address", name: "approver", type: "address" }],
|
|
373
|
+
name: "ERC721InvalidApprover",
|
|
374
|
+
type: "error"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
inputs: [{ internalType: "address", name: "operator", type: "address" }],
|
|
378
|
+
name: "ERC721InvalidOperator",
|
|
379
|
+
type: "error"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
inputs: [{ internalType: "address", name: "owner", type: "address" }],
|
|
383
|
+
name: "ERC721InvalidOwner",
|
|
384
|
+
type: "error"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
inputs: [{ internalType: "address", name: "receiver", type: "address" }],
|
|
388
|
+
name: "ERC721InvalidReceiver",
|
|
389
|
+
type: "error"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
inputs: [{ internalType: "address", name: "sender", type: "address" }],
|
|
393
|
+
name: "ERC721InvalidSender",
|
|
394
|
+
type: "error"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
398
|
+
name: "ERC721NonexistentToken",
|
|
399
|
+
type: "error"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
inputs: [
|
|
403
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
404
|
+
{ internalType: "uint256", name: "index", type: "uint256" }
|
|
405
|
+
],
|
|
406
|
+
name: "ERC721OutOfBoundsIndex",
|
|
407
|
+
type: "error"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
inputs: [{ internalType: "address", name: "token", type: "address" }],
|
|
411
|
+
name: "SafeERC20FailedOperation",
|
|
412
|
+
type: "error"
|
|
413
|
+
},
|
|
414
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
415
|
+
{ inputs: [], name: "ZeroAddress", type: "error" },
|
|
416
|
+
{
|
|
417
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
418
|
+
name: "OrderAlreadyProcessed",
|
|
419
|
+
type: "error"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
inputs: [
|
|
423
|
+
{ internalType: "uint256", name: "orderIndex", type: "uint256" },
|
|
424
|
+
{
|
|
425
|
+
internalType: "enum WithdrawQueue.OrderType",
|
|
426
|
+
name: "currentStatus",
|
|
427
|
+
type: "uint8"
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
name: "InvalidOrderType",
|
|
431
|
+
type: "error"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
435
|
+
name: "InvalidOrderIndex",
|
|
436
|
+
type: "error"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
inputs: [
|
|
440
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
441
|
+
{ internalType: "uint256", name: "minimum", type: "uint256" }
|
|
442
|
+
],
|
|
443
|
+
name: "AmountBelowMinimum",
|
|
444
|
+
type: "error"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
inputs: [
|
|
448
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
449
|
+
{ internalType: "uint256", name: "currentTimestamp", type: "uint256" }
|
|
450
|
+
],
|
|
451
|
+
name: "SignatureExpired",
|
|
452
|
+
type: "error"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
inputs: [
|
|
456
|
+
{ internalType: "uint256", name: "ordersToProcess", type: "uint256" },
|
|
457
|
+
{ internalType: "uint256", name: "latestOrder", type: "uint256" }
|
|
458
|
+
],
|
|
459
|
+
name: "NotEnoughOrdersToProcess",
|
|
460
|
+
type: "error"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
inputs: [
|
|
464
|
+
{ internalType: "uint256", name: "ordersToProcess", type: "uint256" }
|
|
465
|
+
],
|
|
466
|
+
name: "InvalidOrdersCount",
|
|
467
|
+
type: "error"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
inputs: [
|
|
471
|
+
{ internalType: "address", name: "intendedDepositor", type: "address" },
|
|
472
|
+
{ internalType: "address", name: "depositor", type: "address" }
|
|
473
|
+
],
|
|
474
|
+
name: "InvalidEip2612Signature",
|
|
475
|
+
type: "error"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
inputs: [
|
|
479
|
+
{ internalType: "address", name: "intendedDepositor", type: "address" },
|
|
480
|
+
{ internalType: "address", name: "depositor", type: "address" }
|
|
481
|
+
],
|
|
482
|
+
name: "InvalidDepositor",
|
|
483
|
+
type: "error"
|
|
484
|
+
},
|
|
485
|
+
{ inputs: [], name: "PermitFailedAndAllowanceTooLow", type: "error" },
|
|
486
|
+
{ inputs: [], name: "TellerVaultMissmatch", type: "error" },
|
|
487
|
+
{
|
|
488
|
+
inputs: [
|
|
489
|
+
{ internalType: "address", name: "attemptedToCancel", type: "address" },
|
|
490
|
+
{ internalType: "address", name: "orderOwner", type: "address" }
|
|
491
|
+
],
|
|
492
|
+
name: "OnlyOrderOwnerCanCancel",
|
|
493
|
+
type: "error"
|
|
494
|
+
},
|
|
495
|
+
{ inputs: [], name: "QueueMustBeEmpty", type: "error" },
|
|
496
|
+
{
|
|
497
|
+
inputs: [
|
|
498
|
+
{ internalType: "contract IERC20", name: "asset", type: "address" }
|
|
499
|
+
],
|
|
500
|
+
name: "AssetNotSupported",
|
|
501
|
+
type: "error"
|
|
502
|
+
},
|
|
503
|
+
{ inputs: [], name: "InvalidAssetsOut", type: "error" },
|
|
504
|
+
{ inputs: [], name: "EmptyArray", type: "error" },
|
|
505
|
+
{
|
|
506
|
+
inputs: [
|
|
507
|
+
{ internalType: "contract IERC20", name: "wantAsset", type: "address" },
|
|
508
|
+
{ internalType: "uint256", name: "expectedAssetsOut", type: "uint256" },
|
|
509
|
+
{
|
|
510
|
+
internalType: "uint256",
|
|
511
|
+
name: "vaultBalanceOfWantAsset",
|
|
512
|
+
type: "uint256"
|
|
513
|
+
}
|
|
514
|
+
],
|
|
515
|
+
name: "VaultInsufficientBalance",
|
|
516
|
+
type: "error"
|
|
517
|
+
},
|
|
518
|
+
{ inputs: [], name: "TellerIsPaused", type: "error" },
|
|
519
|
+
{
|
|
520
|
+
anonymous: false,
|
|
521
|
+
inputs: [
|
|
522
|
+
{
|
|
523
|
+
indexed: true,
|
|
524
|
+
internalType: "address",
|
|
525
|
+
name: "owner",
|
|
526
|
+
type: "address"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
indexed: true,
|
|
530
|
+
internalType: "address",
|
|
531
|
+
name: "approved",
|
|
532
|
+
type: "address"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
indexed: true,
|
|
536
|
+
internalType: "uint256",
|
|
537
|
+
name: "tokenId",
|
|
538
|
+
type: "uint256"
|
|
539
|
+
}
|
|
540
|
+
],
|
|
541
|
+
name: "Approval",
|
|
542
|
+
type: "event"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
anonymous: false,
|
|
546
|
+
inputs: [
|
|
547
|
+
{
|
|
548
|
+
indexed: true,
|
|
549
|
+
internalType: "address",
|
|
550
|
+
name: "owner",
|
|
551
|
+
type: "address"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
indexed: true,
|
|
555
|
+
internalType: "address",
|
|
556
|
+
name: "operator",
|
|
557
|
+
type: "address"
|
|
558
|
+
},
|
|
559
|
+
{ indexed: false, internalType: "bool", name: "approved", type: "bool" }
|
|
560
|
+
],
|
|
561
|
+
name: "ApprovalForAll",
|
|
562
|
+
type: "event"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
anonymous: false,
|
|
566
|
+
inputs: [
|
|
567
|
+
{
|
|
568
|
+
indexed: true,
|
|
569
|
+
internalType: "address",
|
|
570
|
+
name: "user",
|
|
571
|
+
type: "address"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
indexed: true,
|
|
575
|
+
internalType: "address",
|
|
576
|
+
name: "newAuthority",
|
|
577
|
+
type: "address"
|
|
578
|
+
}
|
|
579
|
+
],
|
|
580
|
+
name: "AuthorityUpdated",
|
|
581
|
+
type: "event"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
anonymous: false,
|
|
585
|
+
inputs: [
|
|
586
|
+
{
|
|
587
|
+
indexed: true,
|
|
588
|
+
internalType: "contract IFeeModule",
|
|
589
|
+
name: "oldFeeModule",
|
|
590
|
+
type: "address"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
indexed: true,
|
|
594
|
+
internalType: "contract IFeeModule",
|
|
595
|
+
name: "newFeeModule",
|
|
596
|
+
type: "address"
|
|
597
|
+
}
|
|
598
|
+
],
|
|
599
|
+
name: "FeeModuleUpdated",
|
|
600
|
+
type: "event"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
anonymous: false,
|
|
604
|
+
inputs: [
|
|
605
|
+
{
|
|
606
|
+
indexed: true,
|
|
607
|
+
internalType: "address",
|
|
608
|
+
name: "oldFeeRecipient",
|
|
609
|
+
type: "address"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
indexed: true,
|
|
613
|
+
internalType: "address",
|
|
614
|
+
name: "newFeeRecipient",
|
|
615
|
+
type: "address"
|
|
616
|
+
}
|
|
617
|
+
],
|
|
618
|
+
name: "FeeRecipientUpdated",
|
|
619
|
+
type: "event"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
anonymous: false,
|
|
623
|
+
inputs: [
|
|
624
|
+
{
|
|
625
|
+
indexed: false,
|
|
626
|
+
internalType: "uint256",
|
|
627
|
+
name: "oldMinimum",
|
|
628
|
+
type: "uint256"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
indexed: false,
|
|
632
|
+
internalType: "uint256",
|
|
633
|
+
name: "newMinimum",
|
|
634
|
+
type: "uint256"
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
name: "MinimumOrderSizeUpdated",
|
|
638
|
+
type: "event"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
anonymous: false,
|
|
642
|
+
inputs: [
|
|
643
|
+
{
|
|
644
|
+
indexed: true,
|
|
645
|
+
internalType: "uint256",
|
|
646
|
+
name: "orderIndex",
|
|
647
|
+
type: "uint256"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
components: [
|
|
651
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
652
|
+
{
|
|
653
|
+
internalType: "contract IERC20",
|
|
654
|
+
name: "wantAsset",
|
|
655
|
+
type: "address"
|
|
656
|
+
},
|
|
657
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
658
|
+
{
|
|
659
|
+
internalType: "enum WithdrawQueue.OrderType",
|
|
660
|
+
name: "orderType",
|
|
661
|
+
type: "uint8"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
internalType: "bool",
|
|
665
|
+
name: "didOrderFailTransfer",
|
|
666
|
+
type: "bool"
|
|
667
|
+
}
|
|
668
|
+
],
|
|
669
|
+
indexed: false,
|
|
670
|
+
internalType: "struct WithdrawQueue.Order",
|
|
671
|
+
name: "order",
|
|
672
|
+
type: "tuple"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
indexed: true,
|
|
676
|
+
internalType: "address",
|
|
677
|
+
name: "receiver",
|
|
678
|
+
type: "address"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
indexed: true,
|
|
682
|
+
internalType: "address",
|
|
683
|
+
name: "depositor",
|
|
684
|
+
type: "address"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
indexed: false,
|
|
688
|
+
internalType: "bool",
|
|
689
|
+
name: "isSubmittedViaSignature",
|
|
690
|
+
type: "bool"
|
|
691
|
+
}
|
|
692
|
+
],
|
|
693
|
+
name: "OrderSubmitted",
|
|
694
|
+
type: "event"
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
anonymous: false,
|
|
698
|
+
inputs: [
|
|
699
|
+
{
|
|
700
|
+
indexed: true,
|
|
701
|
+
internalType: "uint256",
|
|
702
|
+
name: "startIndex",
|
|
703
|
+
type: "uint256"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
indexed: true,
|
|
707
|
+
internalType: "uint256",
|
|
708
|
+
name: "endIndex",
|
|
709
|
+
type: "uint256"
|
|
710
|
+
}
|
|
711
|
+
],
|
|
712
|
+
name: "OrdersProcessedInRange",
|
|
713
|
+
type: "event"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
anonymous: false,
|
|
717
|
+
inputs: [
|
|
718
|
+
{
|
|
719
|
+
indexed: true,
|
|
720
|
+
internalType: "uint256",
|
|
721
|
+
name: "orderIndex",
|
|
722
|
+
type: "uint256"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
components: [
|
|
726
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
727
|
+
{
|
|
728
|
+
internalType: "contract IERC20",
|
|
729
|
+
name: "wantAsset",
|
|
730
|
+
type: "address"
|
|
731
|
+
},
|
|
732
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
733
|
+
{
|
|
734
|
+
internalType: "enum WithdrawQueue.OrderType",
|
|
735
|
+
name: "orderType",
|
|
736
|
+
type: "uint8"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
internalType: "bool",
|
|
740
|
+
name: "didOrderFailTransfer",
|
|
741
|
+
type: "bool"
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
indexed: false,
|
|
745
|
+
internalType: "struct WithdrawQueue.Order",
|
|
746
|
+
name: "order",
|
|
747
|
+
type: "tuple"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
indexed: true,
|
|
751
|
+
internalType: "address",
|
|
752
|
+
name: "receiver",
|
|
753
|
+
type: "address"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
indexed: true,
|
|
757
|
+
internalType: "bool",
|
|
758
|
+
name: "isForceProcessed",
|
|
759
|
+
type: "bool"
|
|
760
|
+
}
|
|
761
|
+
],
|
|
762
|
+
name: "OrderProcessed",
|
|
763
|
+
type: "event"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
anonymous: false,
|
|
767
|
+
inputs: [
|
|
768
|
+
{
|
|
769
|
+
indexed: true,
|
|
770
|
+
internalType: "uint256",
|
|
771
|
+
name: "orderIndex",
|
|
772
|
+
type: "uint256"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
components: [
|
|
776
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
777
|
+
{
|
|
778
|
+
internalType: "contract IERC20",
|
|
779
|
+
name: "wantAsset",
|
|
780
|
+
type: "address"
|
|
781
|
+
},
|
|
782
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
783
|
+
{
|
|
784
|
+
internalType: "enum WithdrawQueue.OrderType",
|
|
785
|
+
name: "orderType",
|
|
786
|
+
type: "uint8"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
internalType: "bool",
|
|
790
|
+
name: "didOrderFailTransfer",
|
|
791
|
+
type: "bool"
|
|
792
|
+
}
|
|
793
|
+
],
|
|
794
|
+
indexed: false,
|
|
795
|
+
internalType: "struct WithdrawQueue.Order",
|
|
796
|
+
name: "order",
|
|
797
|
+
type: "tuple"
|
|
798
|
+
}
|
|
799
|
+
],
|
|
800
|
+
name: "OrderRefunded",
|
|
801
|
+
type: "event"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
anonymous: false,
|
|
805
|
+
inputs: [
|
|
806
|
+
{
|
|
807
|
+
indexed: true,
|
|
808
|
+
internalType: "uint256",
|
|
809
|
+
name: "orderIndex",
|
|
810
|
+
type: "uint256"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
indexed: true,
|
|
814
|
+
internalType: "bool",
|
|
815
|
+
name: "isMarkedByUser",
|
|
816
|
+
type: "bool"
|
|
817
|
+
}
|
|
818
|
+
],
|
|
819
|
+
name: "OrderMarkedForRefund",
|
|
820
|
+
type: "event"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
anonymous: false,
|
|
824
|
+
inputs: [
|
|
825
|
+
{
|
|
826
|
+
indexed: true,
|
|
827
|
+
internalType: "address",
|
|
828
|
+
name: "user",
|
|
829
|
+
type: "address"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
indexed: true,
|
|
833
|
+
internalType: "address",
|
|
834
|
+
name: "newOwner",
|
|
835
|
+
type: "address"
|
|
836
|
+
}
|
|
837
|
+
],
|
|
838
|
+
name: "OwnershipTransferred",
|
|
839
|
+
type: "event"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
anonymous: false,
|
|
843
|
+
inputs: [
|
|
844
|
+
{
|
|
845
|
+
indexed: true,
|
|
846
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
847
|
+
name: "oldTeller",
|
|
848
|
+
type: "address"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
indexed: true,
|
|
852
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
853
|
+
name: "newTeller",
|
|
854
|
+
type: "address"
|
|
855
|
+
}
|
|
856
|
+
],
|
|
857
|
+
name: "TellerUpdated",
|
|
858
|
+
type: "event"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
anonymous: false,
|
|
862
|
+
inputs: [
|
|
863
|
+
{
|
|
864
|
+
indexed: true,
|
|
865
|
+
internalType: "address",
|
|
866
|
+
name: "from",
|
|
867
|
+
type: "address"
|
|
868
|
+
},
|
|
869
|
+
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
870
|
+
{
|
|
871
|
+
indexed: true,
|
|
872
|
+
internalType: "uint256",
|
|
873
|
+
name: "tokenId",
|
|
874
|
+
type: "uint256"
|
|
875
|
+
}
|
|
876
|
+
],
|
|
877
|
+
name: "Transfer",
|
|
878
|
+
type: "event"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
inputs: [],
|
|
882
|
+
name: "CANCEL_ORDER_TYPEHASH",
|
|
883
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
884
|
+
stateMutability: "view",
|
|
885
|
+
type: "function"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
inputs: [],
|
|
889
|
+
name: "authority",
|
|
890
|
+
outputs: [
|
|
891
|
+
{ internalType: "contract Authority", name: "", type: "address" }
|
|
892
|
+
],
|
|
893
|
+
stateMutability: "view",
|
|
894
|
+
type: "function"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
inputs: [{ internalType: "address", name: "owner", type: "address" }],
|
|
898
|
+
name: "balanceOf",
|
|
899
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
900
|
+
stateMutability: "view",
|
|
901
|
+
type: "function"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
905
|
+
name: "ownerOf",
|
|
906
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
907
|
+
stateMutability: "view",
|
|
908
|
+
type: "function"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
912
|
+
name: "cancelOrder",
|
|
913
|
+
outputs: [],
|
|
914
|
+
stateMutability: "nonpayable",
|
|
915
|
+
type: "function"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
inputs: [
|
|
919
|
+
{ internalType: "uint256", name: "orderIndex", type: "uint256" },
|
|
920
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
921
|
+
{ internalType: "bytes", name: "cancelSignature", type: "bytes" }
|
|
922
|
+
],
|
|
923
|
+
name: "cancelOrderWithSignature",
|
|
924
|
+
outputs: [],
|
|
925
|
+
stateMutability: "nonpayable",
|
|
926
|
+
type: "function"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
inputs: [],
|
|
930
|
+
name: "feeModule",
|
|
931
|
+
outputs: [
|
|
932
|
+
{ internalType: "contract IFeeModule", name: "", type: "address" }
|
|
933
|
+
],
|
|
934
|
+
stateMutability: "view",
|
|
935
|
+
type: "function"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
inputs: [],
|
|
939
|
+
name: "feeRecipient",
|
|
940
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
941
|
+
stateMutability: "view",
|
|
942
|
+
type: "function"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
946
|
+
name: "forceProcess",
|
|
947
|
+
outputs: [],
|
|
948
|
+
stateMutability: "nonpayable",
|
|
949
|
+
type: "function"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
inputs: [
|
|
953
|
+
{ internalType: "uint256[]", name: "orderIndices", type: "uint256[]" }
|
|
954
|
+
],
|
|
955
|
+
name: "forceProcessOrders",
|
|
956
|
+
outputs: [],
|
|
957
|
+
stateMutability: "nonpayable",
|
|
958
|
+
type: "function"
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
962
|
+
name: "getOrderStatus",
|
|
963
|
+
outputs: [
|
|
964
|
+
{
|
|
965
|
+
internalType: "enum WithdrawQueue.OrderStatus",
|
|
966
|
+
name: "",
|
|
967
|
+
type: "uint8"
|
|
968
|
+
}
|
|
969
|
+
],
|
|
970
|
+
stateMutability: "view",
|
|
971
|
+
type: "function"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
975
|
+
name: "getApproved",
|
|
976
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
977
|
+
stateMutability: "view",
|
|
978
|
+
type: "function"
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
inputs: [],
|
|
982
|
+
name: "lastProcessedOrder",
|
|
983
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
984
|
+
stateMutability: "view",
|
|
985
|
+
type: "function"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
inputs: [],
|
|
989
|
+
name: "latestOrder",
|
|
990
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
991
|
+
stateMutability: "view",
|
|
992
|
+
type: "function"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
inputs: [
|
|
996
|
+
{ internalType: "contract IERC20", name: "token", type: "address" },
|
|
997
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
998
|
+
{ internalType: "address", name: "receiver", type: "address" }
|
|
999
|
+
],
|
|
1000
|
+
name: "manageERC20",
|
|
1001
|
+
outputs: [],
|
|
1002
|
+
stateMutability: "nonpayable",
|
|
1003
|
+
type: "function"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
inputs: [],
|
|
1007
|
+
name: "minimumOrderSize",
|
|
1008
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1009
|
+
stateMutability: "view",
|
|
1010
|
+
type: "function"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
inputs: [],
|
|
1014
|
+
name: "name",
|
|
1015
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
1016
|
+
stateMutability: "view",
|
|
1017
|
+
type: "function"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
1021
|
+
name: "nonces",
|
|
1022
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1023
|
+
stateMutability: "view",
|
|
1024
|
+
type: "function"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
inputs: [],
|
|
1028
|
+
name: "offerAsset",
|
|
1029
|
+
outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
|
|
1030
|
+
stateMutability: "view",
|
|
1031
|
+
type: "function"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
inputs: [],
|
|
1035
|
+
name: "owner",
|
|
1036
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
1037
|
+
stateMutability: "view",
|
|
1038
|
+
type: "function"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1042
|
+
name: "orderAtQueueIndex",
|
|
1043
|
+
outputs: [
|
|
1044
|
+
{
|
|
1045
|
+
components: [
|
|
1046
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
1047
|
+
{
|
|
1048
|
+
internalType: "contract IERC20",
|
|
1049
|
+
name: "wantAsset",
|
|
1050
|
+
type: "address"
|
|
1051
|
+
},
|
|
1052
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
1053
|
+
{
|
|
1054
|
+
internalType: "enum WithdrawQueue.OrderType",
|
|
1055
|
+
name: "orderType",
|
|
1056
|
+
type: "uint8"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
internalType: "bool",
|
|
1060
|
+
name: "didOrderFailTransfer",
|
|
1061
|
+
type: "bool"
|
|
1062
|
+
}
|
|
1063
|
+
],
|
|
1064
|
+
internalType: "struct WithdrawQueue.Order",
|
|
1065
|
+
name: "",
|
|
1066
|
+
type: "tuple"
|
|
1067
|
+
}
|
|
1068
|
+
],
|
|
1069
|
+
stateMutability: "view",
|
|
1070
|
+
type: "function"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
inputs: [
|
|
1074
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
1075
|
+
{ internalType: "address", name: "operator", type: "address" }
|
|
1076
|
+
],
|
|
1077
|
+
name: "isApprovedForAll",
|
|
1078
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1079
|
+
stateMutability: "view",
|
|
1080
|
+
type: "function"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
1084
|
+
name: "refundOrder",
|
|
1085
|
+
outputs: [],
|
|
1086
|
+
stateMutability: "nonpayable",
|
|
1087
|
+
type: "function"
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
inputs: [
|
|
1091
|
+
{ internalType: "uint256[]", name: "orderIndices", type: "uint256[]" }
|
|
1092
|
+
],
|
|
1093
|
+
name: "refundOrders",
|
|
1094
|
+
outputs: [],
|
|
1095
|
+
stateMutability: "nonpayable",
|
|
1096
|
+
type: "function"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
inputs: [
|
|
1100
|
+
{ internalType: "uint256", name: "ordersToProcess", type: "uint256" }
|
|
1101
|
+
],
|
|
1102
|
+
name: "processOrders",
|
|
1103
|
+
outputs: [],
|
|
1104
|
+
stateMutability: "nonpayable",
|
|
1105
|
+
type: "function"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
inputs: [
|
|
1109
|
+
{
|
|
1110
|
+
components: [
|
|
1111
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
1112
|
+
{
|
|
1113
|
+
internalType: "contract IERC20",
|
|
1114
|
+
name: "wantAsset",
|
|
1115
|
+
type: "address"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
internalType: "address",
|
|
1119
|
+
name: "intendedDepositor",
|
|
1120
|
+
type: "address"
|
|
1121
|
+
},
|
|
1122
|
+
{ internalType: "address", name: "receiver", type: "address" },
|
|
1123
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
1124
|
+
{
|
|
1125
|
+
components: [
|
|
1126
|
+
{
|
|
1127
|
+
internalType: "enum WithdrawQueue.ApprovalMethod",
|
|
1128
|
+
name: "approvalMethod",
|
|
1129
|
+
type: "uint8"
|
|
1130
|
+
},
|
|
1131
|
+
{ internalType: "uint8", name: "approvalV", type: "uint8" },
|
|
1132
|
+
{ internalType: "bytes32", name: "approvalR", type: "bytes32" },
|
|
1133
|
+
{ internalType: "bytes32", name: "approvalS", type: "bytes32" },
|
|
1134
|
+
{
|
|
1135
|
+
internalType: "bool",
|
|
1136
|
+
name: "submitWithSignature",
|
|
1137
|
+
type: "bool"
|
|
1138
|
+
},
|
|
1139
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
1140
|
+
{
|
|
1141
|
+
internalType: "bytes",
|
|
1142
|
+
name: "eip2612Signature",
|
|
1143
|
+
type: "bytes"
|
|
1144
|
+
}
|
|
1145
|
+
],
|
|
1146
|
+
internalType: "struct WithdrawQueue.SignatureParams",
|
|
1147
|
+
name: "signatureParams",
|
|
1148
|
+
type: "tuple"
|
|
1149
|
+
}
|
|
1150
|
+
],
|
|
1151
|
+
internalType: "struct WithdrawQueue.SubmitOrderParams",
|
|
1152
|
+
name: "params",
|
|
1153
|
+
type: "tuple"
|
|
1154
|
+
}
|
|
1155
|
+
],
|
|
1156
|
+
name: "submitOrder",
|
|
1157
|
+
outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
1158
|
+
stateMutability: "nonpayable",
|
|
1159
|
+
type: "function"
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
inputs: [
|
|
1163
|
+
{
|
|
1164
|
+
components: [
|
|
1165
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
1166
|
+
{
|
|
1167
|
+
internalType: "contract IERC20",
|
|
1168
|
+
name: "wantAsset",
|
|
1169
|
+
type: "address"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
internalType: "address",
|
|
1173
|
+
name: "intendedDepositor",
|
|
1174
|
+
type: "address"
|
|
1175
|
+
},
|
|
1176
|
+
{ internalType: "address", name: "receiver", type: "address" },
|
|
1177
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
1178
|
+
{
|
|
1179
|
+
components: [
|
|
1180
|
+
{
|
|
1181
|
+
internalType: "enum WithdrawQueue.ApprovalMethod",
|
|
1182
|
+
name: "approvalMethod",
|
|
1183
|
+
type: "uint8"
|
|
1184
|
+
},
|
|
1185
|
+
{ internalType: "uint8", name: "approvalV", type: "uint8" },
|
|
1186
|
+
{ internalType: "bytes32", name: "approvalR", type: "bytes32" },
|
|
1187
|
+
{ internalType: "bytes32", name: "approvalS", type: "bytes32" },
|
|
1188
|
+
{
|
|
1189
|
+
internalType: "bool",
|
|
1190
|
+
name: "submitWithSignature",
|
|
1191
|
+
type: "bool"
|
|
1192
|
+
},
|
|
1193
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
1194
|
+
{
|
|
1195
|
+
internalType: "bytes",
|
|
1196
|
+
name: "eip2612Signature",
|
|
1197
|
+
type: "bytes"
|
|
1198
|
+
}
|
|
1199
|
+
],
|
|
1200
|
+
internalType: "struct WithdrawQueue.SignatureParams",
|
|
1201
|
+
name: "signatureParams",
|
|
1202
|
+
type: "tuple"
|
|
1203
|
+
}
|
|
1204
|
+
],
|
|
1205
|
+
internalType: "struct WithdrawQueue.SubmitOrderParams",
|
|
1206
|
+
name: "params",
|
|
1207
|
+
type: "tuple"
|
|
1208
|
+
},
|
|
1209
|
+
{ internalType: "uint256", name: "ordersToProcess", type: "uint256" }
|
|
1210
|
+
],
|
|
1211
|
+
name: "submitOrderAndProcess",
|
|
1212
|
+
outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
1213
|
+
stateMutability: "nonpayable",
|
|
1214
|
+
type: "function"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
inputs: [
|
|
1218
|
+
{
|
|
1219
|
+
components: [
|
|
1220
|
+
{ internalType: "uint256", name: "amountOffer", type: "uint256" },
|
|
1221
|
+
{
|
|
1222
|
+
internalType: "contract IERC20",
|
|
1223
|
+
name: "wantAsset",
|
|
1224
|
+
type: "address"
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
internalType: "address",
|
|
1228
|
+
name: "intendedDepositor",
|
|
1229
|
+
type: "address"
|
|
1230
|
+
},
|
|
1231
|
+
{ internalType: "address", name: "receiver", type: "address" },
|
|
1232
|
+
{ internalType: "address", name: "refundReceiver", type: "address" },
|
|
1233
|
+
{
|
|
1234
|
+
components: [
|
|
1235
|
+
{
|
|
1236
|
+
internalType: "enum WithdrawQueue.ApprovalMethod",
|
|
1237
|
+
name: "approvalMethod",
|
|
1238
|
+
type: "uint8"
|
|
1239
|
+
},
|
|
1240
|
+
{ internalType: "uint8", name: "approvalV", type: "uint8" },
|
|
1241
|
+
{ internalType: "bytes32", name: "approvalR", type: "bytes32" },
|
|
1242
|
+
{ internalType: "bytes32", name: "approvalS", type: "bytes32" },
|
|
1243
|
+
{
|
|
1244
|
+
internalType: "bool",
|
|
1245
|
+
name: "submitWithSignature",
|
|
1246
|
+
type: "bool"
|
|
1247
|
+
},
|
|
1248
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
1249
|
+
{
|
|
1250
|
+
internalType: "bytes",
|
|
1251
|
+
name: "eip2612Signature",
|
|
1252
|
+
type: "bytes"
|
|
1253
|
+
}
|
|
1254
|
+
],
|
|
1255
|
+
internalType: "struct WithdrawQueue.SignatureParams",
|
|
1256
|
+
name: "signatureParams",
|
|
1257
|
+
type: "tuple"
|
|
1258
|
+
}
|
|
1259
|
+
],
|
|
1260
|
+
internalType: "struct WithdrawQueue.SubmitOrderParams",
|
|
1261
|
+
name: "params",
|
|
1262
|
+
type: "tuple"
|
|
1263
|
+
}
|
|
1264
|
+
],
|
|
1265
|
+
name: "submitOrderAndProcessAll",
|
|
1266
|
+
outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
|
|
1267
|
+
stateMutability: "nonpayable",
|
|
1268
|
+
type: "function"
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
inputs: [],
|
|
1272
|
+
name: "symbol",
|
|
1273
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
1274
|
+
stateMutability: "view",
|
|
1275
|
+
type: "function"
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
1279
|
+
name: "supportsInterface",
|
|
1280
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1281
|
+
stateMutability: "view",
|
|
1282
|
+
type: "function"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
inputs: [],
|
|
1286
|
+
name: "tellerWithMultiAssetSupport",
|
|
1287
|
+
outputs: [
|
|
1288
|
+
{
|
|
1289
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
1290
|
+
name: "",
|
|
1291
|
+
type: "address"
|
|
1292
|
+
}
|
|
1293
|
+
],
|
|
1294
|
+
stateMutability: "view",
|
|
1295
|
+
type: "function"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
1299
|
+
name: "tokenByIndex",
|
|
1300
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1301
|
+
stateMutability: "view",
|
|
1302
|
+
type: "function"
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
inputs: [
|
|
1306
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
1307
|
+
{ internalType: "uint256", name: "index", type: "uint256" }
|
|
1308
|
+
],
|
|
1309
|
+
name: "tokenOfOwnerByIndex",
|
|
1310
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1311
|
+
stateMutability: "view",
|
|
1312
|
+
type: "function"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
1316
|
+
name: "tokenURI",
|
|
1317
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
1318
|
+
stateMutability: "view",
|
|
1319
|
+
type: "function"
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
inputs: [],
|
|
1323
|
+
name: "totalSupply",
|
|
1324
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1325
|
+
stateMutability: "view",
|
|
1326
|
+
type: "function"
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
inputs: [
|
|
1330
|
+
{ internalType: "address", name: "from", type: "address" },
|
|
1331
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1332
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" }
|
|
1333
|
+
],
|
|
1334
|
+
name: "transferFrom",
|
|
1335
|
+
outputs: [],
|
|
1336
|
+
stateMutability: "nonpayable",
|
|
1337
|
+
type: "function"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
inputs: [
|
|
1341
|
+
{ internalType: "address", name: "from", type: "address" },
|
|
1342
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1343
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" }
|
|
1344
|
+
],
|
|
1345
|
+
name: "safeTransferFrom",
|
|
1346
|
+
outputs: [],
|
|
1347
|
+
stateMutability: "nonpayable",
|
|
1348
|
+
type: "function"
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
inputs: [
|
|
1352
|
+
{ internalType: "address", name: "from", type: "address" },
|
|
1353
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1354
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" },
|
|
1355
|
+
{ internalType: "bytes", name: "_data", type: "bytes" }
|
|
1356
|
+
],
|
|
1357
|
+
name: "safeTransferFrom",
|
|
1358
|
+
outputs: [],
|
|
1359
|
+
stateMutability: "nonpayable",
|
|
1360
|
+
type: "function"
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
inputs: [
|
|
1364
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
1365
|
+
{ internalType: "bool", name: "approved", type: "bool" }
|
|
1366
|
+
],
|
|
1367
|
+
name: "setApprovalForAll",
|
|
1368
|
+
outputs: [],
|
|
1369
|
+
stateMutability: "nonpayable",
|
|
1370
|
+
type: "function"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
inputs: [
|
|
1374
|
+
{
|
|
1375
|
+
internalType: "contract IFeeModule",
|
|
1376
|
+
name: "_feeModule",
|
|
1377
|
+
type: "address"
|
|
1378
|
+
}
|
|
1379
|
+
],
|
|
1380
|
+
name: "setFeeModule",
|
|
1381
|
+
outputs: [],
|
|
1382
|
+
stateMutability: "nonpayable",
|
|
1383
|
+
type: "function"
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
inputs: [
|
|
1387
|
+
{ internalType: "address", name: "_feeRecipient", type: "address" }
|
|
1388
|
+
],
|
|
1389
|
+
name: "setFeeRecipient",
|
|
1390
|
+
outputs: [],
|
|
1391
|
+
stateMutability: "nonpayable",
|
|
1392
|
+
type: "function"
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
inputs: [
|
|
1396
|
+
{
|
|
1397
|
+
internalType: "contract TellerWithMultiAssetSupport",
|
|
1398
|
+
name: "_newTeller",
|
|
1399
|
+
type: "address"
|
|
1400
|
+
}
|
|
1401
|
+
],
|
|
1402
|
+
name: "setTellerWithMultiAssetSupport",
|
|
1403
|
+
outputs: [],
|
|
1404
|
+
stateMutability: "nonpayable",
|
|
1405
|
+
type: "function"
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
1409
|
+
name: "setOwner",
|
|
1410
|
+
outputs: [],
|
|
1411
|
+
stateMutability: "nonpayable",
|
|
1412
|
+
type: "function"
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
inputs: [
|
|
1416
|
+
{
|
|
1417
|
+
internalType: "contract Authority",
|
|
1418
|
+
name: "newAuthority",
|
|
1419
|
+
type: "address"
|
|
1420
|
+
}
|
|
1421
|
+
],
|
|
1422
|
+
name: "setAuthority",
|
|
1423
|
+
outputs: [],
|
|
1424
|
+
stateMutability: "nonpayable",
|
|
1425
|
+
type: "function"
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
inputs: [{ internalType: "uint256", name: "_newMinimum", type: "uint256" }],
|
|
1429
|
+
name: "updateAssetMinimumOrderSize",
|
|
1430
|
+
outputs: [],
|
|
1431
|
+
stateMutability: "nonpayable",
|
|
1432
|
+
type: "function"
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
inputs: [
|
|
1436
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1437
|
+
{ internalType: "uint256", name: "tokenId", type: "uint256" }
|
|
1438
|
+
],
|
|
1439
|
+
name: "approve",
|
|
1440
|
+
outputs: [],
|
|
1441
|
+
stateMutability: "nonpayable",
|
|
1442
|
+
type: "function"
|
|
1443
|
+
}
|
|
1444
|
+
];
|
|
1445
|
+
|
|
1446
|
+
// src/constants/environment.ts
|
|
1447
|
+
var BASE_URL = "https://api.paxoslabs.com";
|
|
1448
|
+
function getGraphQLEndpoint() {
|
|
1449
|
+
return `${BASE_URL}/graphql`;
|
|
1450
|
+
}
|
|
1451
|
+
function getRestV2BaseURL() {
|
|
1452
|
+
return `${BASE_URL}/v2`;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// src/types/telemetry.ts
|
|
1456
|
+
var LogLevel = {
|
|
1457
|
+
DEBUG: 0,
|
|
1458
|
+
INFO: 1,
|
|
1459
|
+
WARN: 2,
|
|
1460
|
+
ERROR: 3,
|
|
1461
|
+
NONE: 4
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
// src/lib/logger.ts
|
|
1465
|
+
var ConsoleLogger = class {
|
|
1466
|
+
constructor(level = LogLevel.ERROR) {
|
|
1467
|
+
__publicField(this, "level");
|
|
1468
|
+
this.level = level;
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Update log level
|
|
1472
|
+
*/
|
|
1473
|
+
setLevel(level) {
|
|
1474
|
+
this.level = level;
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* Get current log level
|
|
1478
|
+
*/
|
|
1479
|
+
getLevel() {
|
|
1480
|
+
return this.level;
|
|
1481
|
+
}
|
|
1482
|
+
debug(message, context) {
|
|
1483
|
+
if (this.level <= LogLevel.DEBUG) {
|
|
1484
|
+
if (context) {
|
|
1485
|
+
console.debug("[Amplify SDK]", message, context);
|
|
1486
|
+
} else {
|
|
1487
|
+
console.debug("[Amplify SDK]", message);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
info(message, context) {
|
|
1492
|
+
if (this.level <= LogLevel.INFO) {
|
|
1493
|
+
if (context) {
|
|
1494
|
+
console.info("[Amplify SDK]", message, context);
|
|
1495
|
+
} else {
|
|
1496
|
+
console.info("[Amplify SDK]", message);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
warn(message, context) {
|
|
1501
|
+
if (this.level <= LogLevel.WARN) {
|
|
1502
|
+
if (context) {
|
|
1503
|
+
console.warn("[Amplify SDK]", message, context);
|
|
1504
|
+
} else {
|
|
1505
|
+
console.warn("[Amplify SDK]", message);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
error(message, context) {
|
|
1510
|
+
if (this.level <= LogLevel.ERROR) {
|
|
1511
|
+
if (context) {
|
|
1512
|
+
console.error("[Amplify SDK]", message, context);
|
|
1513
|
+
} else {
|
|
1514
|
+
console.error("[Amplify SDK]", message);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
var currentLogger = new ConsoleLogger(LogLevel.ERROR);
|
|
1520
|
+
var defaultLogger = currentLogger;
|
|
1521
|
+
function setLogger(logger) {
|
|
1522
|
+
currentLogger = logger;
|
|
1523
|
+
}
|
|
1524
|
+
function getLogger() {
|
|
1525
|
+
return currentLogger;
|
|
1526
|
+
}
|
|
1527
|
+
function setLogLevel(level) {
|
|
1528
|
+
if (defaultLogger && typeof defaultLogger.setLevel === "function") {
|
|
1529
|
+
defaultLogger.setLevel(level);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// src/lib/vault-cache.ts
|
|
1534
|
+
var DEFAULT_TTL = 6e5;
|
|
1535
|
+
var VaultCache = class {
|
|
1536
|
+
/**
|
|
1537
|
+
* Creates a new VaultCache instance
|
|
1538
|
+
*
|
|
1539
|
+
* @param ttl - Time-to-live in milliseconds (default: 600000 = 10 minutes)
|
|
1540
|
+
*/
|
|
1541
|
+
constructor(ttl = DEFAULT_TTL) {
|
|
1542
|
+
/**
|
|
1543
|
+
* Vaults keyed by baseTokenAddress
|
|
1544
|
+
* One key can map to multiple vaults (different chains/yield types)
|
|
1545
|
+
*/
|
|
1546
|
+
__publicField(this, "vaults");
|
|
1547
|
+
/**
|
|
1548
|
+
* Assets keyed by token address
|
|
1549
|
+
*/
|
|
1550
|
+
__publicField(this, "assets");
|
|
1551
|
+
/**
|
|
1552
|
+
* Vaults keyed by boringVaultAddress (lowercase, for case-insensitive lookup)
|
|
1553
|
+
*/
|
|
1554
|
+
__publicField(this, "vaultsByAddress");
|
|
1555
|
+
/**
|
|
1556
|
+
* Vaults keyed by vault name (lowercase, for case-insensitive lookup)
|
|
1557
|
+
*/
|
|
1558
|
+
__publicField(this, "vaultsByName");
|
|
1559
|
+
/**
|
|
1560
|
+
* Unix timestamp (milliseconds) of last successful fetch
|
|
1561
|
+
*/
|
|
1562
|
+
__publicField(this, "lastFetch");
|
|
1563
|
+
/**
|
|
1564
|
+
* Time-to-live in milliseconds
|
|
1565
|
+
*/
|
|
1566
|
+
__publicField(this, "ttl");
|
|
1567
|
+
/**
|
|
1568
|
+
* Current refresh promise (prevents duplicate concurrent refreshes)
|
|
1569
|
+
* When non-null, a refresh is in progress and callers should await this promise
|
|
1570
|
+
*/
|
|
1571
|
+
__publicField(this, "refreshPromise");
|
|
1572
|
+
/**
|
|
1573
|
+
* Unix timestamp (milliseconds) when current refresh started.
|
|
1574
|
+
* Used to detect stale refresh promises.
|
|
1575
|
+
*/
|
|
1576
|
+
__publicField(this, "refreshStartedAt");
|
|
1577
|
+
this.vaults = /* @__PURE__ */ new Map();
|
|
1578
|
+
this.assets = /* @__PURE__ */ new Map();
|
|
1579
|
+
this.vaultsByAddress = /* @__PURE__ */ new Map();
|
|
1580
|
+
this.vaultsByName = /* @__PURE__ */ new Map();
|
|
1581
|
+
this.lastFetch = 0;
|
|
1582
|
+
this.ttl = ttl;
|
|
1583
|
+
this.refreshPromise = null;
|
|
1584
|
+
this.refreshStartedAt = 0;
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Gets vaults by deposit token address
|
|
1588
|
+
*
|
|
1589
|
+
* Returns undefined if no vaults found for the given token address.
|
|
1590
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
1591
|
+
*
|
|
1592
|
+
* @param tokenAddress - Deposit token address (baseTokenAddress)
|
|
1593
|
+
* @returns Array of AmplifyVault objects, or undefined if not found
|
|
1594
|
+
*/
|
|
1595
|
+
getVault(tokenAddress) {
|
|
1596
|
+
return this.vaults.get(tokenAddress);
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Gets a vault by its boringVaultAddress (on-chain vault contract).
|
|
1600
|
+
* Case-insensitive lookup.
|
|
1601
|
+
*/
|
|
1602
|
+
getVaultByAddress(address) {
|
|
1603
|
+
return this.vaultsByAddress.get(address.toLowerCase());
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Gets a vault by its human-readable name.
|
|
1607
|
+
* Case-insensitive lookup.
|
|
1608
|
+
*/
|
|
1609
|
+
getVaultByName(name) {
|
|
1610
|
+
return this.vaultsByName.get(name.toLowerCase());
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Gets asset by token address
|
|
1614
|
+
*
|
|
1615
|
+
* Returns undefined if asset not found.
|
|
1616
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
1617
|
+
*
|
|
1618
|
+
* @param tokenAddress - Token address
|
|
1619
|
+
* @returns SupportedAsset object, or undefined if not found
|
|
1620
|
+
*/
|
|
1621
|
+
getAsset(tokenAddress) {
|
|
1622
|
+
return this.assets.get(tokenAddress);
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Gets all cached vaults
|
|
1626
|
+
*
|
|
1627
|
+
* Returns an array of all vaults across all deposit tokens.
|
|
1628
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
1629
|
+
*
|
|
1630
|
+
* @returns Array of all AmplifyVault objects
|
|
1631
|
+
*/
|
|
1632
|
+
getAllVaults() {
|
|
1633
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1634
|
+
const allVaults = [];
|
|
1635
|
+
for (const vaultArray of this.vaults.values()) {
|
|
1636
|
+
for (const vault of vaultArray) {
|
|
1637
|
+
if (!seen.has(vault.id)) {
|
|
1638
|
+
seen.add(vault.id);
|
|
1639
|
+
allVaults.push(vault);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
return allVaults;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Gets all cached assets
|
|
1647
|
+
*
|
|
1648
|
+
* Returns an array of all assets.
|
|
1649
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
1650
|
+
*
|
|
1651
|
+
* @returns Array of all SupportedAsset objects
|
|
1652
|
+
*/
|
|
1653
|
+
getAllAssets() {
|
|
1654
|
+
return Array.from(this.assets.values());
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Checks if cache is expired
|
|
1658
|
+
*
|
|
1659
|
+
* Cache is considered expired if current time exceeds lastFetch + ttl.
|
|
1660
|
+
*
|
|
1661
|
+
* @returns true if cache is expired, false otherwise
|
|
1662
|
+
*/
|
|
1663
|
+
isExpired() {
|
|
1664
|
+
return Date.now() > this.lastFetch + this.ttl;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Gets the time until cache expires
|
|
1668
|
+
*
|
|
1669
|
+
* @returns Milliseconds until expiry, or 0 if already expired
|
|
1670
|
+
*/
|
|
1671
|
+
getTimeUntilExpiry() {
|
|
1672
|
+
const expiryTime = this.lastFetch + this.ttl;
|
|
1673
|
+
const now = Date.now();
|
|
1674
|
+
return Math.max(0, expiryTime - now);
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Checks if cache is empty (never populated)
|
|
1678
|
+
*
|
|
1679
|
+
* @returns true if cache has never been populated, false otherwise
|
|
1680
|
+
*/
|
|
1681
|
+
isEmpty() {
|
|
1682
|
+
return this.lastFetch === 0;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Manually refreshes the cache
|
|
1686
|
+
*
|
|
1687
|
+
* Fetches fresh data from the API and updates both vaults and assets maps.
|
|
1688
|
+
* Updates lastFetch timestamp on success.
|
|
1689
|
+
*
|
|
1690
|
+
* If a refresh is already in progress, this method returns the existing
|
|
1691
|
+
* promise instead of starting a concurrent refresh. This is more efficient
|
|
1692
|
+
* than polling and ensures all callers wait for the same refresh operation.
|
|
1693
|
+
*
|
|
1694
|
+
* @throws {APIError} If the API request fails
|
|
1695
|
+
*/
|
|
1696
|
+
async refresh() {
|
|
1697
|
+
const STALE_REFRESH_MS = 3e4;
|
|
1698
|
+
if (this.refreshPromise) {
|
|
1699
|
+
if (Date.now() - this.refreshStartedAt < STALE_REFRESH_MS) {
|
|
1700
|
+
return this.refreshPromise;
|
|
1701
|
+
}
|
|
1702
|
+
this.refreshPromise = null;
|
|
1703
|
+
}
|
|
1704
|
+
this.refreshStartedAt = Date.now();
|
|
1705
|
+
this.refreshPromise = this._doRefresh();
|
|
1706
|
+
try {
|
|
1707
|
+
await this.refreshPromise;
|
|
1708
|
+
} finally {
|
|
1709
|
+
this.refreshPromise = null;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Internal refresh implementation
|
|
1714
|
+
* Separated to allow promise reuse in refresh()
|
|
1715
|
+
*
|
|
1716
|
+
* Fetches data via GraphQL and derives both vaults and assets
|
|
1717
|
+
* from the same response.
|
|
1718
|
+
*/
|
|
1719
|
+
async _doRefresh() {
|
|
1720
|
+
const { vaults, assets } = await fetchVaultDataFromGraphQL();
|
|
1721
|
+
this.vaults.clear();
|
|
1722
|
+
this.assets.clear();
|
|
1723
|
+
this.vaultsByAddress.clear();
|
|
1724
|
+
this.vaultsByName.clear();
|
|
1725
|
+
for (const vault of vaults) {
|
|
1726
|
+
for (const asset of vault.supportedAssets) {
|
|
1727
|
+
const tokenAddress = asset.address;
|
|
1728
|
+
const existing = this.vaults.get(tokenAddress);
|
|
1729
|
+
if (existing) {
|
|
1730
|
+
if (!existing.includes(vault)) {
|
|
1731
|
+
existing.push(vault);
|
|
1732
|
+
}
|
|
1733
|
+
} else {
|
|
1734
|
+
this.vaults.set(tokenAddress, [vault]);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
this.vaultsByAddress.set(
|
|
1738
|
+
vault.vault.boringVaultAddress.toLowerCase(),
|
|
1739
|
+
vault
|
|
1740
|
+
);
|
|
1741
|
+
if (vault.name) {
|
|
1742
|
+
this.vaultsByName.set(vault.name.toLowerCase(), vault);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
for (const asset of assets) {
|
|
1746
|
+
this.assets.set(asset.address, asset);
|
|
1747
|
+
}
|
|
1748
|
+
this.lastFetch = Date.now();
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* Check if a refresh is currently in progress
|
|
1752
|
+
*
|
|
1753
|
+
* @returns true if cache is being refreshed, false otherwise
|
|
1754
|
+
*/
|
|
1755
|
+
isRefreshing() {
|
|
1756
|
+
return this.refreshPromise !== null;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Clears the cache
|
|
1760
|
+
*
|
|
1761
|
+
* Removes all cached data and resets lastFetch timestamp.
|
|
1762
|
+
* Does not affect TTL setting.
|
|
1763
|
+
*/
|
|
1764
|
+
clear() {
|
|
1765
|
+
this.vaults.clear();
|
|
1766
|
+
this.assets.clear();
|
|
1767
|
+
this.vaultsByAddress.clear();
|
|
1768
|
+
this.vaultsByName.clear();
|
|
1769
|
+
this.lastFetch = 0;
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Gets cache statistics
|
|
1773
|
+
*
|
|
1774
|
+
* @returns Object with cache statistics
|
|
1775
|
+
*/
|
|
1776
|
+
getStats() {
|
|
1777
|
+
return {
|
|
1778
|
+
vaultCount: this.getAllVaults().length,
|
|
1779
|
+
assetCount: this.assets.size,
|
|
1780
|
+
tokenCount: this.vaults.size,
|
|
1781
|
+
lastFetch: this.lastFetch,
|
|
1782
|
+
ttl: this.ttl,
|
|
1783
|
+
isExpired: this.isExpired(),
|
|
1784
|
+
isEmpty: this.isEmpty(),
|
|
1785
|
+
timeUntilExpiry: this.getTimeUntilExpiry()
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
|
|
1790
|
+
// src/constants/index.ts
|
|
1791
|
+
var DEFAULT_DEADLINE = 3;
|
|
1792
|
+
var CHAINLINK_ADDRESS = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
1793
|
+
var DEFAULT_APPROVAL_AMOUNT = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
1794
|
+
var API_BASE_URL = "https://api.paxoslabs.com";
|
|
1795
|
+
|
|
1796
|
+
// src/utils/fetch.ts
|
|
1797
|
+
var DEFAULT_TIMEOUT = 1e4;
|
|
1798
|
+
function createTimeoutSignal(timeoutMs) {
|
|
1799
|
+
const controller = new AbortController();
|
|
1800
|
+
setTimeout(() => controller.abort(), timeoutMs);
|
|
1801
|
+
return controller.signal;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// src/lib/sdk-config.ts
|
|
1805
|
+
var MAX_CACHE_RETRIES = 3;
|
|
1806
|
+
var RETRY_DELAYS = [1e3, 2e3, 4e3];
|
|
1807
|
+
var sdkConfig = {
|
|
1808
|
+
apiKey: null,
|
|
1809
|
+
isInitialized: false,
|
|
1810
|
+
initializedAt: null,
|
|
1811
|
+
isInitializing: false,
|
|
1812
|
+
initPromise: null,
|
|
1813
|
+
telemetryEnabled: true,
|
|
1814
|
+
cachePopulationPromise: null,
|
|
1815
|
+
isCacheReady: false,
|
|
1816
|
+
rpcUrls: {}
|
|
1817
|
+
};
|
|
1818
|
+
var ERROR_MESSAGES = {
|
|
1819
|
+
INVALID_API_KEY: "Invalid API key format. Expected format: pxl_<type>_<string>",
|
|
1820
|
+
EMPTY_API_KEY: "API key cannot be empty. Provide a valid API key from Paxos Labs.",
|
|
1821
|
+
UNKNOWN_ERROR: "Unexpected initialization error. Contact support if issue persists."};
|
|
1822
|
+
function validateAPIKey(apiKey) {
|
|
1823
|
+
if (!apiKey || apiKey.trim().length === 0) {
|
|
1824
|
+
throw new APIError(ERROR_MESSAGES.EMPTY_API_KEY, {
|
|
1825
|
+
endpoint: "initAmplifySDK",
|
|
1826
|
+
statusCode: void 0
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
if (apiKey.length < 10) {
|
|
1830
|
+
throw new APIError(ERROR_MESSAGES.INVALID_API_KEY, {
|
|
1831
|
+
endpoint: "initAmplifySDK",
|
|
1832
|
+
statusCode: void 0
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
if (!apiKey.startsWith("pxl_")) {
|
|
1836
|
+
getLogger().warn(
|
|
1837
|
+
'API key does not start with expected prefix "pxl_". It may not be valid.'
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
function setAPIKey(apiKey) {
|
|
1842
|
+
sdkConfig.apiKey = apiKey;
|
|
1843
|
+
}
|
|
1844
|
+
function getAPIKey() {
|
|
1845
|
+
return sdkConfig.apiKey;
|
|
1846
|
+
}
|
|
1847
|
+
function getRpcUrls() {
|
|
1848
|
+
return { ...sdkConfig.rpcUrls };
|
|
1849
|
+
}
|
|
1850
|
+
function clearConfig() {
|
|
1851
|
+
sdkConfig.apiKey = null;
|
|
1852
|
+
sdkConfig.isInitialized = false;
|
|
1853
|
+
sdkConfig.initializedAt = null;
|
|
1854
|
+
sdkConfig.isInitializing = false;
|
|
1855
|
+
sdkConfig.initPromise = null;
|
|
1856
|
+
sdkConfig.telemetryEnabled = true;
|
|
1857
|
+
sdkConfig.cachePopulationPromise = null;
|
|
1858
|
+
sdkConfig.isCacheReady = false;
|
|
1859
|
+
sdkConfig.rpcUrls = {};
|
|
1860
|
+
clearClients();
|
|
1861
|
+
resetTelemetry();
|
|
1862
|
+
}
|
|
1863
|
+
function getRequestHeaders() {
|
|
1864
|
+
const apiKey = getAPIKey();
|
|
1865
|
+
const headers = {
|
|
1866
|
+
"Content-Type": "application/json"
|
|
1867
|
+
};
|
|
1868
|
+
if (apiKey) {
|
|
1869
|
+
headers["x-api-key"] = apiKey;
|
|
1870
|
+
}
|
|
1871
|
+
return headers;
|
|
1872
|
+
}
|
|
1873
|
+
async function populateCacheInBackground(cache) {
|
|
1874
|
+
const logger = getLogger();
|
|
1875
|
+
for (let attempt = 0; attempt < MAX_CACHE_RETRIES; attempt++) {
|
|
1876
|
+
try {
|
|
1877
|
+
await cache.refresh();
|
|
1878
|
+
sdkConfig.isCacheReady = true;
|
|
1879
|
+
logger.debug("Background cache population completed", {
|
|
1880
|
+
attempt: attempt + 1
|
|
1881
|
+
});
|
|
1882
|
+
return;
|
|
1883
|
+
} catch (error) {
|
|
1884
|
+
const isLastAttempt = attempt === MAX_CACHE_RETRIES - 1;
|
|
1885
|
+
if (isLastAttempt) {
|
|
1886
|
+
logger.warn(
|
|
1887
|
+
"Background cache population failed after all retries, falling back to on-demand fetching",
|
|
1888
|
+
{
|
|
1889
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1890
|
+
attempts: MAX_CACHE_RETRIES
|
|
1891
|
+
}
|
|
1892
|
+
);
|
|
1893
|
+
return;
|
|
1894
|
+
}
|
|
1895
|
+
logger.debug(
|
|
1896
|
+
`Cache population attempt ${attempt + 1} failed, retrying...`,
|
|
1897
|
+
{
|
|
1898
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1899
|
+
nextRetryIn: RETRY_DELAYS[attempt]
|
|
1900
|
+
}
|
|
1901
|
+
);
|
|
1902
|
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAYS[attempt]));
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
function isCacheReady() {
|
|
1907
|
+
return sdkConfig.isCacheReady;
|
|
1908
|
+
}
|
|
1909
|
+
async function waitForCacheReady() {
|
|
1910
|
+
if (sdkConfig.isCacheReady) {
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
if (sdkConfig.cachePopulationPromise) {
|
|
1914
|
+
await sdkConfig.cachePopulationPromise;
|
|
1915
|
+
if (sdkConfig.isCacheReady) {
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
const cache = getCache();
|
|
1920
|
+
await cache.refresh();
|
|
1921
|
+
sdkConfig.isCacheReady = true;
|
|
1922
|
+
}
|
|
1923
|
+
async function initAmplifySDK(apiKey, options) {
|
|
1924
|
+
validateAPIKey(apiKey);
|
|
1925
|
+
if (sdkConfig.isInitialized && sdkConfig.apiKey === apiKey) {
|
|
1926
|
+
const nextRpcUrls = options?.rpcUrls ?? {};
|
|
1927
|
+
const hasRpcUrlChange = Object.keys(nextRpcUrls).length !== Object.keys(sdkConfig.rpcUrls).length || Object.entries(nextRpcUrls).some(
|
|
1928
|
+
([chainId, url]) => sdkConfig.rpcUrls[Number(chainId)] !== url
|
|
1929
|
+
);
|
|
1930
|
+
if (hasRpcUrlChange) {
|
|
1931
|
+
sdkConfig.rpcUrls = { ...nextRpcUrls };
|
|
1932
|
+
clearClients();
|
|
1933
|
+
}
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
if (sdkConfig.isInitializing && sdkConfig.initPromise) {
|
|
1937
|
+
await sdkConfig.initPromise;
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
if (sdkConfig.isInitialized && sdkConfig.apiKey !== apiKey) {
|
|
1941
|
+
clearConfig();
|
|
1942
|
+
clearCache();
|
|
1943
|
+
}
|
|
1944
|
+
if (options?.logger) {
|
|
1945
|
+
setLogger(options.logger);
|
|
1946
|
+
}
|
|
1947
|
+
if (options?.logLevel !== void 0) {
|
|
1948
|
+
setLogLevel(options.logLevel);
|
|
1949
|
+
}
|
|
1950
|
+
sdkConfig.telemetryEnabled = options?.telemetry !== false;
|
|
1951
|
+
sdkConfig.rpcUrls = options?.rpcUrls ?? {};
|
|
1952
|
+
sdkConfig.isInitializing = true;
|
|
1953
|
+
sdkConfig.initPromise = (async () => {
|
|
1954
|
+
try {
|
|
1955
|
+
setAPIKey(apiKey);
|
|
1956
|
+
const cache = initializeCache();
|
|
1957
|
+
sdkConfig.isInitialized = true;
|
|
1958
|
+
sdkConfig.initializedAt = /* @__PURE__ */ new Date();
|
|
1959
|
+
sdkConfig.isCacheReady = false;
|
|
1960
|
+
sdkConfig.cachePopulationPromise = populateCacheInBackground(cache);
|
|
1961
|
+
if (sdkConfig.telemetryEnabled) {
|
|
1962
|
+
initTelemetry(apiKey).catch(() => {
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
getLogger().info(
|
|
1966
|
+
"Amplify SDK initialized (cache populating in background)"
|
|
1967
|
+
);
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
clearConfig();
|
|
1970
|
+
clearCache();
|
|
1971
|
+
if (error instanceof APIError) {
|
|
1972
|
+
throw error;
|
|
1973
|
+
}
|
|
1974
|
+
throw new APIError(ERROR_MESSAGES.UNKNOWN_ERROR, {
|
|
1975
|
+
endpoint: "initAmplifySDK",
|
|
1976
|
+
cause: error
|
|
1977
|
+
});
|
|
1978
|
+
} finally {
|
|
1979
|
+
sdkConfig.isInitializing = false;
|
|
1980
|
+
sdkConfig.initPromise = null;
|
|
1981
|
+
}
|
|
1982
|
+
})();
|
|
1983
|
+
await sdkConfig.initPromise;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
// src/lib/telemetry.ts
|
|
1987
|
+
var SDK_VERSION = "0.1.1-beta.1";
|
|
1988
|
+
var MAX_ERROR_BUFFER_SIZE = 10;
|
|
1989
|
+
var CONFIG_FETCH_TIMEOUT = 5e3;
|
|
1990
|
+
var telemetryState = {
|
|
1991
|
+
enabled: false,
|
|
1992
|
+
isInitialized: false,
|
|
1993
|
+
isInitializing: false,
|
|
1994
|
+
initPromise: null,
|
|
1995
|
+
config: null,
|
|
1996
|
+
apiKey: null
|
|
1997
|
+
};
|
|
1998
|
+
var posthogClient = null;
|
|
1999
|
+
var errorBuffer = [];
|
|
2000
|
+
var bufferFullWarningLogged = false;
|
|
2001
|
+
function hashApiKey(apiKey) {
|
|
2002
|
+
const FNV_OFFSET = BigInt("0xcbf29ce484222325");
|
|
2003
|
+
const FNV_PRIME = BigInt("0x100000001b3");
|
|
2004
|
+
let hash = FNV_OFFSET;
|
|
2005
|
+
for (let i = 0; i < apiKey.length; i++) {
|
|
2006
|
+
hash ^= BigInt(apiKey.charCodeAt(i));
|
|
2007
|
+
hash = hash * FNV_PRIME & BigInt("0xffffffffffffffff");
|
|
2008
|
+
}
|
|
2009
|
+
return `sdk_${hash.toString(16).slice(0, 12)}`;
|
|
2010
|
+
}
|
|
2011
|
+
async function fetchTelemetryConfig(apiKey) {
|
|
2012
|
+
const endpoint = "/v1/earn-sdk/config";
|
|
2013
|
+
const url = `${API_BASE_URL}${endpoint}`;
|
|
2014
|
+
try {
|
|
2015
|
+
const headers = getRequestHeaders();
|
|
2016
|
+
if (!headers["x-api-key"]) {
|
|
2017
|
+
headers["x-api-key"] = apiKey;
|
|
2018
|
+
}
|
|
2019
|
+
const response = await fetch(url, {
|
|
2020
|
+
method: "GET",
|
|
2021
|
+
headers,
|
|
2022
|
+
signal: createTimeoutSignal(CONFIG_FETCH_TIMEOUT)
|
|
2023
|
+
});
|
|
2024
|
+
if (!response.ok) {
|
|
2025
|
+
return null;
|
|
2026
|
+
}
|
|
2027
|
+
const data = await response.json();
|
|
2028
|
+
if (!data || typeof data.posthogApiKey !== "string") {
|
|
2029
|
+
return null;
|
|
2030
|
+
}
|
|
2031
|
+
return {
|
|
2032
|
+
posthogApiKey: data.posthogApiKey,
|
|
2033
|
+
posthogHost: data.posthogHost || "https://us.i.posthog.com"
|
|
2034
|
+
};
|
|
2035
|
+
} catch {
|
|
2036
|
+
return null;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
async function flushErrorBuffer() {
|
|
2040
|
+
if (errorBuffer.length === 0 || !posthogClient) {
|
|
2041
|
+
return;
|
|
2042
|
+
}
|
|
2043
|
+
for (const bufferedError of errorBuffer) {
|
|
2044
|
+
const payload = {
|
|
2045
|
+
error_type: bufferedError.name,
|
|
2046
|
+
error_message: bufferedError.message,
|
|
2047
|
+
error_code: bufferedError.code,
|
|
2048
|
+
sdk_version: SDK_VERSION,
|
|
2049
|
+
buffered: true,
|
|
2050
|
+
...bufferedError.context
|
|
2051
|
+
};
|
|
2052
|
+
posthogClient.capture("sdk_error", payload);
|
|
2053
|
+
}
|
|
2054
|
+
errorBuffer.length = 0;
|
|
2055
|
+
}
|
|
2056
|
+
async function initTelemetry(apiKey) {
|
|
2057
|
+
if (telemetryState.isInitialized) {
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
if (telemetryState.isInitializing && telemetryState.initPromise) {
|
|
2061
|
+
await telemetryState.initPromise;
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
telemetryState.isInitializing = true;
|
|
2065
|
+
telemetryState.apiKey = apiKey;
|
|
2066
|
+
telemetryState.initPromise = (async () => {
|
|
2067
|
+
try {
|
|
2068
|
+
const config = await fetchTelemetryConfig(apiKey);
|
|
2069
|
+
if (!config) {
|
|
2070
|
+
telemetryState.enabled = false;
|
|
2071
|
+
telemetryState.isInitialized = true;
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
telemetryState.config = config;
|
|
2075
|
+
const posthogModule = await import('posthog-js');
|
|
2076
|
+
const posthog = posthogModule.default;
|
|
2077
|
+
posthog.init(config.posthogApiKey, {
|
|
2078
|
+
api_host: config.posthogHost,
|
|
2079
|
+
autocapture: false,
|
|
2080
|
+
capture_pageview: false,
|
|
2081
|
+
capture_pageleave: false,
|
|
2082
|
+
disable_session_recording: true,
|
|
2083
|
+
persistence: "memory",
|
|
2084
|
+
// Don't persist to localStorage
|
|
2085
|
+
loaded: (ph) => {
|
|
2086
|
+
ph.identify(hashApiKey(apiKey));
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
posthogClient = posthog;
|
|
2090
|
+
telemetryState.enabled = true;
|
|
2091
|
+
telemetryState.isInitialized = true;
|
|
2092
|
+
await flushErrorBuffer();
|
|
2093
|
+
posthog.capture("sdk_initialized", {
|
|
2094
|
+
sdk_version: SDK_VERSION
|
|
2095
|
+
});
|
|
2096
|
+
} catch (error) {
|
|
2097
|
+
const logger = getLogger();
|
|
2098
|
+
logger.warn("Telemetry initialization failed", {
|
|
2099
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2100
|
+
});
|
|
2101
|
+
telemetryState.enabled = false;
|
|
2102
|
+
telemetryState.isInitialized = true;
|
|
2103
|
+
} finally {
|
|
2104
|
+
telemetryState.isInitializing = false;
|
|
2105
|
+
telemetryState.initPromise = null;
|
|
2106
|
+
}
|
|
2107
|
+
})();
|
|
2108
|
+
await telemetryState.initPromise;
|
|
2109
|
+
}
|
|
2110
|
+
function trackError(error, context) {
|
|
2111
|
+
const logger = getLogger();
|
|
2112
|
+
logger.error(error.message, {
|
|
2113
|
+
name: error.name,
|
|
2114
|
+
stack: error.stack,
|
|
2115
|
+
...context
|
|
2116
|
+
});
|
|
2117
|
+
const errorDetails = {
|
|
2118
|
+
name: error.name,
|
|
2119
|
+
message: error.message,
|
|
2120
|
+
code: error.code,
|
|
2121
|
+
context: context || {},
|
|
2122
|
+
timestamp: Date.now()
|
|
2123
|
+
};
|
|
2124
|
+
if (!posthogClient || !telemetryState.enabled) {
|
|
2125
|
+
if (errorBuffer.length < MAX_ERROR_BUFFER_SIZE) {
|
|
2126
|
+
errorBuffer.push(errorDetails);
|
|
2127
|
+
} else if (!bufferFullWarningLogged) {
|
|
2128
|
+
logger.warn(
|
|
2129
|
+
`Telemetry error buffer full (${MAX_ERROR_BUFFER_SIZE} errors). Additional errors will not be tracked until telemetry initializes.`
|
|
2130
|
+
);
|
|
2131
|
+
bufferFullWarningLogged = true;
|
|
2132
|
+
}
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
const payload = {
|
|
2136
|
+
error_type: error.name,
|
|
2137
|
+
error_message: error.message,
|
|
2138
|
+
error_code: error.code,
|
|
2139
|
+
endpoint: error.endpoint,
|
|
2140
|
+
status_code: error.statusCode,
|
|
2141
|
+
sdk_version: SDK_VERSION,
|
|
2142
|
+
...context
|
|
2143
|
+
};
|
|
2144
|
+
posthogClient.capture("sdk_error", payload);
|
|
2145
|
+
}
|
|
2146
|
+
function resetTelemetry() {
|
|
2147
|
+
telemetryState.enabled = false;
|
|
2148
|
+
telemetryState.isInitialized = false;
|
|
2149
|
+
telemetryState.isInitializing = false;
|
|
2150
|
+
telemetryState.initPromise = null;
|
|
2151
|
+
telemetryState.config = null;
|
|
2152
|
+
telemetryState.apiKey = null;
|
|
2153
|
+
posthogClient = null;
|
|
2154
|
+
errorBuffer.length = 0;
|
|
2155
|
+
bufferFullWarningLogged = false;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
// src/types/amplify-sdk-api.ts
|
|
2159
|
+
var APIError = class _APIError extends Error {
|
|
2160
|
+
constructor(message, options) {
|
|
2161
|
+
super(message);
|
|
2162
|
+
/**
|
|
2163
|
+
* HTTP status code (if available)
|
|
2164
|
+
*/
|
|
2165
|
+
__publicField(this, "statusCode");
|
|
2166
|
+
/**
|
|
2167
|
+
* API endpoint that failed
|
|
2168
|
+
*/
|
|
2169
|
+
__publicField(this, "endpoint");
|
|
2170
|
+
/**
|
|
2171
|
+
* Original error cause
|
|
2172
|
+
*/
|
|
2173
|
+
__publicField(this, "cause");
|
|
2174
|
+
this.name = "APIError";
|
|
2175
|
+
this.statusCode = options?.statusCode;
|
|
2176
|
+
this.endpoint = options?.endpoint;
|
|
2177
|
+
this.cause = options?.cause;
|
|
2178
|
+
Object.setPrototypeOf(this, _APIError.prototype);
|
|
2179
|
+
if (Error.captureStackTrace) {
|
|
2180
|
+
Error.captureStackTrace(this, _APIError);
|
|
2181
|
+
}
|
|
2182
|
+
try {
|
|
2183
|
+
trackError(this, {
|
|
2184
|
+
endpoint: this.endpoint,
|
|
2185
|
+
statusCode: this.statusCode
|
|
2186
|
+
});
|
|
2187
|
+
} catch {
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
function isValidYieldType(value) {
|
|
2192
|
+
return typeof value === "string" && (value === "CORE" || value === "TREASURY" || value === "FRONTIER");
|
|
2193
|
+
}
|
|
2194
|
+
function isValidAddress(value) {
|
|
2195
|
+
return typeof value === "string" && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
2196
|
+
}
|
|
2197
|
+
function isValidChainId(value) {
|
|
2198
|
+
return typeof value === "number" && value > 0 && Number.isInteger(value);
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
// src/client/graphql-client.ts
|
|
2202
|
+
var VAULT_FIELDS = `
|
|
2203
|
+
id
|
|
2204
|
+
name
|
|
2205
|
+
chainId
|
|
2206
|
+
isDeleted
|
|
2207
|
+
inDeprecation
|
|
2208
|
+
boringVaultModuleId
|
|
2209
|
+
boringVaultAddress
|
|
2210
|
+
rolesAuthorityModuleId
|
|
2211
|
+
tellerModuleId
|
|
2212
|
+
accountantModuleId
|
|
2213
|
+
managerModuleId
|
|
2214
|
+
withdrawQueueModuleId
|
|
2215
|
+
communityCodeDepositorModuleId
|
|
2216
|
+
depositFeeModuleId
|
|
2217
|
+
withdrawFeeModuleId
|
|
2218
|
+
enterpriseConfig {
|
|
2219
|
+
predicatePolicyId
|
|
2220
|
+
}
|
|
2221
|
+
baseTokenAddressId
|
|
2222
|
+
baseTokenStandInId
|
|
2223
|
+
baseTokenStandIn {
|
|
2224
|
+
decimals
|
|
2225
|
+
symbol
|
|
2226
|
+
coinGeckoApiId
|
|
2227
|
+
}
|
|
2228
|
+
withdrawalSla {
|
|
2229
|
+
withdrawAssetAddress
|
|
2230
|
+
externalWithdrawalQueueDelaySLA
|
|
2231
|
+
externalAccountantRateUpdateSLA
|
|
2232
|
+
}
|
|
2233
|
+
supportedAssets {
|
|
2234
|
+
address
|
|
2235
|
+
chainId
|
|
2236
|
+
depositable
|
|
2237
|
+
withdrawable
|
|
2238
|
+
symbol
|
|
2239
|
+
tokenName
|
|
2240
|
+
decimals
|
|
2241
|
+
}
|
|
2242
|
+
depositFeeConfigs {
|
|
2243
|
+
feeModuleAddress
|
|
2244
|
+
depositAsset
|
|
2245
|
+
feePercentage
|
|
2246
|
+
flatFee
|
|
2247
|
+
}
|
|
2248
|
+
withdrawQueueFeeConfig {
|
|
2249
|
+
queueAddress
|
|
2250
|
+
feeModule
|
|
2251
|
+
offerFeeBps
|
|
2252
|
+
offerFeeRate
|
|
2253
|
+
}
|
|
2254
|
+
atomicWithdrawal
|
|
2255
|
+
`;
|
|
2256
|
+
var DEPOSIT_TOKEN_FIELDS = `
|
|
2257
|
+
id
|
|
2258
|
+
address
|
|
2259
|
+
chainId
|
|
2260
|
+
name
|
|
2261
|
+
`;
|
|
2262
|
+
var TOKEN_METADATA_FIELDS = `
|
|
2263
|
+
address
|
|
2264
|
+
chainId
|
|
2265
|
+
symbol
|
|
2266
|
+
tokenName
|
|
2267
|
+
decimals
|
|
2268
|
+
coinGeckoTokenId
|
|
2269
|
+
tokenStandard
|
|
2270
|
+
source
|
|
2271
|
+
firstSeenAt
|
|
2272
|
+
metadataRefreshedAt
|
|
2273
|
+
`;
|
|
2274
|
+
var VAULT_ASSET_FLAGS_FIELDS = `
|
|
2275
|
+
depositable
|
|
2276
|
+
withdrawable
|
|
2277
|
+
`;
|
|
2278
|
+
var SDK_CONFIG_CORE_FIELDS = `
|
|
2279
|
+
id
|
|
2280
|
+
chainId
|
|
2281
|
+
environment
|
|
2282
|
+
yieldType
|
|
2283
|
+
vaultId
|
|
2284
|
+
depositTokenAddressId
|
|
2285
|
+
`;
|
|
2286
|
+
function buildSdkConfigsQuery(options) {
|
|
2287
|
+
const nestedFields = [];
|
|
2288
|
+
if (options.vault) {
|
|
2289
|
+
nestedFields.push(`vault { ${options.vault} }`);
|
|
2290
|
+
}
|
|
2291
|
+
if (options.depositTokenAddress) {
|
|
2292
|
+
nestedFields.push(`depositTokenAddress { ${options.depositTokenAddress} }`);
|
|
2293
|
+
}
|
|
2294
|
+
if (options.tokenMetadata) {
|
|
2295
|
+
nestedFields.push(`tokenMetadata { ${options.tokenMetadata} }`);
|
|
2296
|
+
}
|
|
2297
|
+
if (options.vaultAssetFlags) {
|
|
2298
|
+
nestedFields.push(`vaultAssetFlags { ${options.vaultAssetFlags} }`);
|
|
2299
|
+
}
|
|
2300
|
+
const allFields = [...options.fields, ...nestedFields].join("\n ");
|
|
2301
|
+
return `
|
|
2302
|
+
query AmplifySdkConfigs(
|
|
2303
|
+
$environment: Environment
|
|
2304
|
+
$chainId: Int
|
|
2305
|
+
$yieldType: YieldType
|
|
2306
|
+
) {
|
|
2307
|
+
amplifySdkConfigs(
|
|
2308
|
+
environment: $environment
|
|
2309
|
+
chainId: $chainId
|
|
2310
|
+
yieldType: $yieldType
|
|
2311
|
+
) {
|
|
2312
|
+
${allFields}
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
`;
|
|
2316
|
+
}
|
|
2317
|
+
async function executeGraphQLQuery(endpoint, query, variables) {
|
|
2318
|
+
const headers = getRequestHeaders();
|
|
2319
|
+
let response;
|
|
2320
|
+
try {
|
|
2321
|
+
response = await fetch(endpoint, {
|
|
2322
|
+
method: "POST",
|
|
2323
|
+
headers,
|
|
2324
|
+
body: JSON.stringify({ query, variables }),
|
|
2325
|
+
signal: createTimeoutSignal(DEFAULT_TIMEOUT)
|
|
2326
|
+
});
|
|
2327
|
+
} catch (error) {
|
|
2328
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
2329
|
+
throw new APIError("GraphQL request timed out", {
|
|
2330
|
+
endpoint,
|
|
2331
|
+
cause: error
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
throw new APIError(
|
|
2335
|
+
`GraphQL network error: ${error instanceof Error ? error.message : String(error)}`,
|
|
2336
|
+
{ endpoint, cause: error }
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
if (!response.ok) {
|
|
2340
|
+
throw new APIError(
|
|
2341
|
+
`GraphQL HTTP error: ${response.status} ${response.statusText}`,
|
|
2342
|
+
{ endpoint, statusCode: response.status }
|
|
2343
|
+
);
|
|
2344
|
+
}
|
|
2345
|
+
let body;
|
|
2346
|
+
try {
|
|
2347
|
+
body = await response.json();
|
|
2348
|
+
} catch (error) {
|
|
2349
|
+
throw new APIError("GraphQL response is not valid JSON", {
|
|
2350
|
+
endpoint,
|
|
2351
|
+
cause: error
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
if (body.errors && body.errors.length > 0) {
|
|
2355
|
+
const messages = body.errors.map((e) => e.message).join("; ");
|
|
2356
|
+
throw new APIError(`GraphQL errors: ${messages}`, {
|
|
2357
|
+
endpoint,
|
|
2358
|
+
cause: body.errors
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
if (!body.data) {
|
|
2362
|
+
throw new APIError("GraphQL response missing data field", { endpoint });
|
|
2363
|
+
}
|
|
2364
|
+
return body.data;
|
|
2365
|
+
}
|
|
2366
|
+
async function fetchAmplifySdkConfigs(endpoint, variables) {
|
|
2367
|
+
const query = buildSdkConfigsQuery({
|
|
2368
|
+
fields: SDK_CONFIG_CORE_FIELDS.trim().split(/\s+/),
|
|
2369
|
+
vault: VAULT_FIELDS,
|
|
2370
|
+
depositTokenAddress: DEPOSIT_TOKEN_FIELDS,
|
|
2371
|
+
tokenMetadata: TOKEN_METADATA_FIELDS,
|
|
2372
|
+
vaultAssetFlags: VAULT_ASSET_FLAGS_FIELDS
|
|
2373
|
+
});
|
|
2374
|
+
return executeGraphQLQuery(
|
|
2375
|
+
endpoint,
|
|
2376
|
+
query,
|
|
2377
|
+
variables
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
// src/constants/config.ts
|
|
2382
|
+
var YieldType = {
|
|
2383
|
+
CORE: "CORE",
|
|
2384
|
+
TREASURY: "TREASURY",
|
|
2385
|
+
FRONTIER: "FRONTIER"
|
|
2386
|
+
};
|
|
2387
|
+
var DEFAULT_SLIPPAGE_BPS = 50;
|
|
2388
|
+
|
|
2389
|
+
// src/client/graphql-mapper.ts
|
|
2390
|
+
function mapYieldType(graphqlYieldType) {
|
|
2391
|
+
switch (graphqlYieldType) {
|
|
2392
|
+
case "CORE":
|
|
2393
|
+
case "PRIME":
|
|
2394
|
+
return YieldType.CORE;
|
|
2395
|
+
case "TREASURY":
|
|
2396
|
+
case "TBILL":
|
|
2397
|
+
return YieldType.TREASURY;
|
|
2398
|
+
case "FRONTIER":
|
|
2399
|
+
case "LENDING":
|
|
2400
|
+
return YieldType.FRONTIER;
|
|
2401
|
+
default: {
|
|
2402
|
+
const logger = getLogger();
|
|
2403
|
+
logger.warn(`Unknown GraphQL yield type: ${graphqlYieldType}, skipping`);
|
|
2404
|
+
return null;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
function mapGraphQLConfigToVault(config) {
|
|
2409
|
+
if (!config.vault || !config.depositTokenAddress) {
|
|
2410
|
+
return null;
|
|
2411
|
+
}
|
|
2412
|
+
const yieldType = mapYieldType(config.yieldType);
|
|
2413
|
+
if (!yieldType) {
|
|
2414
|
+
return null;
|
|
2415
|
+
}
|
|
2416
|
+
const { vault, depositTokenAddress } = config;
|
|
2417
|
+
const indexerAssets = vault.supportedAssets && vault.supportedAssets.length > 0 ? vault.supportedAssets.map((a) => ({
|
|
2418
|
+
address: a.address,
|
|
2419
|
+
chainId: a.chainId,
|
|
2420
|
+
symbol: a.symbol ?? a.address,
|
|
2421
|
+
name: a.tokenName ?? a.symbol ?? a.address,
|
|
2422
|
+
decimals: a.decimals ?? 0,
|
|
2423
|
+
depositable: a.depositable,
|
|
2424
|
+
withdrawable: a.withdrawable
|
|
2425
|
+
})) : [
|
|
2426
|
+
{
|
|
2427
|
+
address: depositTokenAddress.address,
|
|
2428
|
+
symbol: config.tokenMetadata?.symbol ?? depositTokenAddress.name,
|
|
2429
|
+
name: config.tokenMetadata?.tokenName ?? depositTokenAddress.name,
|
|
2430
|
+
decimals: config.tokenMetadata?.decimals ?? 0,
|
|
2431
|
+
...config.vaultAssetFlags && {
|
|
2432
|
+
depositable: config.vaultAssetFlags.depositable,
|
|
2433
|
+
withdrawable: config.vaultAssetFlags.withdrawable
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
];
|
|
2437
|
+
return {
|
|
2438
|
+
id: config.id,
|
|
2439
|
+
chainId: config.chainId,
|
|
2440
|
+
yieldType,
|
|
2441
|
+
name: vault.name,
|
|
2442
|
+
inDeprecation: vault.inDeprecation,
|
|
2443
|
+
vault: {
|
|
2444
|
+
boringVaultAddress: vault.boringVaultAddress,
|
|
2445
|
+
tellerAddress: vault.tellerModuleId,
|
|
2446
|
+
accountantAddress: vault.accountantModuleId,
|
|
2447
|
+
managerAddress: vault.managerModuleId,
|
|
2448
|
+
rolesAuthorityAddress: vault.rolesAuthorityModuleId,
|
|
2449
|
+
baseTokenAddress: vault.baseTokenAddressId,
|
|
2450
|
+
baseTokenStandIn: vault.baseTokenStandInId ? vault.baseTokenStandInId : void 0,
|
|
2451
|
+
withdrawQueueAddress: vault.withdrawQueueModuleId ? vault.withdrawQueueModuleId : void 0,
|
|
2452
|
+
communityCodeDepositorAddress: vault.communityCodeDepositorModuleId ? vault.communityCodeDepositorModuleId : void 0,
|
|
2453
|
+
depositFeeModuleAddress: vault.depositFeeModuleId ? vault.depositFeeModuleId : void 0,
|
|
2454
|
+
withdrawFeeModuleAddress: vault.withdrawFeeModuleId ? vault.withdrawFeeModuleId : void 0
|
|
2455
|
+
},
|
|
2456
|
+
atomicWithdrawal: vault.atomicWithdrawal ?? false,
|
|
2457
|
+
enterpriseConfig: vault.enterpriseConfig ? { predicatePolicyId: vault.enterpriseConfig.predicatePolicyId } : void 0,
|
|
2458
|
+
supportedAssets: indexerAssets,
|
|
2459
|
+
sla: vault.withdrawalSla && vault.withdrawalSla.length > 0 ? {
|
|
2460
|
+
externalWithdrawalQueueDelaySLA: vault.withdrawalSla[0].externalWithdrawalQueueDelaySLA,
|
|
2461
|
+
externalAccountantRateUpdateSLA: vault.withdrawalSla[0].externalAccountantRateUpdateSLA
|
|
2462
|
+
} : void 0,
|
|
2463
|
+
depositFees: (() => {
|
|
2464
|
+
const configs = vault.depositFeeConfigs ?? [];
|
|
2465
|
+
if (configs.length > 0) {
|
|
2466
|
+
return {
|
|
2467
|
+
hasFees: true,
|
|
2468
|
+
feeModuleAddress: configs[0].feeModuleAddress,
|
|
2469
|
+
fees: configs.map((fc) => ({
|
|
2470
|
+
depositAsset: fc.depositAsset ? fc.depositAsset : null,
|
|
2471
|
+
feePercentage: BigInt(fc.feePercentage ?? "0"),
|
|
2472
|
+
flatFee: BigInt(fc.flatFee ?? "0")
|
|
2473
|
+
}))
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
if (vault.depositFeeModuleId) {
|
|
2477
|
+
return {
|
|
2478
|
+
hasFees: false,
|
|
2479
|
+
feeModuleAddress: vault.depositFeeModuleId,
|
|
2480
|
+
fees: []
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
return void 0;
|
|
2484
|
+
})(),
|
|
2485
|
+
withdrawFees: vault.withdrawQueueFeeConfig && (vault.withdrawQueueFeeConfig.feeModule != null || vault.withdrawQueueFeeConfig.offerFeeBps != null || vault.withdrawQueueFeeConfig.offerFeeRate != null) ? {
|
|
2486
|
+
hasFees: true,
|
|
2487
|
+
feeModuleAddress: vault.withdrawQueueFeeConfig.feeModule || vault.withdrawFeeModuleId || null,
|
|
2488
|
+
offerFeeBps: vault.withdrawQueueFeeConfig.offerFeeBps != null ? BigInt(vault.withdrawQueueFeeConfig.offerFeeBps) : 0n,
|
|
2489
|
+
offerFeeRate: BigInt(
|
|
2490
|
+
vault.withdrawQueueFeeConfig.offerFeeRate ?? "0"
|
|
2491
|
+
)
|
|
2492
|
+
} : vault.withdrawFeeModuleId ? {
|
|
2493
|
+
hasFees: false,
|
|
2494
|
+
feeModuleAddress: vault.withdrawFeeModuleId,
|
|
2495
|
+
offerFeeBps: 0n,
|
|
2496
|
+
offerFeeRate: 0n
|
|
2497
|
+
} : void 0
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
function aggregateVaultConfigs(configs) {
|
|
2501
|
+
const vaultMap = /* @__PURE__ */ new Map();
|
|
2502
|
+
for (const config of configs) {
|
|
2503
|
+
if (!config.vault || !config.depositTokenAddress) continue;
|
|
2504
|
+
if (vaultMap.has(config.vaultId)) continue;
|
|
2505
|
+
const mapped = mapGraphQLConfigToVault(config);
|
|
2506
|
+
if (mapped) {
|
|
2507
|
+
vaultMap.set(config.vaultId, mapped);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return Array.from(vaultMap.values());
|
|
2511
|
+
}
|
|
2512
|
+
function extractSupportedAssetsFromConfigs(configs) {
|
|
2513
|
+
const assetMap = /* @__PURE__ */ new Map();
|
|
2514
|
+
for (const config of configs) {
|
|
2515
|
+
if (!config.depositTokenAddress) continue;
|
|
2516
|
+
const key = config.depositTokenAddress.address.toLowerCase();
|
|
2517
|
+
const existing = assetMap.get(key);
|
|
2518
|
+
if (existing) {
|
|
2519
|
+
existing.chains.add(config.chainId);
|
|
2520
|
+
if (existing.decimals === 0 && config.tokenMetadata?.decimals) {
|
|
2521
|
+
existing.decimals = config.tokenMetadata.decimals;
|
|
2522
|
+
existing.symbol = config.tokenMetadata.symbol ?? existing.symbol;
|
|
2523
|
+
existing.name = config.tokenMetadata.tokenName ?? existing.name;
|
|
2524
|
+
}
|
|
2525
|
+
} else {
|
|
2526
|
+
assetMap.set(key, {
|
|
2527
|
+
address: config.depositTokenAddress.address,
|
|
2528
|
+
symbol: config.tokenMetadata?.symbol ?? config.depositTokenAddress.name,
|
|
2529
|
+
name: config.tokenMetadata?.tokenName ?? config.depositTokenAddress.name,
|
|
2530
|
+
decimals: config.tokenMetadata?.decimals ?? 0,
|
|
2531
|
+
chains: /* @__PURE__ */ new Set([config.chainId])
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
return Array.from(assetMap.values()).map((asset) => ({
|
|
2536
|
+
address: asset.address,
|
|
2537
|
+
symbol: asset.symbol,
|
|
2538
|
+
name: asset.name,
|
|
2539
|
+
decimals: asset.decimals,
|
|
2540
|
+
chains: Array.from(asset.chains)
|
|
2541
|
+
}));
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
// src/client/amplify-sdk-client.ts
|
|
2545
|
+
function validateVaultFilterOptions(options) {
|
|
2546
|
+
if (!options) return;
|
|
2547
|
+
if (options.chainId !== void 0 && !isValidChainId(options.chainId)) {
|
|
2548
|
+
throw new APIError(
|
|
2549
|
+
`Invalid chainId: ${options.chainId}. Must be a positive integer.`,
|
|
2550
|
+
{ endpoint: "/v1/earn-sdk/vaults" }
|
|
2551
|
+
);
|
|
2552
|
+
}
|
|
2553
|
+
if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
|
|
2554
|
+
throw new APIError(
|
|
2555
|
+
`Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
2556
|
+
{ endpoint: "/v1/earn-sdk/vaults" }
|
|
2557
|
+
);
|
|
2558
|
+
}
|
|
2559
|
+
if (options.depositTokenAddress !== void 0 && !isValidAddress(options.depositTokenAddress)) {
|
|
2560
|
+
throw new APIError(
|
|
2561
|
+
`Invalid depositTokenAddress: ${options.depositTokenAddress}. Must be a valid Ethereum address.`,
|
|
2562
|
+
{ endpoint: "/v1/earn-sdk/vaults" }
|
|
2563
|
+
);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
function validateAssetFilterOptions(options) {
|
|
2567
|
+
if (!options) return;
|
|
2568
|
+
if (options.chains !== void 0) {
|
|
2569
|
+
if (!Array.isArray(options.chains) || options.chains.length === 0) {
|
|
2570
|
+
throw new APIError(
|
|
2571
|
+
"Invalid chains: Must be a non-empty array of chain IDs.",
|
|
2572
|
+
{ endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
for (const chainId of options.chains) {
|
|
2576
|
+
if (!isValidChainId(chainId)) {
|
|
2577
|
+
throw new APIError(
|
|
2578
|
+
`Invalid chainId in chains array: ${chainId}. Must be a positive integer.`,
|
|
2579
|
+
{ endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
|
|
2580
|
+
);
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
|
|
2585
|
+
throw new APIError(
|
|
2586
|
+
`Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
2587
|
+
{ endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
|
|
2588
|
+
);
|
|
2589
|
+
}
|
|
2590
|
+
if (options.address !== void 0 && !isValidAddress(options.address)) {
|
|
2591
|
+
throw new APIError(
|
|
2592
|
+
`Invalid address: ${options.address}. Must be a valid Ethereum address.`,
|
|
2593
|
+
{ endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
if (options.symbol !== void 0 && typeof options.symbol !== "string") {
|
|
2597
|
+
throw new APIError(`Invalid symbol: ${options.symbol}. Must be a string.`, {
|
|
2598
|
+
endpoint: "/v1/earn-sdk/supported-assets-by-chains"
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
async function fetchVaultDataFromGraphQL() {
|
|
2603
|
+
const endpoint = getGraphQLEndpoint();
|
|
2604
|
+
const response = await fetchAmplifySdkConfigs(endpoint);
|
|
2605
|
+
const configs = response.amplifySdkConfigs;
|
|
2606
|
+
const vaults = aggregateVaultConfigs(configs);
|
|
2607
|
+
const assets = extractSupportedAssetsFromConfigs(configs);
|
|
2608
|
+
let enrichedVaults = vaults;
|
|
2609
|
+
try {
|
|
2610
|
+
enrichedVaults = await enrichVaultsWithSupplyCapsAndFees(vaults);
|
|
2611
|
+
} catch (err) {
|
|
2612
|
+
getLogger().debug(
|
|
2613
|
+
`enrichVaultsWithSupplyCapsAndFees failed for ${vaults.length} vault(s)`,
|
|
2614
|
+
{ error: err instanceof Error ? err.message : String(err) }
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2617
|
+
return { vaults: enrichedVaults, assets };
|
|
2618
|
+
}
|
|
2619
|
+
function applyVaultFilters(vaults, options) {
|
|
2620
|
+
if (!options) return vaults;
|
|
2621
|
+
let filtered = vaults;
|
|
2622
|
+
if (options.chainId !== void 0) {
|
|
2623
|
+
filtered = filtered.filter((v) => v.chainId === options.chainId);
|
|
2624
|
+
}
|
|
2625
|
+
if (options.yieldType) {
|
|
2626
|
+
filtered = filtered.filter((v) => v.yieldType === options.yieldType);
|
|
2627
|
+
}
|
|
2628
|
+
if (options.depositTokenAddress) {
|
|
2629
|
+
const normalized = options.depositTokenAddress.toLowerCase();
|
|
2630
|
+
filtered = filtered.filter(
|
|
2631
|
+
(v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
return filtered;
|
|
2635
|
+
}
|
|
2636
|
+
function applyAssetFilters(assets, options) {
|
|
2637
|
+
if (!options) return assets;
|
|
2638
|
+
let filtered = assets;
|
|
2639
|
+
if (options.chains !== void 0 && options.chains.length > 0) {
|
|
2640
|
+
filtered = filtered.filter(
|
|
2641
|
+
(asset) => options.chains?.some((chainId) => asset.chains.includes(chainId))
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
if (options.address) {
|
|
2645
|
+
const normalizedAddress = options.address.toLowerCase();
|
|
2646
|
+
filtered = filtered.filter(
|
|
2647
|
+
(asset) => asset.address.toLowerCase() === normalizedAddress
|
|
2648
|
+
);
|
|
2649
|
+
}
|
|
2650
|
+
if (options.symbol) {
|
|
2651
|
+
filtered = filtered.filter((asset) => asset.symbol === options.symbol);
|
|
2652
|
+
}
|
|
2653
|
+
return filtered;
|
|
2654
|
+
}
|
|
2655
|
+
async function getVaults(options) {
|
|
2656
|
+
validateVaultFilterOptions(options);
|
|
2657
|
+
const cache = getCache();
|
|
2658
|
+
if (cache.isEmpty() || cache.isExpired()) {
|
|
2659
|
+
await cache.refresh();
|
|
2660
|
+
}
|
|
2661
|
+
return applyVaultFilters(cache.getAllVaults(), options);
|
|
2662
|
+
}
|
|
2663
|
+
async function getSupportedAssets(options) {
|
|
2664
|
+
validateAssetFilterOptions(options);
|
|
2665
|
+
const cache = getCache();
|
|
2666
|
+
if (cache.isEmpty() || cache.isExpired()) {
|
|
2667
|
+
await cache.refresh();
|
|
2668
|
+
}
|
|
2669
|
+
return applyAssetFilters(cache.getAllAssets(), options);
|
|
2670
|
+
}
|
|
2671
|
+
var globalCache = null;
|
|
2672
|
+
function initializeCache(ttl) {
|
|
2673
|
+
globalCache = new VaultCache(ttl);
|
|
2674
|
+
return globalCache;
|
|
2675
|
+
}
|
|
2676
|
+
function getCache() {
|
|
2677
|
+
if (!globalCache) {
|
|
2678
|
+
globalCache = new VaultCache();
|
|
2679
|
+
}
|
|
2680
|
+
return globalCache;
|
|
2681
|
+
}
|
|
2682
|
+
async function refreshVaultCache() {
|
|
2683
|
+
const cache = getCache();
|
|
2684
|
+
await cache.refresh();
|
|
2685
|
+
}
|
|
2686
|
+
function clearCache() {
|
|
2687
|
+
const cache = getCache();
|
|
2688
|
+
cache.clear();
|
|
2689
|
+
}
|
|
2690
|
+
async function getAssetsFromCache(options) {
|
|
2691
|
+
return getSupportedAssets(options);
|
|
2692
|
+
}
|
|
2693
|
+
async function findVaultByConfig(params) {
|
|
2694
|
+
if (!isValidAddress(params.assetAddress)) {
|
|
2695
|
+
throw new APIError(
|
|
2696
|
+
`Invalid assetAddress: ${params.assetAddress}. Must be a valid Ethereum address.`,
|
|
2697
|
+
{ endpoint: "findVaultByConfig" }
|
|
2698
|
+
);
|
|
2699
|
+
}
|
|
2700
|
+
if (!isValidYieldType(params.yieldType)) {
|
|
2701
|
+
throw new APIError(
|
|
2702
|
+
`Invalid yieldType: ${params.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
2703
|
+
{ endpoint: "findVaultByConfig" }
|
|
2704
|
+
);
|
|
2705
|
+
}
|
|
2706
|
+
if (!isValidChainId(params.chainId)) {
|
|
2707
|
+
throw new APIError(
|
|
2708
|
+
`Invalid chainId: ${params.chainId}. Must be a positive integer.`,
|
|
2709
|
+
{ endpoint: "findVaultByConfig" }
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
const cache = getCache();
|
|
2713
|
+
if (cache.isEmpty() || cache.isExpired()) {
|
|
2714
|
+
await cache.refresh();
|
|
2715
|
+
}
|
|
2716
|
+
const normalizedAddress = params.assetAddress.toLowerCase();
|
|
2717
|
+
let vaultsByToken = cache.getVault(params.assetAddress);
|
|
2718
|
+
if (!vaultsByToken) {
|
|
2719
|
+
vaultsByToken = cache.getVault(normalizedAddress);
|
|
2720
|
+
}
|
|
2721
|
+
if (!vaultsByToken) {
|
|
2722
|
+
const allVaults = cache.getAllVaults();
|
|
2723
|
+
const matchingVaults = allVaults.filter(
|
|
2724
|
+
(vault) => vault.supportedAssets.some(
|
|
2725
|
+
(a) => a.address.toLowerCase() === normalizedAddress
|
|
2726
|
+
)
|
|
2727
|
+
);
|
|
2728
|
+
vaultsByToken = matchingVaults.length > 0 ? matchingVaults : void 0;
|
|
2729
|
+
}
|
|
2730
|
+
if (!vaultsByToken || vaultsByToken.length === 0) {
|
|
2731
|
+
return null;
|
|
2732
|
+
}
|
|
2733
|
+
const matchingVault = vaultsByToken.find(
|
|
2734
|
+
(vault) => vault.yieldType === params.yieldType && vault.chainId === params.chainId
|
|
2735
|
+
);
|
|
2736
|
+
return matchingVault || null;
|
|
2737
|
+
}
|
|
2738
|
+
async function getVaultsByConfig(params) {
|
|
2739
|
+
const cache = getCache();
|
|
2740
|
+
if (cache.isEmpty() || cache.isExpired()) {
|
|
2741
|
+
await cache.refresh();
|
|
2742
|
+
}
|
|
2743
|
+
let vaults = cache.getAllVaults();
|
|
2744
|
+
if (params?.yieldType) {
|
|
2745
|
+
if (!isValidYieldType(params.yieldType)) {
|
|
2746
|
+
throw new APIError(
|
|
2747
|
+
`Invalid yieldType: ${params.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
|
|
2748
|
+
{ endpoint: "getVaultsByConfig" }
|
|
2749
|
+
);
|
|
2750
|
+
}
|
|
2751
|
+
vaults = vaults.filter((v) => v.yieldType === params.yieldType);
|
|
2752
|
+
}
|
|
2753
|
+
if (params?.chainId !== void 0) {
|
|
2754
|
+
if (!isValidChainId(params.chainId)) {
|
|
2755
|
+
throw new APIError(
|
|
2756
|
+
`Invalid chainId: ${params.chainId}. Must be a positive integer.`,
|
|
2757
|
+
{ endpoint: "getVaultsByConfig" }
|
|
2758
|
+
);
|
|
2759
|
+
}
|
|
2760
|
+
vaults = vaults.filter((v) => v.chainId === params.chainId);
|
|
2761
|
+
}
|
|
2762
|
+
if (params?.depositAssetAddress) {
|
|
2763
|
+
if (!isValidAddress(params.depositAssetAddress)) {
|
|
2764
|
+
throw new APIError(
|
|
2765
|
+
`Invalid depositAssetAddress: ${params.depositAssetAddress}.`,
|
|
2766
|
+
{ endpoint: "getVaultsByConfig" }
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2769
|
+
const normalized = params.depositAssetAddress.toLowerCase();
|
|
2770
|
+
vaults = vaults.filter(
|
|
2771
|
+
(v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2774
|
+
if (params?.withdrawAssetAddress) {
|
|
2775
|
+
if (!isValidAddress(params.withdrawAssetAddress)) {
|
|
2776
|
+
throw new APIError(
|
|
2777
|
+
`Invalid withdrawAssetAddress: ${params.withdrawAssetAddress}.`,
|
|
2778
|
+
{ endpoint: "getVaultsByConfig" }
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
const normalized = params.withdrawAssetAddress.toLowerCase();
|
|
2782
|
+
vaults = vaults.filter(
|
|
2783
|
+
(v) => v.supportedAssets.some(
|
|
2784
|
+
(a) => a.withdrawable !== false && a.address.toLowerCase() === normalized
|
|
2785
|
+
)
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2788
|
+
if (params?.settlementAssetAddress) {
|
|
2789
|
+
if (!isValidAddress(params.settlementAssetAddress)) {
|
|
2790
|
+
throw new APIError(
|
|
2791
|
+
`Invalid settlementAssetAddress: ${params.settlementAssetAddress}.`,
|
|
2792
|
+
{ endpoint: "getVaultsByConfig" }
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2795
|
+
const normalized = params.settlementAssetAddress.toLowerCase();
|
|
2796
|
+
vaults = vaults.filter(
|
|
2797
|
+
(v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2800
|
+
return vaults;
|
|
2801
|
+
}
|
|
2802
|
+
async function getWithdrawSupportedAssets() {
|
|
2803
|
+
const cache = getCache();
|
|
2804
|
+
if (cache.isEmpty() || cache.isExpired()) {
|
|
2805
|
+
await cache.refresh();
|
|
2806
|
+
}
|
|
2807
|
+
const vaults = cache.getAllVaults();
|
|
2808
|
+
const assets = cache.getAllAssets();
|
|
2809
|
+
const result = [];
|
|
2810
|
+
const assetMap = /* @__PURE__ */ new Map();
|
|
2811
|
+
for (const asset of assets) {
|
|
2812
|
+
assetMap.set(asset.address.toLowerCase(), asset);
|
|
2813
|
+
}
|
|
2814
|
+
const assetVaultMap = /* @__PURE__ */ new Map();
|
|
2815
|
+
for (const vault of vaults) {
|
|
2816
|
+
for (const asset of vault.supportedAssets) {
|
|
2817
|
+
const assetAddress = asset.address.toLowerCase();
|
|
2818
|
+
if (!assetVaultMap.has(assetAddress)) {
|
|
2819
|
+
assetVaultMap.set(assetAddress, []);
|
|
2820
|
+
}
|
|
2821
|
+
assetVaultMap.get(assetAddress)?.push({
|
|
2822
|
+
id: vault.id,
|
|
2823
|
+
yieldType: vault.yieldType,
|
|
2824
|
+
chainId: vault.chainId,
|
|
2825
|
+
vaultId: vault.id
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
for (const [assetAddress, vaultsData] of assetVaultMap.entries()) {
|
|
2830
|
+
const asset = assetMap.get(assetAddress);
|
|
2831
|
+
if (asset) {
|
|
2832
|
+
result.push({
|
|
2833
|
+
address: asset.address,
|
|
2834
|
+
symbol: asset.symbol,
|
|
2835
|
+
decimals: asset.decimals,
|
|
2836
|
+
vaults: vaultsData
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
return result;
|
|
2841
|
+
}
|
|
2842
|
+
var hyperEvm = viem.defineChain({
|
|
2843
|
+
id: 999,
|
|
2844
|
+
name: "HyperEVM",
|
|
2845
|
+
nativeCurrency: {
|
|
2846
|
+
decimals: 18,
|
|
2847
|
+
name: "Hyperliquid",
|
|
2848
|
+
symbol: "HYPE"
|
|
2849
|
+
},
|
|
2850
|
+
rpcUrls: {
|
|
2851
|
+
default: {
|
|
2852
|
+
http: ["https://rpc.hyperliquid.xyz/evm"],
|
|
2853
|
+
webSocket: ["wss://hyperliquid.drpc.org"]
|
|
2854
|
+
}
|
|
2855
|
+
},
|
|
2856
|
+
blockExplorers: {
|
|
2857
|
+
default: { name: "Explorer", url: "https://purrsec.com/" }
|
|
2858
|
+
},
|
|
2859
|
+
contracts: {
|
|
2860
|
+
multicall3: {
|
|
2861
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
2862
|
+
blockCreated: 13051
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
});
|
|
2866
|
+
var stableTestnet = viem.defineChain({
|
|
2867
|
+
id: 2201,
|
|
2868
|
+
name: "Stable Testnet",
|
|
2869
|
+
nativeCurrency: {
|
|
2870
|
+
decimals: 18,
|
|
2871
|
+
name: "Ether",
|
|
2872
|
+
symbol: "ETH"
|
|
2873
|
+
},
|
|
2874
|
+
rpcUrls: {
|
|
2875
|
+
default: {
|
|
2876
|
+
http: ["https://rpc.testnet.stable.xyz"]
|
|
2877
|
+
}
|
|
2878
|
+
},
|
|
2879
|
+
blockExplorers: {
|
|
2880
|
+
default: { name: "Stablescan", url: "https://testnet.stablescan.xyz" }
|
|
2881
|
+
},
|
|
2882
|
+
contracts: {
|
|
2883
|
+
multicall3: {
|
|
2884
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
2885
|
+
blockCreated: 0
|
|
2886
|
+
}
|
|
2887
|
+
},
|
|
2888
|
+
testnet: true
|
|
2889
|
+
});
|
|
2890
|
+
var CHAIN_ID_TO_CHAIN_MAP = {
|
|
2891
|
+
[chains.mainnet.id]: chains.mainnet,
|
|
2892
|
+
[chains.sepolia.id]: chains.sepolia,
|
|
2893
|
+
[chains.base.id]: chains.base,
|
|
2894
|
+
[hyperEvm.id]: hyperEvm,
|
|
2895
|
+
[stableTestnet.id]: stableTestnet,
|
|
2896
|
+
[chains.baseSepolia.id]: chains.baseSepolia
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
// src/utils/chain-utils.ts
|
|
2900
|
+
function toChainId(value) {
|
|
2901
|
+
return typeof value === "number" ? value : Number(value);
|
|
2902
|
+
}
|
|
2903
|
+
var chainsCache = null;
|
|
2904
|
+
async function getChainFromConfig(chainId, config) {
|
|
2905
|
+
if (chainsCache && !config) {
|
|
2906
|
+
const chain2 = chainsCache.get(Number(chainId));
|
|
2907
|
+
if (chain2) {
|
|
2908
|
+
return chain2;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
const vaults = config ?? await getVaults();
|
|
2912
|
+
const numericChainId = Number(chainId);
|
|
2913
|
+
const knownChain = CHAIN_ID_TO_CHAIN_MAP[numericChainId];
|
|
2914
|
+
const vaultForChain = vaults.find((v) => v.chainId === numericChainId);
|
|
2915
|
+
if (!knownChain && !vaultForChain) {
|
|
2916
|
+
throw new Error(`Vault not found for ID: ${chainId}`);
|
|
2917
|
+
}
|
|
2918
|
+
if (config && !chainsCache) {
|
|
2919
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2920
|
+
for (const v of vaults) {
|
|
2921
|
+
const chainConfig = CHAIN_ID_TO_CHAIN_MAP[v.chainId];
|
|
2922
|
+
if (!chainConfig) {
|
|
2923
|
+
throw new Error(`Chain config not found for ID: ${v.chainId}`);
|
|
2924
|
+
}
|
|
2925
|
+
cache.set(v.chainId, {
|
|
2926
|
+
id: v.chainId,
|
|
2927
|
+
name: chainConfig.name,
|
|
2928
|
+
nativeCurrency: chainConfig.nativeCurrency,
|
|
2929
|
+
rpcUrls: chainConfig.rpcUrls,
|
|
2930
|
+
contracts: chainConfig.contracts
|
|
2931
|
+
});
|
|
2932
|
+
}
|
|
2933
|
+
if (knownChain && !cache.has(numericChainId)) {
|
|
2934
|
+
cache.set(numericChainId, {
|
|
2935
|
+
id: numericChainId,
|
|
2936
|
+
name: knownChain.name,
|
|
2937
|
+
nativeCurrency: knownChain.nativeCurrency,
|
|
2938
|
+
rpcUrls: knownChain.rpcUrls,
|
|
2939
|
+
contracts: knownChain.contracts
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
chainsCache = cache;
|
|
2943
|
+
}
|
|
2944
|
+
const chain = chainsCache ? chainsCache.get(numericChainId) : void 0;
|
|
2945
|
+
if (!chain) {
|
|
2946
|
+
throw new Error(`Chain not found for ID: ${chainId}`);
|
|
2947
|
+
}
|
|
2948
|
+
return chain;
|
|
2949
|
+
}
|
|
2950
|
+
function getChainNameById(chainId) {
|
|
2951
|
+
return CHAIN_ID_TO_CHAIN_MAP[chainId]?.name || null;
|
|
2952
|
+
}
|
|
2953
|
+
function clearChainsCache() {
|
|
2954
|
+
chainsCache = null;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
// src/lib/viem/client.ts
|
|
2958
|
+
var clients = /* @__PURE__ */ new Map();
|
|
2959
|
+
var directClients = /* @__PURE__ */ new Map();
|
|
2960
|
+
var warnedChains = /* @__PURE__ */ new Set();
|
|
2961
|
+
var getClient = async (chainId) => {
|
|
2962
|
+
if (!chainId) {
|
|
2963
|
+
throw new Error("Chain ID is required");
|
|
2964
|
+
}
|
|
2965
|
+
const numericChainId = toChainId(chainId);
|
|
2966
|
+
if (!clients.has(numericChainId)) {
|
|
2967
|
+
const chain = await getChainFromConfig(numericChainId, await getVaults());
|
|
2968
|
+
const customRpcUrl = getRpcUrls()[numericChainId];
|
|
2969
|
+
if (!customRpcUrl && !warnedChains.has(numericChainId)) {
|
|
2970
|
+
warnedChains.add(numericChainId);
|
|
2971
|
+
getLogger().warn(
|
|
2972
|
+
`No custom RPC URL provided for chain ${numericChainId} (${chain.name}). Using default public RPC. Public RPCs may be unreliable \u2014 pass rpcUrls in initAmplifySDK() options for better reliability.`
|
|
2973
|
+
);
|
|
2974
|
+
}
|
|
2975
|
+
const rpcUrl = customRpcUrl ?? chain.rpcUrls.default.http[0];
|
|
2976
|
+
const client2 = viem.createPublicClient({
|
|
2977
|
+
chain,
|
|
2978
|
+
transport: viem.http(rpcUrl)
|
|
2979
|
+
});
|
|
2980
|
+
clients.set(numericChainId, client2);
|
|
2981
|
+
}
|
|
2982
|
+
const client = clients.get(numericChainId);
|
|
2983
|
+
if (!client) {
|
|
2984
|
+
throw new Error(`Client not found for chain ID ${chainId}`);
|
|
2985
|
+
}
|
|
2986
|
+
return client;
|
|
2987
|
+
};
|
|
2988
|
+
var getClientDirect = async (chainId) => {
|
|
2989
|
+
if (!chainId) {
|
|
2990
|
+
throw new Error("Chain ID is required");
|
|
2991
|
+
}
|
|
2992
|
+
const numericChainId = toChainId(chainId);
|
|
2993
|
+
if (!directClients.has(numericChainId)) {
|
|
2994
|
+
const chain = CHAIN_ID_TO_CHAIN_MAP[numericChainId];
|
|
2995
|
+
if (!chain) {
|
|
2996
|
+
throw new Error(`Chain config not found for ID: ${numericChainId}`);
|
|
2997
|
+
}
|
|
2998
|
+
const customRpcUrl = getRpcUrls()[numericChainId];
|
|
2999
|
+
if (!customRpcUrl && !warnedChains.has(numericChainId)) {
|
|
3000
|
+
warnedChains.add(numericChainId);
|
|
3001
|
+
getLogger().warn(
|
|
3002
|
+
`No custom RPC URL provided for chain ${numericChainId} (${chain.name}). Using default public RPC. Public RPCs may be unreliable \u2014 pass rpcUrls in initAmplifySDK() options for better reliability.`
|
|
3003
|
+
);
|
|
3004
|
+
}
|
|
3005
|
+
const rpcUrl = customRpcUrl ?? chain.rpcUrls.default.http[0];
|
|
3006
|
+
const client2 = viem.createPublicClient({
|
|
3007
|
+
chain,
|
|
3008
|
+
transport: viem.http(rpcUrl)
|
|
3009
|
+
});
|
|
3010
|
+
directClients.set(numericChainId, client2);
|
|
3011
|
+
}
|
|
3012
|
+
const client = directClients.get(numericChainId);
|
|
3013
|
+
if (!client) {
|
|
3014
|
+
throw new Error(`Client not found for chain ID ${chainId}`);
|
|
3015
|
+
}
|
|
3016
|
+
return client;
|
|
3017
|
+
};
|
|
3018
|
+
function clearClients() {
|
|
3019
|
+
clients.clear();
|
|
3020
|
+
directClients.clear();
|
|
3021
|
+
warnedChains.clear();
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
// src/api/fees-and-supply-cap.ts
|
|
3025
|
+
async function readSupplyCapInBase(dcdAddress, chainId) {
|
|
3026
|
+
const client = await getClientDirect(chainId);
|
|
3027
|
+
const result = await client.readContract({
|
|
3028
|
+
abi: DistributorCodeDepositorAbiV0,
|
|
3029
|
+
address: dcdAddress,
|
|
3030
|
+
functionName: "supplyCapInBase"
|
|
3031
|
+
});
|
|
3032
|
+
return result;
|
|
3033
|
+
}
|
|
3034
|
+
async function readFeeModuleFromDCD(dcdAddress, chainId) {
|
|
3035
|
+
try {
|
|
3036
|
+
const client = await getClientDirect(chainId);
|
|
3037
|
+
const result = await client.readContract({
|
|
3038
|
+
abi: DistributorCodeDepositorAbiV0,
|
|
3039
|
+
address: dcdAddress,
|
|
3040
|
+
functionName: "feeModule"
|
|
3041
|
+
});
|
|
3042
|
+
return result || viem.zeroAddress;
|
|
3043
|
+
} catch {
|
|
3044
|
+
return viem.zeroAddress;
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
async function readDepositFeeStructure(feeModuleAddress, depositAsset, chainId) {
|
|
3048
|
+
const client = await getClientDirect(chainId);
|
|
3049
|
+
const results = await client.multicall({
|
|
3050
|
+
contracts: [
|
|
3051
|
+
{
|
|
3052
|
+
abi: DCDAssetSpecificFeeModuleAbi,
|
|
3053
|
+
address: feeModuleAddress,
|
|
3054
|
+
functionName: "depositTokenFeeData",
|
|
3055
|
+
args: [depositAsset]
|
|
3056
|
+
},
|
|
3057
|
+
{
|
|
3058
|
+
abi: DCDAssetSpecificFeeModuleAbi,
|
|
3059
|
+
address: feeModuleAddress,
|
|
3060
|
+
functionName: "ONE_HUNDRED_PERCENT"
|
|
3061
|
+
}
|
|
3062
|
+
]
|
|
3063
|
+
});
|
|
3064
|
+
const [feeDataResult, oneHundredPercentResult] = results;
|
|
3065
|
+
if (feeDataResult.status === "failure" || oneHundredPercentResult.status === "failure") {
|
|
3066
|
+
throw new Error(
|
|
3067
|
+
"Failed to read fee data from fee module contract: RPC call failed"
|
|
3068
|
+
);
|
|
3069
|
+
}
|
|
3070
|
+
const [feePercentage, flatFee] = feeDataResult.result;
|
|
3071
|
+
const oneHundredPercent = oneHundredPercentResult.result;
|
|
3072
|
+
return { feePercentage, flatFee, oneHundredPercent };
|
|
3073
|
+
}
|
|
3074
|
+
async function readOneHundredPercent(feeModuleAddress, chainId) {
|
|
3075
|
+
const client = await getClientDirect(chainId);
|
|
3076
|
+
const result = await client.readContract({
|
|
3077
|
+
abi: DCDAssetSpecificFeeModuleAbi,
|
|
3078
|
+
address: feeModuleAddress,
|
|
3079
|
+
functionName: "ONE_HUNDRED_PERCENT"
|
|
3080
|
+
});
|
|
3081
|
+
return result;
|
|
3082
|
+
}
|
|
3083
|
+
async function readWithdrawFeePercentage(withdrawQueueAddress, chainId) {
|
|
3084
|
+
const client = await getClientDirect(chainId);
|
|
3085
|
+
const feeModuleAddress = await client.readContract({
|
|
3086
|
+
abi: WithdrawQueueAbi,
|
|
3087
|
+
address: withdrawQueueAddress,
|
|
3088
|
+
functionName: "feeModule"
|
|
3089
|
+
});
|
|
3090
|
+
if (!feeModuleAddress || feeModuleAddress === viem.zeroAddress) {
|
|
3091
|
+
return null;
|
|
3092
|
+
}
|
|
3093
|
+
const result = await client.readContract({
|
|
3094
|
+
abi: FeeModuleAbi,
|
|
3095
|
+
address: feeModuleAddress,
|
|
3096
|
+
functionName: "offerFeePercentage"
|
|
3097
|
+
});
|
|
3098
|
+
return {
|
|
3099
|
+
feeModuleAddress,
|
|
3100
|
+
offerFeePercentage: result
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
async function enrichVaultsWithSupplyCapsAndFees(vaults) {
|
|
3104
|
+
const enrichmentPromises = vaults.map(async (vault) => {
|
|
3105
|
+
const enriched = { ...vault };
|
|
3106
|
+
if (vault.vault.communityCodeDepositorAddress && vault.vault.depositFeeModuleAddress) {
|
|
3107
|
+
try {
|
|
3108
|
+
const supplyCapInBase = await readSupplyCapInBase(
|
|
3109
|
+
vault.vault.communityCodeDepositorAddress,
|
|
3110
|
+
vault.chainId
|
|
3111
|
+
);
|
|
3112
|
+
enriched.depositCap = {
|
|
3113
|
+
supplyCapInBase,
|
|
3114
|
+
hasDepositCap: supplyCapInBase !== 0n && supplyCapInBase !== viem.maxUint256
|
|
3115
|
+
};
|
|
3116
|
+
} catch {
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
const depositFeeModuleAddr = vault.vault.depositFeeModuleAddress;
|
|
3120
|
+
if (depositFeeModuleAddr && depositFeeModuleAddr !== viem.zeroAddress) {
|
|
3121
|
+
if (!vault.depositFees?.hasFees || vault.depositFees.fees.length === 0) {
|
|
3122
|
+
const defaultFees = vault.supportedAssets.filter((a) => a.depositable !== false).map((a) => ({
|
|
3123
|
+
depositAsset: a.address,
|
|
3124
|
+
feePercentage: 0n,
|
|
3125
|
+
flatFee: 0n
|
|
3126
|
+
}));
|
|
3127
|
+
enriched.depositFees = {
|
|
3128
|
+
hasFees: true,
|
|
3129
|
+
feeModuleAddress: depositFeeModuleAddr,
|
|
3130
|
+
fees: defaultFees
|
|
3131
|
+
};
|
|
3132
|
+
}
|
|
3133
|
+
if (!enriched.depositFees?.oneHundredPercent) {
|
|
3134
|
+
try {
|
|
3135
|
+
const oneHundredPercentFromFeeModule = await readOneHundredPercent(
|
|
3136
|
+
depositFeeModuleAddr,
|
|
3137
|
+
vault.chainId
|
|
3138
|
+
);
|
|
3139
|
+
enriched.depositFees = {
|
|
3140
|
+
...enriched.depositFees,
|
|
3141
|
+
oneHundredPercent: oneHundredPercentFromFeeModule
|
|
3142
|
+
};
|
|
3143
|
+
} catch {
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
const wfAddr = vault.vault.withdrawFeeModuleAddress;
|
|
3148
|
+
if (wfAddr && wfAddr !== viem.zeroAddress) {
|
|
3149
|
+
if (!vault.withdrawFees?.hasFees) {
|
|
3150
|
+
enriched.withdrawFees = {
|
|
3151
|
+
hasFees: true,
|
|
3152
|
+
feeModuleAddress: wfAddr,
|
|
3153
|
+
offerFeeBps: 0n,
|
|
3154
|
+
offerFeeRate: 0n
|
|
3155
|
+
};
|
|
3156
|
+
} else if (!enriched.withdrawFees?.feeModuleAddress) {
|
|
3157
|
+
enriched.withdrawFees = {
|
|
3158
|
+
...enriched.withdrawFees,
|
|
3159
|
+
feeModuleAddress: wfAddr
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
return enriched;
|
|
3164
|
+
});
|
|
3165
|
+
return Promise.all(enrichmentPromises);
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
exports.APIError = APIError;
|
|
3169
|
+
exports.API_BASE_URL = API_BASE_URL;
|
|
3170
|
+
exports.CHAINLINK_ADDRESS = CHAINLINK_ADDRESS;
|
|
3171
|
+
exports.DEFAULT_APPROVAL_AMOUNT = DEFAULT_APPROVAL_AMOUNT;
|
|
3172
|
+
exports.DEFAULT_DEADLINE = DEFAULT_DEADLINE;
|
|
3173
|
+
exports.DEFAULT_SLIPPAGE_BPS = DEFAULT_SLIPPAGE_BPS;
|
|
3174
|
+
exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
|
3175
|
+
exports.DistributorCodeDepositorAbiV0 = DistributorCodeDepositorAbiV0;
|
|
3176
|
+
exports.FeeModuleAbi = FeeModuleAbi;
|
|
3177
|
+
exports.LogLevel = LogLevel;
|
|
3178
|
+
exports.WithdrawQueueAbi = WithdrawQueueAbi;
|
|
3179
|
+
exports.YieldType = YieldType;
|
|
3180
|
+
exports.__publicField = __publicField;
|
|
3181
|
+
exports.clearChainsCache = clearChainsCache;
|
|
3182
|
+
exports.createTimeoutSignal = createTimeoutSignal;
|
|
3183
|
+
exports.enrichVaultsWithSupplyCapsAndFees = enrichVaultsWithSupplyCapsAndFees;
|
|
3184
|
+
exports.findVaultByConfig = findVaultByConfig;
|
|
3185
|
+
exports.getAssetsFromCache = getAssetsFromCache;
|
|
3186
|
+
exports.getCache = getCache;
|
|
3187
|
+
exports.getChainFromConfig = getChainFromConfig;
|
|
3188
|
+
exports.getChainNameById = getChainNameById;
|
|
3189
|
+
exports.getClient = getClient;
|
|
3190
|
+
exports.getLogger = getLogger;
|
|
3191
|
+
exports.getRequestHeaders = getRequestHeaders;
|
|
3192
|
+
exports.getRestV2BaseURL = getRestV2BaseURL;
|
|
3193
|
+
exports.getSupportedAssets = getSupportedAssets;
|
|
3194
|
+
exports.getVaults = getVaults;
|
|
3195
|
+
exports.getVaultsByConfig = getVaultsByConfig;
|
|
3196
|
+
exports.getWithdrawSupportedAssets = getWithdrawSupportedAssets;
|
|
3197
|
+
exports.initAmplifySDK = initAmplifySDK;
|
|
3198
|
+
exports.initializeCache = initializeCache;
|
|
3199
|
+
exports.isCacheReady = isCacheReady;
|
|
3200
|
+
exports.isValidAddress = isValidAddress;
|
|
3201
|
+
exports.isValidChainId = isValidChainId;
|
|
3202
|
+
exports.readDepositFeeStructure = readDepositFeeStructure;
|
|
3203
|
+
exports.readFeeModuleFromDCD = readFeeModuleFromDCD;
|
|
3204
|
+
exports.readSupplyCapInBase = readSupplyCapInBase;
|
|
3205
|
+
exports.readWithdrawFeePercentage = readWithdrawFeePercentage;
|
|
3206
|
+
exports.refreshVaultCache = refreshVaultCache;
|
|
3207
|
+
exports.setLogLevel = setLogLevel;
|
|
3208
|
+
exports.setLogger = setLogger;
|
|
3209
|
+
exports.toChainId = toChainId;
|
|
3210
|
+
exports.waitForCacheReady = waitForCacheReady;
|
|
3211
|
+
//# sourceMappingURL=chunk-GOJQYEJQ.js.map
|
|
3212
|
+
//# sourceMappingURL=chunk-GOJQYEJQ.js.map
|