@paxoslabs/amplify-sdk 0.4.2 → 0.4.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +79 -64
  2. package/dist/{chain-utils-CRMbWzu7.d.mts → chain-utils-CpOJcWig.d.mts} +48 -29
  3. package/dist/{chain-utils-CRMbWzu7.d.ts → chain-utils-CpOJcWig.d.ts} +48 -29
  4. package/dist/{chunk-RW7PZETN.mjs → chunk-7JMQWERX.mjs} +238 -254
  5. package/dist/chunk-7JMQWERX.mjs.map +1 -0
  6. package/dist/{chunk-TPU2HZAX.mjs → chunk-HV2LE2M6.mjs} +86 -169
  7. package/dist/chunk-HV2LE2M6.mjs.map +1 -0
  8. package/dist/{chunk-WZXCJAKM.js → chunk-JTURYJHV.js} +12 -12
  9. package/dist/{chunk-WZXCJAKM.js.map → chunk-JTURYJHV.js.map} +1 -1
  10. package/dist/{chunk-5CV25BTQ.js → chunk-KXU3GSF4.mjs} +87 -4
  11. package/dist/chunk-KXU3GSF4.mjs.map +1 -0
  12. package/dist/{chunk-CQZCGPZK.mjs → chunk-MB6HYA7R.js} +96 -3
  13. package/dist/chunk-MB6HYA7R.js.map +1 -0
  14. package/dist/{chunk-BQG3XKTU.js → chunk-PKGFLHZA.js} +239 -253
  15. package/dist/chunk-PKGFLHZA.js.map +1 -0
  16. package/dist/{chunk-2YPKHXFJ.js → chunk-R35K46S5.js} +180 -263
  17. package/dist/chunk-R35K46S5.js.map +1 -0
  18. package/dist/{chunk-GMMBJB4B.mjs → chunk-UM7S7U45.mjs} +71 -46
  19. package/dist/chunk-UM7S7U45.mjs.map +1 -0
  20. package/dist/{chunk-VZED4E3L.mjs → chunk-USF4CU2K.mjs} +3 -3
  21. package/dist/{chunk-VZED4E3L.mjs.map → chunk-USF4CU2K.mjs.map} +1 -1
  22. package/dist/{chunk-OZJNKGW6.js → chunk-YEAWQB72.js} +120 -95
  23. package/dist/chunk-YEAWQB72.js.map +1 -0
  24. package/dist/core.d.mts +2 -2
  25. package/dist/core.d.ts +2 -2
  26. package/dist/core.js +16 -16
  27. package/dist/core.mjs +4 -4
  28. package/dist/display.d.mts +23 -11
  29. package/dist/display.d.ts +23 -11
  30. package/dist/display.js +10 -10
  31. package/dist/display.mjs +4 -4
  32. package/dist/index.d.mts +107 -7
  33. package/dist/index.d.ts +107 -7
  34. package/dist/index.js +75 -51
  35. package/dist/index.mjs +5 -5
  36. package/dist/utils.d.mts +1 -1
  37. package/dist/utils.d.ts +1 -1
  38. package/dist/utils.js +7 -7
  39. package/dist/utils.mjs +2 -2
  40. package/dist/vaults.d.mts +107 -94
  41. package/dist/vaults.d.ts +107 -94
  42. package/dist/vaults.js +25 -25
  43. package/dist/vaults.mjs +4 -4
  44. package/package.json +18 -11
  45. package/dist/chunk-2YPKHXFJ.js.map +0 -1
  46. package/dist/chunk-5CV25BTQ.js.map +0 -1
  47. package/dist/chunk-BQG3XKTU.js.map +0 -1
  48. package/dist/chunk-CQZCGPZK.mjs.map +0 -1
  49. package/dist/chunk-GMMBJB4B.mjs.map +0 -1
  50. package/dist/chunk-OZJNKGW6.js.map +0 -1
  51. package/dist/chunk-RW7PZETN.mjs.map +0 -1
  52. package/dist/chunk-TPU2HZAX.mjs.map +0 -1
@@ -1,30 +1,23 @@
1
- import { WithdrawQueueAbi } from './chunk-CQZCGPZK.mjs';
2
- import { getTokenPermitInfoWithAllowance, getErc20AllowanceWithDecimals, getRateInQuoteWithAssetDecimals, erc2612Abi, getErc20Decimals, BoringVaultAbi } from './chunk-VZED4E3L.mjs';
1
+ import { resolveVault, WithdrawQueueAbi } from './chunk-KXU3GSF4.mjs';
2
+ import { getTokenPermitInfoWithAllowance, getErc20AllowanceWithDecimals, getRateInQuoteWithAssetDecimals, erc2612Abi, getErc20Decimals, BoringVaultAbi } from './chunk-USF4CU2K.mjs';
3
3
  import { WAD } from './chunk-7RWWVUHP.mjs';
