@morpho-org/bundler-sdk-viem 3.0.0-next.0 → 3.0.0-next.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.
@@ -386,6 +386,8 @@ export var BundlerAction;
386
386
  */
387
387
  function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
388
388
  const { permit2 } = getChainAddresses(chainId);
389
+ if (permit2 == null)
390
+ throw new BundlerErrors.UnexpectedAction("approve2", chainId);
389
391
  return [
390
392
  {
391
393
  to: permit2,
@@ -411,6 +413,8 @@ export var BundlerAction;
411
413
  */
412
414
  function transferFrom2(chainId, asset, owner, amount, recipient) {
413
415
  const { permit2, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
416
+ if (permit2 == null)
417
+ throw new BundlerErrors.UnexpectedAction("transferFrom2", chainId);
414
418
  recipient ??= generalAdapter1;
415
419
  return [
416
420
  {
package/lib/operations.js CHANGED
@@ -43,7 +43,9 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
43
43
  const useSimplePermit = erc2612Nonce != null &&
44
44
  (data.tryGetVault(address) != null || // MetaMorpho vaults implement EIP-2612.
45
45
  hasSimplePermit);
46
- const isPermissioned = permissionedWrapperTokens[data.chainId].has(address) ||
46
+ const useSimpleTransfer = permit2 == null ||
47
+ // Token is permissioned and Permit2 may not be authorized so Permit2 cannot be used.
48
+ permissionedWrapperTokens[data.chainId].has(address) ||
47
49
  permissionedBackedTokens[data.chainId].has(address);
48
50
  if (useSimplePermit)
49
51
  operations.push({
@@ -56,8 +58,7 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
56
58
  nonce: erc2612Nonce,
57
59
  },
58
60
  });
59
- // Token is permissioned and Permit2 may not be authorized so Permit2 cannot be used.
60
- else if (isPermissioned)
61
+ else if (useSimpleTransfer)
61
62
  operations.push({
62
63
  type: "Erc20_Approve",
63
64
  sender: from,
@@ -67,7 +68,7 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
67
68
  spender: generalAdapter1,
68
69
  },
69
70
  });
70
- if (useSimplePermit || isPermissioned)
71
+ if (useSimplePermit || useSimpleTransfer)
71
72
  operations.push({
72
73
  type: "Erc20_Transfer",
73
74
  sender: generalAdapter1,
@@ -78,7 +79,7 @@ export const populateInputTransfer = ({ address, args: { amount, from } }, data,
78
79
  to: generalAdapter1,
79
80
  },
80
81
  });
81
- // Simple permit is not supported and token is not permissioned: fallback to Permit2.
82
+ // Simple permit is not supported: fallback to Permit2.
82
83
  else {
83
84
  if (erc20Allowances.permit2 < amount)
84
85
  operations.push({
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.0.0-next.0",
4
+ "version": "3.0.0-next.1",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -20,9 +20,9 @@
20
20
  ],
21
21
  "peerDependencies": {
22
22
  "viem": "^2.0.0",
23
- "@morpho-org/blue-sdk": "^3.0.0-next.1",
24
- "@morpho-org/blue-sdk-viem": "^3.0.0-next.0",
25
- "@morpho-org/simulation-sdk": "^3.0.0-next.0",
23
+ "@morpho-org/blue-sdk-viem": "^3.0.0-next.1",
24
+ "@morpho-org/simulation-sdk": "^3.0.0-next.1",
25
+ "@morpho-org/blue-sdk": "^3.0.0-next.3",
26
26
  "@morpho-org/morpho-ts": "^2.1.0"
27
27
  },
28
28
  "devDependencies": {
@@ -35,13 +35,13 @@
35
35
  "typescript": "^5.7.2",
36
36
  "viem": "^2.23.0",
37
37
  "vitest": "^3.0.5",
38
- "@morpho-org/blue-sdk": "^3.0.0-next.1",
39
- "@morpho-org/blue-sdk-viem": "^3.0.0-next.0",
40
- "@morpho-org/morpho-ts": "^2.1.0",
41
- "@morpho-org/simulation-sdk": "^3.0.0-next.0",
38
+ "@morpho-org/blue-sdk": "^3.0.0-next.3",
39
+ "@morpho-org/blue-sdk-viem": "^3.0.0-next.1",
42
40
  "@morpho-org/morpho-test": "^2.2.1",
43
- "@morpho-org/test": "^2.0.7-next.0",
44
- "@morpho-org/simulation-sdk-wagmi": "^3.0.0-next.0",
41
+ "@morpho-org/morpho-ts": "^2.1.0",
42
+ "@morpho-org/simulation-sdk": "^3.0.0-next.1",
43
+ "@morpho-org/simulation-sdk-wagmi": "^2.0.5",
44
+ "@morpho-org/test": "^2.0.6",
45
45
  "@morpho-org/test-wagmi": "^2.0.4"
46
46
  },
47
47
  "scripts": {