@morpho-org/bundler-sdk-viem 5.0.0 → 5.0.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.
@@ -19,9 +19,10 @@ var BundlerAction;
19
19
  if (type !== "nativeTransfer")
20
20
  continue;
21
21
  const [owner, recipient, amount] = args;
22
- if (owner !== bundler3 &&
23
- owner !== generalAdapter1 &&
24
- (recipient === bundler3 || recipient === generalAdapter1))
22
+ if (!(0, viem_1.isAddressEqual)(owner, bundler3) &&
23
+ !(0, viem_1.isAddressEqual)(owner, generalAdapter1) &&
24
+ ((0, viem_1.isAddressEqual)(recipient, bundler3) ||
25
+ (0, viem_1.isAddressEqual)(recipient, generalAdapter1)))
25
26
  value += amount;
26
27
  }
27
28
  const encodedActions = actions.flatMap(BundlerAction.encode.bind(null, chainId));
@@ -229,9 +230,9 @@ var BundlerAction;
229
230
  // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
230
231
  function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
231
232
  const { bundler3: { bundler3, generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
232
- if (recipient === bundler3)
233
+ if ((0, viem_1.isAddressEqual)(recipient, bundler3))
233
234
  return [];
234
- if (owner === generalAdapter1)
235
+ if ((0, viem_1.isAddressEqual)(owner, generalAdapter1))
235
236
  return [
236
237
  {
237
238
  to: generalAdapter1,
@@ -725,7 +726,7 @@ var BundlerAction;
725
726
  function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
726
727
  const { morpho, bundler3: { bundler3 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
727
728
  const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
728
- if (authorization.authorized === bundler3)
729
+ if ((0, viem_1.isAddressEqual)(authorization.authorized, bundler3))
729
730
  throw new errors_js_1.BundlerErrors.UnexpectedSignature(authorization.authorized);
730
731
  return [
731
732
  {
@@ -1,6 +1,6 @@
1
1
  import { ChainId, getChainAddresses, } from "@morpho-org/blue-sdk";
2
2
  import { blueAbi, erc2612Abi, permit2Abi, publicAllocatorAbi, } from "@morpho-org/blue-sdk-viem";
3
- import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
3
+ import { encodeAbiParameters, encodeFunctionData, isAddressEqual, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
4
4
  import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, paraswapAdapterAbi, universalRewardsDistributorAbi, } from "./abis.js";
5
5
  import { BundlerErrors } from "./errors.js";
6
6
  const reenterAbiInputs = bundler3Abi.find((item) => item.name === "reenter").inputs;
@@ -16,9 +16,10 @@ export var BundlerAction;
16
16
  if (type !== "nativeTransfer")
17
17
  continue;
18
18
  const [owner, recipient, amount] = args;
19
- if (owner !== bundler3 &&
20
- owner !== generalAdapter1 &&
21
- (recipient === bundler3 || recipient === generalAdapter1))
19
+ if (!isAddressEqual(owner, bundler3) &&
20
+ !isAddressEqual(owner, generalAdapter1) &&
21
+ (isAddressEqual(recipient, bundler3) ||
22
+ isAddressEqual(recipient, generalAdapter1)))
22
23
  value += amount;
23
24
  }
24
25
  const encodedActions = actions.flatMap(BundlerAction.encode.bind(null, chainId));
@@ -226,9 +227,9 @@ export var BundlerAction;
226
227
  // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
227
228
  function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
228
229
  const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
229
- if (recipient === bundler3)
230
+ if (isAddressEqual(recipient, bundler3))
230
231
  return [];
231
- if (owner === generalAdapter1)
232
+ if (isAddressEqual(owner, generalAdapter1))
232
233
  return [
233
234
  {
234
235
  to: generalAdapter1,
@@ -722,7 +723,7 @@ export var BundlerAction;
722
723
  function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
723
724
  const { morpho, bundler3: { bundler3 }, } = getChainAddresses(chainId);
724
725
  const { r, s, yParity } = parseSignature(signature);
725
- if (authorization.authorized === bundler3)
726
+ if (isAddressEqual(authorization.authorized, bundler3))
726
727
  throw new BundlerErrors.UnexpectedSignature(authorization.authorized);
727
728
  return [
728
729
  {
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": "5.0.0",
4
+ "version": "5.0.1",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -19,11 +19,11 @@
19
19
  "lib"
20
20
  ],
21
21
  "peerDependencies": {
22
- "viem": "^2.0.0",
23
22
  "@morpho-org/blue-sdk": "^6.0.0",
24
23
  "@morpho-org/blue-sdk-viem": "^5.0.0",
25
24
  "@morpho-org/morpho-ts": "^2.5.1",
26
- "@morpho-org/simulation-sdk": "^4.0.0"
25
+ "@morpho-org/simulation-sdk": "^4.0.0",
26
+ "viem": "^2.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@tanstack/query-core": "^5.100.10",
@@ -38,11 +38,11 @@
38
38
  "@morpho-org/blue-sdk": "^6.0.0",
39
39
  "@morpho-org/blue-sdk-viem": "^5.0.0",
40
40
  "@morpho-org/morpho-test": "^4.0.0",
41
- "@morpho-org/morpho-ts": "^2.5.1",
42
- "@morpho-org/simulation-sdk": "^4.0.0",
43
- "@morpho-org/simulation-sdk-wagmi": "^5.0.0",
41
+ "@morpho-org/morpho-ts": "^2.5.2",
42
+ "@morpho-org/simulation-sdk": "^4.0.1",
43
+ "@morpho-org/simulation-sdk-wagmi": "^5.0.1",
44
44
  "@morpho-org/test": "^2.8.0",
45
- "@morpho-org/test-wagmi": "^3.0.0"
45
+ "@morpho-org/test-wagmi": "^3.0.1"
46
46
  },
47
47
  "scripts": {
48
48
  "prepublish": "$npm_execpath build",