@morpho-org/bundler-sdk-viem 3.0.0-next.6 → 3.0.0-next.7
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 +7 -7
- package/package.json +7 -7
package/lib/actions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeFunctionData, erc20Abi, maxUint256, verifyTypedData, zeroAddress, } from "viem";
|
|
2
|
-
import { ChainId, MathLib, NATIVE_ADDRESS, convexWrapperTokens, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { ChainId, DEFAULT_SLIPPAGE_TOLERANCE, MathLib, NATIVE_ADDRESS, convexWrapperTokens, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, } from "@morpho-org/blue-sdk";
|
|
3
3
|
import { Time, getValue } from "@morpho-org/morpho-ts";
|
|
4
4
|
import { getCurrent, simulateOperation, } from "@morpho-org/simulation-sdk";
|
|
5
5
|
import { blueAbi, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermitTypedData, } from "@morpho-org/blue-sdk-viem";
|
|
@@ -389,7 +389,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
389
389
|
break;
|
|
390
390
|
}
|
|
391
391
|
case "Blue_Supply": {
|
|
392
|
-
const { id, assets = 0n, shares = 0n, onBehalf, slippage =
|
|
392
|
+
const { id, assets = 0n, shares = 0n, onBehalf, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
393
393
|
const market = dataBefore.getMarket(id);
|
|
394
394
|
const maxSharePrice = market.toSupplyAssets(MathLib.wToRay(MathLib.WAD + slippage));
|
|
395
395
|
actions.push({
|
|
@@ -406,7 +406,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
406
406
|
break;
|
|
407
407
|
}
|
|
408
408
|
case "Blue_Withdraw": {
|
|
409
|
-
const { id, assets = 0n, shares = 0n, receiver, slippage =
|
|
409
|
+
const { id, assets = 0n, shares = 0n, receiver, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
410
410
|
const market = dataBefore.getMarket(id);
|
|
411
411
|
const minSharePrice = market.toSupplyAssets(MathLib.wToRay(MathLib.WAD - slippage));
|
|
412
412
|
actions.push({
|
|
@@ -416,7 +416,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
416
416
|
break;
|
|
417
417
|
}
|
|
418
418
|
case "Blue_Borrow": {
|
|
419
|
-
const { id, assets = 0n, shares = 0n, receiver, slippage =
|
|
419
|
+
const { id, assets = 0n, shares = 0n, receiver, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
420
420
|
const market = dataBefore.getMarket(id);
|
|
421
421
|
const minSharePrice = market.toBorrowAssets(MathLib.wToRay(MathLib.WAD - slippage));
|
|
422
422
|
actions.push({
|
|
@@ -426,7 +426,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
426
426
|
break;
|
|
427
427
|
}
|
|
428
428
|
case "Blue_Repay": {
|
|
429
|
-
const { id, assets = 0n, shares = 0n, onBehalf, slippage =
|
|
429
|
+
const { id, assets = 0n, shares = 0n, onBehalf, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
430
430
|
const market = dataBefore.getMarket(id);
|
|
431
431
|
const maxSharePrice = market.toBorrowAssets(MathLib.wToRay(MathLib.WAD + slippage));
|
|
432
432
|
actions.push({
|
|
@@ -471,7 +471,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
471
471
|
break;
|
|
472
472
|
}
|
|
473
473
|
case "MetaMorpho_Deposit": {
|
|
474
|
-
const { assets = 0n, shares = 0n, owner, slippage =
|
|
474
|
+
const { assets = 0n, shares = 0n, owner, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
475
475
|
const vault = dataBefore.getVault(address);
|
|
476
476
|
const maxSharePrice = vault.toAssets(MathLib.wToRay(MathLib.WAD + slippage));
|
|
477
477
|
if (shares === 0n)
|
|
@@ -487,7 +487,7 @@ export const encodeOperation = (operation, dataBefore, supportsSignature = true,
|
|
|
487
487
|
break;
|
|
488
488
|
}
|
|
489
489
|
case "MetaMorpho_Withdraw": {
|
|
490
|
-
const { assets = 0n, shares = 0n, owner, receiver, slippage =
|
|
490
|
+
const { assets = 0n, shares = 0n, owner, receiver, slippage = DEFAULT_SLIPPAGE_TOLERANCE, } = operation.args;
|
|
491
491
|
const vault = dataBefore.getVault(address);
|
|
492
492
|
const minSharePrice = vault.toAssets(MathLib.wToRay(MathLib.WAD - slippage));
|
|
493
493
|
if (assets > 0n)
|
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
|
+
"version": "3.0.0-next.7",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"viem": "^2.0.0",
|
|
23
23
|
"@morpho-org/blue-sdk": "^2.3.2",
|
|
24
|
-
"@morpho-org/morpho-ts": "^2.1.0",
|
|
25
24
|
"@morpho-org/blue-sdk-viem": "^2.2.2",
|
|
25
|
+
"@morpho-org/morpho-ts": "^2.2.0",
|
|
26
26
|
"@morpho-org/simulation-sdk": "^2.1.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"typescript": "^5.7.2",
|
|
36
36
|
"viem": "^2.23.0",
|
|
37
37
|
"vitest": "^3.0.5",
|
|
38
|
-
"@morpho-org/blue-sdk": "^2.3.2",
|
|
39
38
|
"@morpho-org/blue-sdk-viem": "^2.2.2",
|
|
40
|
-
"@morpho-org/morpho-test": "^2.
|
|
39
|
+
"@morpho-org/morpho-test": "^2.2.1",
|
|
40
|
+
"@morpho-org/blue-sdk": "^2.3.2",
|
|
41
|
+
"@morpho-org/morpho-ts": "^2.2.0",
|
|
41
42
|
"@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
|
-
"@morpho-org/test": "^2.0.
|
|
45
|
-
"@morpho-org/test
|
|
44
|
+
"@morpho-org/test-wagmi": "^2.0.4",
|
|
45
|
+
"@morpho-org/test": "^2.0.6"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prepublish": "$npm_execpath build",
|