@defisaver/positions-sdk 2.1.157 → 2.1.158-morpho-batch-dev

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.
@@ -1129,15 +1129,27 @@ exports.MorphoBlueView = {
1129
1129
  },
1130
1130
  };
1131
1131
  exports.MidnightView = {
1132
- "abi": [{ "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "getMarketInfo", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }, { "internalType": "uint128", "name": "totalUnits", "type": "uint128" }, { "internalType": "uint128", "name": "lossFactor", "type": "uint128" }, { "internalType": "uint128", "name": "withdrawable", "type": "uint128" }, { "internalType": "uint128", "name": "continuousFeeCredit", "type": "uint128" }, { "internalType": "uint16[7]", "name": "settlementFees", "type": "uint16[7]" }, { "internalType": "uint32", "name": "continuousFee", "type": "uint32" }, { "internalType": "uint8", "name": "tickSpacing", "type": "uint8" }, { "internalType": "uint256[]", "name": "prices", "type": "uint256[]" }], "internalType": "struct MidnightView.MarketInfo", "name": "info", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getPositionInfo", "outputs": [{ "components": [{ "internalType": "uint128", "name": "credit", "type": "uint128" }, { "internalType": "uint128", "name": "pendingFee", "type": "uint128" }, { "internalType": "uint128", "name": "debt", "type": "uint128" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "uint128[]", "name": "collateral", "type": "uint128[]" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }], "internalType": "struct MidnightView.PositionInfo", "name": "pos", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "ratio", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "_market", "type": "tuple" }], "name": "toId", "outputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "toMarket", "outputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "market", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
1132
+ "abi": [{ "inputs": [], "name": "InvalidCollateralIndex", "type": "error" }, { "inputs": [], "name": "InvalidOfferMarketId", "type": "error" }, { "inputs": [], "name": "InvalidOfferType", "type": "error" }, { "inputs": [], "name": "NoOrdersProvided", "type": "error" }, { "inputs": [], "name": "ZeroAmountRequested", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "getMarketInfo", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }, { "internalType": "uint128", "name": "totalUnits", "type": "uint128" }, { "internalType": "uint128", "name": "lossFactor", "type": "uint128" }, { "internalType": "uint128", "name": "withdrawable", "type": "uint128" }, { "internalType": "uint128", "name": "continuousFeeCredit", "type": "uint128" }, { "internalType": "uint16[7]", "name": "settlementFees", "type": "uint16[7]" }, { "internalType": "uint32", "name": "continuousFee", "type": "uint32" }, { "internalType": "uint8", "name": "tickSpacing", "type": "uint8" }, { "internalType": "uint256[]", "name": "prices", "type": "uint256[]" }], "internalType": "struct MidnightView.MarketInfo", "name": "info", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getPositionInfo", "outputs": [{ "components": [{ "internalType": "uint128", "name": "credit", "type": "uint128" }, { "internalType": "uint128", "name": "pendingFee", "type": "uint128" }, { "internalType": "uint128", "name": "debt", "type": "uint128" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "uint128[]", "name": "collateral", "type": "uint128[]" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }], "internalType": "struct MidnightView.PositionInfo", "name": "pos", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "ratio", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "_market", "type": "tuple" }], "name": "toId", "outputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "toMarket", "outputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "market", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
1133
1133
  "networks": {
1134
1134
  "1": {
1135
- "address": "0xB64FBf011343961D9AC4A04b714414E35ebE6BE0",
1136
- "createdBlock": 25938908,
1135
+ "address": "0xb8e1dAAd42e18203cfCED7193FE0e2E19d713A56",
1136
+ "createdBlock": 25983494,
1137
+ "oldVersions": {
1138
+ "25938908": {
1139
+ "abi": [{ "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "getMarketInfo", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }, { "internalType": "uint128", "name": "totalUnits", "type": "uint128" }, { "internalType": "uint128", "name": "lossFactor", "type": "uint128" }, { "internalType": "uint128", "name": "withdrawable", "type": "uint128" }, { "internalType": "uint128", "name": "continuousFeeCredit", "type": "uint128" }, { "internalType": "uint16[7]", "name": "settlementFees", "type": "uint16[7]" }, { "internalType": "uint32", "name": "continuousFee", "type": "uint32" }, { "internalType": "uint8", "name": "tickSpacing", "type": "uint8" }, { "internalType": "uint256[]", "name": "prices", "type": "uint256[]" }], "internalType": "struct MidnightView.MarketInfo", "name": "info", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getPositionInfo", "outputs": [{ "components": [{ "internalType": "uint128", "name": "credit", "type": "uint128" }, { "internalType": "uint128", "name": "pendingFee", "type": "uint128" }, { "internalType": "uint128", "name": "debt", "type": "uint128" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "uint128[]", "name": "collateral", "type": "uint128[]" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }], "internalType": "struct MidnightView.PositionInfo", "name": "pos", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "ratio", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "_market", "type": "tuple" }], "name": "toId", "outputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "toMarket", "outputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "market", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
1140
+ "address": "0xB64FBf011343961D9AC4A04b714414E35ebE6BE0",
1141
+ }
1142
+ },
1137
1143
  },
1138
1144
  "8453": {
1139
- "address": "0x3aa272f329E8B562A3bA56Bb6979a44D23A28839",
1140
- "createdBlock": 48932293,
1145
+ "address": "0xdEab43eb1519bD4314bc99c4019866734103D3Ae",
1146
+ "createdBlock": 51346932,
1147
+ "oldVersions": {
1148
+ "48932293": {
1149
+ "abi": [{ "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "getMarketInfo", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }, { "internalType": "uint128", "name": "totalUnits", "type": "uint128" }, { "internalType": "uint128", "name": "lossFactor", "type": "uint128" }, { "internalType": "uint128", "name": "withdrawable", "type": "uint128" }, { "internalType": "uint128", "name": "continuousFeeCredit", "type": "uint128" }, { "internalType": "uint16[7]", "name": "settlementFees", "type": "uint16[7]" }, { "internalType": "uint32", "name": "continuousFee", "type": "uint32" }, { "internalType": "uint8", "name": "tickSpacing", "type": "uint8" }, { "internalType": "uint256[]", "name": "prices", "type": "uint256[]" }], "internalType": "struct MidnightView.MarketInfo", "name": "info", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getPositionInfo", "outputs": [{ "components": [{ "internalType": "uint128", "name": "credit", "type": "uint128" }, { "internalType": "uint128", "name": "pendingFee", "type": "uint128" }, { "internalType": "uint128", "name": "debt", "type": "uint128" }, { "internalType": "uint128", "name": "collateralBitmap", "type": "uint128" }, { "internalType": "uint128[]", "name": "collateral", "type": "uint128[]" }, { "internalType": "uint256", "name": "ratio", "type": "uint256" }], "internalType": "struct MidnightView.PositionInfo", "name": "pos", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }, { "internalType": "address", "name": "_user", "type": "address" }], "name": "getRatio", "outputs": [{ "internalType": "uint256", "name": "ratio", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "_market", "type": "tuple" }], "name": "toId", "outputs": [{ "internalType": "bytes32", "name": "id", "type": "bytes32" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "_id", "type": "bytes32" }], "name": "toMarket", "outputs": [{ "components": [{ "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "midnight", "type": "address" }, { "internalType": "address", "name": "loanToken", "type": "address" }, { "components": [{ "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "lltv", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationCursor", "type": "uint256" }, { "internalType": "address", "name": "oracle", "type": "address" }], "internalType": "struct CollateralParams[]", "name": "collateralParams", "type": "tuple[]" }, { "internalType": "uint256", "name": "maturity", "type": "uint256" }, { "internalType": "uint256", "name": "rcfThreshold", "type": "uint256" }, { "internalType": "address", "name": "enterGate", "type": "address" }, { "internalType": "address", "name": "liquidatorGate", "type": "address" }], "internalType": "struct Market", "name": "market", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
1150
+ "address": "0x3aa272f329E8B562A3bA56Bb6979a44D23A28839",
1151
+ }
1152
+ },
1141
1153
  }
1142
1154
  },
1143
1155
  };
@@ -100745,6 +100745,26 @@ export declare const MorphoBlueViewContractViem: (client: Client, network: Netwo
100745
100745
  export declare const MorphoMidnightViewContractViem: (client: Client, network: NetworkNumber, block?: Blockish) => {
100746
100746
  read: {
100747
100747
  getRatio: (args: readonly [`0x${string}`, `0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
100748
+ readonly inputs: readonly [];
100749
+ readonly name: "InvalidCollateralIndex";
100750
+ readonly type: "error";
100751
+ }, {
100752
+ readonly inputs: readonly [];
100753
+ readonly name: "InvalidOfferMarketId";
100754
+ readonly type: "error";
100755
+ }, {
100756
+ readonly inputs: readonly [];
100757
+ readonly name: "InvalidOfferType";
100758
+ readonly type: "error";
100759
+ }, {
100760
+ readonly inputs: readonly [];
100761
+ readonly name: "NoOrdersProvided";
100762
+ readonly type: "error";
100763
+ }, {
100764
+ readonly inputs: readonly [];
100765
+ readonly name: "ZeroAmountRequested";
100766
+ readonly type: "error";
100767
+ }, {
100748
100768
  readonly inputs: readonly [{
100749
100769
  readonly internalType: "bytes32";
100750
100770
  readonly name: "_id";
@@ -100986,6 +101006,26 @@ export declare const MorphoMidnightViewContractViem: (client: Client, network: N
100986
101006
  readonly type: "function";
100987
101007
  }], "getRatio", readonly [`0x${string}`, `0x${string}`]>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<bigint>;
100988
101008
  getMarketInfo: (args: readonly [`0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
101009
+ readonly inputs: readonly [];
101010
+ readonly name: "InvalidCollateralIndex";
101011
+ readonly type: "error";
101012
+ }, {
101013
+ readonly inputs: readonly [];
101014
+ readonly name: "InvalidOfferMarketId";
101015
+ readonly type: "error";
101016
+ }, {
101017
+ readonly inputs: readonly [];
101018
+ readonly name: "InvalidOfferType";
101019
+ readonly type: "error";
101020
+ }, {
101021
+ readonly inputs: readonly [];
101022
+ readonly name: "NoOrdersProvided";
101023
+ readonly type: "error";
101024
+ }, {
101025
+ readonly inputs: readonly [];
101026
+ readonly name: "ZeroAmountRequested";
101027
+ readonly type: "error";
101028
+ }, {
100989
101029
  readonly inputs: readonly [{
100990
101030
  readonly internalType: "bytes32";
100991
101031
  readonly name: "_id";
@@ -101237,6 +101277,26 @@ export declare const MorphoMidnightViewContractViem: (client: Client, network: N
101237
101277
  prices: readonly bigint[];
101238
101278
  }>;
101239
101279
  getPositionInfo: (args: readonly [`0x${string}`, `0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
101280
+ readonly inputs: readonly [];
101281
+ readonly name: "InvalidCollateralIndex";
101282
+ readonly type: "error";
101283
+ }, {
101284
+ readonly inputs: readonly [];
101285
+ readonly name: "InvalidOfferMarketId";
101286
+ readonly type: "error";
101287
+ }, {
101288
+ readonly inputs: readonly [];
101289
+ readonly name: "InvalidOfferType";
101290
+ readonly type: "error";
101291
+ }, {
101292
+ readonly inputs: readonly [];
101293
+ readonly name: "NoOrdersProvided";
101294
+ readonly type: "error";
101295
+ }, {
101296
+ readonly inputs: readonly [];
101297
+ readonly name: "ZeroAmountRequested";
101298
+ readonly type: "error";
101299
+ }, {
101240
101300
  readonly inputs: readonly [{
101241
101301
  readonly internalType: "bytes32";
101242
101302
  readonly name: "_id";
@@ -101499,6 +101559,26 @@ export declare const MorphoMidnightViewContractViem: (client: Client, network: N
101499
101559
  enterGate: `0x${string}`;
101500
101560
  liquidatorGate: `0x${string}`;
101501
101561
  }], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
101562
+ readonly inputs: readonly [];
101563
+ readonly name: "InvalidCollateralIndex";
101564
+ readonly type: "error";
101565
+ }, {
101566
+ readonly inputs: readonly [];
101567
+ readonly name: "InvalidOfferMarketId";
101568
+ readonly type: "error";
101569
+ }, {
101570
+ readonly inputs: readonly [];
101571
+ readonly name: "InvalidOfferType";
101572
+ readonly type: "error";
101573
+ }, {
101574
+ readonly inputs: readonly [];
101575
+ readonly name: "NoOrdersProvided";
101576
+ readonly type: "error";
101577
+ }, {
101578
+ readonly inputs: readonly [];
101579
+ readonly name: "ZeroAmountRequested";
101580
+ readonly type: "error";
101581
+ }, {
101502
101582
  readonly inputs: readonly [{
101503
101583
  readonly internalType: "bytes32";
101504
101584
  readonly name: "_id";
@@ -101754,6 +101834,26 @@ export declare const MorphoMidnightViewContractViem: (client: Client, network: N
101754
101834
  liquidatorGate: `0x${string}`;
101755
101835
  }]>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<`0x${string}`>;
101756
101836
  toMarket: (args: readonly [`0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
101837
+ readonly inputs: readonly [];
101838
+ readonly name: "InvalidCollateralIndex";
101839
+ readonly type: "error";
101840
+ }, {
101841
+ readonly inputs: readonly [];
101842
+ readonly name: "InvalidOfferMarketId";
101843
+ readonly type: "error";
101844
+ }, {
101845
+ readonly inputs: readonly [];
101846
+ readonly name: "InvalidOfferType";
101847
+ readonly type: "error";
101848
+ }, {
101849
+ readonly inputs: readonly [];
101850
+ readonly name: "NoOrdersProvided";
101851
+ readonly type: "error";
101852
+ }, {
101853
+ readonly inputs: readonly [];
101854
+ readonly name: "ZeroAmountRequested";
101855
+ readonly type: "error";
101856
+ }, {
101757
101857
  readonly inputs: readonly [{
101758
101858
  readonly internalType: "bytes32";
101759
101859
  readonly name: "_id";
@@ -102011,6 +102111,26 @@ export declare const MorphoMidnightViewContractViem: (client: Client, network: N
102011
102111
  };
102012
102112
  address: `0x${string}`;
102013
102113
  abi: readonly [{
102114
+ readonly inputs: readonly [];
102115
+ readonly name: "InvalidCollateralIndex";
102116
+ readonly type: "error";
102117
+ }, {
102118
+ readonly inputs: readonly [];
102119
+ readonly name: "InvalidOfferMarketId";
102120
+ readonly type: "error";
102121
+ }, {
102122
+ readonly inputs: readonly [];
102123
+ readonly name: "InvalidOfferType";
102124
+ readonly type: "error";
102125
+ }, {
102126
+ readonly inputs: readonly [];
102127
+ readonly name: "NoOrdersProvided";
102128
+ readonly type: "error";
102129
+ }, {
102130
+ readonly inputs: readonly [];
102131
+ readonly name: "ZeroAmountRequested";
102132
+ readonly type: "error";
102133
+ }, {
102014
102134
  readonly inputs: readonly [{
102015
102135
  readonly internalType: "bytes32";
102016
102136
  readonly name: "_id";
@@ -69,16 +69,16 @@ const getSavingsData = (provider, network, accounts) => __awaiter(void 0, void 0
69
69
  const savingsData = {};
70
70
  yield Promise.all([
71
71
  ...(network === common_1.NetworkNumber.Eth ? [
72
- ...morphoVaultsList.map((vaultKey) => __awaiter(void 0, void 0, void 0, function* () {
72
+ (() => __awaiter(void 0, void 0, void 0, function* () {
73
73
  try {
74
- const vault = morphoVaults.morphoVaultsOptions.getMorphoVault(vaultKey);
75
- const data = yield morphoVaults.getMorphoVaultData(provider, network, vault, accounts);
76
- savingsData[vaultKey] = data;
74
+ const vaults = morphoVaultsList.map((vaultKey) => morphoVaults.morphoVaultsOptions.getMorphoVault(vaultKey));
75
+ const data = yield morphoVaults.getMorphoVaultsData(provider, network, vaults, accounts);
76
+ Object.assign(savingsData, data);
77
77
  }
78
78
  catch (err) {
79
- console.error(`[getSavingsData] Error fetching morpho vault ${vaultKey}:`, err);
79
+ console.error('[getSavingsData] Error fetching morpho vaults:', err);
80
80
  }
81
- })),
81
+ }))(),
82
82
  ...yearnVaultsList.map((vaultKey) => __awaiter(void 0, void 0, void 0, function* () {
83
83
  try {
84
84
  const vault = yearnVaults.yearnVaultsOptions.getYearnVault(vaultKey);
@@ -1,7 +1,19 @@
1
1
  import { Client } from 'viem';
2
2
  import * as morphoVaultsOptions from './options';
3
- import { EthAddress, EthereumProvider, NetworkNumber } from '../../types/common';
4
- import { MorphoVault, SavingsVaultData } from '../../types';
3
+ import { EthAddress, EthereumProvider, NetworkNumber, MorphoVault, MorphoVaultType, SavingsVaultData } from '../../types';
5
4
  export { morphoVaultsOptions, };
6
- export declare const _getMorphoVaultData: (provider: Client, network: NetworkNumber, morphoVault: MorphoVault, accounts: EthAddress[]) => Promise<SavingsVaultData>;
5
+ /**
6
+ * Fetches liquidity for all given vaults in a single API request (chunked if over the page cap),
7
+ * returned as a map keyed by lowercased vault address. A vault missing from the API response is
8
+ * absent from the map.
9
+ */
10
+ export declare const fetchMorphoVaultsLiquidity: (network: NetworkNumber, vaults: MorphoVault[]) => Promise<Record<string, string>>;
11
+ /**
12
+ * Fetches data for all given vaults with a single Morpho API request for their liquidity,
13
+ * instead of one request per vault. The on-chain reads run in parallel with the API request.
14
+ * A vault whose on-chain reads fail or that is missing from the API response is left out of
15
+ * the result; a failed API request rejects, leaving all vaults out.
16
+ */
17
+ export declare const _getMorphoVaultsData: (provider: Client, network: NetworkNumber, vaults: MorphoVault[], accounts: EthAddress[]) => Promise<Partial<Record<MorphoVaultType, SavingsVaultData>>>;
18
+ export declare function getMorphoVaultsData(provider: EthereumProvider, network: NetworkNumber, vaults: MorphoVault[], accounts: EthAddress[]): Promise<Partial<Record<MorphoVaultType, SavingsVaultData>>>;
7
19
  export declare function getMorphoVaultData(provider: EthereumProvider, network: NetworkNumber, morphoVault: MorphoVault, accounts: EthAddress[]): Promise<SavingsVaultData>;
@@ -45,7 +45,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports._getMorphoVaultData = exports.morphoVaultsOptions = void 0;
48
+ exports._getMorphoVaultsData = exports.fetchMorphoVaultsLiquidity = exports.morphoVaultsOptions = void 0;
49
+ exports.getMorphoVaultsData = getMorphoVaultsData;
49
50
  exports.getMorphoVaultData = getMorphoVaultData;
50
51
  const decimal_js_1 = __importDefault(require("decimal.js"));
51
52
  const graphql_request_1 = require("graphql-request");
@@ -54,38 +55,74 @@ const morphoVaultsOptions = __importStar(require("./options"));
54
55
  exports.morphoVaultsOptions = morphoVaultsOptions;
55
56
  const viem_1 = require("../../services/viem");
56
57
  const contracts_1 = require("../../contracts");
57
- const vaultDataQuery = `
58
- query VaultByAddress($address: String!, $chainId: Int!) {
59
- vaultByAddress(address: $address, chainId: $chainId) {
60
- address
61
- state {
62
- totalAssets
63
- totalAssetsUsd
64
- totalSupply
65
- }
66
- liquidity {
67
- underlying
68
- usd
58
+ const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
59
+ // Morpho API caps list page size at 100 items
60
+ const MORPHO_API_PAGE_SIZE = 100;
61
+ const vaultsLiquidityQuery = `
62
+ query VaultsLiquidity($addresses: [String!], $chainIds: [Int!]) {
63
+ vaults(first: ${MORPHO_API_PAGE_SIZE}, where: { address_in: $addresses, chainId_in: $chainIds }) {
64
+ items {
65
+ address
66
+ liquidity {
67
+ underlying
68
+ }
69
69
  }
70
70
  }
71
71
  }`;
72
- const MORPHO_BLUE_API = 'https://api.morpho.org/graphql';
73
- const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
72
+ /**
73
+ * Fetches liquidity for all given vaults in a single API request (chunked if over the page cap),
74
+ * returned as a map keyed by lowercased vault address. A vault missing from the API response is
75
+ * absent from the map.
76
+ */
77
+ const fetchMorphoVaultsLiquidity = (network, vaults) => __awaiter(void 0, void 0, void 0, function* () {
78
+ const chunks = [];
79
+ for (let i = 0; i < vaults.length; i += MORPHO_API_PAGE_SIZE)
80
+ chunks.push(vaults.slice(i, i + MORPHO_API_PAGE_SIZE));
81
+ const liquidityByAddress = {};
82
+ yield Promise.all(chunks.map((chunk) => __awaiter(void 0, void 0, void 0, function* () {
83
+ const data = yield (0, graphql_request_1.request)(MORPHO_BLUE_API, vaultsLiquidityQuery, {
84
+ addresses: chunk.map((vault) => vault.address),
85
+ chainIds: [network],
86
+ // the BigInt scalar serializes as a JSON number when it fits in Number.MAX_SAFE_INTEGER, a string otherwise
87
+ });
88
+ (data.vaults.items || []).forEach((item) => {
89
+ var _a, _b;
90
+ if (((_a = item === null || item === void 0 ? void 0 : item.liquidity) === null || _a === void 0 ? void 0 : _a.underlying) !== undefined && ((_b = item.liquidity) === null || _b === void 0 ? void 0 : _b.underlying) !== null) {
91
+ liquidityByAddress[item.address.toLowerCase()] = String(item.liquidity.underlying);
92
+ }
93
+ });
94
+ })));
95
+ return liquidityByAddress;
96
+ });
97
+ exports.fetchMorphoVaultsLiquidity = fetchMorphoVaultsLiquidity;
98
+ const getBatchedViemProvider = (provider, network) => (0, viem_1.getViemProvider)(provider, network, {
99
+ batch: {
100
+ multicall: {
101
+ batchSize: 2500000,
102
+ },
103
+ },
104
+ });
105
+ const getMorphoVaultChainData = (provider, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
74
106
  const morphoVaultContract = (0, contracts_1.getMorphoVaultContractViem)(provider, morphoVault.address);
75
107
  const shares = {};
76
- const [totalAssets, totalSupply, decimals, decimalsOffset, vaultData] = yield Promise.all([
108
+ const [totalAssets, totalSupply, decimals, decimalsOffset] = yield Promise.all([
77
109
  morphoVaultContract.read.totalAssets(),
78
110
  morphoVaultContract.read.totalSupply(),
79
111
  morphoVaultContract.read.decimals(),
80
112
  morphoVaultContract.read.DECIMALS_OFFSET(),
81
- (0, graphql_request_1.request)(MORPHO_BLUE_API, vaultDataQuery, { address: morphoVault.address, chainId: network }),
82
113
  ...accounts.map((account) => __awaiter(void 0, void 0, void 0, function* () {
83
114
  const share = yield morphoVaultContract.read.balanceOf([account]);
84
115
  shares[account] = share;
85
116
  })),
86
117
  ]);
118
+ return {
119
+ totalAssets, totalSupply, decimals, decimalsOffset, shares,
120
+ };
121
+ });
122
+ const formatMorphoVaultData = (morphoVault, chainData, liquidityUnderlying, accounts) => {
123
+ const { totalAssets, totalSupply, decimals, decimalsOffset, shares, } = chainData;
87
124
  const poolSize = (0, tokens_1.assetAmountInEth)(totalAssets.toString(), morphoVault.asset);
88
- const liquidity = (0, tokens_1.assetAmountInEth)(vaultData.vaultByAddress.liquidity.underlying, morphoVault.asset);
125
+ const liquidity = (0, tokens_1.assetAmountInEth)(liquidityUnderlying, morphoVault.asset);
89
126
  const supplied = {};
90
127
  accounts.forEach((account) => {
91
128
  const share = shares[account] || BigInt(0);
@@ -100,16 +137,50 @@ const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awai
100
137
  asset: morphoVault.asset,
101
138
  optionType: morphoVault.type,
102
139
  };
140
+ };
141
+ /**
142
+ * Fetches data for all given vaults with a single Morpho API request for their liquidity,
143
+ * instead of one request per vault. The on-chain reads run in parallel with the API request.
144
+ * A vault whose on-chain reads fail or that is missing from the API response is left out of
145
+ * the result; a failed API request rejects, leaving all vaults out.
146
+ */
147
+ const _getMorphoVaultsData = (provider, network, vaults, accounts) => __awaiter(void 0, void 0, void 0, function* () {
148
+ const [liquidityByAddress, chainData] = yield Promise.all([
149
+ (0, exports.fetchMorphoVaultsLiquidity)(network, vaults),
150
+ Promise.all(vaults.map((vault) => getMorphoVaultChainData(provider, vault, accounts).catch((err) => {
151
+ console.error(`[getMorphoVaultsData] Error fetching on-chain data for morpho vault ${vault.type}:`, err);
152
+ return null;
153
+ }))),
154
+ ]);
155
+ const savingsData = {};
156
+ vaults.forEach((vault, i) => {
157
+ const vaultChainData = chainData[i];
158
+ if (!vaultChainData)
159
+ return;
160
+ const liquidityUnderlying = liquidityByAddress[vault.address.toLowerCase()];
161
+ if (liquidityUnderlying === undefined) {
162
+ console.error(`[getMorphoVaultsData] Vault ${vault.type} (${vault.address}) missing from Morpho API response`);
163
+ return;
164
+ }
165
+ savingsData[vault.type] = formatMorphoVaultData(vault, vaultChainData, liquidityUnderlying, accounts);
166
+ });
167
+ return savingsData;
103
168
  });
104
- exports._getMorphoVaultData = _getMorphoVaultData;
169
+ exports._getMorphoVaultsData = _getMorphoVaultsData;
170
+ function getMorphoVaultsData(provider, network, vaults, accounts) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ return (0, exports._getMorphoVaultsData)(getBatchedViemProvider(provider, network), network, vaults, accounts);
173
+ });
174
+ }
105
175
  function getMorphoVaultData(provider, network, morphoVault, accounts) {
106
176
  return __awaiter(this, void 0, void 0, function* () {
107
- return (0, exports._getMorphoVaultData)((0, viem_1.getViemProvider)(provider, network, {
108
- batch: {
109
- multicall: {
110
- batchSize: 2500000,
111
- },
112
- },
113
- }), network, morphoVault, accounts);
177
+ const [liquidityByAddress, chainData] = yield Promise.all([
178
+ (0, exports.fetchMorphoVaultsLiquidity)(network, [morphoVault]),
179
+ getMorphoVaultChainData(getBatchedViemProvider(provider, network), morphoVault, accounts),
180
+ ]);
181
+ const liquidityUnderlying = liquidityByAddress[morphoVault.address.toLowerCase()];
182
+ if (liquidityUnderlying === undefined)
183
+ throw new Error(`Vault ${morphoVault.address} missing from Morpho API response`);
184
+ return formatMorphoVaultData(morphoVault, chainData, liquidityUnderlying, accounts);
114
185
  });
115
186
  }
@@ -29,7 +29,9 @@ export interface IncentiveData {
29
29
  apy: string;
30
30
  incentiveKind?: IncentiveKind;
31
31
  source?: IncentiveSource;
32
+ name?: string;
32
33
  description?: string;
34
+ endTimestamp?: number;
33
35
  eligibilityId?: IncentiveEligibilityId;
34
36
  }
35
37
  export type EthAddress = HexString;
@@ -11,8 +11,6 @@ export declare enum OpportunityStatus {
11
11
  export type MerklCampaign = {
12
12
  id: string;
13
13
  campaignId: string;
14
- startTimestamp?: number;
15
- endTimestamp?: number;
16
14
  /**
17
15
  * Merkl-internal `id` of the parent campaign — set on child campaigns, which re-publish a hub
18
16
  * (parent) campaign's reward scoped to a single spoke reserve. Absent on standalone campaigns,
@@ -20,12 +18,49 @@ export type MerklCampaign = {
20
18
  */
21
19
  parentCampaignId?: string;
22
20
  childCampaignIds?: string[];
21
+ startTimestamp?: number;
22
+ endTimestamp?: number;
23
23
  params?: {
24
24
  reserveId?: string | number;
25
25
  spokeAddress?: EthAddress;
26
26
  hubAddress?: EthAddress;
27
27
  hubAssetId?: string | number;
28
28
  assetId?: string | number;
29
+ /**
30
+ * AAVE_V4_HUB_NET_* campaigns scope per hub: the reward applies to the ids on the campaign's
31
+ * own side (`lendingAssetIds` for LEND, `borrowAssetIds` for BORROW) — the opposite-side ids
32
+ * only describe positions that reduce the net accrual, so they never map to a reward.
33
+ */
34
+ hubs?: {
35
+ hubAddress: EthAddress;
36
+ assets?: {
37
+ symbol: string;
38
+ assetId: string | number;
39
+ decimals?: number;
40
+ underlyingToken?: EthAddress;
41
+ }[];
42
+ lendingAssetIds?: (string | number)[];
43
+ borrowAssetIds?: (string | number)[];
44
+ }[];
45
+ /** AAVE_V4_SPOKE_NET_* campaigns scope per spoke, with the same own-side rule as `hubs`. */
46
+ spokes?: {
47
+ spokeAddress: EthAddress;
48
+ spokeName?: string;
49
+ supplyTokens?: {
50
+ symbol: string;
51
+ reserveId: string | number;
52
+ hubAddress?: EthAddress;
53
+ hubAssetId?: string | number;
54
+ underlyingToken?: EthAddress;
55
+ }[];
56
+ borrowTokens?: {
57
+ symbol: string;
58
+ reserveId: string | number;
59
+ hubAddress?: EthAddress;
60
+ hubAssetId?: string | number;
61
+ underlyingToken?: EthAddress;
62
+ }[];
63
+ }[];
29
64
  distributionMethodParameters?: {
30
65
  distributionMethod?: string;
31
66
  distributionSettings?: {
@@ -31,6 +31,7 @@ export const AAVE_V4_TOKENIZED_SPOKES = {
31
31
  USDC_PRIME: '0x486415fb1F8b062c89ED548f871cf64304AACb31',
32
32
  USDT_PRIME: '0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D',
33
33
  USDC_PAXOS: '0xaed7c529bD2878170B61C758DfAa215AC7a4FD07',
34
+ USDG_PAXOS: '0x378B4a7c394E22bd562F66eB612165893533c124',
34
35
  USDT_PAXOS: '0xa0e97e45C2f89003730E467Bd484fA3eEcE5B4Cf',
35
36
  PT_USDG_Sep_PAXOS: '0x7Df10B4A01350D2A1d95cFbE7c9207d7210A2663',
36
37
  };