@morpho-org/bundler-sdk-viem 3.0.0-next.4 → 3.0.0-next.6

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.
@@ -33,7 +33,7 @@ export declare namespace BundlerAction {
33
33
  * @param recipient The address to send tokens to.
34
34
  * @param amount The amount of tokens to send.
35
35
  */
36
- function erc20Transfer(chainId: ChainId, asset: Address, recipient: Address, amount: bigint): BundlerCall[];
36
+ function erc20Transfer(chainId: ChainId, asset: Address, recipient: Address, amount: bigint, adapter?: Address): BundlerCall[];
37
37
  /**
38
38
  * Encodes a call to the Adapter to transfer ERC20 tokens from the sender to the Bundler.
39
39
  * @param chainId The chain id for which to encode the call.
@@ -251,11 +251,12 @@ export var BundlerAction;
251
251
  * @param recipient The address to send tokens to.
252
252
  * @param amount The amount of tokens to send.
253
253
  */
254
- function erc20Transfer(chainId, asset, recipient, amount) {
254
+ function erc20Transfer(chainId, asset, recipient, amount, adapter) {
255
255
  const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
256
+ adapter ??= generalAdapter1;
256
257
  return [
257
258
  {
258
- to: generalAdapter1,
259
+ to: adapter,
259
260
  data: encodeFunctionData({
260
261
  abi: coreAdapterAbi,
261
262
  functionName: "erc20Transfer",
package/lib/actions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { encodeFunctionData, erc20Abi, maxUint256, verifyTypedData, zeroAddress, } from "viem";
2
2
  import { ChainId, MathLib, NATIVE_ADDRESS, convexWrapperTokens, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, } from "@morpho-org/blue-sdk";
3
3
  import { Time, getValue } from "@morpho-org/morpho-ts";
4
- import { simulateOperation, } from "@morpho-org/simulation-sdk";
4
+ import { getCurrent, simulateOperation, } from "@morpho-org/simulation-sdk";
5
5
  import { blueAbi, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermitTypedData, } from "@morpho-org/blue-sdk-viem";
6
6
  import { signTypedData } from "viem/actions";
7
7
  import { ActionBundle, ActionBundleRequirements } from "./ActionBundle.js";
@@ -76,7 +76,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
76
76
  ...operation.args,
77
77
  ...(callback && {
78
78
  callback: (dataBefore) => {
79
- callbackBundle = encodeBundle(callback, dataBefore, supportsSignature);
79
+ callbackBundle = encodeBundle(callback, getCurrent(dataBefore), supportsSignature);
80
80
  return callback;
81
81
  },
82
82
  }),
package/lib/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./types/index.js";
5
5
  export * from "./BundlerAction.js";
6
6
  export * from "./bundle.js";
7
7
  export * from "./ActionBundle.js";
8
+ export * from "./abis.js";
package/lib/index.js CHANGED
@@ -5,3 +5,4 @@ export * from "./types/index.js";
5
5
  export * from "./BundlerAction.js";
6
6
  export * from "./bundle.js";
7
7
  export * from "./ActionBundle.js";
8
+ export * from "./abis.js";
@@ -24,7 +24,12 @@ export interface Permit2PermitSingle {
24
24
  }
25
25
  export interface ActionArgs {
26
26
  nativeTransfer: [owner: Address, recipient: Address, amount: bigint];
27
- erc20Transfer: [asset: Address, recipient: Address, amount: bigint];
27
+ erc20Transfer: [
28
+ asset: Address,
29
+ recipient: Address,
30
+ amount: bigint,
31
+ adapter?: Address
32
+ ];
28
33
  erc20TransferFrom: [asset: Address, amount: bigint, recipient?: Address];
29
34
  erc20WrapperDepositFor: [
30
35
  wrapper: Address,
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.4",
4
+ "version": "3.0.0-next.6",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -20,10 +20,10 @@
20
20
  ],
21
21
  "peerDependencies": {
22
22
  "viem": "^2.0.0",
23
- "@morpho-org/blue-sdk": "^2.3.1",
24
- "@morpho-org/blue-sdk-viem": "^2.2.2",
23
+ "@morpho-org/blue-sdk": "^2.3.2",
25
24
  "@morpho-org/morpho-ts": "^2.1.0",
26
- "@morpho-org/simulation-sdk": "^2.1.3"
25
+ "@morpho-org/blue-sdk-viem": "^2.2.2",
26
+ "@morpho-org/simulation-sdk": "^2.1.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@tanstack/query-core": "^5.62.16",
@@ -35,11 +35,11 @@
35
35
  "typescript": "^5.7.2",
36
36
  "viem": "^2.23.0",
37
37
  "vitest": "^3.0.5",
38
- "@morpho-org/morpho-ts": "^2.1.0",
39
- "@morpho-org/blue-sdk": "^2.3.1",
38
+ "@morpho-org/blue-sdk": "^2.3.2",
40
39
  "@morpho-org/blue-sdk-viem": "^2.2.2",
41
- "@morpho-org/morpho-test": "^2.2.1",
42
- "@morpho-org/simulation-sdk": "^2.1.3",
40
+ "@morpho-org/morpho-test": "^2.3.0-next.1",
41
+ "@morpho-org/simulation-sdk": "^2.1.4",
42
+ "@morpho-org/morpho-ts": "^2.1.0",
43
43
  "@morpho-org/simulation-sdk-wagmi": "^2.0.5",
44
44
  "@morpho-org/test": "^2.0.6",
45
45
  "@morpho-org/test-wagmi": "^2.0.4"