@paxoslabs/amplify-sdk 0.4.0-alpha.1 → 0.4.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 CHANGED
@@ -7,6 +7,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  <!-- auto-changelog-above -->
9
9
 
10
+
11
+ ## [0.4.0](///compare/v0.2.4...v0.4.0) (2026-02-18)
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * **core:** Minimum Node.js version increased from 20 to 22.
16
+
17
+ ### Features
18
+
19
+ * **client:** migrate vault data fetching from REST v1 to GraphQL b71bbd6
20
+ * **config:** add PRIME yield type support 7b7e60d
21
+ * **core:** bump minimum Node.js requirement from 20 to 22 d96f256
22
+ * **deposit:** improve TypeScript inference and add eth_signTypedData_v4 helper 7feb7b6
23
+ * **display:** add display module with UI helper functions 868d722
24
+ * **init:** make SDK initialization fully non-blocking 3cfb510
25
+ * **wallets:** add smart contract wallet detection for deposit and withdrawal flows 1547072
26
+ * **withdraw:** add prepareWithdrawal wrapper and forceMethod authorization overrides 1deef81
27
+ * **withdraw:** add prepareWithdrawalAuthorization and fix approval bugs 88baaaf
28
+ * **withdraw:** add WithdrawQueue contract integration 901bb5e
29
+
30
+ ### Bug Fixes
31
+
32
+ * address CodeRabbit PR review findings 299cc64
33
+ * address CodeRabbit review findings across withdraw, deposit, and display modules 8b52868
34
+ * align stale API references with current naming (PR review) d2a2655
35
+ * **auth:** remove redundant allowance fields from approval authorization results f6236a4
36
+ * **ci:** restrict dry-run job permissions to read-only af546e1
37
+ * **ci:** separate dry-run job to skip environment approval 7c88088
38
+ * **deposit:** verify asset is supported on target chain d4a6eae
39
+ * **display:** add multicall error handling in getMinimumMint 2fe41d5
40
+ * **display:** use AND separator in v2 API filter query strings 46bdec5
41
+ * **errors:** ensure instanceof checks work in transpiled code 9167032
42
+ * reset version to 0.3.0 for release-it minor bump to 0.4.0 79d7b6d
43
+ * **withdraw:** remove legacy AtomicQueue utils and update tests 67f6703
44
+
45
+ ## [0.4.0] - 2026-02-18
46
+
47
+ ### BREAKING CHANGES
48
+
49
+ - **withdraw:** Replace AtomicQueue with WithdrawQueue contract ([7c521f4](https://github.com/Ion-Protocol/amplify-sdk/commit/7c521f4))
50
+ - `prepareWithdrawTransactionData()` → `prepareWithdrawOrderTxData()`
51
+ - `prepareApproveWithdrawToken()` → `prepareApproveWithdrawOrderTxData()`
52
+ - Added `prepareCancelWithdrawOrderTxData()` for order cancellation
53
+ - Slippage params no longer required for withdrawals
54
+ - **withdraw:** Rename WithdrawQueue functions for API clarity ([6b287de](https://github.com/Ion-Protocol/amplify-sdk/commit/6b287de))
55
+ - **auth:** Remove redundant allowance fields from approval authorization results ([f6236a4](https://github.com/Ion-Protocol/amplify-sdk/commit/f6236a4))
56
+ - **client:** Migrate vault data fetching from REST v1 to GraphQL ([b71bbd6](https://github.com/Ion-Protocol/amplify-sdk/commit/b71bbd6))
57
+
58
+ ### Features
59
+
60
+ - **withdraw:** add `prepareWithdrawal` unified wrapper and `forceMethod` authorization overrides ([1deef81](https://github.com/Ion-Protocol/amplify-sdk/commit/1deef81))
61
+ - `prepareWithdrawal()` provides a stable high-level API wrapping `prepareWithdrawOrderTxData()`
62
+ - `forceMethod` parameter on both deposit and withdrawal authorization for explicit routing control
63
+ - Auth logic reordered: force override → smart wallet heuristic → auto-detect
64
+ - **withdraw:** add WithdrawQueue contract integration ([901bb5e](https://github.com/Ion-Protocol/amplify-sdk/commit/901bb5e))
65
+ - **withdraw:** add `prepareWithdrawalAuthorization` unified wrapper and fix approval bugs ([88baaaf](https://github.com/Ion-Protocol/amplify-sdk/commit/88baaaf))
66
+ - **display:** add display module with UI helper functions (`getVaultAPY`, `getVaultTVL`, `getMinimumMint`, `getMinimumWithdrawalOrderSize`, `getWithdrawalFee`, `getWithdrawalRequests`) ([868d722](https://github.com/Ion-Protocol/amplify-sdk/commit/868d722))
67
+ - **init:** make SDK initialization fully non-blocking ([3cfb510](https://github.com/Ion-Protocol/amplify-sdk/commit/3cfb510))
68
+ - **wallets:** add smart contract wallet detection for deposit and withdrawal flows ([1547072](https://github.com/Ion-Protocol/amplify-sdk/commit/1547072))
69
+
70
+ ### Bug Fixes
71
+
72
+ - **withdraw:** remove legacy AtomicQueue utils and update tests ([67f6703](https://github.com/Ion-Protocol/amplify-sdk/commit/67f6703))
73
+ - **display:** use AND separator in v2 API filter query strings ([46bdec5](https://github.com/Ion-Protocol/amplify-sdk/commit/46bdec5))
74
+ - **display:** add multicall error handling in `getMinimumMint` ([2fe41d5](https://github.com/Ion-Protocol/amplify-sdk/commit/2fe41d5))
75
+ - **auth:** remove redundant allowance fields from approval authorization results ([f6236a4](https://github.com/Ion-Protocol/amplify-sdk/commit/f6236a4))
76
+ - address CodeRabbit review findings across withdraw, deposit, and display modules ([8b52868](https://github.com/Ion-Protocol/amplify-sdk/commit/8b52868))
77
+
78
+ ### Code Refactoring
79
+
80
+ - **withdraw:** add ApprovalMethod enum for signature params ([21e0ae9](https://github.com/Ion-Protocol/amplify-sdk/commit/21e0ae9))
81
+ - **client:** make `fetchVaults` and `fetchSupportedAssets` cache-aware ([a50a345](https://github.com/Ion-Protocol/amplify-sdk/commit/a50a345))
82
+ - **client:** move API client from `api/` to `client/` folder ([a6523db](https://github.com/Ion-Protocol/amplify-sdk/commit/a6523db))
83
+
84
+ ### Styles
85
+
86
+ - apply biome formatting to codebase ([d034237](https://github.com/Ion-Protocol/amplify-sdk/commit/d034237))
87
+
88
+ ### Documentation
89
+
90
+ - update API reference and guides for new withdrawal API ([623fbf0](https://github.com/Ion-Protocol/amplify-sdk/commit/623fbf0))
91
+ - align Mintlify docs with current SDK state ([df67147](https://github.com/Ion-Protocol/amplify-sdk/commit/df67147))
92
+ - update withdrawal docs from AtomicQueue to WithdrawQueue terminology ([4ff639d](https://github.com/Ion-Protocol/amplify-sdk/commit/4ff639d))
93
+ - fix withdrawal examples and smart wallet guide per code review ([bacca7c](https://github.com/Ion-Protocol/amplify-sdk/commit/bacca7c))
94
+
95
+ ### Chores
96
+
97
+ - **deps:** add version overrides for brace-expansion and lodash ([4dba204](https://github.com/Ion-Protocol/amplify-sdk/commit/4dba204))
98
+ - **test:** remove unused getMockAssets import ([b3e9bd0](https://github.com/Ion-Protocol/amplify-sdk/commit/b3e9bd0))
99
+
100
+
10
101
  ## [0.3.0-beta.0] - 2025-01-30
11
102
 
12
103
  ### BREAKING CHANGES
@@ -183,86 +274,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
183
274
 
184
275
  * **chain-utils:** remove redundant optional chaining after null check ([22f1181](https://github.com/Ion-Protocol/amplify-sdk/commit/22f1181e9e670436a2eda1d6ef7e6921a4c61188))
185
276
 
186
- ## [Unreleased]
187
-
188
- ### BREAKING CHANGES
189
-
190
- - **Product Rename**: Earn SDK renamed to Amplify SDK
191
- - Package name: `@paxoslabs/earn-sdk` → `@paxoslabs/amplify-sdk`
192
- - Function: `initEarnSDK()` → `initAmplifySDK()`
193
- - Type: `AmplifyVault` → `AmplifyVault`
194
- - Repository: `Ion-Protocol/earn-sdk` → `Ion-Protocol/amplify-sdk`
195
- - 7 source files renamed (earn-* → amplify-*)
196
-
197
- ### Migration Guide
198
-
199
- **For Existing Users**:
200
-
201
- 1. Update package in `package.json`:
202
- ```bash
203
- npm uninstall @paxoslabs/earn-sdk
204
- npm install @paxoslabs/amplify-sdk
205
- ```
206
-
207
- 2. Update import statements:
208
- ```typescript
209
- // Old
210
- import { initEarnSDK, type EarnVault } from "@paxoslabs/earn-sdk";
211
-
212
- // New
213
- import { initAmplifySDK, type AmplifyVault } from "@paxoslabs/amplify-sdk";
214
- ```
215
-
216
- 3. Update function calls:
217
- ```typescript
218
- // Old
219
- await initEarnSDK("pxl_internal_your_api_key");
220
-
221
- // New
222
- await initAmplifySDK("pxl_internal_your_api_key");
223
- ```
224
-
225
- 4. Update type references:
226
- ```typescript
227
- // Old
228
- const vault: EarnVault = ...;
229
-
230
- // New
231
- const vault: AmplifyVault = ...;
232
- ```
233
-
234
- ### Notes
235
- - API endpoints continue to use `/v1/earn-sdk/*` for backwards compatibility
236
- - No changes required to backend integration
237
- - Old package `@paxoslabs/earn-sdk` will be deprecated but remain functional
238
- - Endpoint migration to `/v1/amplify-sdk/*` planned for future release
239
-
240
- ### Documentation
241
- - **Comprehensive SDK Documentation (Phase 008)**:
242
- - Complete README.md overhaul with 5-minute quick start guide
243
- - New documentation structure under `docs/`:
244
- - `getting-started.md` - Detailed installation and first API call guide
245
- - `api-reference/` - Complete API documentation for all SDK functions
246
- - `vault-discovery.md` - Vault and asset discovery via Amplify API
247
- - `deposits.md` - Standard deposit flows (viem + wagmi patterns)
248
- - `deposits-permit.md` - Gas-optimized permit deposits (EIP-2612)
249
- - `withdrawals.md` - Complete withdrawal flows with deadline protection
250
- - `caching.md` - Performance optimization with vault caching
251
- - `types.md` - TypeScript type definitions reference
252
- - `guides/` - Tutorial-style integration guides
253
- - `react-integration.md` - Three React patterns (direct, custom hooks, TanStack Query)
254
- - `error-handling.md` - Error handling patterns for API and transactions
255
- - `multi-chain.md` - Multi-chain deployment and chain selection
256
- - `examples/` - Fully executable example projects
257
- - `viem-deposit/` - Complete viem deposit example with tests
258
- - `wagmi-deposit/` - Complete wagmi deposit example with React hooks
259
- - `wagmi-withdraw/` - Complete wagmi withdrawal example
260
- - 56 viem code examples and 33 wagmi code examples across all documentation
261
- - 100% coverage of all 48 functional requirements
262
- - All code examples are TypeScript with full type safety
263
- - MSW (Mock Service Worker) integration for runnable examples
264
- - Validation script for documentation quality assurance
265
-
266
277
  ## [0.0.1-alpha.1] - 2025-11-01
267
278
 
268
279
  ### Features
package/README.md CHANGED
@@ -57,18 +57,18 @@ await initAmplifySDK("pxl_your_api_key");
57
57
  // Prepare deposit authorization (auto-detects permit vs approval)
58
58
  const auth = await prepareDepositAuthorization({
59
59
  yieldType: "CORE",
60
- depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
60
+ depositAsset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
61
61
  depositAmount: "1000.0",
62
- recipientAddress: userAddress,
62
+ to: userAddress,
63
63
  chainId: 1,
64
64
  });
65
65
 
66
66
  // Shared deposit parameters
67
67
  const depositParams = {
68
68
  yieldType: "CORE",
69
- depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
69
+ depositAsset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
70
70
  depositAmount: "1000.0",
71
- recipientAddress: userAddress,
71
+ to: userAddress,
72
72
  chainId: 1,
73
73
  };
74
74
 
@@ -462,22 +462,11 @@ async function prepareDepositTxData(params) {
462
462
  } = params;
463
463
  try {
464
464
  const normalizedChainId = toChainId(chainId);
465
- let vault;
466
- try {
467
- vault = await findVaultByConfig({
468
- assetAddress: depositAsset,
469
- yieldType,
470
- chainId: normalizedChainId
471
- });
472
- } catch (error) {
473
- throw new APIError(
474
- `Failed to resolve vault for token ${depositAsset} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
475
- {
476
- endpoint: "prepareDepositTransactionData",
477
- cause: error
478
- }
479
- );
480
- }
465
+ const vault = await findVaultByConfig({
466
+ assetAddress: depositAsset,
467
+ yieldType,
468
+ chainId: normalizedChainId
469
+ });
481
470
  if (!vault) {
482
471
  throw new APIError(
483
472
  `No vault found for token address ${depositAsset} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
@@ -486,11 +475,8 @@ async function prepareDepositTxData(params) {
486
475
  }
487
476
  );
488
477
  }
489
- let asset = null;
490
478
  const assets = await getAssetsFromCache({ address: depositAsset });
491
- if (assets.length > 0) {
492
- asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
493
- }
479
+ const asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets.find((a) => a.address.toLowerCase() === depositAsset.toLowerCase());
494
480
  if (!asset) {
495
481
  throw new APIError(
496
482
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
@@ -948,6 +934,15 @@ async function prepareDepositWithPermitTxData(params) {
948
934
  );
949
935
  }
950
936
  }
937
+
938
+ // src/utils/wallet.ts
939
+ async function isSmartContractWallet(address, chainId) {
940
+ const client = await getClient(chainId);
941
+ const code = await client.getCode({ address });
942
+ return !!code && code !== "0x";
943
+ }
944
+
945
+ // src/vaults/deposit/index.ts
951
946
  var DepositAuthMethod = {
952
947
  PERMIT: "permit",
953
948
  APPROVAL: "approval",
@@ -985,13 +980,25 @@ async function prepareDepositAuthorization(params) {
985
980
  { endpoint: "prepareDepositAuthorization" }
986
981
  );
987
982
  }
988
- const tokenInfo = await isDepositSpendApproved({
989
- yieldType,
990
- chainId: normalizedChainId,
991
- depositAssetAddress: depositAsset,
992
- recipientAddress: to
993
- });
983
+ if (forceMethod === "approval") {
984
+ const txData2 = await prepareApproveDepositTokenTxData({
985
+ yieldType,
986
+ depositAsset,
987
+ approvalAmount: depositAmount,
988
+ chainId: normalizedChainId
989
+ });
990
+ return {
991
+ method: DepositAuthMethod.APPROVAL,
992
+ txData: txData2
993
+ };
994
+ }
994
995
  if (forceMethod === "permit") {
996
+ const tokenInfo2 = await isDepositSpendApproved({
997
+ yieldType,
998
+ chainId: normalizedChainId,
999
+ depositAssetAddress: depositAsset,
1000
+ recipientAddress: to
1001
+ });
995
1002
  const permitData = await prepareDepositPermitSignature({
996
1003
  yieldType,
997
1004
  depositAsset,
@@ -1000,17 +1007,21 @@ async function prepareDepositAuthorization(params) {
1000
1007
  chainId: normalizedChainId,
1001
1008
  deadline,
1002
1009
  // Pass pre-fetched data to avoid redundant RPC calls
1003
- nonce: tokenInfo.nonce ?? void 0,
1004
- decimals: tokenInfo.decimals,
1005
- tokenName: tokenInfo.tokenName,
1006
- tokenVersion: tokenInfo.tokenVersion
1010
+ nonce: tokenInfo2.nonce ?? void 0,
1011
+ decimals: tokenInfo2.decimals,
1012
+ tokenName: tokenInfo2.tokenName,
1013
+ tokenVersion: tokenInfo2.tokenVersion
1007
1014
  });
1008
1015
  return {
1009
1016
  method: DepositAuthMethod.PERMIT,
1010
1017
  permitData
1011
1018
  };
1012
1019
  }
1013
- if (forceMethod === "approval") {
1020
+ const smartWallet = await isSmartContractWallet(
1021
+ to,
1022
+ normalizedChainId
1023
+ );
1024
+ if (smartWallet) {
1014
1025
  const txData2 = await prepareApproveDepositTokenTxData({
1015
1026
  yieldType,
1016
1027
  depositAsset,
@@ -1019,11 +1030,15 @@ async function prepareDepositAuthorization(params) {
1019
1030
  });
1020
1031
  return {
1021
1032
  method: DepositAuthMethod.APPROVAL,
1022
- txData: txData2,
1023
- allowance: tokenInfo.allowance,
1024
- allowanceAsBigInt: tokenInfo.allowanceAsBigInt
1033
+ txData: txData2
1025
1034
  };
1026
1035
  }
1036
+ const tokenInfo = await isDepositSpendApproved({
1037
+ yieldType,
1038
+ chainId: normalizedChainId,
1039
+ depositAssetAddress: depositAsset,
1040
+ recipientAddress: to
1041
+ });
1027
1042
  if (tokenInfo.supportsPermit) {
1028
1043
  const permitData = await prepareDepositPermitSignature({
1029
1044
  yieldType,
@@ -1060,9 +1075,7 @@ async function prepareDepositAuthorization(params) {
1060
1075
  });
1061
1076
  return {
1062
1077
  method: DepositAuthMethod.APPROVAL,
1063
- txData,
1064
- allowance: tokenInfo.allowance,
1065
- allowanceAsBigInt: tokenInfo.allowanceAsBigInt
1078
+ txData
1066
1079
  };
1067
1080
  } catch (error) {
1068
1081
  if (error instanceof APIError) {
@@ -1164,19 +1177,19 @@ async function prepareApproveWithdrawOrderTxData({
1164
1177
  if (!config || config.chainId !== normalizedChainId) {
1165
1178
  throw new APIError(
1166
1179
  `Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
1167
- { endpoint: "prepareApproveWithdrawToken" }
1180
+ { endpoint: "prepareApproveWithdrawOrderTxData" }
1168
1181
  );
1169
1182
  }
1170
1183
  if (!config.vault.boringVaultAddress) {
1171
1184
  throw new APIError(
1172
1185
  `BoringVault contract address not configured for vault ${config.id}`,
1173
- { endpoint: "prepareApproveWithdrawToken" }
1186
+ { endpoint: "prepareApproveWithdrawOrderTxData" }
1174
1187
  );
1175
1188
  }
1176
1189
  if (!config.vault.withdrawQueueAddress) {
1177
1190
  throw new APIError(
1178
1191
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1179
- { endpoint: "prepareApproveWithdrawToken" }
1192
+ { endpoint: "prepareApproveWithdrawOrderTxData" }
1180
1193
  );
1181
1194
  }
1182
1195
  const boringVaultAddress = config.vault.boringVaultAddress;
@@ -1199,7 +1212,7 @@ async function prepareApproveWithdrawOrderTxData({
1199
1212
  throw new APIError(
1200
1213
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
1201
1214
  {
1202
- endpoint: "prepareApproveWithdrawToken",
1215
+ endpoint: "prepareApproveWithdrawOrderTxData",
1203
1216
  cause: error
1204
1217
  }
1205
1218
  );
@@ -1275,8 +1288,7 @@ var prepareWithdrawOrderTxData = async ({
1275
1288
  wantAsset,
1276
1289
  userAddress,
1277
1290
  chainId,
1278
- amountOffer,
1279
- skipApprovalCheck
1291
+ amountOffer
1280
1292
  }) => {
1281
1293
  try {
1282
1294
  const normalizedChainId = toChainId(chainId);
@@ -1309,20 +1321,6 @@ var prepareWithdrawOrderTxData = async ({
1309
1321
  { endpoint: "prepareWithdrawOrderTxData" }
1310
1322
  );
1311
1323
  }
1312
- if (!skipApprovalCheck) {
1313
- const approvalInfo = await isWithdrawalSpendApproved({
1314
- yieldType,
1315
- chainId: normalizedChainId,
1316
- wantAssetAddress: wantAsset,
1317
- recipientAddress: userAddress
1318
- });
1319
- if (!approvalInfo.isApproved) {
1320
- throw new APIError(
1321
- `Vault shares not approved for withdrawal`,
1322
- { endpoint: "prepareWithdrawOrderTxData" }
1323
- );
1324
- }
1325
- }
1326
1324
  const sharesDecimals = await getErc20Decimals({
1327
1325
  tokenAddress: config.vault.boringVaultAddress,
1328
1326
  chainId: normalizedChainId
@@ -1367,8 +1365,38 @@ function isWithdrawApprovalAuth(result) {
1367
1365
  function isWithdrawAlreadyApprovedAuth(result) {
1368
1366
  return result.method === WithdrawAuthMethod.ALREADY_APPROVED;
1369
1367
  }
1370
- async function prepareWithdrawalAuthorization(params) {
1368
+ async function prepareWithdrawal(params) {
1371
1369
  const { yieldType, wantAsset, withdrawAmount, userAddress, chainId } = params;
1370
+ try {
1371
+ return await prepareWithdrawOrderTxData({
1372
+ yieldType,
1373
+ wantAsset,
1374
+ userAddress,
1375
+ chainId,
1376
+ amountOffer: withdrawAmount
1377
+ });
1378
+ } catch (error) {
1379
+ if (error instanceof APIError) {
1380
+ throw error;
1381
+ }
1382
+ throw new APIError(
1383
+ `Failed to prepare withdrawal: ${error instanceof Error ? error.message : String(error)}`,
1384
+ {
1385
+ endpoint: "prepareWithdrawal",
1386
+ cause: error
1387
+ }
1388
+ );
1389
+ }
1390
+ }
1391
+ async function prepareWithdrawalAuthorization(params) {
1392
+ const {
1393
+ yieldType,
1394
+ wantAsset,
1395
+ withdrawAmount,
1396
+ userAddress,
1397
+ chainId,
1398
+ forceMethod
1399
+ } = params;
1372
1400
  try {
1373
1401
  const normalizedChainId = toChainId(chainId);
1374
1402
  const vault = await findVaultByConfig({
@@ -1382,6 +1410,36 @@ async function prepareWithdrawalAuthorization(params) {
1382
1410
  { endpoint: "prepareWithdrawalAuthorization" }
1383
1411
  );
1384
1412
  }
1413
+ if (forceMethod === "approval") {
1414
+ const txData2 = await prepareApproveWithdrawOrderTxData({
1415
+ yieldType,
1416
+ wantAssetAddress: wantAsset,
1417
+ withdrawAmount,
1418
+ chainId: normalizedChainId
1419
+ });
1420
+ return {
1421
+ method: WithdrawAuthMethod.APPROVAL,
1422
+ txData: txData2
1423
+ };
1424
+ }
1425
+ if (forceMethod !== "allowance_check") {
1426
+ const smartWallet = await isSmartContractWallet(
1427
+ userAddress,
1428
+ normalizedChainId
1429
+ );
1430
+ if (smartWallet) {
1431
+ const txData2 = await prepareApproveWithdrawOrderTxData({
1432
+ yieldType,
1433
+ wantAssetAddress: wantAsset,
1434
+ withdrawAmount,
1435
+ chainId: normalizedChainId
1436
+ });
1437
+ return {
1438
+ method: WithdrawAuthMethod.APPROVAL,
1439
+ txData: txData2
1440
+ };
1441
+ }
1442
+ }
1385
1443
  const approvalInfo = await isWithdrawalSpendApproved({
1386
1444
  yieldType,
1387
1445
  chainId: normalizedChainId,
@@ -1415,9 +1473,7 @@ async function prepareWithdrawalAuthorization(params) {
1415
1473
  });
1416
1474
  return {
1417
1475
  method: WithdrawAuthMethod.APPROVAL,
1418
- txData,
1419
- allowance: approvalInfo.allowance,
1420
- allowanceAsBigInt: approvalInfo.allowanceAsBigInt
1476
+ txData
1421
1477
  };
1422
1478
  } catch (error) {
1423
1479
  if (error instanceof APIError) {
@@ -1433,6 +1489,6 @@ async function prepareWithdrawalAuthorization(params) {
1433
1489
  }
1434
1490
  }
1435
1491
 
1436
- export { DepositAuthMethod, PERMIT_TYPES, WithdrawAuthMethod, isAlreadyApprovedAuth, isApprovalAuth, isDepositSpendApproved, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, isWithdrawalSpendApproved, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawalAuthorization, toEthSignTypedDataV4 };
1437
- //# sourceMappingURL=chunk-JHBZLKKP.mjs.map
1438
- //# sourceMappingURL=chunk-JHBZLKKP.mjs.map
1492
+ 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-5VVP4RVO.mjs.map
1494
+ //# sourceMappingURL=chunk-5VVP4RVO.mjs.map