@paxoslabs/amplify-sdk 0.4.1 → 0.4.2
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 +11 -0
- package/README.md +8 -0
- package/dist/{chunk-QKU5APOV.js → chunk-2YPKHXFJ.js} +120 -120
- package/dist/{chunk-QKU5APOV.js.map → chunk-2YPKHXFJ.js.map} +1 -1
- package/dist/{chunk-ZPIVBZLP.js → chunk-BQG3XKTU.js} +404 -371
- package/dist/chunk-BQG3XKTU.js.map +1 -0
- package/dist/{chunk-5FVJVJXC.mjs → chunk-GMMBJB4B.mjs} +7 -7
- package/dist/chunk-GMMBJB4B.mjs.map +1 -0
- package/dist/{chunk-VDNXXONH.js → chunk-OZJNKGW6.js} +59 -59
- package/dist/chunk-OZJNKGW6.js.map +1 -0
- package/dist/{chunk-SQ3YW6UK.mjs → chunk-RW7PZETN.mjs} +405 -371
- package/dist/chunk-RW7PZETN.mjs.map +1 -0
- package/dist/{chunk-PLWWBYSM.mjs → chunk-TPU2HZAX.mjs} +4 -4
- package/dist/{chunk-PLWWBYSM.mjs.map → chunk-TPU2HZAX.mjs.map} +1 -1
- package/dist/{chunk-Y55F4I3A.mjs → chunk-VZED4E3L.mjs} +5 -27
- package/dist/chunk-VZED4E3L.mjs.map +1 -0
- package/dist/{chunk-YTCO5BHT.js → chunk-WZXCJAKM.js} +12 -35
- package/dist/chunk-WZXCJAKM.js.map +1 -0
- package/dist/core.js +16 -16
- package/dist/core.mjs +4 -4
- package/dist/display.js +9 -9
- package/dist/display.mjs +3 -3
- package/dist/index.d.mts +28 -28
- package/dist/index.d.ts +28 -28
- package/dist/index.js +50 -58
- package/dist/index.mjs +4 -4
- package/dist/utils.js +7 -7
- package/dist/utils.mjs +2 -2
- package/dist/vaults.js +24 -24
- package/dist/vaults.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-5FVJVJXC.mjs.map +0 -1
- package/dist/chunk-SQ3YW6UK.mjs.map +0 -1
- package/dist/chunk-VDNXXONH.js.map +0 -1
- package/dist/chunk-Y55F4I3A.mjs.map +0 -1
- package/dist/chunk-YTCO5BHT.js.map +0 -1
- package/dist/chunk-ZPIVBZLP.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5CV25BTQ_js = require('./chunk-5CV25BTQ.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkWZXCJAKM_js = require('./chunk-WZXCJAKM.js');
|
|
5
5
|
var chunk3I3PYX2F_js = require('./chunk-3I3PYX2F.js');
|
|
6
|
-
var
|
|
6
|
+
var chunkBQG3XKTU_js = require('./chunk-BQG3XKTU.js');
|
|
7
7
|
var viem = require('viem');
|
|
8
8
|
|
|
9
9
|
var isDepositSpendApproved = async ({
|
|
@@ -13,14 +13,14 @@ var isDepositSpendApproved = async ({
|
|
|
13
13
|
recipientAddress
|
|
14
14
|
}) => {
|
|
15
15
|
try {
|
|
16
|
-
const normalizedChainId =
|
|
17
|
-
const config = await
|
|
16
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
17
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
18
18
|
yieldType,
|
|
19
19
|
chainId: normalizedChainId,
|
|
20
20
|
assetAddress: depositAssetAddress
|
|
21
21
|
});
|
|
22
22
|
if (!config) {
|
|
23
|
-
throw new
|
|
23
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
24
24
|
`Vault not found for ${yieldType} on chain ${normalizedChainId}`,
|
|
25
25
|
{
|
|
26
26
|
endpoint: "isDepositSpendApproved"
|
|
@@ -29,7 +29,7 @@ var isDepositSpendApproved = async ({
|
|
|
29
29
|
}
|
|
30
30
|
const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
|
|
31
31
|
if (!communityCodeDepositorAddress) {
|
|
32
|
-
throw new
|
|
32
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
33
33
|
`Community code depositor contract address not configured for vault ${config.id}`,
|
|
34
34
|
{
|
|
35
35
|
endpoint: "isDepositSpendApproved"
|
|
@@ -44,7 +44,7 @@ var isDepositSpendApproved = async ({
|
|
|
44
44
|
domainSeparator,
|
|
45
45
|
tokenName,
|
|
46
46
|
tokenVersion
|
|
47
|
-
} = await
|
|
47
|
+
} = await chunkWZXCJAKM_js.getTokenPermitInfoWithAllowance({
|
|
48
48
|
chainId: normalizedChainId,
|
|
49
49
|
tokenAddress: depositAssetAddress,
|
|
50
50
|
owner: recipientAddress,
|
|
@@ -63,10 +63,10 @@ var isDepositSpendApproved = async ({
|
|
|
63
63
|
error: null
|
|
64
64
|
};
|
|
65
65
|
} catch (error) {
|
|
66
|
-
if (error instanceof
|
|
66
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
67
67
|
throw error;
|
|
68
68
|
}
|
|
69
|
-
throw new
|
|
69
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
70
70
|
`Failed to check deposit approval: ${error instanceof Error ? error.message : String(error)}`,
|
|
71
71
|
{
|
|
72
72
|
endpoint: "isDepositSpendApproved",
|
|
@@ -82,14 +82,14 @@ var isWithdrawalSpendApproved = async ({
|
|
|
82
82
|
recipientAddress
|
|
83
83
|
}) => {
|
|
84
84
|
try {
|
|
85
|
-
const normalizedChainId =
|
|
86
|
-
const config = await
|
|
85
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
86
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
87
87
|
yieldType,
|
|
88
88
|
chainId: normalizedChainId,
|
|
89
89
|
assetAddress: wantAssetAddress
|
|
90
90
|
});
|
|
91
91
|
if (!config) {
|
|
92
|
-
throw new
|
|
92
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
93
93
|
`Vault not found for ${yieldType} on chain ${normalizedChainId}`,
|
|
94
94
|
{
|
|
95
95
|
endpoint: "isWithdrawalSpendApproved"
|
|
@@ -98,7 +98,7 @@ var isWithdrawalSpendApproved = async ({
|
|
|
98
98
|
}
|
|
99
99
|
const boringVaultAddress = config.vault.boringVaultAddress;
|
|
100
100
|
if (!boringVaultAddress) {
|
|
101
|
-
throw new
|
|
101
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
102
102
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
103
103
|
{
|
|
104
104
|
endpoint: "isWithdrawalSpendApproved"
|
|
@@ -107,14 +107,14 @@ var isWithdrawalSpendApproved = async ({
|
|
|
107
107
|
}
|
|
108
108
|
const withdrawQueueAddress = config.vault.withdrawQueueAddress;
|
|
109
109
|
if (!withdrawQueueAddress) {
|
|
110
|
-
throw new
|
|
110
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
111
111
|
`WithdrawQueue contract address not configured for vault ${config.id}`,
|
|
112
112
|
{
|
|
113
113
|
endpoint: "isWithdrawalSpendApproved"
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
const [allowance, decimals] = await
|
|
117
|
+
const [allowance, decimals] = await chunkWZXCJAKM_js.getErc20AllowanceWithDecimals({
|
|
118
118
|
chainId: normalizedChainId,
|
|
119
119
|
tokenAddress: boringVaultAddress,
|
|
120
120
|
recipientAddress,
|
|
@@ -137,10 +137,10 @@ var isWithdrawalSpendApproved = async ({
|
|
|
137
137
|
error: null
|
|
138
138
|
};
|
|
139
139
|
} catch (error) {
|
|
140
|
-
if (error instanceof
|
|
140
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
141
141
|
throw error;
|
|
142
142
|
}
|
|
143
|
-
throw new
|
|
143
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
144
144
|
`Failed to check withdrawal approval: ${error instanceof Error ? error.message : String(error)}`,
|
|
145
145
|
{ endpoint: "isWithdrawalSpendApproved", cause: error }
|
|
146
146
|
);
|
|
@@ -152,29 +152,29 @@ async function prepareApproveDepositTokenTxData({
|
|
|
152
152
|
approvalAmount,
|
|
153
153
|
chainId
|
|
154
154
|
}) {
|
|
155
|
-
const normalizedChainId =
|
|
155
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
156
156
|
try {
|
|
157
|
-
const config = await
|
|
157
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
158
158
|
assetAddress: depositAsset,
|
|
159
159
|
yieldType,
|
|
160
160
|
chainId: normalizedChainId
|
|
161
161
|
});
|
|
162
162
|
if (!config) {
|
|
163
|
-
throw new
|
|
163
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
164
164
|
`No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
165
165
|
{ endpoint: "prepareApproveDepositToken" }
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
|
|
169
169
|
if (!communityCodeDepositorAddress) {
|
|
170
|
-
throw new
|
|
170
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
171
171
|
`Community Code Depositor contract address not configured for vault ${config.id}`,
|
|
172
172
|
{ endpoint: "prepareApproveDepositToken" }
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
|
-
const assets = await
|
|
175
|
+
const assets = await chunkBQG3XKTU_js.getAssetsFromCache({ address: depositAsset });
|
|
176
176
|
if (assets.length === 0) {
|
|
177
|
-
throw new
|
|
177
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
178
178
|
`Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
|
|
179
179
|
{ endpoint: "prepareApproveDepositToken" }
|
|
180
180
|
);
|
|
@@ -183,13 +183,13 @@ async function prepareApproveDepositTokenTxData({
|
|
|
183
183
|
(asset) => asset.address.toLowerCase() === depositAsset.toLowerCase() && asset.chains.includes(normalizedChainId)
|
|
184
184
|
);
|
|
185
185
|
if (!verifiedAsset) {
|
|
186
|
-
throw new
|
|
186
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
187
187
|
`Asset ${depositAsset} not verified on chain ${normalizedChainId}`,
|
|
188
188
|
{ endpoint: "prepareApproveDepositToken" }
|
|
189
189
|
);
|
|
190
190
|
}
|
|
191
191
|
const decimals = verifiedAsset.decimals;
|
|
192
|
-
const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) :
|
|
192
|
+
const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkBQG3XKTU_js.DEFAULT_APPROVAL_AMOUNT;
|
|
193
193
|
return {
|
|
194
194
|
abi: viem.erc20Abi,
|
|
195
195
|
address: depositAsset,
|
|
@@ -197,10 +197,10 @@ async function prepareApproveDepositTokenTxData({
|
|
|
197
197
|
args: [communityCodeDepositorAddress, amount]
|
|
198
198
|
};
|
|
199
199
|
} catch (error) {
|
|
200
|
-
if (error instanceof
|
|
200
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
201
201
|
throw error;
|
|
202
202
|
}
|
|
203
|
-
throw new
|
|
203
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
204
204
|
`Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
205
205
|
{
|
|
206
206
|
endpoint: "prepareApproveDepositToken",
|
|
@@ -441,7 +441,7 @@ var CommunityCodeDepositorAbi = [
|
|
|
441
441
|
|
|
442
442
|
// src/vaults/deposit/utils.ts
|
|
443
443
|
var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) => {
|
|
444
|
-
const slippageValue = slippage ??
|
|
444
|
+
const slippageValue = slippage ?? chunkBQG3XKTU_js.DEFAULT_SLIPPAGE_BPS;
|
|
445
445
|
const slippageAsBigInt = BigInt(slippageValue) * chunk3I3PYX2F_js.WAD.bigint / BigInt(1e4);
|
|
446
446
|
const minimumMint = depositAmount * chunk3I3PYX2F_js.WAD.bigint / rate;
|
|
447
447
|
const slippageAmount = minimumMint * slippageAsBigInt / chunk3I3PYX2F_js.WAD.bigint;
|
|
@@ -458,29 +458,29 @@ async function prepareDepositTxData(params) {
|
|
|
458
458
|
depositAsset,
|
|
459
459
|
depositAmount,
|
|
460
460
|
chainId,
|
|
461
|
-
slippage =
|
|
461
|
+
slippage = chunkBQG3XKTU_js.DEFAULT_SLIPPAGE_BPS,
|
|
462
462
|
to,
|
|
463
463
|
distributorCode
|
|
464
464
|
} = params;
|
|
465
465
|
try {
|
|
466
|
-
const normalizedChainId =
|
|
467
|
-
const vault = await
|
|
466
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
467
|
+
const vault = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
468
468
|
assetAddress: depositAsset,
|
|
469
469
|
yieldType,
|
|
470
470
|
chainId: normalizedChainId
|
|
471
471
|
});
|
|
472
472
|
if (!vault) {
|
|
473
|
-
throw new
|
|
473
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
474
474
|
`No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
475
475
|
{
|
|
476
476
|
endpoint: "prepareDepositTransactionData"
|
|
477
477
|
}
|
|
478
478
|
);
|
|
479
479
|
}
|
|
480
|
-
const assets = await
|
|
480
|
+
const assets = await chunkBQG3XKTU_js.getAssetsFromCache({ address: depositAsset });
|
|
481
481
|
const asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets.find((a) => a.address.toLowerCase() === depositAsset.toLowerCase());
|
|
482
482
|
if (!asset) {
|
|
483
|
-
throw new
|
|
483
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
484
484
|
`Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
|
|
485
485
|
{
|
|
486
486
|
endpoint: "prepareDepositTransactionData"
|
|
@@ -489,26 +489,26 @@ async function prepareDepositTxData(params) {
|
|
|
489
489
|
}
|
|
490
490
|
const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
|
|
491
491
|
if (!communityCodeDepositorAddress) {
|
|
492
|
-
throw new
|
|
492
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
493
493
|
`Community Code Depositor contract address not found for vault ${vault.id}`,
|
|
494
494
|
{ endpoint: "prepareDepositTransactionData" }
|
|
495
495
|
);
|
|
496
496
|
}
|
|
497
497
|
const accountantAddress = vault.vault.accountantAddress;
|
|
498
498
|
if (!accountantAddress) {
|
|
499
|
-
throw new
|
|
499
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
500
500
|
`Accountant contract address not found for vault ${vault.id}`,
|
|
501
501
|
{ endpoint: "prepareDepositTransactionData" }
|
|
502
502
|
);
|
|
503
503
|
}
|
|
504
504
|
const depositAssetAddress = asset.address;
|
|
505
|
-
const [depositAssetDecimalsResult, rateInQuoteResult] = await
|
|
505
|
+
const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkWZXCJAKM_js.getRateInQuoteWithAssetDecimals({
|
|
506
506
|
assetAddress: depositAssetAddress,
|
|
507
507
|
accountantAddress,
|
|
508
508
|
chainId: normalizedChainId
|
|
509
509
|
});
|
|
510
510
|
if (depositAssetDecimalsResult.status === "failure") {
|
|
511
|
-
throw new
|
|
511
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
512
512
|
`Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
|
|
513
513
|
{
|
|
514
514
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -517,7 +517,7 @@ async function prepareDepositTxData(params) {
|
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
519
|
if (rateInQuoteResult.status === "failure") {
|
|
520
|
-
throw new
|
|
520
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
521
521
|
`Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
|
|
522
522
|
{
|
|
523
523
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -536,7 +536,7 @@ async function prepareDepositTxData(params) {
|
|
|
536
536
|
slippage
|
|
537
537
|
);
|
|
538
538
|
if (!communityCodeDepositorAddress) {
|
|
539
|
-
throw new
|
|
539
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
540
540
|
`CommunityCodeDepositor contract address not found for vault ${vault.id}`,
|
|
541
541
|
{ endpoint: "prepareDepositTransactionData" }
|
|
542
542
|
);
|
|
@@ -555,10 +555,10 @@ async function prepareDepositTxData(params) {
|
|
|
555
555
|
chainId: normalizedChainId
|
|
556
556
|
};
|
|
557
557
|
} catch (error) {
|
|
558
|
-
if (error instanceof
|
|
558
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
559
559
|
throw error;
|
|
560
560
|
}
|
|
561
|
-
throw new
|
|
561
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
562
562
|
`Failed to prepare deposit transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
563
563
|
{
|
|
564
564
|
endpoint: "prepareDepositTransactionData",
|
|
@@ -614,16 +614,16 @@ async function prepareDepositPermitSignature(params) {
|
|
|
614
614
|
tokenVersion: prefetchedTokenVersion
|
|
615
615
|
} = params;
|
|
616
616
|
try {
|
|
617
|
-
const normalizedChainId =
|
|
617
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
618
618
|
let vault;
|
|
619
619
|
try {
|
|
620
|
-
vault = await
|
|
620
|
+
vault = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
621
621
|
assetAddress: depositAsset,
|
|
622
622
|
yieldType,
|
|
623
623
|
chainId: normalizedChainId
|
|
624
624
|
});
|
|
625
625
|
} catch (error) {
|
|
626
|
-
throw new
|
|
626
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
627
627
|
`Failed to resolve vault for token ${depositAsset} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
628
628
|
{
|
|
629
629
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -632,7 +632,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
632
632
|
);
|
|
633
633
|
}
|
|
634
634
|
if (!vault) {
|
|
635
|
-
throw new
|
|
635
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
636
636
|
`No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
637
637
|
{
|
|
638
638
|
endpoint: "prepareDepositPermitSignature"
|
|
@@ -641,7 +641,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
641
641
|
}
|
|
642
642
|
const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
|
|
643
643
|
if (!communityCodeDepositorAddress) {
|
|
644
|
-
throw new
|
|
644
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
645
645
|
`CommunityCodeDepositor contract address not found for vault ${vault.id}`,
|
|
646
646
|
{ endpoint: "prepareDepositPermitSignature" }
|
|
647
647
|
);
|
|
@@ -655,24 +655,24 @@ async function prepareDepositPermitSignature(params) {
|
|
|
655
655
|
resolvedTokenVersion = prefetchedTokenVersion;
|
|
656
656
|
resolvedNonce = prefetchedNonce;
|
|
657
657
|
} else {
|
|
658
|
-
const client = await
|
|
658
|
+
const client = await chunkBQG3XKTU_js.getClient(normalizedChainId);
|
|
659
659
|
try {
|
|
660
660
|
const [nameResult, versionResult, nonceResult] = await client.multicall(
|
|
661
661
|
{
|
|
662
662
|
contracts: [
|
|
663
663
|
{
|
|
664
664
|
address: depositAsset,
|
|
665
|
-
abi:
|
|
665
|
+
abi: chunkWZXCJAKM_js.erc2612Abi,
|
|
666
666
|
functionName: "name"
|
|
667
667
|
},
|
|
668
668
|
{
|
|
669
669
|
address: depositAsset,
|
|
670
|
-
abi:
|
|
670
|
+
abi: chunkWZXCJAKM_js.erc2612Abi,
|
|
671
671
|
functionName: "version"
|
|
672
672
|
},
|
|
673
673
|
{
|
|
674
674
|
address: depositAsset,
|
|
675
|
-
abi:
|
|
675
|
+
abi: chunkWZXCJAKM_js.erc2612Abi,
|
|
676
676
|
functionName: "nonces",
|
|
677
677
|
args: [to]
|
|
678
678
|
}
|
|
@@ -684,7 +684,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
684
684
|
} else if (nameResult.status === "success") {
|
|
685
685
|
resolvedTokenName = nameResult.result;
|
|
686
686
|
} else {
|
|
687
|
-
throw new
|
|
687
|
+
throw new chunkBQG3XKTU_js.APIError(`Failed to read token name from ${depositAsset}`, {
|
|
688
688
|
endpoint: "prepareDepositPermitSignature",
|
|
689
689
|
cause: nameResult.error
|
|
690
690
|
});
|
|
@@ -701,7 +701,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
701
701
|
} else if (nonceResult.status === "success") {
|
|
702
702
|
resolvedNonce = nonceResult.result;
|
|
703
703
|
} else {
|
|
704
|
-
throw new
|
|
704
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
705
705
|
`Token ${depositAsset} does not support EIP-2612 permit. Missing required function: nonces()`,
|
|
706
706
|
{
|
|
707
707
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -710,10 +710,10 @@ async function prepareDepositPermitSignature(params) {
|
|
|
710
710
|
);
|
|
711
711
|
}
|
|
712
712
|
} catch (error) {
|
|
713
|
-
if (error instanceof
|
|
713
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
714
714
|
throw error;
|
|
715
715
|
}
|
|
716
|
-
throw new
|
|
716
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
717
717
|
`Failed to read token metadata: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
718
718
|
{
|
|
719
719
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -727,7 +727,7 @@ async function prepareDepositPermitSignature(params) {
|
|
|
727
727
|
if (prefetchedDecimals !== void 0) {
|
|
728
728
|
resolvedDecimals = prefetchedDecimals;
|
|
729
729
|
} else {
|
|
730
|
-
resolvedDecimals = await
|
|
730
|
+
resolvedDecimals = await chunkWZXCJAKM_js.getErc20Decimals({
|
|
731
731
|
tokenAddress: depositAsset,
|
|
732
732
|
chainId: normalizedChainId
|
|
733
733
|
});
|
|
@@ -754,10 +754,10 @@ async function prepareDepositPermitSignature(params) {
|
|
|
754
754
|
message
|
|
755
755
|
};
|
|
756
756
|
} catch (error) {
|
|
757
|
-
if (error instanceof
|
|
757
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
758
758
|
throw error;
|
|
759
759
|
}
|
|
760
|
-
throw new
|
|
760
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
761
761
|
`Failed to prepare permit signature: ${error instanceof Error ? error.message : String(error)}`,
|
|
762
762
|
{
|
|
763
763
|
endpoint: "prepareDepositPermitSignature",
|
|
@@ -783,7 +783,7 @@ function parsePermitSignature(signature) {
|
|
|
783
783
|
s: parsed.s
|
|
784
784
|
};
|
|
785
785
|
} catch (error) {
|
|
786
|
-
throw new
|
|
786
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
787
787
|
`Invalid permit signature format. Expected hex string but received: ${signature}. ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
788
788
|
{
|
|
789
789
|
endpoint: "parsePermitSignature",
|
|
@@ -800,30 +800,30 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
800
800
|
chainId,
|
|
801
801
|
signature,
|
|
802
802
|
deadline,
|
|
803
|
-
slippage =
|
|
803
|
+
slippage = chunkBQG3XKTU_js.DEFAULT_SLIPPAGE_BPS,
|
|
804
804
|
to,
|
|
805
805
|
distributorCode
|
|
806
806
|
} = params;
|
|
807
807
|
try {
|
|
808
808
|
const { v, r, s } = parsePermitSignature(signature);
|
|
809
809
|
if (slippage < 0 || slippage > 1e4) {
|
|
810
|
-
throw new
|
|
810
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
811
811
|
`Invalid slippage value: ${slippage}. Slippage must be between 0 and 10000 basis points.`,
|
|
812
812
|
{
|
|
813
813
|
endpoint: "prepareDepositWithPermitTxData"
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
816
|
}
|
|
817
|
-
const normalizedChainId =
|
|
817
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
818
818
|
let vault;
|
|
819
819
|
try {
|
|
820
|
-
vault = await
|
|
820
|
+
vault = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
821
821
|
assetAddress: depositAsset,
|
|
822
822
|
yieldType,
|
|
823
823
|
chainId: normalizedChainId
|
|
824
824
|
});
|
|
825
825
|
} catch (error) {
|
|
826
|
-
throw new
|
|
826
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
827
827
|
`Failed to resolve vault for token ${depositAsset} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
828
828
|
{
|
|
829
829
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -832,7 +832,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
832
832
|
);
|
|
833
833
|
}
|
|
834
834
|
if (!vault) {
|
|
835
|
-
throw new
|
|
835
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
836
836
|
`No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
|
|
837
837
|
{
|
|
838
838
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -840,12 +840,12 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
840
840
|
);
|
|
841
841
|
}
|
|
842
842
|
let asset = null;
|
|
843
|
-
const assets = await
|
|
843
|
+
const assets = await chunkBQG3XKTU_js.getAssetsFromCache({ address: depositAsset });
|
|
844
844
|
if (assets.length > 0) {
|
|
845
845
|
asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
|
|
846
846
|
}
|
|
847
847
|
if (!asset) {
|
|
848
|
-
throw new
|
|
848
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
849
849
|
`Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
|
|
850
850
|
{
|
|
851
851
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -853,7 +853,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
853
853
|
);
|
|
854
854
|
}
|
|
855
855
|
if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
|
|
856
|
-
throw new
|
|
856
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
857
857
|
`Token ${asset.symbol || depositAsset} not supported on chain ${normalizedChainId}`,
|
|
858
858
|
{
|
|
859
859
|
endpoint: "prepareDepositWithPermitTxData"
|
|
@@ -864,19 +864,19 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
864
864
|
const accountantAddress = vault.vault.accountantAddress;
|
|
865
865
|
const depositAssetAddress = depositAsset;
|
|
866
866
|
if (!communityCodeDepositorAddress) {
|
|
867
|
-
throw new
|
|
867
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
868
868
|
`CommunityCodeDepositor contract address not found for vault ${vault.id}`,
|
|
869
869
|
{ endpoint: "prepareDepositWithPermitTxData" }
|
|
870
870
|
);
|
|
871
871
|
}
|
|
872
|
-
const rateAndDecimalResults = await
|
|
872
|
+
const rateAndDecimalResults = await chunkWZXCJAKM_js.getRateInQuoteWithAssetDecimals({
|
|
873
873
|
assetAddress: depositAssetAddress,
|
|
874
874
|
accountantAddress,
|
|
875
875
|
chainId: normalizedChainId
|
|
876
876
|
});
|
|
877
877
|
const [depositAssetDecimalsResult, rateInQuoteResult] = rateAndDecimalResults;
|
|
878
878
|
if (depositAssetDecimalsResult.status === "failure") {
|
|
879
|
-
throw new
|
|
879
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
880
880
|
`Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
|
|
881
881
|
{
|
|
882
882
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -885,7 +885,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
885
885
|
);
|
|
886
886
|
}
|
|
887
887
|
if (rateInQuoteResult.status === "failure") {
|
|
888
|
-
throw new
|
|
888
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
889
889
|
`Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
|
|
890
890
|
{
|
|
891
891
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -924,10 +924,10 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
924
924
|
chainId: normalizedChainId
|
|
925
925
|
};
|
|
926
926
|
} catch (error) {
|
|
927
|
-
if (error instanceof
|
|
927
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
928
928
|
throw error;
|
|
929
929
|
}
|
|
930
|
-
throw new
|
|
930
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
931
931
|
`Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
932
932
|
{
|
|
933
933
|
endpoint: "prepareDepositWithPermitTxData",
|
|
@@ -939,7 +939,7 @@ async function prepareDepositWithPermitTxData(params) {
|
|
|
939
939
|
|
|
940
940
|
// src/utils/wallet.ts
|
|
941
941
|
async function isSmartContractWallet(address, chainId) {
|
|
942
|
-
const client = await
|
|
942
|
+
const client = await chunkBQG3XKTU_js.getClient(chainId);
|
|
943
943
|
const code = await client.getCode({ address });
|
|
944
944
|
return !!code && code !== "0x";
|
|
945
945
|
}
|
|
@@ -970,14 +970,14 @@ async function prepareDepositAuthorization(params) {
|
|
|
970
970
|
forceMethod
|
|
971
971
|
} = params;
|
|
972
972
|
try {
|
|
973
|
-
const normalizedChainId =
|
|
974
|
-
const vault = await
|
|
973
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
974
|
+
const vault = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
975
975
|
assetAddress: depositAsset,
|
|
976
976
|
yieldType,
|
|
977
977
|
chainId: normalizedChainId
|
|
978
978
|
});
|
|
979
979
|
if (!vault) {
|
|
980
|
-
throw new
|
|
980
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
981
981
|
`No vault found for token ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
|
|
982
982
|
{ endpoint: "prepareDepositAuthorization" }
|
|
983
983
|
);
|
|
@@ -1080,10 +1080,10 @@ async function prepareDepositAuthorization(params) {
|
|
|
1080
1080
|
txData
|
|
1081
1081
|
};
|
|
1082
1082
|
} catch (error) {
|
|
1083
|
-
if (error instanceof
|
|
1083
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1084
1084
|
throw error;
|
|
1085
1085
|
}
|
|
1086
|
-
throw new
|
|
1086
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1087
1087
|
`Failed to prepare deposit authorization: ${error instanceof Error ? error.message : String(error)}`,
|
|
1088
1088
|
{
|
|
1089
1089
|
endpoint: "prepareDepositAuthorization",
|
|
@@ -1107,7 +1107,7 @@ async function prepareDeposit(params) {
|
|
|
1107
1107
|
} = params;
|
|
1108
1108
|
try {
|
|
1109
1109
|
if (forceMethod === "permit" && (!signature || deadline === void 0)) {
|
|
1110
|
-
throw new
|
|
1110
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1111
1111
|
"Permit deposit requires both signature and deadline parameters when forceMethod is 'permit'",
|
|
1112
1112
|
{ endpoint: "prepareDeposit" }
|
|
1113
1113
|
);
|
|
@@ -1115,7 +1115,7 @@ async function prepareDeposit(params) {
|
|
|
1115
1115
|
const usePermit = forceMethod === "permit" || forceMethod !== "approval" && signature !== void 0 && deadline !== void 0;
|
|
1116
1116
|
if (usePermit) {
|
|
1117
1117
|
if (!signature || deadline === void 0) {
|
|
1118
|
-
throw new
|
|
1118
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1119
1119
|
"Permit deposit requires both signature and deadline parameters",
|
|
1120
1120
|
{ endpoint: "prepareDeposit" }
|
|
1121
1121
|
);
|
|
@@ -1150,10 +1150,10 @@ async function prepareDeposit(params) {
|
|
|
1150
1150
|
txData
|
|
1151
1151
|
};
|
|
1152
1152
|
} catch (error) {
|
|
1153
|
-
if (error instanceof
|
|
1153
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1154
1154
|
throw error;
|
|
1155
1155
|
}
|
|
1156
|
-
throw new
|
|
1156
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1157
1157
|
`Failed to prepare deposit: ${error instanceof Error ? error.message : String(error)}`,
|
|
1158
1158
|
{
|
|
1159
1159
|
endpoint: "prepareDeposit",
|
|
@@ -1170,48 +1170,48 @@ async function prepareApproveWithdrawOrderTxData({
|
|
|
1170
1170
|
shareDecimals
|
|
1171
1171
|
}) {
|
|
1172
1172
|
try {
|
|
1173
|
-
const normalizedChainId =
|
|
1174
|
-
const config = await
|
|
1173
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
1174
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
1175
1175
|
assetAddress: wantAssetAddress,
|
|
1176
1176
|
yieldType,
|
|
1177
1177
|
chainId: normalizedChainId
|
|
1178
1178
|
});
|
|
1179
1179
|
if (!config || config.chainId !== normalizedChainId) {
|
|
1180
|
-
throw new
|
|
1180
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1181
1181
|
`Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
|
|
1182
1182
|
{ endpoint: "prepareApproveWithdrawOrderTxData" }
|
|
1183
1183
|
);
|
|
1184
1184
|
}
|
|
1185
1185
|
if (!config.vault.boringVaultAddress) {
|
|
1186
|
-
throw new
|
|
1186
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1187
1187
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
1188
1188
|
{ endpoint: "prepareApproveWithdrawOrderTxData" }
|
|
1189
1189
|
);
|
|
1190
1190
|
}
|
|
1191
1191
|
if (!config.vault.withdrawQueueAddress) {
|
|
1192
|
-
throw new
|
|
1192
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1193
1193
|
`WithdrawQueue contract address not configured for vault ${config.id}`,
|
|
1194
1194
|
{ endpoint: "prepareApproveWithdrawOrderTxData" }
|
|
1195
1195
|
);
|
|
1196
1196
|
}
|
|
1197
1197
|
const boringVaultAddress = config.vault.boringVaultAddress;
|
|
1198
1198
|
const withdrawQueueAddress = config.vault.withdrawQueueAddress;
|
|
1199
|
-
const decimals = shareDecimals ?? await
|
|
1199
|
+
const decimals = shareDecimals ?? await chunkWZXCJAKM_js.getErc20Decimals({
|
|
1200
1200
|
tokenAddress: boringVaultAddress,
|
|
1201
1201
|
chainId: normalizedChainId
|
|
1202
1202
|
});
|
|
1203
|
-
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) :
|
|
1203
|
+
const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) : chunkBQG3XKTU_js.DEFAULT_APPROVAL_AMOUNT;
|
|
1204
1204
|
return {
|
|
1205
|
-
abi:
|
|
1205
|
+
abi: chunkWZXCJAKM_js.BoringVaultAbi,
|
|
1206
1206
|
address: boringVaultAddress,
|
|
1207
1207
|
functionName: "approve",
|
|
1208
1208
|
args: [withdrawQueueAddress, withdrawAmountAsBigInt]
|
|
1209
1209
|
};
|
|
1210
1210
|
} catch (error) {
|
|
1211
|
-
if (error instanceof
|
|
1211
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1212
1212
|
throw error;
|
|
1213
1213
|
}
|
|
1214
|
-
throw new
|
|
1214
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1215
1215
|
`Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
1216
1216
|
{
|
|
1217
1217
|
endpoint: "prepareApproveWithdrawOrderTxData",
|
|
@@ -1229,26 +1229,26 @@ var prepareCancelWithdrawOrderTxData = async ({
|
|
|
1229
1229
|
orderIndex
|
|
1230
1230
|
}) => {
|
|
1231
1231
|
try {
|
|
1232
|
-
const normalizedChainId =
|
|
1233
|
-
const config = await
|
|
1232
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
1233
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
1234
1234
|
assetAddress: wantAsset,
|
|
1235
1235
|
yieldType,
|
|
1236
1236
|
chainId: normalizedChainId
|
|
1237
1237
|
});
|
|
1238
1238
|
if (!config) {
|
|
1239
|
-
throw new
|
|
1239
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1240
1240
|
`No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
|
|
1241
1241
|
{ endpoint: "prepareCancelWithdrawOrderTxData" }
|
|
1242
1242
|
);
|
|
1243
1243
|
}
|
|
1244
1244
|
if (config.chainId !== normalizedChainId) {
|
|
1245
|
-
throw new
|
|
1245
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1246
1246
|
`Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
|
|
1247
1247
|
{ endpoint: "prepareCancelWithdrawOrderTxData" }
|
|
1248
1248
|
);
|
|
1249
1249
|
}
|
|
1250
1250
|
if (!config.vault.withdrawQueueAddress) {
|
|
1251
|
-
throw new
|
|
1251
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1252
1252
|
`WithdrawQueue contract address not configured for vault ${config.id}`,
|
|
1253
1253
|
{ endpoint: "prepareCancelWithdrawOrderTxData" }
|
|
1254
1254
|
);
|
|
@@ -1261,10 +1261,10 @@ var prepareCancelWithdrawOrderTxData = async ({
|
|
|
1261
1261
|
chainId: normalizedChainId
|
|
1262
1262
|
};
|
|
1263
1263
|
} catch (error) {
|
|
1264
|
-
if (error instanceof
|
|
1264
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1265
1265
|
throw error;
|
|
1266
1266
|
}
|
|
1267
|
-
throw new
|
|
1267
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1268
1268
|
`Failed to prepare cancel order transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
1269
1269
|
{
|
|
1270
1270
|
endpoint: "prepareCancelWithdrawOrderTxData",
|
|
@@ -1293,37 +1293,37 @@ var prepareWithdrawOrderTxData = async ({
|
|
|
1293
1293
|
amountOffer
|
|
1294
1294
|
}) => {
|
|
1295
1295
|
try {
|
|
1296
|
-
const normalizedChainId =
|
|
1297
|
-
const config = await
|
|
1296
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
1297
|
+
const config = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
1298
1298
|
assetAddress: wantAsset,
|
|
1299
1299
|
yieldType,
|
|
1300
1300
|
chainId: normalizedChainId
|
|
1301
1301
|
});
|
|
1302
1302
|
if (!config) {
|
|
1303
|
-
throw new
|
|
1303
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1304
1304
|
`No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
|
|
1305
1305
|
{ endpoint: "prepareWithdrawOrderTxData" }
|
|
1306
1306
|
);
|
|
1307
1307
|
}
|
|
1308
1308
|
if (config.chainId !== normalizedChainId) {
|
|
1309
|
-
throw new
|
|
1309
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1310
1310
|
`Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
|
|
1311
1311
|
{ endpoint: "prepareWithdrawOrderTxData" }
|
|
1312
1312
|
);
|
|
1313
1313
|
}
|
|
1314
1314
|
if (!config.vault.withdrawQueueAddress) {
|
|
1315
|
-
throw new
|
|
1315
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1316
1316
|
`WithdrawQueue contract address not configured for vault ${config.id}`,
|
|
1317
1317
|
{ endpoint: "prepareWithdrawOrderTxData" }
|
|
1318
1318
|
);
|
|
1319
1319
|
}
|
|
1320
1320
|
if (!config.vault.boringVaultAddress) {
|
|
1321
|
-
throw new
|
|
1321
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1322
1322
|
`BoringVault contract address not configured for vault ${config.id}`,
|
|
1323
1323
|
{ endpoint: "prepareWithdrawOrderTxData" }
|
|
1324
1324
|
);
|
|
1325
1325
|
}
|
|
1326
|
-
const sharesDecimals = await
|
|
1326
|
+
const sharesDecimals = await chunkWZXCJAKM_js.getErc20Decimals({
|
|
1327
1327
|
tokenAddress: config.vault.boringVaultAddress,
|
|
1328
1328
|
chainId: normalizedChainId
|
|
1329
1329
|
});
|
|
@@ -1345,10 +1345,10 @@ var prepareWithdrawOrderTxData = async ({
|
|
|
1345
1345
|
chainId: normalizedChainId
|
|
1346
1346
|
};
|
|
1347
1347
|
} catch (error) {
|
|
1348
|
-
if (error instanceof
|
|
1348
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1349
1349
|
throw error;
|
|
1350
1350
|
}
|
|
1351
|
-
throw new
|
|
1351
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1352
1352
|
`Failed to prepare withdraw order transaction: ${error instanceof Error ? error.message : String(error)}`,
|
|
1353
1353
|
{
|
|
1354
1354
|
endpoint: "prepareWithdrawOrderTxData",
|
|
@@ -1378,10 +1378,10 @@ async function prepareWithdrawal(params) {
|
|
|
1378
1378
|
amountOffer: withdrawAmount
|
|
1379
1379
|
});
|
|
1380
1380
|
} catch (error) {
|
|
1381
|
-
if (error instanceof
|
|
1381
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1382
1382
|
throw error;
|
|
1383
1383
|
}
|
|
1384
|
-
throw new
|
|
1384
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1385
1385
|
`Failed to prepare withdrawal: ${error instanceof Error ? error.message : String(error)}`,
|
|
1386
1386
|
{
|
|
1387
1387
|
endpoint: "prepareWithdrawal",
|
|
@@ -1400,14 +1400,14 @@ async function prepareWithdrawalAuthorization(params) {
|
|
|
1400
1400
|
forceMethod
|
|
1401
1401
|
} = params;
|
|
1402
1402
|
try {
|
|
1403
|
-
const normalizedChainId =
|
|
1404
|
-
const vault = await
|
|
1403
|
+
const normalizedChainId = chunkBQG3XKTU_js.toChainId(chainId);
|
|
1404
|
+
const vault = await chunkBQG3XKTU_js.findVaultByConfig({
|
|
1405
1405
|
assetAddress: wantAsset,
|
|
1406
1406
|
yieldType,
|
|
1407
1407
|
chainId: normalizedChainId
|
|
1408
1408
|
});
|
|
1409
1409
|
if (!vault) {
|
|
1410
|
-
throw new
|
|
1410
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1411
1411
|
`No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
|
|
1412
1412
|
{ endpoint: "prepareWithdrawalAuthorization" }
|
|
1413
1413
|
);
|
|
@@ -1449,7 +1449,7 @@ async function prepareWithdrawalAuthorization(params) {
|
|
|
1449
1449
|
recipientAddress: userAddress
|
|
1450
1450
|
});
|
|
1451
1451
|
if (approvalInfo.error) {
|
|
1452
|
-
throw new
|
|
1452
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1453
1453
|
`Failed to check withdrawal approval: ${approvalInfo.error}`,
|
|
1454
1454
|
{ endpoint: "prepareWithdrawalAuthorization" }
|
|
1455
1455
|
);
|
|
@@ -1478,10 +1478,10 @@ async function prepareWithdrawalAuthorization(params) {
|
|
|
1478
1478
|
txData
|
|
1479
1479
|
};
|
|
1480
1480
|
} catch (error) {
|
|
1481
|
-
if (error instanceof
|
|
1481
|
+
if (error instanceof chunkBQG3XKTU_js.APIError) {
|
|
1482
1482
|
throw error;
|
|
1483
1483
|
}
|
|
1484
|
-
throw new
|
|
1484
|
+
throw new chunkBQG3XKTU_js.APIError(
|
|
1485
1485
|
`Failed to prepare withdrawal authorization: ${error instanceof Error ? error.message : String(error)}`,
|
|
1486
1486
|
{
|
|
1487
1487
|
endpoint: "prepareWithdrawalAuthorization",
|
|
@@ -1514,5 +1514,5 @@ exports.prepareWithdrawOrderTxData = prepareWithdrawOrderTxData;
|
|
|
1514
1514
|
exports.prepareWithdrawal = prepareWithdrawal;
|
|
1515
1515
|
exports.prepareWithdrawalAuthorization = prepareWithdrawalAuthorization;
|
|
1516
1516
|
exports.toEthSignTypedDataV4 = toEthSignTypedDataV4;
|
|
1517
|
-
//# sourceMappingURL=chunk-
|
|
1518
|
-
//# sourceMappingURL=chunk-
|
|
1517
|
+
//# sourceMappingURL=chunk-2YPKHXFJ.js.map
|
|
1518
|
+
//# sourceMappingURL=chunk-2YPKHXFJ.js.map
|