@morpho-org/bundler-sdk-viem 3.2.2 → 3.2.4

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/lib/actions.js CHANGED
@@ -564,7 +564,7 @@ const encodeOperation = (operation, dataBefore, supportsSignature = true, index
564
564
  .getAccrualVault(operation.address)
565
565
  .accrueInterest(dataBefore.block.timestamp);
566
566
  if (shares === 0n) {
567
- const minSharePrice = blue_sdk_1.MathLib.mulDivUp(assets, blue_sdk_1.MathLib.wToRay(blue_sdk_1.MathLib.WAD - slippage), vault.toShares(assets));
567
+ const minSharePrice = blue_sdk_1.MathLib.mulDivDown(assets, blue_sdk_1.MathLib.wToRay(blue_sdk_1.MathLib.WAD - slippage), vault.toShares(assets));
568
568
  actions.push({
569
569
  type: "erc4626Withdraw",
570
570
  args: [
@@ -578,7 +578,7 @@ const encodeOperation = (operation, dataBefore, supportsSignature = true, index
578
578
  });
579
579
  }
580
580
  else {
581
- const minSharePrice = blue_sdk_1.MathLib.mulDivUp(vault.toAssets(shares), blue_sdk_1.MathLib.wToRay(blue_sdk_1.MathLib.WAD - slippage), shares);
581
+ const minSharePrice = blue_sdk_1.MathLib.mulDivDown(vault.toAssets(shares), blue_sdk_1.MathLib.wToRay(blue_sdk_1.MathLib.WAD - slippage), shares);
582
582
  actions.push({
583
583
  type: "erc4626Redeem",
584
584
  args: [
package/lib/operations.js CHANGED
@@ -402,7 +402,9 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
402
402
  case "Erc20_Approve": {
403
403
  const duplicateApproval = approvals.find((approval) => approval.address === operation.address &&
404
404
  approval.sender === operation.sender &&
405
- approval.args.spender === operation.args.spender);
405
+ approval.args.spender === operation.args.spender &&
406
+ (!simulation_sdk_1.APPROVE_ONLY_ONCE_TOKENS[startData.chainId]?.includes(approval.address) ||
407
+ (approval.args.amount === 0n) === (operation.args.amount === 0n)));
406
408
  if (duplicateApproval == null)
407
409
  return approvals.push(operation);
408
410
  duplicateApproval.args.amount += operation.args.amount;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/bundler-sdk-viem",
3
3
  "description": "Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.",
4
- "version": "3.2.2",
4
+ "version": "3.2.4",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -19,10 +19,10 @@
19
19
  ],
20
20
  "peerDependencies": {
21
21
  "viem": "^2.0.0",
22
- "@morpho-org/blue-sdk": "^4.0.0",
23
- "@morpho-org/blue-sdk-viem": "^3.1.1",
24
- "@morpho-org/morpho-ts": "^2.4.0",
25
- "@morpho-org/simulation-sdk": "^3.1.1"
22
+ "@morpho-org/blue-sdk": "^4.4.0",
23
+ "@morpho-org/morpho-ts": "^2.4.1",
24
+ "@morpho-org/simulation-sdk": "^3.1.1",
25
+ "@morpho-org/blue-sdk-viem": "^3.1.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tanstack/query-core": "^5.62.16",
@@ -34,14 +34,14 @@
34
34
  "typescript": "^5.7.2",
35
35
  "viem": "^2.23.0",
36
36
  "vitest": "^3.0.5",
37
- "@morpho-org/blue-sdk": "^4.0.0",
38
- "@morpho-org/blue-sdk-viem": "^3.1.1",
37
+ "@morpho-org/blue-sdk": "^4.4.0",
39
38
  "@morpho-org/morpho-test": "^2.3.0",
40
- "@morpho-org/morpho-ts": "^2.4.0",
39
+ "@morpho-org/blue-sdk-viem": "^3.1.1",
40
+ "@morpho-org/morpho-ts": "^2.4.1",
41
41
  "@morpho-org/simulation-sdk": "^3.1.1",
42
- "@morpho-org/simulation-sdk-wagmi": "^3.0.2",
42
+ "@morpho-org/test": "^2.1.4",
43
43
  "@morpho-org/test-wagmi": "^2.0.4",
44
- "@morpho-org/test": "^2.1.4"
44
+ "@morpho-org/simulation-sdk-wagmi": "^3.0.2"
45
45
  },
46
46
  "scripts": {
47
47
  "prepublish": "$npm_execpath build",