@morpho-org/morpho-sdk 2.0.0 → 3.0.0

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 (202) hide show
  1. package/lib/cjs/abis.d.ts +2816 -0
  2. package/lib/cjs/abis.js +1951 -0
  3. package/lib/cjs/actions/index.d.ts +3 -0
  4. package/lib/cjs/actions/marketV1/borrow.js +7 -10
  5. package/lib/cjs/actions/marketV1/buildReallocationActions.d.ts +2 -3
  6. package/lib/cjs/actions/marketV1/buildReallocationActions.js +1 -2
  7. package/lib/cjs/actions/marketV1/repay.d.ts +2 -0
  8. package/lib/cjs/actions/marketV1/repay.js +7 -8
  9. package/lib/cjs/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
  10. package/lib/cjs/actions/marketV1/repayWithdrawCollateral.js +9 -10
  11. package/lib/cjs/actions/marketV1/supplyCollateral.d.ts +2 -0
  12. package/lib/cjs/actions/marketV1/supplyCollateral.js +11 -12
  13. package/lib/cjs/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
  14. package/lib/cjs/actions/marketV1/supplyCollateralBorrow.js +13 -14
  15. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -2
  16. package/lib/cjs/actions/requirements/getRequirementsAction.d.ts +28 -4
  17. package/lib/cjs/actions/requirements/getRequirementsAction.js +28 -4
  18. package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -2
  19. package/lib/cjs/actions/requirements/index.d.ts +1 -0
  20. package/lib/cjs/actions/requirements/index.js +1 -0
  21. package/lib/cjs/actions/vaultV1/deposit.d.ts +2 -0
  22. package/lib/cjs/actions/vaultV1/deposit.js +13 -14
  23. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +2 -0
  24. package/lib/cjs/actions/vaultV1/migrateToV2.js +11 -9
  25. package/lib/cjs/actions/vaultV2/deposit.d.ts +2 -0
  26. package/lib/cjs/actions/vaultV2/deposit.js +13 -14
  27. package/lib/cjs/addresses.d.ts +2 -0
  28. package/lib/cjs/addresses.js +18 -0
  29. package/lib/cjs/augment/AccrualPosition.d.ts +9 -0
  30. package/lib/cjs/augment/AccrualPosition.js +8 -0
  31. package/lib/cjs/augment/AccrualVault.d.ts +8 -0
  32. package/lib/cjs/augment/AccrualVault.js +7 -0
  33. package/lib/cjs/augment/Holding.d.ts +8 -0
  34. package/lib/cjs/augment/Holding.js +7 -0
  35. package/lib/cjs/augment/Market.d.ts +8 -0
  36. package/lib/cjs/augment/Market.js +7 -0
  37. package/lib/cjs/augment/MarketParams.d.ts +8 -0
  38. package/lib/cjs/augment/MarketParams.js +7 -0
  39. package/lib/cjs/augment/Position.d.ts +8 -0
  40. package/lib/cjs/augment/Position.js +7 -0
  41. package/lib/cjs/augment/Token.d.ts +8 -0
  42. package/lib/cjs/augment/Token.js +7 -0
  43. package/lib/cjs/augment/User.d.ts +8 -0
  44. package/lib/cjs/augment/User.js +7 -0
  45. package/lib/cjs/augment/Vault.d.ts +8 -0
  46. package/lib/cjs/augment/Vault.js +7 -0
  47. package/lib/cjs/augment/VaultConfig.d.ts +8 -0
  48. package/lib/cjs/augment/VaultConfig.js +7 -0
  49. package/lib/cjs/augment/VaultMarketAllocation.d.ts +8 -0
  50. package/lib/cjs/augment/VaultMarketAllocation.js +7 -0
  51. package/lib/cjs/augment/VaultMarketConfig.d.ts +8 -0
  52. package/lib/cjs/augment/VaultMarketConfig.js +7 -0
  53. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
  54. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +8 -0
  55. package/lib/cjs/augment/VaultUser.d.ts +8 -0
  56. package/lib/cjs/augment/VaultUser.js +7 -0
  57. package/lib/cjs/augment.d.ts +14 -0
  58. package/lib/cjs/augment.js +16 -0
  59. package/lib/cjs/bundler/actions.d.ts +555 -0
  60. package/lib/cjs/bundler/actions.js +953 -0
  61. package/lib/cjs/bundler/index.d.ts +2 -0
  62. package/lib/cjs/bundler/index.js +18 -0
  63. package/lib/cjs/bundler/types.d.ts +181 -0
  64. package/lib/cjs/bundler/types.js +2 -0
  65. package/lib/cjs/constants.d.ts +3 -0
  66. package/lib/cjs/constants.js +32 -0
  67. package/lib/cjs/entities/index.d.ts +6 -3
  68. package/lib/cjs/entities/index.js +41 -17
  69. package/lib/cjs/entities/marketV1/marketV1.d.ts +45 -11
  70. package/lib/cjs/entities/marketV1/marketV1.js +45 -23
  71. package/lib/cjs/entities/reallocationData.d.ts +193 -0
  72. package/lib/cjs/entities/reallocationData.js +406 -0
  73. package/lib/cjs/entities/vaultV1/vaultV1.js +6 -2
  74. package/lib/cjs/entities/vaultV2/vaultV2.js +6 -1
  75. package/lib/cjs/errors.d.ts +2 -0
  76. package/lib/cjs/errors.js +18 -0
  77. package/lib/cjs/fetch.d.ts +1 -0
  78. package/lib/cjs/fetch.js +30 -0
  79. package/lib/cjs/format.d.ts +2 -0
  80. package/lib/cjs/format.js +22 -0
  81. package/lib/cjs/helpers/computeReallocations.d.ts +48 -8
  82. package/lib/cjs/helpers/computeReallocations.js +120 -32
  83. package/lib/cjs/helpers/constant.d.ts +17 -0
  84. package/lib/cjs/helpers/constant.js +30 -1
  85. package/lib/cjs/helpers/index.d.ts +1 -0
  86. package/lib/cjs/helpers/index.js +9 -1
  87. package/lib/cjs/helpers/metadata.d.ts +10 -0
  88. package/lib/cjs/helpers/metadata.js +20 -1
  89. package/lib/cjs/helpers/validate.d.ts +2 -0
  90. package/lib/cjs/helpers/validate.js +14 -2
  91. package/lib/cjs/index.d.ts +0 -1
  92. package/lib/cjs/index.js +0 -1
  93. package/lib/cjs/types/client.d.ts +1 -1
  94. package/lib/cjs/types/error.d.ts +91 -1
  95. package/lib/cjs/types/error.js +126 -1
  96. package/lib/cjs/types/sharedLiquidity.d.ts +43 -3
  97. package/lib/cjs/types.d.ts +3 -0
  98. package/lib/cjs/types.js +17 -0
  99. package/lib/cjs/utils.d.ts +9 -0
  100. package/lib/cjs/utils.js +65 -0
  101. package/lib/esm/abis.d.ts +2816 -0
  102. package/lib/esm/abis.js +1922 -0
  103. package/lib/esm/actions/index.d.ts +3 -0
  104. package/lib/esm/actions/marketV1/borrow.js +2 -5
  105. package/lib/esm/actions/marketV1/buildReallocationActions.d.ts +2 -3
  106. package/lib/esm/actions/marketV1/buildReallocationActions.js +1 -2
  107. package/lib/esm/actions/marketV1/repay.d.ts +2 -0
  108. package/lib/esm/actions/marketV1/repay.js +4 -5
  109. package/lib/esm/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
  110. package/lib/esm/actions/marketV1/repayWithdrawCollateral.js +4 -5
  111. package/lib/esm/actions/marketV1/supplyCollateral.d.ts +2 -0
  112. package/lib/esm/actions/marketV1/supplyCollateral.js +4 -5
  113. package/lib/esm/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
  114. package/lib/esm/actions/marketV1/supplyCollateralBorrow.js +4 -5
  115. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +1 -1
  116. package/lib/esm/actions/requirements/getRequirementsAction.d.ts +28 -4
  117. package/lib/esm/actions/requirements/getRequirementsAction.js +29 -5
  118. package/lib/esm/actions/requirements/getRequirementsApproval.js +1 -1
  119. package/lib/esm/actions/requirements/index.d.ts +1 -0
  120. package/lib/esm/actions/requirements/index.js +1 -0
  121. package/lib/esm/actions/vaultV1/deposit.d.ts +2 -0
  122. package/lib/esm/actions/vaultV1/deposit.js +3 -4
  123. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +2 -0
  124. package/lib/esm/actions/vaultV1/migrateToV2.js +3 -1
  125. package/lib/esm/actions/vaultV2/deposit.d.ts +2 -0
  126. package/lib/esm/actions/vaultV2/deposit.js +3 -4
  127. package/lib/esm/addresses.d.ts +2 -0
  128. package/lib/esm/addresses.js +1 -0
  129. package/lib/esm/augment/AccrualPosition.d.ts +9 -0
  130. package/lib/esm/augment/AccrualPosition.js +5 -0
  131. package/lib/esm/augment/AccrualVault.d.ts +8 -0
  132. package/lib/esm/augment/AccrualVault.js +4 -0
  133. package/lib/esm/augment/Holding.d.ts +8 -0
  134. package/lib/esm/augment/Holding.js +4 -0
  135. package/lib/esm/augment/Market.d.ts +8 -0
  136. package/lib/esm/augment/Market.js +4 -0
  137. package/lib/esm/augment/MarketParams.d.ts +8 -0
  138. package/lib/esm/augment/MarketParams.js +4 -0
  139. package/lib/esm/augment/Position.d.ts +8 -0
  140. package/lib/esm/augment/Position.js +4 -0
  141. package/lib/esm/augment/Token.d.ts +8 -0
  142. package/lib/esm/augment/Token.js +4 -0
  143. package/lib/esm/augment/User.d.ts +8 -0
  144. package/lib/esm/augment/User.js +4 -0
  145. package/lib/esm/augment/Vault.d.ts +8 -0
  146. package/lib/esm/augment/Vault.js +4 -0
  147. package/lib/esm/augment/VaultConfig.d.ts +8 -0
  148. package/lib/esm/augment/VaultConfig.js +4 -0
  149. package/lib/esm/augment/VaultMarketAllocation.d.ts +8 -0
  150. package/lib/esm/augment/VaultMarketAllocation.js +4 -0
  151. package/lib/esm/augment/VaultMarketConfig.d.ts +8 -0
  152. package/lib/esm/augment/VaultMarketConfig.js +4 -0
  153. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
  154. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +5 -0
  155. package/lib/esm/augment/VaultUser.d.ts +8 -0
  156. package/lib/esm/augment/VaultUser.js +4 -0
  157. package/lib/esm/augment.d.ts +14 -0
  158. package/lib/esm/augment.js +14 -0
  159. package/lib/esm/bundler/actions.d.ts +555 -0
  160. package/lib/esm/bundler/actions.js +950 -0
  161. package/lib/esm/bundler/index.d.ts +2 -0
  162. package/lib/esm/bundler/index.js +2 -0
  163. package/lib/esm/bundler/types.d.ts +181 -0
  164. package/lib/esm/bundler/types.js +1 -0
  165. package/lib/esm/constants.d.ts +3 -0
  166. package/lib/esm/constants.js +3 -0
  167. package/lib/esm/entities/index.d.ts +6 -3
  168. package/lib/esm/entities/index.js +5 -3
  169. package/lib/esm/entities/marketV1/marketV1.d.ts +45 -11
  170. package/lib/esm/entities/marketV1/marketV1.js +46 -24
  171. package/lib/esm/entities/reallocationData.d.ts +193 -0
  172. package/lib/esm/entities/reallocationData.js +402 -0
  173. package/lib/esm/entities/vaultV1/vaultV1.js +6 -2
  174. package/lib/esm/entities/vaultV2/vaultV2.js +6 -1
  175. package/lib/esm/errors.d.ts +2 -0
  176. package/lib/esm/errors.js +1 -0
  177. package/lib/esm/fetch.d.ts +1 -0
  178. package/lib/esm/fetch.js +1 -0
  179. package/lib/esm/format.d.ts +2 -0
  180. package/lib/esm/format.js +1 -0
  181. package/lib/esm/helpers/computeReallocations.d.ts +48 -8
  182. package/lib/esm/helpers/computeReallocations.js +119 -31
  183. package/lib/esm/helpers/constant.d.ts +17 -0
  184. package/lib/esm/helpers/constant.js +30 -1
  185. package/lib/esm/helpers/index.d.ts +1 -0
  186. package/lib/esm/helpers/index.js +1 -0
  187. package/lib/esm/helpers/metadata.d.ts +10 -0
  188. package/lib/esm/helpers/metadata.js +20 -1
  189. package/lib/esm/helpers/validate.d.ts +2 -0
  190. package/lib/esm/helpers/validate.js +12 -1
  191. package/lib/esm/index.d.ts +0 -1
  192. package/lib/esm/index.js +0 -1
  193. package/lib/esm/types/client.d.ts +1 -1
  194. package/lib/esm/types/error.d.ts +91 -1
  195. package/lib/esm/types/error.js +118 -0
  196. package/lib/esm/types/sharedLiquidity.d.ts +43 -3
  197. package/lib/esm/types.d.ts +3 -0
  198. package/lib/esm/types.js +1 -0
  199. package/lib/esm/utils.d.ts +9 -0
  200. package/lib/esm/utils.js +7 -0
  201. package/package.json +121 -14
  202. package/src/index.ts +0 -1
