@paxoslabs/amplify-sdk 0.0.2 → 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -1
- package/README.md +1 -1
- package/dist/{amplify-sdk-api-DPrRhynk.d.mts → amplify-sdk-api-Biol0OIp.d.mts} +1 -1
- package/dist/{amplify-sdk-api-B5hBTGrB.d.ts → amplify-sdk-api-DGRgEybp.d.ts} +1 -1
- package/dist/{chunk-IBNTWZ4S.js → chunk-B2QCI6ET.js} +13 -35
- package/dist/chunk-B2QCI6ET.js.map +1 -0
- package/dist/{chunk-WFCHKDDG.mjs → chunk-CUGK4ZBJ.mjs} +13 -35
- package/dist/chunk-CUGK4ZBJ.mjs.map +1 -0
- package/dist/{chunk-ANL3PE7L.js → chunk-DTFLXAZJ.js} +21 -46
- package/dist/chunk-DTFLXAZJ.js.map +1 -0
- package/dist/{chunk-NLLEYTJ6.js → chunk-GS7TDQXA.js} +8 -8
- package/dist/{chunk-NLLEYTJ6.js.map → chunk-GS7TDQXA.js.map} +1 -1
- package/dist/{chunk-774KTF7A.mjs → chunk-HI44AMLC.mjs} +4 -4
- package/dist/{chunk-774KTF7A.mjs.map → chunk-HI44AMLC.mjs.map} +1 -1
- package/dist/{chunk-BMN6KTOC.js → chunk-KYR6BFAE.js} +20 -20
- package/dist/{chunk-BMN6KTOC.js.map → chunk-KYR6BFAE.js.map} +1 -1
- package/dist/{chunk-K4DL2AII.js → chunk-LSNRG5Z2.js} +4 -4
- package/dist/{chunk-K4DL2AII.js.map → chunk-LSNRG5Z2.js.map} +1 -1
- package/dist/{chunk-OPOYGPSS.mjs → chunk-REKEQLQA.mjs} +3 -3
- package/dist/{chunk-OPOYGPSS.mjs.map → chunk-REKEQLQA.mjs.map} +1 -1
- package/dist/{chunk-SYVANMRO.mjs → chunk-VIULRHK6.mjs} +3 -3
- package/dist/{chunk-SYVANMRO.mjs.map → chunk-VIULRHK6.mjs.map} +1 -1
- package/dist/{chunk-LVJ44U7Z.mjs → chunk-ZILA73XN.mjs} +19 -44
- package/dist/chunk-ZILA73XN.mjs.map +1 -0
- package/dist/core.js +14 -14
- package/dist/core.mjs +4 -4
- package/dist/display.js +12 -12
- package/dist/display.js.map +1 -1
- package/dist/display.mjs +4 -4
- package/dist/display.mjs.map +1 -1
- package/dist/index.d.mts +235 -5
- package/dist/index.d.ts +235 -5
- package/dist/index.js +323 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +231 -55
- package/dist/index.mjs.map +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +5 -5
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-ANL3PE7L.js.map +0 -1
- package/dist/chunk-IBNTWZ4S.js.map +0 -1
- package/dist/chunk-LVJ44U7Z.mjs.map +0 -1
- package/dist/chunk-WFCHKDDG.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkITB7FXG4_js = require('./chunk-ITB7FXG4.js');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkKYR6BFAE_js = require('./chunk-KYR6BFAE.js');
|
|
5
|
+
var chunkDTFLXAZJ_js = require('./chunk-DTFLXAZJ.js');
|
|
6
6
|
require('./chunk-ICKDAKVS.js');
|
|
7
7
|
var chunkRUIAH5HY_js = require('./chunk-RUIAH5HY.js');
|
|
8
|
-
var
|
|
8
|
+
var chunkLSNRG5Z2_js = require('./chunk-LSNRG5Z2.js');
|
|
9
9
|
var chunk3I3PYX2F_js = require('./chunk-3I3PYX2F.js');
|
|
10
|
-
var
|
|
10
|
+
var chunkB2QCI6ET_js = require('./chunk-B2QCI6ET.js');
|
|
11
11
|
var viem = require('viem');
|
|
12
12
|
|
|
13
13
|
async function prepareApproveDepositTokenTxData({
|
|
@@ -18,33 +18,33 @@ async function prepareApproveDepositTokenTxData({
|
|
|
18
18
|
}) {
|
|
19
19
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
20
20
|
try {
|
|
21
|
-
const config = await
|
|
21
|
+
const config = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
22
22
|
assetAddress: depositToken,
|
|
23
23
|
yieldType,
|
|
24
24
|
chainId: normalizedChainId
|
|
25
25
|
});
|
|
26
26
|
if (!config) {
|
|
27
|
-
throw new
|
|
27
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
28
28
|
`No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
29
29
|
{ endpoint: "prepareApproveDepositToken" }
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
const boringVaultAddress = config.vault.boringVaultAddress;
|
|
33
33
|
if (!boringVaultAddress) {
|
|
34
|
-
throw new
|
|
34
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
35
35
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
36
36
|
{ endpoint: "prepareApproveDepositToken" }
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
const assets = await
|
|
39
|
+
const assets = await chunkB2QCI6ET_js.getAssetsFromCache({ address: depositToken });
|
|
40
40
|
if (assets.length === 0) {
|
|
41
|
-
throw new
|
|
41
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
42
42
|
`Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
|
|
43
43
|
{ endpoint: "prepareApproveDepositToken" }
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
const decimals = assets[0].decimals;
|
|
47
|
-
const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) :
|
|
47
|
+
const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkB2QCI6ET_js.DEFAULT_APPROVAL_AMOUNT;
|
|
48
48
|
return {
|
|
49
49
|
abi: viem.erc20Abi,
|
|
50
50
|
address: depositToken,
|
|
@@ -52,10 +52,10 @@ async function prepareApproveDepositTokenTxData({
|
|
|
52
52
|
args: [boringVaultAddress, amount]
|
|
53
53
|
};
|
|
54
54
|
} catch (error) {
|
|
55
|
-
if (error instanceof
|
|
55
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
56
56
|
throw error;
|
|
57
57
|
}
|
|
58
|
-
throw new
|
|
58
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
59
59
|
`Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
60
60
|
{
|
|
61
61
|
endpoint: "prepareApproveDepositToken",
|
|
@@ -65,6 +65,212 @@ async function prepareApproveDepositTokenTxData({
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// src/abi/community-code-depositor-abi.ts
|
|
69
|
+
var CommunityCodeDepositorAbi = [
|
|
70
|
+
{
|
|
71
|
+
type: "constructor",
|
|
72
|
+
inputs: [
|
|
73
|
+
{ name: "_teller", type: "address", internalType: "address" },
|
|
74
|
+
{ name: "_owner", type: "address", internalType: "address" }
|
|
75
|
+
],
|
|
76
|
+
stateMutability: "nonpayable"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "authority",
|
|
81
|
+
inputs: [],
|
|
82
|
+
outputs: [
|
|
83
|
+
{ name: "", type: "address", internalType: "contract Authority" }
|
|
84
|
+
],
|
|
85
|
+
stateMutability: "view"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: "function",
|
|
89
|
+
name: "boringVault",
|
|
90
|
+
inputs: [],
|
|
91
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
92
|
+
stateMutability: "view"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "function",
|
|
96
|
+
name: "deposit",
|
|
97
|
+
inputs: [
|
|
98
|
+
{
|
|
99
|
+
name: "depositAsset",
|
|
100
|
+
type: "address",
|
|
101
|
+
internalType: "contract ERC20"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "depositAmount",
|
|
105
|
+
type: "uint256",
|
|
106
|
+
internalType: "uint256"
|
|
107
|
+
},
|
|
108
|
+
{ name: "minimumMint", type: "uint256", internalType: "uint256" },
|
|
109
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
110
|
+
{ name: "communityCode", type: "bytes", internalType: "bytes" }
|
|
111
|
+
],
|
|
112
|
+
outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
|
|
113
|
+
stateMutability: "nonpayable"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: "function",
|
|
117
|
+
name: "depositNative",
|
|
118
|
+
inputs: [
|
|
119
|
+
{
|
|
120
|
+
name: "depositAmount",
|
|
121
|
+
type: "uint256",
|
|
122
|
+
internalType: "uint256"
|
|
123
|
+
},
|
|
124
|
+
{ name: "minimumMint", type: "uint256", internalType: "uint256" },
|
|
125
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
126
|
+
{ name: "communityCode", type: "bytes", internalType: "bytes" }
|
|
127
|
+
],
|
|
128
|
+
outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
|
|
129
|
+
stateMutability: "payable"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: "function",
|
|
133
|
+
name: "depositNonce",
|
|
134
|
+
inputs: [],
|
|
135
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
136
|
+
stateMutability: "view"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "function",
|
|
140
|
+
name: "owner",
|
|
141
|
+
inputs: [],
|
|
142
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
143
|
+
stateMutability: "view"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: "function",
|
|
147
|
+
name: "setAuthority",
|
|
148
|
+
inputs: [
|
|
149
|
+
{
|
|
150
|
+
name: "newAuthority",
|
|
151
|
+
type: "address",
|
|
152
|
+
internalType: "contract Authority"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
outputs: [],
|
|
156
|
+
stateMutability: "nonpayable"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: "function",
|
|
160
|
+
name: "teller",
|
|
161
|
+
inputs: [],
|
|
162
|
+
outputs: [
|
|
163
|
+
{
|
|
164
|
+
name: "",
|
|
165
|
+
type: "address",
|
|
166
|
+
internalType: "contract TellerWithMultiAssetSupport"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
stateMutability: "view"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: "function",
|
|
173
|
+
name: "transferOwnership",
|
|
174
|
+
inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
|
|
175
|
+
outputs: [],
|
|
176
|
+
stateMutability: "nonpayable"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: "event",
|
|
180
|
+
name: "AuthorityUpdated",
|
|
181
|
+
inputs: [
|
|
182
|
+
{
|
|
183
|
+
name: "user",
|
|
184
|
+
type: "address",
|
|
185
|
+
indexed: true,
|
|
186
|
+
internalType: "address"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "newAuthority",
|
|
190
|
+
type: "address",
|
|
191
|
+
indexed: true,
|
|
192
|
+
internalType: "contract Authority"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
anonymous: false
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
type: "event",
|
|
199
|
+
name: "DepositWithCommunityCode",
|
|
200
|
+
inputs: [
|
|
201
|
+
{
|
|
202
|
+
name: "depositor",
|
|
203
|
+
type: "address",
|
|
204
|
+
indexed: true,
|
|
205
|
+
internalType: "address"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "depositAsset",
|
|
209
|
+
type: "address",
|
|
210
|
+
indexed: true,
|
|
211
|
+
internalType: "contract ERC20"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "depositAmount",
|
|
215
|
+
type: "uint256",
|
|
216
|
+
indexed: false,
|
|
217
|
+
internalType: "uint256"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "minimumMint",
|
|
221
|
+
type: "uint256",
|
|
222
|
+
indexed: false,
|
|
223
|
+
internalType: "uint256"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "to",
|
|
227
|
+
type: "address",
|
|
228
|
+
indexed: true,
|
|
229
|
+
internalType: "address"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "depositHash",
|
|
233
|
+
type: "bytes32",
|
|
234
|
+
indexed: false,
|
|
235
|
+
internalType: "bytes32"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "communityCode",
|
|
239
|
+
type: "bytes",
|
|
240
|
+
indexed: false,
|
|
241
|
+
internalType: "bytes"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
anonymous: false
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
type: "event",
|
|
248
|
+
name: "OwnershipTransferred",
|
|
249
|
+
inputs: [
|
|
250
|
+
{
|
|
251
|
+
name: "user",
|
|
252
|
+
type: "address",
|
|
253
|
+
indexed: true,
|
|
254
|
+
internalType: "address"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "newOwner",
|
|
258
|
+
type: "address",
|
|
259
|
+
indexed: true,
|
|
260
|
+
internalType: "address"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
anonymous: false
|
|
264
|
+
},
|
|
265
|
+
{ type: "error", name: "IncorrectNativeDepositAmount", inputs: [] },
|
|
266
|
+
{
|
|
267
|
+
type: "error",
|
|
268
|
+
name: "NativeWrapperAccountantDecimalsMismatch",
|
|
269
|
+
inputs: []
|
|
270
|
+
},
|
|
271
|
+
{ type: "error", name: "ZeroAddress", inputs: [] }
|
|
272
|
+
];
|
|
273
|
+
|
|
68
274
|
// src/vaults/deposit/utils.ts
|
|
69
275
|
var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) => {
|
|
70
276
|
const slippageValue = slippage ?? chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS;
|
|
@@ -84,19 +290,21 @@ async function prepareDepositTxData(params) {
|
|
|
84
290
|
depositToken,
|
|
85
291
|
depositAmount,
|
|
86
292
|
chainId,
|
|
87
|
-
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
|
|
293
|
+
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS,
|
|
294
|
+
recipientAddress,
|
|
295
|
+
partnerCode
|
|
88
296
|
} = params;
|
|
89
297
|
try {
|
|
90
298
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
91
299
|
let vault;
|
|
92
300
|
try {
|
|
93
|
-
vault = await
|
|
301
|
+
vault = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
94
302
|
assetAddress: depositToken,
|
|
95
303
|
yieldType,
|
|
96
304
|
chainId: normalizedChainId
|
|
97
305
|
});
|
|
98
306
|
} catch (error) {
|
|
99
|
-
throw new
|
|
307
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
100
308
|
`Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
101
309
|
{
|
|
102
310
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -105,7 +313,7 @@ async function prepareDepositTxData(params) {
|
|
|
105
313
|
);
|
|
106
314
|
}
|
|
107
315
|
if (!vault) {
|
|
108
|
-
throw new
|
|
316
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
109
317
|
`No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
110
318
|
{
|
|
111
319
|
endpoint: "prepareDepositTransactionData"
|
|
@@ -113,12 +321,12 @@ async function prepareDepositTxData(params) {
|
|
|
113
321
|
);
|
|
114
322
|
}
|
|
115
323
|
let asset = null;
|
|
116
|
-
const assets = await
|
|
324
|
+
const assets = await chunkB2QCI6ET_js.getAssetsFromCache({ address: depositToken });
|
|
117
325
|
if (assets.length > 0) {
|
|
118
326
|
asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
|
|
119
327
|
}
|
|
120
328
|
if (!asset) {
|
|
121
|
-
throw new
|
|
329
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
122
330
|
`Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
|
|
123
331
|
{
|
|
124
332
|
endpoint: "prepareDepositTransactionData"
|
|
@@ -126,15 +334,16 @@ async function prepareDepositTxData(params) {
|
|
|
126
334
|
);
|
|
127
335
|
}
|
|
128
336
|
const tellerAddress = vault.vault.tellerAddress;
|
|
337
|
+
const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
|
|
129
338
|
const accountantAddress = vault.vault.accountantAddress;
|
|
130
339
|
const depositAssetAddress = asset.address;
|
|
131
|
-
const [depositAssetDecimalsResult, rateInQuoteResult] = await
|
|
340
|
+
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkDTFLXAZJ_js.getRateInQuoteWithAssetDecimals({
|
|
132
341
|
assetAddress: depositAssetAddress,
|
|
133
342
|
accountantAddress,
|
|
134
343
|
chainId: normalizedChainId
|
|
135
344
|
});
|
|
136
345
|
if (depositAssetDecimalsResult.status === "failure") {
|
|
137
|
-
throw new
|
|
346
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
138
347
|
`Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
|
|
139
348
|
{
|
|
140
349
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -143,7 +352,7 @@ async function prepareDepositTxData(params) {
|
|
|
143
352
|
);
|
|
144
353
|
}
|
|
145
354
|
if (rateInQuoteResult.status === "failure") {
|
|
146
|
-
throw new
|
|
355
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
147
356
|
`Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
|
|
148
357
|
{
|
|
149
358
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -155,11 +364,11 @@ async function prepareDepositTxData(params) {
|
|
|
155
364
|
depositAmount,
|
|
156
365
|
depositAssetDecimalsResult.result
|
|
157
366
|
);
|
|
158
|
-
const vaultSharesAssets = await
|
|
367
|
+
const vaultSharesAssets = await chunkB2QCI6ET_js.fetchSupportedAssets({
|
|
159
368
|
address: vault.vault.boringVaultAddress
|
|
160
369
|
});
|
|
161
370
|
if (vaultSharesAssets.length === 0) {
|
|
162
|
-
throw new
|
|
371
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
163
372
|
`Vault shares token not found in supported assets: ${vault.vault.boringVaultAddress}`,
|
|
164
373
|
{ endpoint: "prepareDepositTransactionData" }
|
|
165
374
|
);
|
|
@@ -170,18 +379,33 @@ async function prepareDepositTxData(params) {
|
|
|
170
379
|
depositAssetDecimalsResult.result,
|
|
171
380
|
slippage
|
|
172
381
|
);
|
|
382
|
+
if (communityCodeDepositorAddress && partnerCode) {
|
|
383
|
+
return {
|
|
384
|
+
abi: CommunityCodeDepositorAbi,
|
|
385
|
+
address: communityCodeDepositorAddress,
|
|
386
|
+
functionName: "deposit",
|
|
387
|
+
args: [
|
|
388
|
+
depositAssetAddress,
|
|
389
|
+
depositAmountAsBigInt,
|
|
390
|
+
minimumMint,
|
|
391
|
+
recipientAddress,
|
|
392
|
+
viem.toBytes(partnerCode)
|
|
393
|
+
],
|
|
394
|
+
chainId: normalizedChainId
|
|
395
|
+
};
|
|
396
|
+
}
|
|
173
397
|
return {
|
|
174
|
-
abi:
|
|
398
|
+
abi: chunkDTFLXAZJ_js.TellerAbi,
|
|
175
399
|
address: tellerAddress,
|
|
176
400
|
functionName: "deposit",
|
|
177
401
|
args: [depositAssetAddress, depositAmountAsBigInt, minimumMint],
|
|
178
402
|
chainId: normalizedChainId
|
|
179
403
|
};
|
|
180
404
|
} catch (error) {
|
|
181
|
-
if (error instanceof
|
|
405
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
182
406
|
throw error;
|
|
183
407
|
}
|
|
184
|
-
throw new
|
|
408
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
185
409
|
`Failed to prepare deposit transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
186
410
|
{
|
|
187
411
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -262,13 +486,13 @@ async function prepareDepositPermitSignature(params) {
|
|
|
262
486
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
263
487
|
let vault;
|
|
264
488
|
try {
|
|
265
|
-
vault = await
|
|
489
|
+
vault = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
266
490
|
assetAddress: depositToken,
|
|
267
491
|
yieldType,
|
|
268
492
|
chainId: normalizedChainId
|
|
269
493
|
});
|
|
270
494
|
} catch (error) {
|
|
271
|
-
throw new
|
|
495
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
272
496
|
`Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
273
497
|
{
|
|
274
498
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -277,7 +501,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
277
501
|
);
|
|
278
502
|
}
|
|
279
503
|
if (!vault) {
|
|
280
|
-
throw new
|
|
504
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
281
505
|
`No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
282
506
|
{
|
|
283
507
|
endpoint: "prepareDepositPermitSignature"
|
|
@@ -285,7 +509,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
285
509
|
);
|
|
286
510
|
}
|
|
287
511
|
const tellerAddress = vault.vault.tellerAddress;
|
|
288
|
-
const client = await
|
|
512
|
+
const client = await chunkDTFLXAZJ_js.getClient(normalizedChainId);
|
|
289
513
|
let tokenName;
|
|
290
514
|
let tokenVersion;
|
|
291
515
|
let nonce;
|
|
@@ -313,7 +537,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
313
537
|
if (nameResult.status === "fulfilled") {
|
|
314
538
|
tokenName = nameResult.value;
|
|
315
539
|
} else {
|
|
316
|
-
throw new
|
|
540
|
+
throw new chunkB2QCI6ET_js.APIError(`Failed to read token name from ${depositToken}`, {
|
|
317
541
|
endpoint: "prepareDepositPermitSignature",
|
|
318
542
|
cause: nameResult.reason
|
|
319
543
|
});
|
|
@@ -326,7 +550,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
326
550
|
if (nonceResult.status === "fulfilled") {
|
|
327
551
|
nonce = nonceResult.value;
|
|
328
552
|
} else {
|
|
329
|
-
throw new
|
|
553
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
330
554
|
`Token ${depositToken} does not support EIP-2612 permit. Missing required function: nonces()`,
|
|
331
555
|
{
|
|
332
556
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -335,10 +559,10 @@ async function prepareDepositPermitSignature(params) {
|
|
|
335
559
|
);
|
|
336
560
|
}
|
|
337
561
|
} catch (error) {
|
|
338
|
-
if (error instanceof
|
|
562
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
339
563
|
throw error;
|
|
340
564
|
}
|
|
341
|
-
throw new
|
|
565
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
342
566
|
`Failed to read token metadata: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
343
567
|
{
|
|
344
568
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -347,9 +571,9 @@ async function prepareDepositPermitSignature(params) {
|
|
|
347
571
|
);
|
|
348
572
|
}
|
|
349
573
|
const permitDeadline = deadline ?? BigInt(Math.floor(Date.now() / 1e3) + 3600);
|
|
350
|
-
const assets = await
|
|
574
|
+
const assets = await chunkB2QCI6ET_js.fetchSupportedAssets({ address: depositToken });
|
|
351
575
|
if (assets.length === 0) {
|
|
352
|
-
throw new
|
|
576
|
+
throw new chunkB2QCI6ET_js.APIError(`Asset metadata not found for token ${depositToken}`, {
|
|
353
577
|
endpoint: "prepareDepositPermitSignature"
|
|
354
578
|
});
|
|
355
579
|
}
|
|
@@ -375,10 +599,10 @@ async function prepareDepositPermitSignature(params) {
|
|
|
375
599
|
types: PERMIT_TYPES
|
|
376
600
|
};
|
|
377
601
|
} catch (error) {
|
|
378
|
-
if (error instanceof
|
|
602
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
379
603
|
throw error;
|
|
380
604
|
}
|
|
381
|
-
throw new
|
|
605
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
382
606
|
`Failed to prepare permit signature: ${error instanceof Error ? error.message : String(error)}`,
|
|
383
607
|
{
|
|
384
608
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -404,7 +628,7 @@ function parsePermitSignature(signature) {
|
|
|
404
628
|
s: parsed.s
|
|
405
629
|
};
|
|
406
630
|
} catch (error) {
|
|
407
|
-
throw new
|
|
631
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
408
632
|
`Invalid permit signature format. Expected hex string but received: ${signature}. ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
409
633
|
{
|
|
410
634
|
endpoint: "parsePermitSignature",
|
|
@@ -423,18 +647,10 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
423
647
|
deadline,
|
|
424
648
|
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
|
|
425
649
|
} = params;
|
|
426
|
-
console.log("[Amplify SDK] prepareDepositWithPermitTxData called", {
|
|
427
|
-
yieldType,
|
|
428
|
-
depositToken,
|
|
429
|
-
depositAmount,
|
|
430
|
-
chainId,
|
|
431
|
-
deadline: deadline.toString(),
|
|
432
|
-
slippage
|
|
433
|
-
});
|
|
434
650
|
try {
|
|
435
651
|
const { v, r, s } = parsePermitSignature(signature);
|
|
436
652
|
if (slippage < 0 || slippage > 1e4) {
|
|
437
|
-
throw new
|
|
653
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
438
654
|
`Invalid slippage value: ${slippage}. Slippage must be between 0 and 10000 basis points.`,
|
|
439
655
|
{
|
|
440
656
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -442,21 +658,15 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
442
658
|
);
|
|
443
659
|
}
|
|
444
660
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
445
|
-
console.log("[Amplify SDK] Normalized chainId:", normalizedChainId);
|
|
446
661
|
let vault;
|
|
447
662
|
try {
|
|
448
|
-
|
|
449
|
-
vault = await chunkIBNTWZ4S_js.findVaultByConfig({
|
|
663
|
+
vault = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
450
664
|
assetAddress: depositToken,
|
|
451
665
|
yieldType,
|
|
452
666
|
chainId: normalizedChainId
|
|
453
667
|
});
|
|
454
|
-
console.log(
|
|
455
|
-
"[Amplify SDK] Vault resolved:",
|
|
456
|
-
vault ? "Found" : "Not found"
|
|
457
|
-
);
|
|
458
668
|
} catch (error) {
|
|
459
|
-
throw new
|
|
669
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
460
670
|
`Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
461
671
|
{
|
|
462
672
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -465,25 +675,20 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
465
675
|
);
|
|
466
676
|
}
|
|
467
677
|
if (!vault) {
|
|
468
|
-
throw new
|
|
678
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
469
679
|
`No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
470
680
|
{
|
|
471
681
|
endpoint: "prepareDepositWithPermitTxData"
|
|
472
682
|
}
|
|
473
683
|
);
|
|
474
684
|
}
|
|
475
|
-
console.log(
|
|
476
|
-
"[Amplify SDK] Fetching supported assets for depositToken:",
|
|
477
|
-
depositToken
|
|
478
|
-
);
|
|
479
685
|
let asset = null;
|
|
480
|
-
const assets = await
|
|
481
|
-
console.log("[Amplify SDK] Supported assets found:", assets.length);
|
|
686
|
+
const assets = await chunkB2QCI6ET_js.fetchSupportedAssets({ address: depositToken });
|
|
482
687
|
if (assets.length > 0) {
|
|
483
688
|
asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
|
|
484
689
|
}
|
|
485
690
|
if (!asset) {
|
|
486
|
-
throw new
|
|
691
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
487
692
|
`Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
|
|
488
693
|
{
|
|
489
694
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -491,7 +696,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
491
696
|
);
|
|
492
697
|
}
|
|
493
698
|
if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
|
|
494
|
-
throw new
|
|
699
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
495
700
|
`Token ${asset.symbol || depositToken} not supported on chain ${normalizedChainId}`,
|
|
496
701
|
{
|
|
497
702
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -501,23 +706,13 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
501
706
|
const tellerAddress = vault.vault.tellerAddress;
|
|
502
707
|
const accountantAddress = vault.vault.accountantAddress;
|
|
503
708
|
const depositAssetAddress = asset.address;
|
|
504
|
-
|
|
505
|
-
tellerAddress,
|
|
506
|
-
accountantAddress,
|
|
507
|
-
depositAssetAddress
|
|
508
|
-
});
|
|
509
|
-
console.log("[Amplify SDK] Calling getRateInQuoteWithAssetDecimals...");
|
|
510
|
-
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkANL3PE7L_js.getRateInQuoteWithAssetDecimals({
|
|
709
|
+
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkDTFLXAZJ_js.getRateInQuoteWithAssetDecimals({
|
|
511
710
|
assetAddress: depositAssetAddress,
|
|
512
711
|
accountantAddress,
|
|
513
712
|
chainId: normalizedChainId
|
|
514
713
|
});
|
|
515
|
-
console.log("[Amplify SDK] getRateInQuoteWithAssetDecimals completed", {
|
|
516
|
-
decimalsStatus: depositAssetDecimalsResult.status,
|
|
517
|
-
rateStatus: rateInQuoteResult.status
|
|
518
|
-
});
|
|
519
714
|
if (depositAssetDecimalsResult.status === "failure") {
|
|
520
|
-
throw new
|
|
715
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
521
716
|
`Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
|
|
522
717
|
{
|
|
523
718
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -526,7 +721,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
526
721
|
);
|
|
527
722
|
}
|
|
528
723
|
if (rateInQuoteResult.status === "failure") {
|
|
529
|
-
throw new
|
|
724
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
530
725
|
`Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
|
|
531
726
|
{
|
|
532
727
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -535,43 +730,24 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
535
730
|
);
|
|
536
731
|
}
|
|
537
732
|
const depositAmountAsBigInt = viem.parseUnits(depositAmount, asset.decimals);
|
|
538
|
-
|
|
539
|
-
"[Amplify SDK] Fetching vault shares asset:",
|
|
540
|
-
vault.vault.boringVaultAddress
|
|
541
|
-
);
|
|
542
|
-
const vaultSharesAssets = await chunkIBNTWZ4S_js.fetchSupportedAssets({
|
|
733
|
+
const vaultSharesAssets = await chunkB2QCI6ET_js.fetchSupportedAssets({
|
|
543
734
|
address: vault.vault.boringVaultAddress
|
|
544
735
|
});
|
|
545
|
-
console.log(
|
|
546
|
-
"[Amplify SDK] Vault shares assets found:",
|
|
547
|
-
vaultSharesAssets.length
|
|
548
|
-
);
|
|
549
736
|
if (vaultSharesAssets.length === 0) {
|
|
550
|
-
throw new
|
|
737
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
551
738
|
`Vault shares token not found in supported assets: ${vault.vault.boringVaultAddress}`,
|
|
552
739
|
{ endpoint: "prepareDepositWithPermitTxData" }
|
|
553
740
|
);
|
|
554
741
|
}
|
|
555
|
-
console.log("[Amplify SDK] Calculating minimumMint...", {
|
|
556
|
-
depositAmountAsBigInt: depositAmountAsBigInt.toString(),
|
|
557
|
-
rateInQuote: rateInQuoteResult.result.toString(),
|
|
558
|
-
vaultSharesDecimals: vaultSharesAssets[0].decimals,
|
|
559
|
-
slippage
|
|
560
|
-
});
|
|
561
742
|
const minimumMint = calculateMinimumMint(
|
|
562
743
|
depositAmountAsBigInt,
|
|
563
744
|
rateInQuoteResult.result,
|
|
564
745
|
vaultSharesAssets[0].decimals,
|
|
565
746
|
slippage
|
|
566
747
|
);
|
|
567
|
-
console.log(
|
|
568
|
-
"[Amplify SDK] minimumMint calculated:",
|
|
569
|
-
minimumMint.toString()
|
|
570
|
-
);
|
|
571
|
-
console.log("[Amplify SDK] Returning transaction data successfully");
|
|
572
748
|
return {
|
|
573
749
|
data: {
|
|
574
|
-
abi:
|
|
750
|
+
abi: chunkDTFLXAZJ_js.TellerAbi,
|
|
575
751
|
functionName: "depositWithPermit",
|
|
576
752
|
args: [
|
|
577
753
|
depositAssetAddress,
|
|
@@ -587,10 +763,10 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
587
763
|
chainId: normalizedChainId
|
|
588
764
|
};
|
|
589
765
|
} catch (error) {
|
|
590
|
-
if (error instanceof
|
|
766
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
591
767
|
throw error;
|
|
592
768
|
}
|
|
593
|
-
throw new
|
|
769
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
594
770
|
`Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
595
771
|
{
|
|
596
772
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -607,45 +783,45 @@ async function prepareApproveWithdrawTxData({
|
|
|
607
783
|
}) {
|
|
608
784
|
try {
|
|
609
785
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
610
|
-
const config = await
|
|
786
|
+
const config = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
611
787
|
assetAddress: wantAssetAddress,
|
|
612
788
|
yieldType,
|
|
613
789
|
chainId: normalizedChainId
|
|
614
790
|
});
|
|
615
791
|
if (!config || config.chainId !== normalizedChainId) {
|
|
616
|
-
throw new
|
|
792
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
617
793
|
`Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
|
|
618
794
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
619
795
|
);
|
|
620
796
|
}
|
|
621
797
|
if (!config.vault.boringVaultAddress) {
|
|
622
|
-
throw new
|
|
798
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
623
799
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
624
800
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
625
801
|
);
|
|
626
802
|
}
|
|
627
803
|
const boringVaultAddress = config.vault.boringVaultAddress;
|
|
628
|
-
const vaultSharesAssets = await
|
|
804
|
+
const vaultSharesAssets = await chunkB2QCI6ET_js.getAssetsFromCache({
|
|
629
805
|
address: boringVaultAddress
|
|
630
806
|
});
|
|
631
807
|
if (vaultSharesAssets.length === 0) {
|
|
632
|
-
throw new
|
|
808
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
633
809
|
`Vault shares token not found in supported assets: ${boringVaultAddress}`,
|
|
634
810
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
635
811
|
);
|
|
636
812
|
}
|
|
637
|
-
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) :
|
|
813
|
+
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) : chunkB2QCI6ET_js.DEFAULT_APPROVAL_AMOUNT;
|
|
638
814
|
return {
|
|
639
|
-
abi:
|
|
815
|
+
abi: chunkDTFLXAZJ_js.BoringVaultAbi,
|
|
640
816
|
address: boringVaultAddress,
|
|
641
817
|
functionName: "approve",
|
|
642
|
-
args: [
|
|
818
|
+
args: [chunkB2QCI6ET_js.ATOMIC_QUEUE_CONTRACT_ADDRESS, withdrawAmountAsBigInt]
|
|
643
819
|
};
|
|
644
820
|
} catch (error) {
|
|
645
|
-
if (error instanceof
|
|
821
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
646
822
|
throw error;
|
|
647
823
|
}
|
|
648
|
-
throw new
|
|
824
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
649
825
|
`Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
650
826
|
{
|
|
651
827
|
endpoint: "prepareApproveWithdrawToken",
|
|
@@ -657,7 +833,7 @@ async function prepareApproveWithdrawTxData({
|
|
|
657
833
|
|
|
658
834
|
// src/vaults/withdraw/utils.ts
|
|
659
835
|
var prepareUserRequest = (offerAmount, atomicPrice, deadline) => {
|
|
660
|
-
const deadlineTimeStamp =
|
|
836
|
+
const deadlineTimeStamp = chunkLSNRG5Z2_js.calculateDeadline(deadline);
|
|
661
837
|
return {
|
|
662
838
|
deadline: deadlineTimeStamp,
|
|
663
839
|
atomicPrice,
|
|
@@ -683,30 +859,30 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
683
859
|
} = params;
|
|
684
860
|
try {
|
|
685
861
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
686
|
-
const vault = await
|
|
862
|
+
const vault = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
687
863
|
assetAddress: wantAssetAddress,
|
|
688
864
|
yieldType,
|
|
689
865
|
chainId: normalizedChainId
|
|
690
866
|
});
|
|
691
867
|
if (vault && vault.chainId !== normalizedChainId) {
|
|
692
|
-
throw new
|
|
868
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
693
869
|
`Vault chain mismatch: vault is on chain ${vault.chainId}, requested chain ${normalizedChainId}`,
|
|
694
870
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
695
871
|
);
|
|
696
872
|
}
|
|
697
873
|
if (!vault || !vault.vault.boringVaultAddress) {
|
|
698
|
-
throw new
|
|
874
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
699
875
|
`BoringVault contract address not configured for vault ${vault?.vault.boringVaultAddress}`,
|
|
700
876
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
701
877
|
);
|
|
702
878
|
}
|
|
703
879
|
const boringVaultAddress = vault.vault.boringVaultAddress;
|
|
704
880
|
const accountantAddress = vault.vault.accountantAddress;
|
|
705
|
-
const wantAsset = await
|
|
881
|
+
const wantAsset = await chunkB2QCI6ET_js.getAssetsFromCache({
|
|
706
882
|
address: wantAssetAddress
|
|
707
883
|
});
|
|
708
884
|
if (wantAsset.length === 0) {
|
|
709
|
-
throw new
|
|
885
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
710
886
|
`Vault shares token not found in supported assets: ${boringVaultAddress}`,
|
|
711
887
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
712
888
|
);
|
|
@@ -715,14 +891,14 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
715
891
|
wantAssetDecimalsResult,
|
|
716
892
|
sharesAssetDecimalsResult,
|
|
717
893
|
rateInQuoteResult
|
|
718
|
-
] = await
|
|
894
|
+
] = await chunkDTFLXAZJ_js.getRateInQuoteAndSharesAndWantAssetDecimals({
|
|
719
895
|
sharesAssetAddress: boringVaultAddress,
|
|
720
896
|
wantAssetAddress,
|
|
721
897
|
accountantAddress,
|
|
722
898
|
chainId: normalizedChainId
|
|
723
899
|
});
|
|
724
900
|
if (rateInQuoteResult.status === "failure" || wantAssetDecimalsResult.status === "failure" || sharesAssetDecimalsResult.status === "failure") {
|
|
725
|
-
throw new
|
|
901
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
726
902
|
`Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
|
|
727
903
|
{
|
|
728
904
|
endpoint: "prepareBulkWithdrawTransactionData",
|
|
@@ -743,7 +919,7 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
743
919
|
);
|
|
744
920
|
const minimumAssets = atomicPrice * offerAmountAsBigInt / BigInt(10 ** sharesAssetDecimalsResult.result);
|
|
745
921
|
return {
|
|
746
|
-
abi:
|
|
922
|
+
abi: chunkDTFLXAZJ_js.TellerAbi,
|
|
747
923
|
address: vault.vault.tellerAddress,
|
|
748
924
|
functionName: "bulkWithdraw",
|
|
749
925
|
args: [
|
|
@@ -755,10 +931,10 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
755
931
|
chainId: normalizedChainId
|
|
756
932
|
};
|
|
757
933
|
} catch (error) {
|
|
758
|
-
if (error instanceof
|
|
934
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
759
935
|
throw error;
|
|
760
936
|
}
|
|
761
|
-
throw new
|
|
937
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
762
938
|
`Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
763
939
|
{
|
|
764
940
|
endpoint: "prepareBulkWithdrawTransactionData",
|
|
@@ -1009,30 +1185,30 @@ var prepareWithdrawTxData = async ({
|
|
|
1009
1185
|
wantAssetAddress,
|
|
1010
1186
|
chainId,
|
|
1011
1187
|
offerAmount,
|
|
1012
|
-
deadline =
|
|
1188
|
+
deadline = chunkB2QCI6ET_js.DEFAULT_DEADLINE,
|
|
1013
1189
|
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
|
|
1014
1190
|
}) => {
|
|
1015
1191
|
try {
|
|
1016
1192
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
1017
|
-
const config = await
|
|
1193
|
+
const config = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
1018
1194
|
assetAddress: wantAssetAddress,
|
|
1019
1195
|
yieldType,
|
|
1020
1196
|
chainId: normalizedChainId
|
|
1021
1197
|
});
|
|
1022
1198
|
if (config && config.chainId !== normalizedChainId) {
|
|
1023
|
-
throw new
|
|
1199
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1024
1200
|
`Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
|
|
1025
1201
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1026
1202
|
);
|
|
1027
1203
|
}
|
|
1028
1204
|
if (!config || !config.vault.boringVaultAddress) {
|
|
1029
|
-
throw new
|
|
1205
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1030
1206
|
`BoringVault contract address not configured for vault ${config?.id}`,
|
|
1031
1207
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1032
1208
|
);
|
|
1033
1209
|
}
|
|
1034
1210
|
if (!config.vault.accountantAddress) {
|
|
1035
|
-
throw new
|
|
1211
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1036
1212
|
`Accountant contract address not configured for vault ${config.id}`,
|
|
1037
1213
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1038
1214
|
);
|
|
@@ -1043,14 +1219,14 @@ var prepareWithdrawTxData = async ({
|
|
|
1043
1219
|
wantAssetDecimalsResult,
|
|
1044
1220
|
sharesAssetDecimalsResult,
|
|
1045
1221
|
rateInQuoteResult
|
|
1046
|
-
] = await
|
|
1222
|
+
] = await chunkDTFLXAZJ_js.getRateInQuoteAndSharesAndWantAssetDecimals({
|
|
1047
1223
|
sharesAssetAddress: boringVaultAddress,
|
|
1048
1224
|
wantAssetAddress,
|
|
1049
1225
|
accountantAddress,
|
|
1050
1226
|
chainId: normalizedChainId
|
|
1051
1227
|
});
|
|
1052
1228
|
if (rateInQuoteResult?.status === "failure" || wantAssetDecimalsResult?.status === "failure" || sharesAssetDecimalsResult?.status === "failure") {
|
|
1053
|
-
throw new
|
|
1229
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1054
1230
|
`Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
|
|
1055
1231
|
{
|
|
1056
1232
|
endpoint: "prepareWithdrawTransactionData",
|
|
@@ -1076,16 +1252,16 @@ var prepareWithdrawTxData = async ({
|
|
|
1076
1252
|
);
|
|
1077
1253
|
return {
|
|
1078
1254
|
abi: AtomicQueueAbi,
|
|
1079
|
-
address:
|
|
1255
|
+
address: chunkB2QCI6ET_js.ATOMIC_QUEUE_CONTRACT_ADDRESS,
|
|
1080
1256
|
functionName: "updateAtomicRequest",
|
|
1081
1257
|
args: [boringVaultAddress, wantAssetAddress, userRequest],
|
|
1082
1258
|
chainId: normalizedChainId
|
|
1083
1259
|
};
|
|
1084
1260
|
} catch (error) {
|
|
1085
|
-
if (error instanceof
|
|
1261
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
1086
1262
|
throw error;
|
|
1087
1263
|
}
|
|
1088
|
-
throw new
|
|
1264
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1089
1265
|
`Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
1090
1266
|
{
|
|
1091
1267
|
endpoint: "prepareWithdrawTransactionData",
|
|
@@ -1101,59 +1277,59 @@ Object.defineProperty(exports, "YieldType", {
|
|
|
1101
1277
|
});
|
|
1102
1278
|
Object.defineProperty(exports, "getDepositExchangeRate", {
|
|
1103
1279
|
enumerable: true,
|
|
1104
|
-
get: function () { return
|
|
1280
|
+
get: function () { return chunkKYR6BFAE_js.getDepositExchangeRate; }
|
|
1105
1281
|
});
|
|
1106
1282
|
Object.defineProperty(exports, "getWithdrawExchangeRate", {
|
|
1107
1283
|
enumerable: true,
|
|
1108
|
-
get: function () { return
|
|
1284
|
+
get: function () { return chunkKYR6BFAE_js.getWithdrawExchangeRate; }
|
|
1109
1285
|
});
|
|
1110
1286
|
Object.defineProperty(exports, "isDepositSpendApproved", {
|
|
1111
1287
|
enumerable: true,
|
|
1112
|
-
get: function () { return
|
|
1288
|
+
get: function () { return chunkKYR6BFAE_js.isDepositSpendApproved; }
|
|
1113
1289
|
});
|
|
1114
1290
|
Object.defineProperty(exports, "isWithdrawalSpendApproved", {
|
|
1115
1291
|
enumerable: true,
|
|
1116
|
-
get: function () { return
|
|
1292
|
+
get: function () { return chunkKYR6BFAE_js.isWithdrawalSpendApproved; }
|
|
1117
1293
|
});
|
|
1118
1294
|
Object.defineProperty(exports, "APIError", {
|
|
1119
1295
|
enumerable: true,
|
|
1120
|
-
get: function () { return
|
|
1296
|
+
get: function () { return chunkB2QCI6ET_js.APIError; }
|
|
1121
1297
|
});
|
|
1122
1298
|
Object.defineProperty(exports, "fetchSupportedAssets", {
|
|
1123
1299
|
enumerable: true,
|
|
1124
|
-
get: function () { return
|
|
1300
|
+
get: function () { return chunkB2QCI6ET_js.fetchSupportedAssets; }
|
|
1125
1301
|
});
|
|
1126
1302
|
Object.defineProperty(exports, "fetchVaults", {
|
|
1127
1303
|
enumerable: true,
|
|
1128
|
-
get: function () { return
|
|
1304
|
+
get: function () { return chunkB2QCI6ET_js.fetchVaults; }
|
|
1129
1305
|
});
|
|
1130
1306
|
Object.defineProperty(exports, "findVaultByConfig", {
|
|
1131
1307
|
enumerable: true,
|
|
1132
|
-
get: function () { return
|
|
1308
|
+
get: function () { return chunkB2QCI6ET_js.findVaultByConfig; }
|
|
1133
1309
|
});
|
|
1134
1310
|
Object.defineProperty(exports, "getAssetsFromCache", {
|
|
1135
1311
|
enumerable: true,
|
|
1136
|
-
get: function () { return
|
|
1312
|
+
get: function () { return chunkB2QCI6ET_js.getAssetsFromCache; }
|
|
1137
1313
|
});
|
|
1138
1314
|
Object.defineProperty(exports, "getCache", {
|
|
1139
1315
|
enumerable: true,
|
|
1140
|
-
get: function () { return
|
|
1316
|
+
get: function () { return chunkB2QCI6ET_js.getCache; }
|
|
1141
1317
|
});
|
|
1142
1318
|
Object.defineProperty(exports, "getWithdrawSupportedAssets", {
|
|
1143
1319
|
enumerable: true,
|
|
1144
|
-
get: function () { return
|
|
1320
|
+
get: function () { return chunkB2QCI6ET_js.getWithdrawSupportedAssets; }
|
|
1145
1321
|
});
|
|
1146
1322
|
Object.defineProperty(exports, "initAmplifySDK", {
|
|
1147
1323
|
enumerable: true,
|
|
1148
|
-
get: function () { return
|
|
1324
|
+
get: function () { return chunkB2QCI6ET_js.initAmplifySDK; }
|
|
1149
1325
|
});
|
|
1150
1326
|
Object.defineProperty(exports, "initializeCache", {
|
|
1151
1327
|
enumerable: true,
|
|
1152
|
-
get: function () { return
|
|
1328
|
+
get: function () { return chunkB2QCI6ET_js.initializeCache; }
|
|
1153
1329
|
});
|
|
1154
1330
|
Object.defineProperty(exports, "refreshVaultCache", {
|
|
1155
1331
|
enumerable: true,
|
|
1156
|
-
get: function () { return
|
|
1332
|
+
get: function () { return chunkB2QCI6ET_js.refreshVaultCache; }
|
|
1157
1333
|
});
|
|
1158
1334
|
exports.PERMIT_TYPES = PERMIT_TYPES;
|
|
1159
1335
|
exports.parsePermitSignature = parsePermitSignature;
|