@morpho-org/bundler-sdk-viem 4.1.3 → 4.1.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.
Files changed (2) hide show
  1. package/lib/operations.js +11 -4
  2. package/package.json +10 -10
package/lib/operations.js CHANGED
@@ -703,11 +703,18 @@ const finalizeBundle = (operations, startData, receiver, unwrapTokens = new Set(
703
703
  })));
704
704
  const finalizedOperations = operations.concat(unwraps, skims);
705
705
  const finalizedSteps = (0, exports.simulateBundlerOperations)(finalizedOperations, startData);
706
- for (const holding of (0, morpho_ts_1.values)((0, morpho_ts_1.getLast)(finalizedSteps).holdings[generalAdapter1])) {
707
- if (!holding)
706
+ const firstHoldings = finalizedSteps[0].holdings[generalAdapter1] ?? {};
707
+ const lastHoldings = (0, morpho_ts_1.getLast)(finalizedSteps).holdings[generalAdapter1] ?? {};
708
+ for (const token of (0, morpho_ts_1.keys)(lastHoldings)) {
709
+ const lastHolding = lastHoldings[token];
710
+ const firstHolding = firstHoldings[token];
711
+ if (!lastHolding)
708
712
  continue;
709
- if (holding.balance > 0n)
710
- throw new errors_js_1.BundlerErrors.UnskimedToken(holding.token);
713
+ // compute delta balance between final and initial, default first holding to 0n
714
+ const delta = lastHolding.balance - (firstHolding?.balance ?? 0n);
715
+ if (delta > 0n) {
716
+ throw new errors_js_1.BundlerErrors.UnskimedToken(lastHolding.token);
717
+ }
711
718
  }
712
719
  return finalizedOperations;
713
720
  };
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": "4.1.3",
4
+ "version": "4.1.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": "^5.9.1",
23
- "@morpho-org/blue-sdk-viem": "^4.1.4",
24
- "@morpho-org/simulation-sdk": "^3.2.3",
25
- "@morpho-org/morpho-ts": "^2.4.6"
22
+ "@morpho-org/blue-sdk": "^5.11.0",
23
+ "@morpho-org/blue-sdk-viem": "^4.2.0",
24
+ "@morpho-org/morpho-ts": "^2.4.6",
25
+ "@morpho-org/simulation-sdk": "^3.2.3"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tanstack/query-core": "^5.62.16",
@@ -34,14 +34,14 @@
34
34
  "typescript": "^5.9.3",
35
35
  "viem": "^2.41.2",
36
36
  "vitest": "^4.0.15",
37
- "@morpho-org/blue-sdk": "^5.9.1",
38
- "@morpho-org/blue-sdk-viem": "^4.1.4",
39
- "@morpho-org/morpho-test": "^2.4.4",
37
+ "@morpho-org/blue-sdk": "^5.11.0",
38
+ "@morpho-org/blue-sdk-viem": "^4.2.0",
40
39
  "@morpho-org/morpho-ts": "^2.4.6",
41
40
  "@morpho-org/simulation-sdk": "^3.2.3",
42
- "@morpho-org/test": "^2.6.4",
41
+ "@morpho-org/morpho-test": "^2.4.4",
42
+ "@morpho-org/simulation-sdk-wagmi": "^3.1.3",
43
43
  "@morpho-org/test-wagmi": "^2.0.8",
44
- "@morpho-org/simulation-sdk-wagmi": "^3.1.3"
44
+ "@morpho-org/test": "^2.6.5"
45
45
  },
46
46
  "scripts": {
47
47
  "prepublish": "$npm_execpath build",