@paxoslabs/amplify-sdk 0.0.1 → 0.1.0-alpha.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 +22 -1
- package/README.md +5 -480
- 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-BXUG3WDV.js → chunk-DTFLXAZJ.js} +27 -52
- package/dist/chunk-DTFLXAZJ.js.map +1 -0
- package/dist/{chunk-AIBI7ZQM.js → chunk-GS7TDQXA.js} +8 -8
- package/dist/{chunk-AIBI7ZQM.js.map → chunk-GS7TDQXA.js.map} +1 -1
- package/dist/{chunk-GBWBO6ZF.mjs → chunk-HI44AMLC.mjs} +8 -8
- package/dist/chunk-HI44AMLC.mjs.map +1 -0
- package/dist/{chunk-ZCVMGIMV.js → chunk-KYR6BFAE.js} +24 -24
- package/dist/chunk-KYR6BFAE.js.map +1 -0
- 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-ZLS2AAMI.mjs → chunk-VIULRHK6.mjs} +3 -3
- package/dist/{chunk-ZLS2AAMI.mjs.map → chunk-VIULRHK6.mjs.map} +1 -1
- package/dist/{chunk-YP2TR5RP.mjs → chunk-ZILA73XN.mjs} +25 -50
- package/dist/chunk-ZILA73XN.mjs.map +1 -0
- package/dist/core.d.mts +6 -6
- package/dist/core.d.ts +6 -6
- package/dist/core.js +16 -16
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +6 -6
- package/dist/core.mjs.map +1 -1
- package/dist/display.d.mts +3 -3
- package/dist/display.d.ts +3 -3
- package/dist/display.js +16 -16
- package/dist/display.js.map +1 -1
- package/dist/display.mjs +8 -8
- package/dist/display.mjs.map +1 -1
- package/dist/{exchange-rate-CRA_CMaX.d.mts → exchange-rate-BfPH_fQt.d.mts} +4 -4
- package/dist/{exchange-rate-D3_FVgqa.d.ts → exchange-rate-Cp1ddpw4.d.ts} +4 -4
- package/dist/index.d.mts +245 -15
- package/dist/index.d.ts +245 -15
- package/dist/index.js +341 -145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -53
- 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 +7 -7
- package/dist/chunk-BXUG3WDV.js.map +0 -1
- package/dist/chunk-GBWBO6ZF.mjs.map +0 -1
- package/dist/chunk-IBNTWZ4S.js.map +0 -1
- package/dist/chunk-WFCHKDDG.mjs.map +0 -1
- package/dist/chunk-YP2TR5RP.mjs.map +0 -1
- package/dist/chunk-ZCVMGIMV.js.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",
|
|
@@ -413,7 +637,7 @@ function parsePermitSignature(signature) {
|
|
|
413
637
|
);
|
|
414
638
|
}
|
|
415
639
|
}
|
|
416
|
-
async function
|
|
640
|
+
async function prepareDepositWithPermitTxData(params) {
|
|
417
641
|
const {
|
|
418
642
|
yieldType,
|
|
419
643
|
depositToken,
|
|
@@ -423,140 +647,107 @@ async function prepareDepositWithPermitTransactionData(params) {
|
|
|
423
647
|
deadline,
|
|
424
648
|
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
|
|
425
649
|
} = params;
|
|
426
|
-
console.log("[Amplify SDK] prepareDepositWithPermitTransactionData 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
|
-
endpoint: "
|
|
656
|
+
endpoint: "prepareDepositWithPermitTxData"
|
|
441
657
|
}
|
|
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("[Amplify SDK] Vault resolved:", vault ? "Found" : "Not found");
|
|
455
668
|
} catch (error) {
|
|
456
|
-
throw new
|
|
669
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
457
670
|
`Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
458
671
|
{
|
|
459
|
-
endpoint: "
|
|
672
|
+
endpoint: "prepareDepositWithPermitTxData",
|
|
460
673
|
cause: error
|
|
461
674
|
}
|
|
462
675
|
);
|
|
463
676
|
}
|
|
464
677
|
if (!vault) {
|
|
465
|
-
throw new
|
|
678
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
466
679
|
`No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
467
680
|
{
|
|
468
|
-
endpoint: "
|
|
681
|
+
endpoint: "prepareDepositWithPermitTxData"
|
|
469
682
|
}
|
|
470
683
|
);
|
|
471
684
|
}
|
|
472
|
-
console.log("[Amplify SDK] Fetching supported assets for depositToken:", depositToken);
|
|
473
685
|
let asset = null;
|
|
474
|
-
const assets = await
|
|
475
|
-
console.log("[Amplify SDK] Supported assets found:", assets.length);
|
|
686
|
+
const assets = await chunkB2QCI6ET_js.fetchSupportedAssets({ address: depositToken });
|
|
476
687
|
if (assets.length > 0) {
|
|
477
688
|
asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
|
|
478
689
|
}
|
|
479
690
|
if (!asset) {
|
|
480
|
-
throw new
|
|
691
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
481
692
|
`Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
|
|
482
693
|
{
|
|
483
|
-
endpoint: "
|
|
694
|
+
endpoint: "prepareDepositWithPermitTxData"
|
|
484
695
|
}
|
|
485
696
|
);
|
|
486
697
|
}
|
|
487
698
|
if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
|
|
488
|
-
throw new
|
|
699
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
489
700
|
`Token ${asset.symbol || depositToken} not supported on chain ${normalizedChainId}`,
|
|
490
701
|
{
|
|
491
|
-
endpoint: "
|
|
702
|
+
endpoint: "prepareDepositWithPermitTxData"
|
|
492
703
|
}
|
|
493
704
|
);
|
|
494
705
|
}
|
|
495
706
|
const tellerAddress = vault.vault.tellerAddress;
|
|
496
707
|
const accountantAddress = vault.vault.accountantAddress;
|
|
497
708
|
const depositAssetAddress = asset.address;
|
|
498
|
-
|
|
499
|
-
tellerAddress,
|
|
500
|
-
accountantAddress,
|
|
501
|
-
depositAssetAddress
|
|
502
|
-
});
|
|
503
|
-
console.log("[Amplify SDK] Calling getRateInQuoteWithAssetDecimals...");
|
|
504
|
-
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkBXUG3WDV_js.getRateInQuoteWithAssetDecimals({
|
|
709
|
+
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkDTFLXAZJ_js.getRateInQuoteWithAssetDecimals({
|
|
505
710
|
assetAddress: depositAssetAddress,
|
|
506
711
|
accountantAddress,
|
|
507
712
|
chainId: normalizedChainId
|
|
508
713
|
});
|
|
509
|
-
console.log("[Amplify SDK] getRateInQuoteWithAssetDecimals completed", {
|
|
510
|
-
decimalsStatus: depositAssetDecimalsResult.status,
|
|
511
|
-
rateStatus: rateInQuoteResult.status
|
|
512
|
-
});
|
|
513
714
|
if (depositAssetDecimalsResult.status === "failure") {
|
|
514
|
-
throw new
|
|
715
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
515
716
|
`Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
|
|
516
717
|
{
|
|
517
|
-
endpoint: "
|
|
718
|
+
endpoint: "prepareDepositWithPermitTxData",
|
|
518
719
|
cause: depositAssetDecimalsResult.error
|
|
519
720
|
}
|
|
520
721
|
);
|
|
521
722
|
}
|
|
522
723
|
if (rateInQuoteResult.status === "failure") {
|
|
523
|
-
throw new
|
|
724
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
524
725
|
`Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
|
|
525
726
|
{
|
|
526
|
-
endpoint: "
|
|
727
|
+
endpoint: "prepareDepositWithPermitTxData",
|
|
527
728
|
cause: rateInQuoteResult.error
|
|
528
729
|
}
|
|
529
730
|
);
|
|
530
731
|
}
|
|
531
732
|
const depositAmountAsBigInt = viem.parseUnits(depositAmount, asset.decimals);
|
|
532
|
-
|
|
533
|
-
const vaultSharesAssets = await chunkIBNTWZ4S_js.fetchSupportedAssets({
|
|
733
|
+
const vaultSharesAssets = await chunkB2QCI6ET_js.fetchSupportedAssets({
|
|
534
734
|
address: vault.vault.boringVaultAddress
|
|
535
735
|
});
|
|
536
|
-
console.log("[Amplify SDK] Vault shares assets found:", vaultSharesAssets.length);
|
|
537
736
|
if (vaultSharesAssets.length === 0) {
|
|
538
|
-
throw new
|
|
737
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
539
738
|
`Vault shares token not found in supported assets: ${vault.vault.boringVaultAddress}`,
|
|
540
|
-
{ endpoint: "
|
|
739
|
+
{ endpoint: "prepareDepositWithPermitTxData" }
|
|
541
740
|
);
|
|
542
741
|
}
|
|
543
|
-
console.log("[Amplify SDK] Calculating minimumMint...", {
|
|
544
|
-
depositAmountAsBigInt: depositAmountAsBigInt.toString(),
|
|
545
|
-
rateInQuote: rateInQuoteResult.result.toString(),
|
|
546
|
-
vaultSharesDecimals: vaultSharesAssets[0].decimals,
|
|
547
|
-
slippage
|
|
548
|
-
});
|
|
549
742
|
const minimumMint = calculateMinimumMint(
|
|
550
743
|
depositAmountAsBigInt,
|
|
551
744
|
rateInQuoteResult.result,
|
|
552
745
|
vaultSharesAssets[0].decimals,
|
|
553
746
|
slippage
|
|
554
747
|
);
|
|
555
|
-
console.log("[Amplify SDK] minimumMint calculated:", minimumMint.toString());
|
|
556
|
-
console.log("[Amplify SDK] Returning transaction data successfully");
|
|
557
748
|
return {
|
|
558
749
|
data: {
|
|
559
|
-
abi:
|
|
750
|
+
abi: chunkDTFLXAZJ_js.TellerAbi,
|
|
560
751
|
functionName: "depositWithPermit",
|
|
561
752
|
args: [
|
|
562
753
|
depositAssetAddress,
|
|
@@ -572,13 +763,13 @@ async function prepareDepositWithPermitTransactionData(params) {
|
|
|
572
763
|
chainId: normalizedChainId
|
|
573
764
|
};
|
|
574
765
|
} catch (error) {
|
|
575
|
-
if (error instanceof
|
|
766
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
576
767
|
throw error;
|
|
577
768
|
}
|
|
578
|
-
throw new
|
|
769
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
579
770
|
`Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
580
771
|
{
|
|
581
|
-
endpoint: "
|
|
772
|
+
endpoint: "prepareDepositWithPermitTxData",
|
|
582
773
|
cause: error
|
|
583
774
|
}
|
|
584
775
|
);
|
|
@@ -592,45 +783,45 @@ async function prepareApproveWithdrawTxData({
|
|
|
592
783
|
}) {
|
|
593
784
|
try {
|
|
594
785
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
595
|
-
const config = await
|
|
786
|
+
const config = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
596
787
|
assetAddress: wantAssetAddress,
|
|
597
788
|
yieldType,
|
|
598
789
|
chainId: normalizedChainId
|
|
599
790
|
});
|
|
600
791
|
if (!config || config.chainId !== normalizedChainId) {
|
|
601
|
-
throw new
|
|
792
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
602
793
|
`Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
|
|
603
794
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
604
795
|
);
|
|
605
796
|
}
|
|
606
797
|
if (!config.vault.boringVaultAddress) {
|
|
607
|
-
throw new
|
|
798
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
608
799
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
609
800
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
610
801
|
);
|
|
611
802
|
}
|
|
612
803
|
const boringVaultAddress = config.vault.boringVaultAddress;
|
|
613
|
-
const vaultSharesAssets = await
|
|
804
|
+
const vaultSharesAssets = await chunkB2QCI6ET_js.getAssetsFromCache({
|
|
614
805
|
address: boringVaultAddress
|
|
615
806
|
});
|
|
616
807
|
if (vaultSharesAssets.length === 0) {
|
|
617
|
-
throw new
|
|
808
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
618
809
|
`Vault shares token not found in supported assets: ${boringVaultAddress}`,
|
|
619
810
|
{ endpoint: "prepareApproveWithdrawToken" }
|
|
620
811
|
);
|
|
621
812
|
}
|
|
622
|
-
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) :
|
|
813
|
+
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) : chunkB2QCI6ET_js.DEFAULT_APPROVAL_AMOUNT;
|
|
623
814
|
return {
|
|
624
|
-
abi:
|
|
815
|
+
abi: chunkDTFLXAZJ_js.BoringVaultAbi,
|
|
625
816
|
address: boringVaultAddress,
|
|
626
817
|
functionName: "approve",
|
|
627
|
-
args: [
|
|
818
|
+
args: [chunkB2QCI6ET_js.ATOMIC_QUEUE_CONTRACT_ADDRESS, withdrawAmountAsBigInt]
|
|
628
819
|
};
|
|
629
820
|
} catch (error) {
|
|
630
|
-
if (error instanceof
|
|
821
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
631
822
|
throw error;
|
|
632
823
|
}
|
|
633
|
-
throw new
|
|
824
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
634
825
|
`Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
635
826
|
{
|
|
636
827
|
endpoint: "prepareApproveWithdrawToken",
|
|
@@ -642,7 +833,7 @@ async function prepareApproveWithdrawTxData({
|
|
|
642
833
|
|
|
643
834
|
// src/vaults/withdraw/utils.ts
|
|
644
835
|
var prepareUserRequest = (offerAmount, atomicPrice, deadline) => {
|
|
645
|
-
const deadlineTimeStamp =
|
|
836
|
+
const deadlineTimeStamp = chunkLSNRG5Z2_js.calculateDeadline(deadline);
|
|
646
837
|
return {
|
|
647
838
|
deadline: deadlineTimeStamp,
|
|
648
839
|
atomicPrice,
|
|
@@ -664,34 +855,34 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
664
855
|
shareAmount,
|
|
665
856
|
chainId,
|
|
666
857
|
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS,
|
|
667
|
-
|
|
858
|
+
recipientAddress
|
|
668
859
|
} = params;
|
|
669
860
|
try {
|
|
670
861
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
671
|
-
const vault = await
|
|
862
|
+
const vault = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
672
863
|
assetAddress: wantAssetAddress,
|
|
673
864
|
yieldType,
|
|
674
865
|
chainId: normalizedChainId
|
|
675
866
|
});
|
|
676
867
|
if (vault && vault.chainId !== normalizedChainId) {
|
|
677
|
-
throw new
|
|
868
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
678
869
|
`Vault chain mismatch: vault is on chain ${vault.chainId}, requested chain ${normalizedChainId}`,
|
|
679
870
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
680
871
|
);
|
|
681
872
|
}
|
|
682
873
|
if (!vault || !vault.vault.boringVaultAddress) {
|
|
683
|
-
throw new
|
|
874
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
684
875
|
`BoringVault contract address not configured for vault ${vault?.vault.boringVaultAddress}`,
|
|
685
876
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
686
877
|
);
|
|
687
878
|
}
|
|
688
879
|
const boringVaultAddress = vault.vault.boringVaultAddress;
|
|
689
880
|
const accountantAddress = vault.vault.accountantAddress;
|
|
690
|
-
const wantAsset = await
|
|
881
|
+
const wantAsset = await chunkB2QCI6ET_js.getAssetsFromCache({
|
|
691
882
|
address: wantAssetAddress
|
|
692
883
|
});
|
|
693
884
|
if (wantAsset.length === 0) {
|
|
694
|
-
throw new
|
|
885
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
695
886
|
`Vault shares token not found in supported assets: ${boringVaultAddress}`,
|
|
696
887
|
{ endpoint: "prepareBulkWithdrawTransactionData" }
|
|
697
888
|
);
|
|
@@ -700,14 +891,14 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
700
891
|
wantAssetDecimalsResult,
|
|
701
892
|
sharesAssetDecimalsResult,
|
|
702
893
|
rateInQuoteResult
|
|
703
|
-
] = await
|
|
894
|
+
] = await chunkDTFLXAZJ_js.getRateInQuoteAndSharesAndWantAssetDecimals({
|
|
704
895
|
sharesAssetAddress: boringVaultAddress,
|
|
705
896
|
wantAssetAddress,
|
|
706
897
|
accountantAddress,
|
|
707
898
|
chainId: normalizedChainId
|
|
708
899
|
});
|
|
709
900
|
if (rateInQuoteResult.status === "failure" || wantAssetDecimalsResult.status === "failure" || sharesAssetDecimalsResult.status === "failure") {
|
|
710
|
-
throw new
|
|
901
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
711
902
|
`Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
|
|
712
903
|
{
|
|
713
904
|
endpoint: "prepareBulkWithdrawTransactionData",
|
|
@@ -728,17 +919,22 @@ async function prepareBulkWithdrawTxData(params) {
|
|
|
728
919
|
);
|
|
729
920
|
const minimumAssets = atomicPrice * offerAmountAsBigInt / BigInt(10 ** sharesAssetDecimalsResult.result);
|
|
730
921
|
return {
|
|
731
|
-
abi:
|
|
922
|
+
abi: chunkDTFLXAZJ_js.TellerAbi,
|
|
732
923
|
address: vault.vault.tellerAddress,
|
|
733
924
|
functionName: "bulkWithdraw",
|
|
734
|
-
args: [
|
|
925
|
+
args: [
|
|
926
|
+
wantAssetAddress,
|
|
927
|
+
offerAmountAsBigInt,
|
|
928
|
+
minimumAssets,
|
|
929
|
+
recipientAddress
|
|
930
|
+
],
|
|
735
931
|
chainId: normalizedChainId
|
|
736
932
|
};
|
|
737
933
|
} catch (error) {
|
|
738
|
-
if (error instanceof
|
|
934
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
739
935
|
throw error;
|
|
740
936
|
}
|
|
741
|
-
throw new
|
|
937
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
742
938
|
`Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
743
939
|
{
|
|
744
940
|
endpoint: "prepareBulkWithdrawTransactionData",
|
|
@@ -989,30 +1185,30 @@ var prepareWithdrawTxData = async ({
|
|
|
989
1185
|
wantAssetAddress,
|
|
990
1186
|
chainId,
|
|
991
1187
|
offerAmount,
|
|
992
|
-
deadline =
|
|
1188
|
+
deadline = chunkB2QCI6ET_js.DEFAULT_DEADLINE,
|
|
993
1189
|
slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
|
|
994
1190
|
}) => {
|
|
995
1191
|
try {
|
|
996
1192
|
const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
|
|
997
|
-
const config = await
|
|
1193
|
+
const config = await chunkB2QCI6ET_js.findVaultByConfig({
|
|
998
1194
|
assetAddress: wantAssetAddress,
|
|
999
1195
|
yieldType,
|
|
1000
1196
|
chainId: normalizedChainId
|
|
1001
1197
|
});
|
|
1002
1198
|
if (config && config.chainId !== normalizedChainId) {
|
|
1003
|
-
throw new
|
|
1199
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1004
1200
|
`Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
|
|
1005
1201
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1006
1202
|
);
|
|
1007
1203
|
}
|
|
1008
1204
|
if (!config || !config.vault.boringVaultAddress) {
|
|
1009
|
-
throw new
|
|
1205
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1010
1206
|
`BoringVault contract address not configured for vault ${config?.id}`,
|
|
1011
1207
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1012
1208
|
);
|
|
1013
1209
|
}
|
|
1014
1210
|
if (!config.vault.accountantAddress) {
|
|
1015
|
-
throw new
|
|
1211
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1016
1212
|
`Accountant contract address not configured for vault ${config.id}`,
|
|
1017
1213
|
{ endpoint: "prepareWithdrawTransactionData" }
|
|
1018
1214
|
);
|
|
@@ -1023,14 +1219,14 @@ var prepareWithdrawTxData = async ({
|
|
|
1023
1219
|
wantAssetDecimalsResult,
|
|
1024
1220
|
sharesAssetDecimalsResult,
|
|
1025
1221
|
rateInQuoteResult
|
|
1026
|
-
] = await
|
|
1222
|
+
] = await chunkDTFLXAZJ_js.getRateInQuoteAndSharesAndWantAssetDecimals({
|
|
1027
1223
|
sharesAssetAddress: boringVaultAddress,
|
|
1028
1224
|
wantAssetAddress,
|
|
1029
1225
|
accountantAddress,
|
|
1030
1226
|
chainId: normalizedChainId
|
|
1031
1227
|
});
|
|
1032
1228
|
if (rateInQuoteResult?.status === "failure" || wantAssetDecimalsResult?.status === "failure" || sharesAssetDecimalsResult?.status === "failure") {
|
|
1033
|
-
throw new
|
|
1229
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1034
1230
|
`Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
|
|
1035
1231
|
{
|
|
1036
1232
|
endpoint: "prepareWithdrawTransactionData",
|
|
@@ -1056,16 +1252,16 @@ var prepareWithdrawTxData = async ({
|
|
|
1056
1252
|
);
|
|
1057
1253
|
return {
|
|
1058
1254
|
abi: AtomicQueueAbi,
|
|
1059
|
-
address:
|
|
1255
|
+
address: chunkB2QCI6ET_js.ATOMIC_QUEUE_CONTRACT_ADDRESS,
|
|
1060
1256
|
functionName: "updateAtomicRequest",
|
|
1061
1257
|
args: [boringVaultAddress, wantAssetAddress, userRequest],
|
|
1062
1258
|
chainId: normalizedChainId
|
|
1063
1259
|
};
|
|
1064
1260
|
} catch (error) {
|
|
1065
|
-
if (error instanceof
|
|
1261
|
+
if (error instanceof chunkB2QCI6ET_js.APIError) {
|
|
1066
1262
|
throw error;
|
|
1067
1263
|
}
|
|
1068
|
-
throw new
|
|
1264
|
+
throw new chunkB2QCI6ET_js.APIError(
|
|
1069
1265
|
`Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
1070
1266
|
{
|
|
1071
1267
|
endpoint: "prepareWithdrawTransactionData",
|
|
@@ -1081,59 +1277,59 @@ Object.defineProperty(exports, "YieldType", {
|
|
|
1081
1277
|
});
|
|
1082
1278
|
Object.defineProperty(exports, "getDepositExchangeRate", {
|
|
1083
1279
|
enumerable: true,
|
|
1084
|
-
get: function () { return
|
|
1280
|
+
get: function () { return chunkKYR6BFAE_js.getDepositExchangeRate; }
|
|
1085
1281
|
});
|
|
1086
1282
|
Object.defineProperty(exports, "getWithdrawExchangeRate", {
|
|
1087
1283
|
enumerable: true,
|
|
1088
|
-
get: function () { return
|
|
1284
|
+
get: function () { return chunkKYR6BFAE_js.getWithdrawExchangeRate; }
|
|
1089
1285
|
});
|
|
1090
1286
|
Object.defineProperty(exports, "isDepositSpendApproved", {
|
|
1091
1287
|
enumerable: true,
|
|
1092
|
-
get: function () { return
|
|
1288
|
+
get: function () { return chunkKYR6BFAE_js.isDepositSpendApproved; }
|
|
1093
1289
|
});
|
|
1094
1290
|
Object.defineProperty(exports, "isWithdrawalSpendApproved", {
|
|
1095
1291
|
enumerable: true,
|
|
1096
|
-
get: function () { return
|
|
1292
|
+
get: function () { return chunkKYR6BFAE_js.isWithdrawalSpendApproved; }
|
|
1097
1293
|
});
|
|
1098
1294
|
Object.defineProperty(exports, "APIError", {
|
|
1099
1295
|
enumerable: true,
|
|
1100
|
-
get: function () { return
|
|
1296
|
+
get: function () { return chunkB2QCI6ET_js.APIError; }
|
|
1101
1297
|
});
|
|
1102
1298
|
Object.defineProperty(exports, "fetchSupportedAssets", {
|
|
1103
1299
|
enumerable: true,
|
|
1104
|
-
get: function () { return
|
|
1300
|
+
get: function () { return chunkB2QCI6ET_js.fetchSupportedAssets; }
|
|
1105
1301
|
});
|
|
1106
1302
|
Object.defineProperty(exports, "fetchVaults", {
|
|
1107
1303
|
enumerable: true,
|
|
1108
|
-
get: function () { return
|
|
1304
|
+
get: function () { return chunkB2QCI6ET_js.fetchVaults; }
|
|
1109
1305
|
});
|
|
1110
1306
|
Object.defineProperty(exports, "findVaultByConfig", {
|
|
1111
1307
|
enumerable: true,
|
|
1112
|
-
get: function () { return
|
|
1308
|
+
get: function () { return chunkB2QCI6ET_js.findVaultByConfig; }
|
|
1113
1309
|
});
|
|
1114
1310
|
Object.defineProperty(exports, "getAssetsFromCache", {
|
|
1115
1311
|
enumerable: true,
|
|
1116
|
-
get: function () { return
|
|
1312
|
+
get: function () { return chunkB2QCI6ET_js.getAssetsFromCache; }
|
|
1117
1313
|
});
|
|
1118
1314
|
Object.defineProperty(exports, "getCache", {
|
|
1119
1315
|
enumerable: true,
|
|
1120
|
-
get: function () { return
|
|
1316
|
+
get: function () { return chunkB2QCI6ET_js.getCache; }
|
|
1121
1317
|
});
|
|
1122
1318
|
Object.defineProperty(exports, "getWithdrawSupportedAssets", {
|
|
1123
1319
|
enumerable: true,
|
|
1124
|
-
get: function () { return
|
|
1320
|
+
get: function () { return chunkB2QCI6ET_js.getWithdrawSupportedAssets; }
|
|
1125
1321
|
});
|
|
1126
1322
|
Object.defineProperty(exports, "initAmplifySDK", {
|
|
1127
1323
|
enumerable: true,
|
|
1128
|
-
get: function () { return
|
|
1324
|
+
get: function () { return chunkB2QCI6ET_js.initAmplifySDK; }
|
|
1129
1325
|
});
|
|
1130
1326
|
Object.defineProperty(exports, "initializeCache", {
|
|
1131
1327
|
enumerable: true,
|
|
1132
|
-
get: function () { return
|
|
1328
|
+
get: function () { return chunkB2QCI6ET_js.initializeCache; }
|
|
1133
1329
|
});
|
|
1134
1330
|
Object.defineProperty(exports, "refreshVaultCache", {
|
|
1135
1331
|
enumerable: true,
|
|
1136
|
-
get: function () { return
|
|
1332
|
+
get: function () { return chunkB2QCI6ET_js.refreshVaultCache; }
|
|
1137
1333
|
});
|
|
1138
1334
|
exports.PERMIT_TYPES = PERMIT_TYPES;
|
|
1139
1335
|
exports.parsePermitSignature = parsePermitSignature;
|
|
@@ -1142,7 +1338,7 @@ exports.prepareApproveWithdrawTxData = prepareApproveWithdrawTxData;
|
|
|
1142
1338
|
exports.prepareBulkWithdrawTxData = prepareBulkWithdrawTxData;
|
|
1143
1339
|
exports.prepareDepositPermitSignature = prepareDepositPermitSignature;
|
|
1144
1340
|
exports.prepareDepositTxData = prepareDepositTxData;
|
|
1145
|
-
exports.
|
|
1341
|
+
exports.prepareDepositWithPermitTxData = prepareDepositWithPermitTxData;
|
|
1146
1342
|
exports.prepareWithdrawTxData = prepareWithdrawTxData;
|
|
1147
1343
|
//# sourceMappingURL=index.js.map
|
|
1148
1344
|
//# sourceMappingURL=index.js.map
|