@@ -1,3 +1,6 @@
1
+ export type { MarketV1Actions } from "../entities/marketV1/index.js";
2
+ export type { VaultV1Actions } from "../entities/vaultV1/index.js";
3
+ export type { VaultV2Actions } from "../entities/vaultV2/index.js";
1
4
  export * from "./marketV1/index.js";
2
5
  export * from "./requirements/index.js";
3
6
  export * from "./vaultV1/index.js";
@@ -1,5 +1,5 @@
1
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
2
1
  import { deepFreeze } from "@morpho-org/morpho-ts";
2
+ import { BundlerAction } from "../../bundler/index.js";
3
3
  import { addTransactionMetadata } from "../../helpers/index.js";
4
4
  import { NonPositiveBorrowAmountError, NonPositiveMinBorrowSharePriceError, } from "../../types/index.js";
5
5
  import { buildReallocationActions } from "./buildReallocationActions.js";
@@ -70,10 +70,7 @@ export const marketV1Borrow = ({ market: { chainId, marketParams }, args: { amou
70
70
  type: "morphoBorrow",
71
71
  args: [marketParams, amount, 0n, minSharePrice, receiver, false],
72
72
  });
73
- let tx = {
74
- ...BundlerAction.encodeBundle(chainId, actions),
75
- value: reallocationFee,
76
- };
73
+ let tx = BundlerAction.encodeBundle(chainId, actions);
77
74
  if (metadata) {
78
75
  tx = addTransactionMetadata(tx, metadata);
79
76
  }
@@ -1,5 +1,5 @@
1
1
  import type { MarketParams } from "@morpho-org/blue-sdk";
2
- import type { Action } from "@morpho-org/bundler-sdk-viem";
2
+ import type { Action } from "../../bundler/index.js";
3
3
  import type { VaultReallocation } from "../../types/index.js";
4
4
  /**
5
5
  * Builds reallocation bundler actions and computes the total fee.
@@ -12,8 +12,7 @@ import type { VaultReallocation } from "../../types/index.js";
12
12
  *
13
13
  * @param reallocations - The vault reallocations to encode.
14
14
  * @param targetMarketParams - The target market params the freed liquidity is destined for.
15
- * @returns The encoded `reallocateTo` actions and the summed reallocation fee (in native, used
16
- * as `tx.value` in the parent bundle).
15
+ * @returns The encoded `reallocateTo` actions and the summed reallocation fee in native tokens.
17
16
  * @throws {NegativeReallocationFeeError} when any reallocation fee is negative.
18
17
  * @throws {EmptyReallocationWithdrawalsError} when any reallocation has no withdrawals.
19
18
  * @throws {NonPositiveReallocationAmountError} when any withdrawal amount is non-positive.
@@ -10,8 +10,7 @@ import { validateReallocations } from "../../helpers/index.js";
10
10
  *
11
11
  * @param reallocations - The vault reallocations to encode.
12
12
  * @param targetMarketParams - The target market params the freed liquidity is destined for.
13
- * @returns The encoded `reallocateTo` actions and the summed reallocation fee (in native, used
14
- * as `tx.value` in the parent bundle).
13
+ * @returns The encoded `reallocateTo` actions and the summed reallocation fee in native tokens.
15
14
  * @throws {NegativeReallocationFeeError} when any reallocation fee is negative.
16
15
  * @throws {EmptyReallocationWithdrawalsError} when any reallocation has no withdrawals.
17
16
  * @throws {NonPositiveReallocationAmountError} when any withdrawal amount is non-positive.
@@ -68,6 +68,8 @@ export interface MarketV1RepayParams {
68
68
  * is provided and the signed asset differs from `marketParams.loanToken`.
69
69
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
70
70
  * is provided and the signed amount differs from `args.transferAmount`.
71
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
72
+ * signature is missing its expiration.
71
73
  * @example
72
74
  * ```ts
73
75
  * import { marketV1Repay } from "@morpho-org/morpho-sdk";
@@ -1,7 +1,7 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
4
3
  import { maxUint256 } from "viem";
4
+ import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata, validateRepayParams, } from "../../helpers/index.js";
6
6
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
7
7
  /**
@@ -44,6 +44,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
44
44
  * is provided and the signed asset differs from `marketParams.loanToken`.
45
45
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
46
46
  * is provided and the signed amount differs from `args.transferAmount`.
47
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
48
+ * signature is missing its expiration.
47
49
  * @example
48
50
  * ```ts
49
51
  * import { marketV1Repay } from "@morpho-org/morpho-sdk";
@@ -105,10 +107,7 @@ export const marketV1Repay = ({ market: { chainId, marketParams }, args: { asset
105
107
  ],
106
108
  });
107
109
  }
108
- let tx = {
109
- ...BundlerAction.encodeBundle(chainId, actions),
110
- value: 0n,
111
- };
110
+ let tx = BundlerAction.encodeBundle(chainId, actions);
112
111
  if (metadata) {
113
112
  tx = addTransactionMetadata(tx, metadata);
114
113
  }
@@ -81,6 +81,8 @@ export interface MarketV1RepayWithdrawCollateralParams {
81
81
  * is provided and the signed asset differs from `marketParams.loanToken`.
82
82
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
83
83
  * is provided and the signed amount differs from `args.transferAmount`.
84
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
85
+ * signature is missing its expiration.
84
86
  * @example
85
87
  * ```ts
86
88
  * import { marketV1RepayWithdrawCollateral } from "@morpho-org/morpho-sdk";
@@ -1,7 +1,7 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
4
3
  import { maxUint256 } from "viem";
4
+ import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata, validateRepayParams, } from "../../helpers/index.js";
6
6
  import { NonPositiveWithdrawCollateralAmountError, } from "../../types/index.js";
7
7
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -55,6 +55,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
55
55
  * is provided and the signed asset differs from `marketParams.loanToken`.
56
56
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
57
57
  * is provided and the signed amount differs from `args.transferAmount`.
58
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
59
+ * signature is missing its expiration.
58
60
  * @example
59
61
  * ```ts
60
62
  * import { marketV1RepayWithdrawCollateral } from "@morpho-org/morpho-sdk";
@@ -125,10 +127,7 @@ export const marketV1RepayWithdrawCollateral = ({ market: { chainId, marketParam
125
127
  type: "morphoWithdrawCollateral",
126
128
  args: [marketParams, withdrawAmount, receiver, false],
127
129
  });
128
- let tx = {
129
- ...BundlerAction.encodeBundle(chainId, actions),
130
- value: 0n,
131
- };
130
+ let tx = BundlerAction.encodeBundle(chainId, actions);
132
131
  if (metadata) {
133
132
  tx = addTransactionMetadata(tx, metadata);
134
133
  }
@@ -45,6 +45,8 @@ export interface MarketV1SupplyCollateralParams {
45
45
  * is provided and the signed asset differs from `marketParams.collateralToken`.
46
46
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
47
47
  * is provided and the signed amount differs from `args.amount`.
48
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
49
+ * signature is missing its expiration.
48
50
  * @example
49
51
  * ```ts
50
52
  * import { marketV1SupplyCollateral } from "@morpho-org/morpho-sdk";
@@ -1,6 +1,6 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
3
+ import { BundlerAction } from "../../bundler/index.js";
4
4
  import { addTransactionMetadata, validateNativeCollateral, } from "../../helpers/index.js";
5
5
  import { NegativeNativeAmountError, NonPositiveAssetAmountError, ZeroCollateralAmountError, } from "../../types/index.js";
6
6
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -36,6 +36,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
36
36
  * is provided and the signed asset differs from `marketParams.collateralToken`.
37
37
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
38
38
  * is provided and the signed amount differs from `args.amount`.
39
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
40
+ * signature is missing its expiration.
39
41
  * @example
40
42
  * ```ts
41
43
  * import { marketV1SupplyCollateral } from "@morpho-org/morpho-sdk";
@@ -90,10 +92,7 @@ export const marketV1SupplyCollateral = ({ market: { chainId, marketParams }, ar
90
92
  type: "morphoSupplyCollateral",
91
93
  args: [marketParams, totalCollateral, onBehalf, [], false],
92
94
  });
93
- let tx = {
94
- ...BundlerAction.encodeBundle(chainId, actions),
95
- value: nativeAmount ?? 0n,
96
- };
95
+ let tx = BundlerAction.encodeBundle(chainId, actions);
97
96
  if (metadata) {
98
97
  tx = addTransactionMetadata(tx, metadata);
99
98
  }
@@ -61,6 +61,8 @@ export interface MarketV1SupplyCollateralBorrowParams {
61
61
  * is provided and the signed asset differs from `marketParams.collateralToken`.
62
62
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
63
63
  * is provided and the signed amount differs from `args.amount`.
64
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
65
+ * signature is missing its expiration.
64
66
  * @throws {NegativeReallocationFeeError} from `buildReallocationActions` when
65
67
  * `reallocations` is non-empty and any `reallocation.fee < 0n`.
66
68
  * @throws {EmptyReallocationWithdrawalsError} from `buildReallocationActions` when any
@@ -1,6 +1,6 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
3
+ import { BundlerAction } from "../../bundler/index.js";
4
4
  import { addTransactionMetadata, validateNativeCollateral, } from "../../helpers/index.js";
5
5
  import { NegativeNativeAmountError, NonPositiveAssetAmountError, NonPositiveBorrowAmountError, NonPositiveMinBorrowSharePriceError, ZeroCollateralAmountError, } from "../../types/index.js";
6
6
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -47,6 +47,8 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
47
47
  * is provided and the signed asset differs from `marketParams.collateralToken`.
48
48
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
49
49
  * is provided and the signed amount differs from `args.amount`.
50
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
51
+ * signature is missing its expiration.
50
52
  * @throws {NegativeReallocationFeeError} from `buildReallocationActions` when
51
53
  * `reallocations` is non-empty and any `reallocation.fee < 0n`.
52
54
  * @throws {EmptyReallocationWithdrawalsError} from `buildReallocationActions` when any
@@ -133,10 +135,7 @@ export const marketV1SupplyCollateralBorrow = ({ market: { chainId, marketParams
133
135
  type: "morphoBorrow",
134
136
  args: [marketParams, borrowAmount, 0n, minSharePrice, receiver, false],
135
137
  });
136
- let tx = {
137
- ...BundlerAction.encodeBundle(chainId, actions),
138
- value: (nativeAmount ?? 0n) + reallocationFee,
139
- };
138
+ let tx = BundlerAction.encodeBundle(chainId, actions);
140
139
  if (metadata) {
141
140
  tx = addTransactionMetadata(tx, metadata);
142
141
  }
@@ -1,7 +1,7 @@
1
1
  import { MathLib } from "@morpho-org/blue-sdk";
2
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
3
- import { MAX_TOKEN_APPROVALS } from "@morpho-org/simulation-sdk";
4
3
  import { encodeFunctionData, erc20Abi, maxUint256 } from "viem";
4
+ import { MAX_TOKEN_APPROVALS } from "../../../helpers/constant.js";
5
5
  /**
6
6
  * Encodes a deep-frozen ERC-20 `approve(spender, amount)` transaction.
7
7
  *
@@ -1,5 +1,5 @@
1
- import type { Action } from "@morpho-org/bundler-sdk-viem";
2
1
  import { type Address } from "viem";
2
+ import type { Action } from "../../bundler/index.js";
3
3
  import { type Permit2Action, type PermitAction, type PermitArgs } from "../../types/index.js";
4
4
  interface GetRequirementsActionParams {
5
5
  asset: Address;
@@ -17,8 +17,7 @@ interface GetRequirementsActionParams {
17
17
  * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
18
18
  * `erc20TransferFrom`. The signed `asset` and `amount` must match the pulled `asset` and
19
19
  * `amount` exactly, otherwise the function throws so the caller does not silently spend a
20
- * wider-than-expected approval. Internal helper — consumed only by the action builders that
21
- * accept a `requirementSignature`; not re-exported on the public surface.
20
+ * wider-than-expected approval.
22
21
  *
23
22
  * @param params.asset - The ERC-20 to pull.
24
23
  * @param params.amount - The amount to pull, in the asset's smallest unit.
@@ -27,7 +26,32 @@ interface GetRequirementsActionParams {
27
26
  * @returns A pair of bundler `Action`s: a permit / approve2 followed by the transfer.
28
27
  * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
29
28
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
30
- * @internal
29
+ * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
30
+ * @example
31
+ * ```ts
32
+ * import { createWalletClient, http } from "viem";
33
+ * import { mainnet } from "viem/chains";
34
+ * import { getRequirementsAction } from "@morpho-org/morpho-sdk";
35
+ *
36
+ * const walletClient = createWalletClient({
37
+ * chain: mainnet,
38
+ * transport: http(),
39
+ * account: borrower,
40
+ * });
41
+ *
42
+ * // `requirement` comes from `getRequirements*` helpers; signing produces a `RequirementSignature`.
43
+ * const requirementSignature = await requirement.sign(walletClient, borrower);
44
+ *
45
+ * const actions = getRequirementsAction({
46
+ * asset: loanToken,
47
+ * amount: 1_000_000n,
48
+ * recipient: generalAdapter1,
49
+ * requirementSignature,
50
+ * });
51
+ * // actions satisfies Action[]
52
+ * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
53
+ * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
54
+ * ```
31
55
  */
32
56
  export declare const getRequirementsAction: ({ asset, amount, recipient, requirementSignature, }: GetRequirementsActionParams) => Action[];
33
57
  export {};
@@ -1,5 +1,5 @@
1
1
  import { isAddressEqual } from "viem";
2
- import { DepositAmountMismatchError, DepositAssetMismatchError, } from "../../types/index.js";
2
+ import { DepositAmountMismatchError, DepositAssetMismatchError, Permit2ExpirationMissingError, } from "../../types/index.js";
3
3
  /**
4
4
  * Encodes the bundler actions that consume a pre-signed permit / permit2 requirement and pull
5
5
  * the asset to `recipient`.
@@ -7,8 +7,7 @@ import { DepositAmountMismatchError, DepositAssetMismatchError, } from "../../ty
7
7
  * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
8
8
  * `erc20TransferFrom`. The signed `asset` and `amount` must match the pulled `asset` and
9
9
  * `amount` exactly, otherwise the function throws so the caller does not silently spend a
10
- * wider-than-expected approval. Internal helper — consumed only by the action builders that
11
- * accept a `requirementSignature`; not re-exported on the public surface.
10
+ * wider-than-expected approval.
12
11
  *
13
12
  * @param params.asset - The ERC-20 to pull.
14
13
  * @param params.amount - The amount to pull, in the asset's smallest unit.
@@ -17,7 +16,32 @@ import { DepositAmountMismatchError, DepositAssetMismatchError, } from "../../ty
17
16
  * @returns A pair of bundler `Action`s: a permit / approve2 followed by the transfer.
18
17
  * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
19
18
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
20
- * @internal
19
+ * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
20
+ * @example
21
+ * ```ts
22
+ * import { createWalletClient, http } from "viem";
23
+ * import { mainnet } from "viem/chains";
24
+ * import { getRequirementsAction } from "@morpho-org/morpho-sdk";
25
+ *
26
+ * const walletClient = createWalletClient({
27
+ * chain: mainnet,
28
+ * transport: http(),
29
+ * account: borrower,
30
+ * });
31
+ *
32
+ * // `requirement` comes from `getRequirements*` helpers; signing produces a `RequirementSignature`.
33
+ * const requirementSignature = await requirement.sign(walletClient, borrower);
34
+ *
35
+ * const actions = getRequirementsAction({
36
+ * asset: loanToken,
37
+ * amount: 1_000_000n,
38
+ * recipient: generalAdapter1,
39
+ * requirementSignature,
40
+ * });
41
+ * // actions satisfies Action[]
42
+ * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
43
+ * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
44
+ * ```
21
45
  */
22
46
  export const getRequirementsAction = ({ asset, amount, recipient, requirementSignature, }) => {
23
47
  if (!isAddressEqual(requirementSignature.args.asset, asset)) {
@@ -28,7 +52,7 @@ export const getRequirementsAction = ({ asset, amount, recipient, requirementSig
28
52
  }
29
53
  if (requirementSignature.action.type === "permit2") {
30
54
  if (!("expiration" in requirementSignature.args)) {
31
- throw new Error("Expiration is not defined");
55
+ throw new Permit2ExpirationMissingError();
32
56
  }
33
57
  return [
34
58
  {
@@ -1,4 +1,4 @@
1
- import { APPROVE_ONLY_ONCE_TOKENS } from "@morpho-org/simulation-sdk";
1
+ import { APPROVE_ONLY_ONCE_TOKENS } from "../../helpers/constant.js";
2
2
  import { ApprovalAmountLessThanSpendAmountError, } from "../../types/index.js";
3
3
  import { encodeErc20Approval } from "./encode/encodeErc20Approval.js";
4
4
  /**
@@ -1,6 +1,7 @@
1
1
  export * from "./encode/index.js";
2
2
  export * from "./getMorphoAuthorizationRequirement.js";
3
3
  export * from "./getRequirements.js";
4
+ export * from "./getRequirementsAction.js";
4
5
  export * from "./getRequirementsApproval.js";
5
6
  export * from "./getRequirementsPermit.js";
6
7
  export * from "./getRequirementsPermit2.js";
@@ -1,6 +1,7 @@
1
1
  export * from "./encode/index.js";
2
2
  export * from "./getMorphoAuthorizationRequirement.js";
3
3
  export * from "./getRequirements.js";
4
+ export * from "./getRequirementsAction.js";
4
5
  export * from "./getRequirementsApproval.js";
5
6
  export * from "./getRequirementsPermit.js";
6
7
  export * from "./getRequirementsPermit2.js";
@@ -53,6 +53,8 @@ export interface VaultV1DepositParams {
53
53
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
54
54
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
55
55
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
56
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
57
+ * Permit2 requirement signature is missing its expiration.
56
58
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
57
59
  * @example
58
60
  * ```ts
@@ -1,7 +1,7 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze, isDefined } from "@morpho-org/morpho-ts";
4
3
  import { isAddressEqual } from "viem";
4
+ import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { ChainWNativeMissingError, NativeAmountOnNonWNativeVaultError, NegativeNativeAmountError, NonPositiveAssetAmountError, NonPositiveMaxSharePriceError, ZeroDepositAmountError, } from "../../types/index.js";
7
7
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -44,6 +44,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
44
44
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
45
45
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
46
46
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
47
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
48
+ * Permit2 requirement signature is missing its expiration.
47
49
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
48
50
  * @example
49
51
  * ```ts
@@ -120,9 +122,6 @@ export const vaultV1Deposit = ({ vault: { chainId, address: vaultAddress, asset
120
122
  ],
121
123
  });
122
124
  let tx = BundlerAction.encodeBundle(chainId, actions);
123
- if (nativeAmount) {
124
- tx = { ...tx, value: nativeAmount };
125
- }
126
125
  if (metadata) {
127
126
  tx = addTransactionMetadata(tx, metadata);
128
127
  }
@@ -63,6 +63,8 @@ export interface VaultV1MigrateToV2Params {
63
63
  * is provided and the signed asset differs from `vault.address` (the V1 share token).
64
64
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
65
65
  * is provided and the signed amount differs from `args.shares`.
66
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
67
+ * signature is missing its expiration.
66
68
  * @example
67
69
  * ```ts
68
70
  * import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
@@ -1,7 +1,7 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze } from "@morpho-org/morpho-ts";
4
3
  import { isAddressEqual, maxUint256 } from "viem";
4
+ import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { NegativeMinSharePriceError, NonPositiveMaxSharePriceError, NonPositiveSharesAmountError, VaultAssetMismatchError, } from "../../types/index.js";
7
7
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -43,6 +43,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
43
43
  * is provided and the signed asset differs from `vault.address` (the V1 share token).
44
44
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
45
45
  * is provided and the signed amount differs from `args.shares`.
46
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
47
+ * signature is missing its expiration.
46
48
  * @example
47
49
  * ```ts
48
50
  * import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
@@ -53,6 +53,8 @@ export interface VaultV2DepositParams {
53
53
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
54
54
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
55
55
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
56
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
57
+ * Permit2 requirement signature is missing its expiration.
56
58
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
57
59
  * @example
58
60
  * ```ts
@@ -1,7 +1,7 @@
1
1
  import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { BundlerAction } from "@morpho-org/bundler-sdk-viem";
3
2
  import { deepFreeze, isDefined } from "@morpho-org/morpho-ts";
4
3
  import { isAddressEqual } from "viem";
4
+ import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { ChainWNativeMissingError, NativeAmountOnNonWNativeVaultError, NegativeNativeAmountError, NonPositiveAssetAmountError, NonPositiveMaxSharePriceError, ZeroDepositAmountError, } from "../../types/index.js";
7
7
  import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
@@ -44,6 +44,8 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
44
44
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
45
45
  * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
46
46
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
47
+ * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
48
+ * Permit2 requirement signature is missing its expiration.
47
49
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
48
50
  * @example
49
51
  * ```ts
@@ -120,9 +122,6 @@ export const vaultV2Deposit = ({ vault: { chainId, address: vaultAddress, asset
120
122
  ],
121
123
  });
122
124
  let tx = BundlerAction.encodeBundle(chainId, actions);
123
- if (nativeAmount) {
124
- tx = { ...tx, value: nativeAmount };
125
- }
126
125
  if (metadata) {
127
126
  tx = addTransactionMetadata(tx, metadata);
128
127
  }
@@ -0,0 +1,2 @@
1
+ export type { AddressLabel, ChainAddresses, ChainDeployments, } from "@morpho-org/blue-sdk";
2
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
@@ -0,0 +1 @@
1
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
@@ -0,0 +1,9 @@
1
+ import { AccrualPosition as BlueAccrualPosition } from "@morpho-org/blue-sdk";
2
+ import { fetchAccrualPosition, fetchPreLiquidationPosition } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace AccrualPosition {
5
+ let fetch: typeof fetchAccrualPosition;
6
+ let fetchPreLiquidation: typeof fetchPreLiquidationPosition;
7
+ }
8
+ }
9
+ export { BlueAccrualPosition as AccrualPosition };
@@ -0,0 +1,5 @@
1
+ import { AccrualPosition as BlueAccrualPosition } from "@morpho-org/blue-sdk";
2
+ import { fetchAccrualPosition, fetchPreLiquidationPosition, } from "@morpho-org/blue-sdk-viem";
3
+ BlueAccrualPosition.fetch = fetchAccrualPosition;
4
+ BlueAccrualPosition.fetchPreLiquidation = fetchPreLiquidationPosition;
5
+ export { BlueAccrualPosition as AccrualPosition };
@@ -0,0 +1,8 @@
1
+ import { AccrualVault as BlueAccrualVault } from "@morpho-org/blue-sdk";
2
+ import { fetchAccrualVault } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace AccrualVault {
5
+ let fetch: typeof fetchAccrualVault;
6
+ }
7
+ }
8
+ export { BlueAccrualVault as AccrualVault };
@@ -0,0 +1,4 @@
1
+ import { AccrualVault as BlueAccrualVault } from "@morpho-org/blue-sdk";
2
+ import { fetchAccrualVault } from "@morpho-org/blue-sdk-viem";
3
+ BlueAccrualVault.fetch = fetchAccrualVault;
4
+ export { BlueAccrualVault as AccrualVault };
@@ -0,0 +1,8 @@
1
+ import { Holding as BlueHolding } from "@morpho-org/blue-sdk";
2
+ import { fetchHolding } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace Holding {
5
+ let fetch: typeof fetchHolding;
6
+ }
7
+ }
8
+ export { BlueHolding as Holding };
@@ -0,0 +1,4 @@
1
+ import { Holding as BlueHolding } from "@morpho-org/blue-sdk";
2
+ import { fetchHolding } from "@morpho-org/blue-sdk-viem";
3
+ BlueHolding.fetch = fetchHolding;
4
+ export { BlueHolding as Holding };
@@ -0,0 +1,8 @@
1
+ import { Market as BlueMarket } from "@morpho-org/blue-sdk";
2
+ import { fetchMarket } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace Market {
5
+ let fetch: typeof fetchMarket;
6
+ }
7
+ }
8
+ export { BlueMarket as Market };
@@ -0,0 +1,4 @@
1
+ import { Market as BlueMarket } from "@morpho-org/blue-sdk";
2
+ import { fetchMarket } from "@morpho-org/blue-sdk-viem";
3
+ BlueMarket.fetch = fetchMarket;
4
+ export { BlueMarket as Market };
@@ -0,0 +1,8 @@
1
+ import { MarketParams as BlueMarketParams } from "@morpho-org/blue-sdk";
2
+ import { fetchMarketParams } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace MarketParams {
5
+ let fetch: typeof fetchMarketParams;
6
+ }
7
+ }
8
+ export { BlueMarketParams as MarketParams };
@@ -0,0 +1,4 @@
1
+ import { MarketParams as BlueMarketParams } from "@morpho-org/blue-sdk";
2
+ import { fetchMarketParams } from "@morpho-org/blue-sdk-viem";
3
+ BlueMarketParams.fetch = fetchMarketParams;
4
+ export { BlueMarketParams as MarketParams };
@@ -0,0 +1,8 @@
1
+ import { Position as BluePosition } from "@morpho-org/blue-sdk";
2
+ import { fetchPosition } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace Position {
5
+ let fetch: typeof fetchPosition;
6
+ }
7
+ }
8
+ export { BluePosition as Position };
@@ -0,0 +1,4 @@
1
+ import { Position as BluePosition } from "@morpho-org/blue-sdk";
2
+ import { fetchPosition } from "@morpho-org/blue-sdk-viem";
3
+ BluePosition.fetch = fetchPosition;
4
+ export { BluePosition as Position };
@@ -0,0 +1,8 @@
1
+ import { Token as BlueToken } from "@morpho-org/blue-sdk";
2
+ import { fetchToken } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace Token {
5
+ let fetch: typeof fetchToken;
6
+ }
7
+ }
8
+ export { BlueToken as Token };
@@ -0,0 +1,4 @@
1
+ import { Token as BlueToken } from "@morpho-org/blue-sdk";
2
+ import { fetchToken } from "@morpho-org/blue-sdk-viem";
3
+ BlueToken.fetch = fetchToken;
4
+ export { BlueToken as Token };
@@ -0,0 +1,8 @@
1
+ import { User as BlueUser } from "@morpho-org/blue-sdk";
2
+ import { fetchUser } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace User {
5
+ let fetch: typeof fetchUser;
6
+ }
7
+ }
8
+ export { BlueUser as User };
@@ -0,0 +1,4 @@
1
+ import { User as BlueUser } from "@morpho-org/blue-sdk";
2
+ import { fetchUser } from "@morpho-org/blue-sdk-viem";
3
+ BlueUser.fetch = fetchUser;
4
+ export { BlueUser as User };
@@ -0,0 +1,8 @@
1
+ import { Vault as BlueVault } from "@morpho-org/blue-sdk";
2
+ import { fetchVault } from "@morpho-org/blue-sdk-viem";
3
+ declare module "@morpho-org/blue-sdk" {
4
+ namespace Vault {
5
+ let fetch: typeof fetchVault;
6
+ }
7
+ }
8
+ export { BlueVault as Vault };
@@ -0,0 +1,4 @@
1
+ import { Vault as BlueVault } from "@morpho-org/blue-sdk";
2
+ import { fetchVault } from "@morpho-org/blue-sdk-viem";
3
+ BlueVault.fetch = fetchVault;
4
+ export { BlueVault as Vault };