4
- import { toChainId, findVaultByConfig, APIError, getAssetsFromCache, DEFAULT_APPROVAL_AMOUNT, DEFAULT_SLIPPAGE_BPS, getClient } from './chunk-RW7PZETN.mjs';
4
+ import { toChainId, APIError, getAssetsFromCache, DEFAULT_APPROVAL_AMOUNT, DEFAULT_SLIPPAGE_BPS, getClient } from './chunk-7JMQWERX.mjs';
5
5
  import { formatUnits, parseUnits, erc20Abi, stringToHex, hexToSignature } from 'viem';
6
6
 
7
7
  var isDepositSpendApproved = async ({
8
- yieldType,
8
+ vaultName,
9
9
  chainId,
10
10
  depositAssetAddress,
11
11
  recipientAddress
12
12
  }) => {
13
13
  try {
14
14
  const normalizedChainId = toChainId(chainId);
15
- const config = await findVaultByConfig({
16
- yieldType,
15
+ const config = await resolveVault({
16
+ vaultName,
17
17
  chainId: normalizedChainId,
18
- assetAddress: depositAssetAddress
18
+ assetAddress: depositAssetAddress,
19
+ callerEndpoint: "isDepositSpendApproved"
19
20
  });
20
- if (!config) {
21
- throw new APIError(
22
- `Vault not found for ${yieldType} on chain ${normalizedChainId}`,
23
- {
24
- endpoint: "isDepositSpendApproved"
25
- }
26
- );
27
- }
28
21
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
29
22
  if (!communityCodeDepositorAddress) {
30
23
  throw new APIError(
@@ -74,26 +67,19 @@ var isDepositSpendApproved = async ({
74
67
  }
75
68
  };
76
69
  var isWithdrawalSpendApproved = async ({
77
- yieldType,
70
+ vaultName,
78
71
  chainId,
79
72
  wantAssetAddress,
80
73
  recipientAddress
81
74
  }) => {
82
75
  try {
83
76
  const normalizedChainId = toChainId(chainId);
84
- const config = await findVaultByConfig({
85
- yieldType,
77
+ const config = await resolveVault({
78
+ vaultName,
86
79
  chainId: normalizedChainId,
87
- assetAddress: wantAssetAddress
80
+ assetAddress: wantAssetAddress,
81
+ callerEndpoint: "isWithdrawalSpendApproved"
88
82
  });
89
- if (!config) {
90
- throw new APIError(
91
- `Vault not found for ${yieldType} on chain ${normalizedChainId}`,
92
- {
93
- endpoint: "isWithdrawalSpendApproved"
94
- }
95
- );
96
- }
97
83
  const boringVaultAddress = config.vault.boringVaultAddress;
98
84
  if (!boringVaultAddress) {
99
85
  throw new APIError(
@@ -145,24 +131,19 @@ var isWithdrawalSpendApproved = async ({
145
131
  }
146
132
  };
147
133
  async function prepareApproveDepositTokenTxData({
148
- yieldType,
134
+ vaultName,
149
135
  depositAsset,
150
136
  approvalAmount,
151
137
  chainId
152
138
  }) {
153
139
  const normalizedChainId = toChainId(chainId);
154
140
  try {
155
- const config = await findVaultByConfig({
141
+ const config = await resolveVault({
142
+ vaultName,
156
143
  assetAddress: depositAsset,
157
- yieldType,
158
- chainId: normalizedChainId
144
+ chainId: normalizedChainId,
145
+ callerEndpoint: "prepareApproveDepositToken"
159
146
  });
160
- if (!config) {
161
- throw new APIError(
162
- `No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
163
- { endpoint: "prepareApproveDepositToken" }
164
- );
165
- }
166
147
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
167
148
  if (!communityCodeDepositorAddress) {
168
149
  throw new APIError(
@@ -452,7 +433,7 @@ var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) =
452
433
  // src/vaults/deposit/deposit.ts
453
434
  async function prepareDepositTxData(params) {
454
435
  const {
455
- yieldType,
436
+ vaultName,
456
437
  depositAsset,
457
438
  depositAmount,
458
439
  chainId,
@@ -462,19 +443,12 @@ async function prepareDepositTxData(params) {
462
443
  } = params;
463
444
  try {
464
445
  const normalizedChainId = toChainId(chainId);
465
- const vault = await findVaultByConfig({
446
+ const vault = await resolveVault({
447
+ vaultName,
466
448
  assetAddress: depositAsset,
467
- yieldType,
468
- chainId: normalizedChainId
449
+ chainId: normalizedChainId,
450
+ callerEndpoint: "prepareDepositTransactionData"
469
451
  });
470
- if (!vault) {
471
- throw new APIError(
472
- `No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
473
- {
474
- endpoint: "prepareDepositTransactionData"
475
- }
476
- );
477
- }
478
452
  const assets = await getAssetsFromCache({ address: depositAsset });
479
453
  const asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets.find((a) => a.address.toLowerCase() === depositAsset.toLowerCase());
480
454
  if (!asset) {
@@ -599,7 +573,7 @@ function toEthSignTypedDataV4(permitData) {
599
573
  }
600
574
  async function prepareDepositPermitSignature(params) {
601
575
  const {
602
- yieldType,
576
+ vaultName,
603
577
  depositAsset,
604
578
  depositAmount,
605
579
  to,
@@ -613,30 +587,12 @@ async function prepareDepositPermitSignature(params) {
613
587
  } = params;
614
588
  try {
615
589
  const normalizedChainId = toChainId(chainId);
616
- let vault;
617
- try {
618
- vault = await findVaultByConfig({
619
- assetAddress: depositAsset,
620
- yieldType,
621
- chainId: normalizedChainId
622
- });
623
- } catch (error) {
624
- throw new APIError(
625
- `Failed to resolve vault for token ${depositAsset} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
626
- {
627
- endpoint: "prepareDepositPermitSignature",
628
- cause: error
629
- }
630
- );
631
- }
632
- if (!vault) {
633
- throw new APIError(
634
- `No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
635
- {
636
- endpoint: "prepareDepositPermitSignature"
637
- }
638
- );
639
- }
590
+ const vault = await resolveVault({
591
+ vaultName,
592
+ assetAddress: depositAsset,
593
+ chainId: normalizedChainId,
594
+ callerEndpoint: "prepareDepositPermitSignature"
595
+ });
640
596
  const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
641
597
  if (!communityCodeDepositorAddress) {
642
598
  throw new APIError(
@@ -792,7 +748,7 @@ function parsePermitSignature(signature) {
792
748
  }
793
749
  async function prepareDepositWithPermitTxData(params) {
794
750
  const {
795
- yieldType,
751
+ vaultName,
796
752
  depositAsset,
797
753
  depositAmount,
798
754
  chainId,
@@ -813,30 +769,12 @@ async function prepareDepositWithPermitTxData(params) {
813
769
  );
814
770
  }
815
771
  const normalizedChainId = toChainId(chainId);
816
- let vault;
817
- try {
818
- vault = await findVaultByConfig({
819
- assetAddress: depositAsset,
820
- yieldType,
821
- chainId: normalizedChainId
822
- });
823
- } catch (error) {
824
- throw new APIError(
825
- `Failed to resolve vault for token ${depositAsset} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
826
- {
827
- endpoint: "prepareDepositWithPermitTxData",
828
- cause: error
829
- }
830
- );
831
- }
832
- if (!vault) {
833
- throw new APIError(
834
- `No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
835
- {
836
- endpoint: "prepareDepositWithPermitTxData"
837
- }
838
- );
839
- }
772
+ const vault = await resolveVault({
773
+ vaultName,
774
+ assetAddress: depositAsset,
775
+ chainId: normalizedChainId,
776
+ callerEndpoint: "prepareDepositWithPermitTxData"
777
+ });
840
778
  let asset = null;
841
779
  const assets = await getAssetsFromCache({ address: depositAsset });
842
780
  if (assets.length > 0) {
@@ -867,6 +805,12 @@ async function prepareDepositWithPermitTxData(params) {
867
805
  { endpoint: "prepareDepositWithPermitTxData" }
868
806
  );
869
807
  }
808
+ if (!accountantAddress) {
809
+ throw new APIError(
810
+ `Accountant contract address not found for vault ${vault.id}`,
811
+ { endpoint: "prepareDepositWithPermitTxData" }
812
+ );
813
+ }
870
814
  const rateAndDecimalResults = await getRateInQuoteWithAssetDecimals({
871
815
  assetAddress: depositAssetAddress,
872
816
  accountantAddress,
@@ -959,7 +903,7 @@ function isAlreadyApprovedAuth(result) {
959
903
  }
960
904
  async function prepareDepositAuthorization(params) {
961
905
  const {
962
- yieldType,
906
+ vaultName,
963
907
  depositAsset,
964
908
  depositAmount,
965
909
  to,
@@ -969,20 +913,15 @@ async function prepareDepositAuthorization(params) {
969
913
  } = params;
970
914
  try {
971
915
  const normalizedChainId = toChainId(chainId);
972
- const vault = await findVaultByConfig({
916
+ const vault = await resolveVault({
917
+ vaultName,
973
918
  assetAddress: depositAsset,
974
- yieldType,
975
- chainId: normalizedChainId
919
+ chainId: normalizedChainId,
920
+ callerEndpoint: "prepareDepositAuthorization"
976
921
  });
977
- if (!vault) {
978
- throw new APIError(
979
- `No vault found for token ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
980
- { endpoint: "prepareDepositAuthorization" }
981
- );
982
- }
983
922
  if (forceMethod === "approval") {
984
923
  const txData2 = await prepareApproveDepositTokenTxData({
985
- yieldType,
924
+ vaultName,
986
925
  depositAsset,
987
926
  approvalAmount: depositAmount,
988
927
  chainId: normalizedChainId
@@ -994,19 +933,18 @@ async function prepareDepositAuthorization(params) {
994
933
  }
995
934
  if (forceMethod === "permit") {
996
935
  const tokenInfo2 = await isDepositSpendApproved({
997
- yieldType,
936
+ vaultName: vault.name,
998
937
  chainId: normalizedChainId,
999
938
  depositAssetAddress: depositAsset,
1000
939
  recipientAddress: to
1001
940
  });
1002
941
  const permitData = await prepareDepositPermitSignature({
1003
- yieldType,
942
+ vaultName,
1004
943
  depositAsset,
1005
944
  depositAmount,
1006
945
  to,
1007
946
  chainId: normalizedChainId,
1008
947
  deadline,
1009
- // Pass pre-fetched data to avoid redundant RPC calls
1010
948
  nonce: tokenInfo2.nonce ?? void 0,
1011
949
  decimals: tokenInfo2.decimals,
1012
950
  tokenName: tokenInfo2.tokenName,
@@ -1023,7 +961,7 @@ async function prepareDepositAuthorization(params) {
1023
961
  );
1024
962
  if (smartWallet) {
1025
963
  const txData2 = await prepareApproveDepositTokenTxData({
1026
- yieldType,
964
+ vaultName,
1027
965
  depositAsset,
1028
966
  approvalAmount: depositAmount,
1029
967
  chainId: normalizedChainId
@@ -1034,20 +972,19 @@ async function prepareDepositAuthorization(params) {
1034
972
  };
1035
973
  }
1036
974
  const tokenInfo = await isDepositSpendApproved({
1037
- yieldType,
975
+ vaultName: vault.name,
1038
976
  chainId: normalizedChainId,
1039
977
  depositAssetAddress: depositAsset,
1040
978
  recipientAddress: to
1041
979
  });
1042
980
  if (tokenInfo.supportsPermit) {
1043
981
  const permitData = await prepareDepositPermitSignature({
1044
- yieldType,
982
+ vaultName,
1045
983
  depositAsset,
1046
984
  depositAmount,
1047
985
  to,
1048
986
  chainId: normalizedChainId,
1049
987
  deadline,
1050
- // Pass pre-fetched data to avoid redundant RPC calls
1051
988
  nonce: tokenInfo.nonce ?? void 0,
1052
989
  decimals: tokenInfo.decimals,
1053
990
  tokenName: tokenInfo.tokenName,
@@ -1068,7 +1005,7 @@ async function prepareDepositAuthorization(params) {
1068
1005
  };
1069
1006
  }
1070
1007
  const txData = await prepareApproveDepositTokenTxData({
1071
- yieldType,
1008
+ vaultName,
1072
1009
  depositAsset,
1073
1010
  approvalAmount: depositAmount,
1074
1011
  chainId: normalizedChainId
@@ -1092,7 +1029,7 @@ async function prepareDepositAuthorization(params) {
1092
1029
  }
1093
1030
  async function prepareDeposit(params) {
1094
1031
  const {
1095
- yieldType,
1032
+ vaultName,
1096
1033
  depositAsset,
1097
1034
  depositAmount,
1098
1035
  to,
@@ -1119,7 +1056,7 @@ async function prepareDeposit(params) {
1119
1056
  );
1120
1057
  }
1121
1058
  const txData2 = await prepareDepositWithPermitTxData({
1122
- yieldType,
1059
+ vaultName,
1123
1060
  depositAsset,
1124
1061
  depositAmount,
1125
1062
  to,
@@ -1135,7 +1072,7 @@ async function prepareDeposit(params) {
1135
1072
  };
1136
1073
  }
1137
1074
  const txData = await prepareDepositTxData({
1138
- yieldType,
1075
+ vaultName,
1139
1076
  depositAsset,
1140
1077
  depositAmount,
1141
1078
  to,
@@ -1161,7 +1098,7 @@ async function prepareDeposit(params) {
1161
1098
  }
1162
1099
  }
1163
1100
  async function prepareApproveWithdrawOrderTxData({
1164
- yieldType,
1101
+ vaultName,
1165
1102
  wantAssetAddress,
1166
1103
  withdrawAmount,
1167
1104
  chainId,
@@ -1169,17 +1106,12 @@ async function prepareApproveWithdrawOrderTxData({
1169
1106
  }) {
1170
1107
  try {
1171
1108
  const normalizedChainId = toChainId(chainId);
1172
- const config = await findVaultByConfig({
1109
+ const config = await resolveVault({
1110
+ vaultName,
1173
1111
  assetAddress: wantAssetAddress,
1174
- yieldType,
1175
- chainId: normalizedChainId
1112
+ chainId: normalizedChainId,
1113
+ callerEndpoint: "prepareApproveWithdrawOrderTxData"
1176
1114
  });
1177
- if (!config || config.chainId !== normalizedChainId) {
1178
- throw new APIError(
1179
- `Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
1180
- { endpoint: "prepareApproveWithdrawOrderTxData" }
1181
- );
1182
- }
1183
1115
  if (!config.vault.boringVaultAddress) {
1184
1116
  throw new APIError(
1185
1117
  `BoringVault contract address not configured for vault ${config.id}`,
@@ -1221,24 +1153,19 @@ async function prepareApproveWithdrawOrderTxData({
1221
1153
 
1222
1154
  // src/vaults/withdraw/cancel-withdraw.ts
1223
1155
  var prepareCancelWithdrawOrderTxData = async ({
1224
- yieldType,
1156
+ vaultName,
1225
1157
  wantAsset,
1226
1158
  chainId,
1227
1159
  orderIndex
1228
1160
  }) => {
1229
1161
  try {
1230
1162
  const normalizedChainId = toChainId(chainId);
1231
- const config = await findVaultByConfig({
1163
+ const config = await resolveVault({
1164
+ vaultName,
1232
1165
  assetAddress: wantAsset,
1233
- yieldType,
1234
- chainId: normalizedChainId
1166
+ chainId: normalizedChainId,
1167
+ callerEndpoint: "prepareCancelWithdrawOrderTxData"
1235
1168
  });
1236
- if (!config) {
1237
- throw new APIError(
1238
- `No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
1239
- { endpoint: "prepareCancelWithdrawOrderTxData" }
1240
- );
1241
- }
1242
1169
  if (config.chainId !== normalizedChainId) {
1243
1170
  throw new APIError(
1244
1171
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
@@ -1284,7 +1211,7 @@ var EMPTY_SIGNATURE_PARAMS = {
1284
1211
  eip2612Signature: "0x"
1285
1212
  };
1286
1213
  var prepareWithdrawOrderTxData = async ({
1287
- yieldType,
1214
+ vaultName,
1288
1215
  wantAsset,
1289
1216
  userAddress,
1290
1217
  chainId,
@@ -1292,17 +1219,12 @@ var prepareWithdrawOrderTxData = async ({
1292
1219
  }) => {
1293
1220
  try {
1294
1221
  const normalizedChainId = toChainId(chainId);
1295
- const config = await findVaultByConfig({
1222
+ const config = await resolveVault({
1223
+ vaultName,
1296
1224
  assetAddress: wantAsset,
1297
- yieldType,
1298
- chainId: normalizedChainId
1225
+ chainId: normalizedChainId,
1226
+ callerEndpoint: "prepareWithdrawOrderTxData"
1299
1227
  });
1300
- if (!config) {
1301
- throw new APIError(
1302
- `No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
1303
- { endpoint: "prepareWithdrawOrderTxData" }
1304
- );
1305
- }
1306
1228
  if (config.chainId !== normalizedChainId) {
1307
1229
  throw new APIError(
1308
1230
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
@@ -1366,10 +1288,10 @@ function isWithdrawAlreadyApprovedAuth(result) {
1366
1288
  return result.method === WithdrawAuthMethod.ALREADY_APPROVED;
1367
1289
  }
1368
1290
  async function prepareWithdrawal(params) {
1369
- const { yieldType, wantAsset, withdrawAmount, userAddress, chainId } = params;
1291
+ const { vaultName, wantAsset, withdrawAmount, userAddress, chainId } = params;
1370
1292
  try {
1371
1293
  return await prepareWithdrawOrderTxData({
1372
- yieldType,
1294
+ vaultName,
1373
1295
  wantAsset,
1374
1296
  userAddress,
1375
1297
  chainId,
@@ -1390,7 +1312,7 @@ async function prepareWithdrawal(params) {
1390
1312
  }
1391
1313
  async function prepareWithdrawalAuthorization(params) {
1392
1314
  const {
1393
- yieldType,
1315
+ vaultName,
1394
1316
  wantAsset,
1395
1317
  withdrawAmount,
1396
1318
  userAddress,
@@ -1399,20 +1321,15 @@ async function prepareWithdrawalAuthorization(params) {
1399
1321
  } = params;
1400
1322
  try {
1401
1323
  const normalizedChainId = toChainId(chainId);
1402
- const vault = await findVaultByConfig({
1324
+ const vault = await resolveVault({
1325
+ vaultName,
1403
1326
  assetAddress: wantAsset,
1404
- yieldType,
1405
- chainId: normalizedChainId
1327
+ chainId: normalizedChainId,
1328
+ callerEndpoint: "prepareWithdrawalAuthorization"
1406
1329
  });
1407
- if (!vault) {
1408
- throw new APIError(
1409
- `No vault found for asset ${wantAsset} with yield type '${yieldType}' on chain ${normalizedChainId}`,
1410
- { endpoint: "prepareWithdrawalAuthorization" }
1411
- );
1412
- }
1413
1330
  if (forceMethod === "approval") {
1414
1331
  const txData2 = await prepareApproveWithdrawOrderTxData({
1415
- yieldType,
1332
+ vaultName,
1416
1333
  wantAssetAddress: wantAsset,
1417
1334
  withdrawAmount,
1418
1335
  chainId: normalizedChainId
@@ -1429,7 +1346,7 @@ async function prepareWithdrawalAuthorization(params) {
1429
1346
  );
1430
1347
  if (smartWallet) {
1431
1348
  const txData2 = await prepareApproveWithdrawOrderTxData({
1432
- yieldType,
1349
+ vaultName,
1433
1350
  wantAssetAddress: wantAsset,
1434
1351
  withdrawAmount,
1435
1352
  chainId: normalizedChainId
@@ -1441,7 +1358,7 @@ async function prepareWithdrawalAuthorization(params) {
1441
1358
  }
1442
1359
  }
1443
1360
  const approvalInfo = await isWithdrawalSpendApproved({
1444
- yieldType,
1361
+ vaultName: vault.name,
1445
1362
  chainId: normalizedChainId,
1446
1363
  wantAssetAddress: wantAsset,
1447
1364
  recipientAddress: userAddress
@@ -1465,7 +1382,7 @@ async function prepareWithdrawalAuthorization(params) {
1465
1382
  };
1466
1383
  }
1467
1384
  const txData = await prepareApproveWithdrawOrderTxData({
1468
- yieldType,
1385
+ vaultName,
1469
1386
  wantAssetAddress: wantAsset,
1470
1387
  withdrawAmount,
1471
1388
  chainId: normalizedChainId,
@@ -1490,5 +1407,5 @@ async function prepareWithdrawalAuthorization(params) {
1490
1407
  }
1491
1408
 
1492
1409
  export { DepositAuthMethod, PERMIT_TYPES, WithdrawAuthMethod, isAlreadyApprovedAuth, isApprovalAuth, isDepositSpendApproved, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, isWithdrawalSpendApproved, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawal, prepareWithdrawalAuthorization, toEthSignTypedDataV4 };
1493
- //# sourceMappingURL=chunk-TPU2HZAX.mjs.map
1494
- //# sourceMappingURL=chunk-TPU2HZAX.mjs.map
1410
+ //# sourceMappingURL=chunk-HV2LE2M6.mjs.map
1411
+ //# sourceMappingURL=chunk-HV2LE2M6.mjs.map