@upshiftfinance/sdk 0.0.0-stage → 0.1.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 (346) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -2
  3. package/lib/abis/AddressResolver.d.ts +28 -0
  4. package/lib/abis/AddressResolver.js +23 -0
  5. package/lib/abis/ChainlinkV3.d.ts +87 -0
  6. package/lib/abis/ChainlinkV3.js +117 -0
  7. package/lib/abis/ERC20.d.ts +168 -0
  8. package/lib/abis/ERC20.js +226 -0
  9. package/lib/abis/ERC20_Bytes32.d.ts +139 -0
  10. package/lib/abis/ERC20_Bytes32.js +196 -0
  11. package/lib/abis/ERC4626.d.ts +364 -0
  12. package/lib/abis/ERC4626.js +507 -0
  13. package/lib/abis/ERC721.d.ts +231 -0
  14. package/lib/abis/ERC721.js +321 -0
  15. package/lib/abis/FeeOracle.d.ts +120 -0
  16. package/lib/abis/FeeOracle.js +162 -0
  17. package/lib/abis/LendingPool.d.ts +1393 -0
  18. package/lib/abis/LendingPool.js +1807 -0
  19. package/lib/abis/LendingPoolV2.d.ts +1413 -0
  20. package/lib/abis/LendingPoolV2.js +1833 -0
  21. package/lib/abis/LendingPoolV3.d.ts +1677 -0
  22. package/lib/abis/LendingPoolV3.js +1160 -0
  23. package/lib/abis/Loan.d.ts +837 -0
  24. package/lib/abis/Loan.js +1080 -0
  25. package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
  26. package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
  27. package/lib/abis/Multicall3.d.ts +30 -0
  28. package/lib/abis/Multicall3.js +97 -0
  29. package/lib/abis/OFT.d.ts +116 -0
  30. package/lib/abis/OFT.js +85 -0
  31. package/lib/abis/PoolAdapter.d.ts +36 -0
  32. package/lib/abis/PoolAdapter.js +51 -0
  33. package/lib/abis/RewardDistributor.d.ts +267 -0
  34. package/lib/abis/RewardDistributor.js +352 -0
  35. package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
  36. package/lib/abis/RwaRedeemSubaccount.js +548 -0
  37. package/lib/abis/SmartAccount.d.ts +17 -0
  38. package/lib/abis/SmartAccount.js +19 -0
  39. package/lib/abis/SwapRouter.d.ts +953 -0
  40. package/lib/abis/SwapRouter.js +1228 -0
  41. package/lib/abis/TextResolver.d.ts +16 -0
  42. package/lib/abis/TextResolver.js +16 -0
  43. package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
  44. package/lib/abis/TokenizedVaultV2.js +1041 -0
  45. package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
  46. package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
  47. package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
  48. package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
  49. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
  50. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
  51. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
  52. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
  53. package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
  54. package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
  55. package/lib/abis/UniversalResolverResolve.d.ts +69 -0
  56. package/lib/abis/UniversalResolverResolve.js +35 -0
  57. package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
  58. package/lib/abis/UniversalSignatureValidator.js +30 -0
  59. package/lib/abis/WrapperAdapter.d.ts +71 -0
  60. package/lib/abis/WrapperAdapter.js +77 -0
  61. package/lib/abis/index.d.ts +34 -0
  62. package/lib/abis/index.js +51 -0
  63. package/lib/adapters/evm/getters.d.ts +19 -0
  64. package/lib/adapters/evm/getters.js +249 -0
  65. package/lib/adapters/evm/index.d.ts +539 -0
  66. package/lib/adapters/evm/index.js +656 -0
  67. package/lib/adapters/evm/utils.d.ts +8 -0
  68. package/lib/adapters/evm/utils.js +51 -0
  69. package/lib/adapters/solana/confirm.d.ts +88 -0
  70. package/lib/adapters/solana/confirm.js +291 -0
  71. package/lib/adapters/solana/constants.d.ts +42 -0
  72. package/lib/adapters/solana/constants.js +59 -0
  73. package/lib/adapters/solana/getters.d.ts +42 -0
  74. package/lib/adapters/solana/getters.js +275 -0
  75. package/lib/adapters/solana/idl/vault-idl.d.ts +700 -0
  76. package/lib/adapters/solana/idl/vault-idl.js +2101 -0
  77. package/lib/adapters/solana/idl/withdrawal-queue-idl.d.ts +795 -0
  78. package/lib/adapters/solana/idl/withdrawal-queue-idl.js +1864 -0
  79. package/lib/adapters/solana/index.d.ts +372 -0
  80. package/lib/adapters/solana/index.js +459 -0
  81. package/lib/adapters/solana/pricing.d.ts +184 -0
  82. package/lib/adapters/solana/pricing.js +239 -0
  83. package/lib/adapters/solana/queue-hints.d.ts +29 -0
  84. package/lib/adapters/solana/queue-hints.js +59 -0
  85. package/lib/adapters/solana/queue.actions.d.ts +97 -0
  86. package/lib/adapters/solana/queue.actions.js +468 -0
  87. package/lib/adapters/solana/token-reads.d.ts +108 -0
  88. package/lib/adapters/solana/token-reads.js +145 -0
  89. package/lib/adapters/solana/types.d.ts +325 -0
  90. package/lib/adapters/solana/types.js +3 -0
  91. package/lib/adapters/solana/utils.d.ts +229 -0
  92. package/lib/adapters/solana/utils.js +773 -0
  93. package/lib/adapters/solana/vault.actions.d.ts +140 -0
  94. package/lib/adapters/solana/vault.actions.js +657 -0
  95. package/lib/adapters/solana/withdrawal-queue.d.ts +125 -0
  96. package/lib/adapters/solana/withdrawal-queue.js +301 -0
  97. package/lib/adapters/stellar/actions.d.ts +41 -0
  98. package/lib/adapters/stellar/actions.js +126 -0
  99. package/lib/adapters/stellar/constants.d.ts +43 -0
  100. package/lib/adapters/stellar/constants.js +53 -0
  101. package/lib/adapters/stellar/getters.d.ts +68 -0
  102. package/lib/adapters/stellar/getters.js +290 -0
  103. package/lib/adapters/stellar/index.d.ts +126 -0
  104. package/lib/adapters/stellar/index.js +187 -0
  105. package/lib/adapters/stellar/invocation.d.ts +55 -0
  106. package/lib/adapters/stellar/invocation.js +92 -0
  107. package/lib/adapters/stellar/soroban.d.ts +131 -0
  108. package/lib/adapters/stellar/soroban.js +617 -0
  109. package/lib/adapters/stellar/submit.d.ts +42 -0
  110. package/lib/adapters/stellar/submit.js +195 -0
  111. package/lib/adapters/stellar/types.d.ts +57 -0
  112. package/lib/adapters/stellar/types.js +6 -0
  113. package/lib/adapters/stellar/utils.d.ts +24 -0
  114. package/lib/adapters/stellar/utils.js +34 -0
  115. package/lib/adapters/sui/constants.d.ts +1 -0
  116. package/lib/adapters/sui/constants.js +9 -0
  117. package/lib/adapters/sui/getters.d.ts +24 -0
  118. package/lib/adapters/sui/getters.js +134 -0
  119. package/lib/adapters/sui/index.d.ts +53 -0
  120. package/lib/adapters/sui/index.js +96 -0
  121. package/lib/adapters/sui/transformer.d.ts +10 -0
  122. package/lib/adapters/sui/transformer.js +115 -0
  123. package/lib/adapters/sui/types.d.ts +70 -0
  124. package/lib/adapters/sui/types.js +3 -0
  125. package/lib/adapters/sui/utils.d.ts +8 -0
  126. package/lib/adapters/sui/utils.js +17 -0
  127. package/lib/core/analytics/app-name.d.ts +27 -0
  128. package/lib/core/analytics/app-name.js +48 -0
  129. package/lib/core/analytics/chain-name.d.ts +9 -0
  130. package/lib/core/analytics/chain-name.js +34 -0
  131. package/lib/core/analytics/constants.d.ts +15 -0
  132. package/lib/core/analytics/constants.js +28 -0
  133. package/lib/core/analytics/env.d.ts +46 -0
  134. package/lib/core/analytics/env.js +147 -0
  135. package/lib/core/analytics/index.d.ts +39 -0
  136. package/lib/core/analytics/index.js +83 -0
  137. package/lib/core/analytics/instrumentation.d.ts +29 -0
  138. package/lib/core/analytics/instrumentation.js +292 -0
  139. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  140. package/lib/core/analytics/method-taxonomy.js +156 -0
  141. package/lib/core/analytics/metrics.d.ts +48 -0
  142. package/lib/core/analytics/metrics.js +142 -0
  143. package/lib/core/analytics/sanitize.d.ts +57 -0
  144. package/lib/core/analytics/sanitize.js +272 -0
  145. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  146. package/lib/core/analytics/sentry-runtime.js +131 -0
  147. package/lib/core/analytics/sentry.d.ts +100 -0
  148. package/lib/core/analytics/sentry.js +696 -0
  149. package/lib/core/analytics/types.d.ts +55 -0
  150. package/lib/core/analytics/types.js +3 -0
  151. package/lib/core/analytics/user-identity.d.ts +55 -0
  152. package/lib/core/analytics/user-identity.js +218 -0
  153. package/lib/core/analytics/version.d.ts +6 -0
  154. package/lib/core/analytics/version.js +10 -0
  155. package/lib/core/attribution.d.ts +159 -0
  156. package/lib/core/attribution.js +194 -0
  157. package/lib/core/auth/index.d.ts +1 -0
  158. package/lib/core/auth/index.js +18 -0
  159. package/lib/core/auth/verify.d.ts +2 -0
  160. package/lib/core/auth/verify.js +35 -0
  161. package/lib/core/base.class.d.ts +193 -0
  162. package/lib/core/base.class.js +163 -0
  163. package/lib/core/cache.d.ts +9 -0
  164. package/lib/core/cache.js +31 -0
  165. package/lib/core/constants/adapters.d.ts +103 -0
  166. package/lib/core/constants/adapters.js +180 -0
  167. package/lib/core/constants/core.d.ts +162 -0
  168. package/lib/core/constants/core.js +281 -0
  169. package/lib/core/constants/swap-router.d.ts +180 -0
  170. package/lib/core/constants/swap-router.js +203 -0
  171. package/lib/core/constants/vaults.d.ts +93 -0
  172. package/lib/core/constants/vaults.js +277 -0
  173. package/lib/core/constants/web3.d.ts +106 -0
  174. package/lib/core/constants/web3.js +251 -0
  175. package/lib/core/errors/index.d.ts +177 -0
  176. package/lib/core/errors/index.js +257 -0
  177. package/lib/core/fetcher.d.ts +237 -0
  178. package/lib/core/fetcher.js +1103 -0
  179. package/lib/core/helpers/adapters.d.ts +13 -0
  180. package/lib/core/helpers/adapters.js +39 -0
  181. package/lib/core/helpers/chain-address.d.ts +13 -0
  182. package/lib/core/helpers/chain-address.js +47 -0
  183. package/lib/core/helpers/chain-error.d.ts +207 -0
  184. package/lib/core/helpers/chain-error.js +697 -0
  185. package/lib/core/helpers/chain-support.d.ts +98 -0
  186. package/lib/core/helpers/chain-support.js +139 -0
  187. package/lib/core/helpers/concurrency.d.ts +51 -0
  188. package/lib/core/helpers/concurrency.js +79 -0
  189. package/lib/core/helpers/core.d.ts +92 -0
  190. package/lib/core/helpers/core.js +368 -0
  191. package/lib/core/helpers/explorer-link.d.ts +16 -0
  192. package/lib/core/helpers/explorer-link.js +26 -0
  193. package/lib/core/helpers/multicall.d.ts +68 -0
  194. package/lib/core/helpers/multicall.js +103 -0
  195. package/lib/core/helpers/revert-decode.d.ts +248 -0
  196. package/lib/core/helpers/revert-decode.js +515 -0
  197. package/lib/core/helpers/signer.d.ts +61 -0
  198. package/lib/core/helpers/signer.js +184 -0
  199. package/lib/core/helpers/swap-router.d.ts +269 -0
  200. package/lib/core/helpers/swap-router.js +542 -0
  201. package/lib/core/helpers/vault-version.d.ts +24 -0
  202. package/lib/core/helpers/vault-version.js +83 -0
  203. package/lib/core/helpers/vaults.d.ts +89 -0
  204. package/lib/core/helpers/vaults.js +241 -0
  205. package/lib/core/helpers/web3.d.ts +366 -0
  206. package/lib/core/helpers/web3.js +1034 -0
  207. package/lib/core/index.d.ts +23 -0
  208. package/lib/core/index.js +40 -0
  209. package/lib/core/logger/curator-alert.d.ts +217 -0
  210. package/lib/core/logger/curator-alert.js +276 -0
  211. package/lib/core/logger/index.d.ts +99 -0
  212. package/lib/core/logger/index.js +163 -0
  213. package/lib/core/logger/slack.d.ts +49 -0
  214. package/lib/core/logger/slack.js +111 -0
  215. package/lib/core/vault-metadata.d.ts +12 -0
  216. package/lib/core/vault-metadata.js +42 -0
  217. package/lib/core/version-check.d.ts +58 -0
  218. package/lib/core/version-check.js +182 -0
  219. package/lib/evm/index.d.ts +2 -0
  220. package/lib/evm/index.js +19 -0
  221. package/lib/evm/methods/crossChainVault.d.ts +132 -0
  222. package/lib/evm/methods/crossChainVault.js +857 -0
  223. package/lib/evm/methods/crossChainVaultRegistry.d.ts +92 -0
  224. package/lib/evm/methods/crossChainVaultRegistry.js +239 -0
  225. package/lib/evm/methods/index.d.ts +2 -0
  226. package/lib/evm/methods/index.js +19 -0
  227. package/lib/evm/types/crossChain.d.ts +363 -0
  228. package/lib/evm/types/crossChain.js +20 -0
  229. package/lib/evm/types/index.d.ts +1 -0
  230. package/lib/evm/types/index.js +18 -0
  231. package/lib/index.d.ts +30 -0
  232. package/lib/index.js +52 -0
  233. package/lib/main.d.ts +596 -0
  234. package/lib/main.js +681 -0
  235. package/lib/modules/api/fetcher.d.ts +108 -0
  236. package/lib/modules/api/fetcher.js +187 -0
  237. package/lib/modules/api/index.d.ts +1 -0
  238. package/lib/modules/api/index.js +6 -0
  239. package/lib/modules/api/main.d.ts +587 -0
  240. package/lib/modules/api/main.js +911 -0
  241. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  242. package/lib/modules/sub-accounts/fetcher.js +96 -0
  243. package/lib/modules/sub-accounts/index.d.ts +2 -0
  244. package/lib/modules/sub-accounts/index.js +19 -0
  245. package/lib/modules/sub-accounts/main.d.ts +249 -0
  246. package/lib/modules/sub-accounts/main.js +211 -0
  247. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  248. package/lib/modules/sub-accounts/utils.js +112 -0
  249. package/lib/modules/vaults/adapter.helpers.d.ts +84 -0
  250. package/lib/modules/vaults/adapter.helpers.js +202 -0
  251. package/lib/modules/vaults/fetcher.d.ts +147 -0
  252. package/lib/modules/vaults/fetcher.js +357 -0
  253. package/lib/modules/vaults/getters.d.ts +1060 -0
  254. package/lib/modules/vaults/getters.js +4079 -0
  255. package/lib/modules/vaults/index.d.ts +20 -0
  256. package/lib/modules/vaults/index.js +44 -0
  257. package/lib/modules/vaults/main.d.ts +607 -0
  258. package/lib/modules/vaults/main.js +1687 -0
  259. package/lib/modules/vaults/prefetch.d.ts +65 -0
  260. package/lib/modules/vaults/prefetch.js +120 -0
  261. package/lib/modules/vaults/read.actions.d.ts +406 -0
  262. package/lib/modules/vaults/read.actions.js +891 -0
  263. package/lib/modules/vaults/types.d.ts +149 -0
  264. package/lib/modules/vaults/types.js +3 -0
  265. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  266. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  267. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  268. package/lib/modules/vaults/utils/date-utils.js +84 -0
  269. package/lib/modules/vaults/utils.d.ts +153 -0
  270. package/lib/modules/vaults/utils.js +818 -0
  271. package/lib/modules/vaults/write.actions.d.ts +812 -0
  272. package/lib/modules/vaults/write.actions.js +2377 -0
  273. package/lib/polyfills.d.ts +1 -0
  274. package/lib/polyfills.js +12 -0
  275. package/lib/sdk.d.ts +30154 -0
  276. package/lib/services/coingecko/fetcher.d.ts +15 -0
  277. package/lib/services/coingecko/fetcher.js +67 -0
  278. package/lib/services/coingecko/index.d.ts +2 -0
  279. package/lib/services/coingecko/index.js +19 -0
  280. package/lib/services/coingecko/utils.d.ts +1 -0
  281. package/lib/services/coingecko/utils.js +24 -0
  282. package/lib/services/debank/fetcher.d.ts +126 -0
  283. package/lib/services/debank/fetcher.js +47 -0
  284. package/lib/services/debank/index.d.ts +2 -0
  285. package/lib/services/debank/index.js +19 -0
  286. package/lib/services/debank/utils.d.ts +50 -0
  287. package/lib/services/debank/utils.js +325 -0
  288. package/lib/services/layerzero/deposits.d.ts +55 -0
  289. package/lib/services/layerzero/deposits.js +174 -0
  290. package/lib/services/layerzero/redeems.d.ts +20 -0
  291. package/lib/services/layerzero/redeems.js +92 -0
  292. package/lib/services/layerzero/utils.d.ts +9 -0
  293. package/lib/services/layerzero/utils.js +22 -0
  294. package/lib/services/octavfi/fetcher.d.ts +33 -0
  295. package/lib/services/octavfi/fetcher.js +39 -0
  296. package/lib/services/octavfi/index.d.ts +3 -0
  297. package/lib/services/octavfi/index.js +20 -0
  298. package/lib/services/octavfi/types.d.ts +34 -0
  299. package/lib/services/octavfi/types.js +3 -0
  300. package/lib/services/octavfi/utils.d.ts +16 -0
  301. package/lib/services/octavfi/utils.js +244 -0
  302. package/lib/services/subgraph/fetcher.d.ts +2 -0
  303. package/lib/services/subgraph/fetcher.js +66 -0
  304. package/lib/services/subgraph/index.d.ts +2 -0
  305. package/lib/services/subgraph/index.js +19 -0
  306. package/lib/services/subgraph/schema.d.ts +48 -0
  307. package/lib/services/subgraph/schema.js +87 -0
  308. package/lib/services/subgraph/vaults.d.ts +83 -0
  309. package/lib/services/subgraph/vaults.js +1282 -0
  310. package/lib/services/swap-quotes/index.d.ts +105 -0
  311. package/lib/services/swap-quotes/index.js +77 -0
  312. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  313. package/lib/services/swap-quotes/paraswap.js +138 -0
  314. package/lib/services/untangled/fetcher.d.ts +40 -0
  315. package/lib/services/untangled/fetcher.js +110 -0
  316. package/lib/services/untangled/index.d.ts +3 -0
  317. package/lib/services/untangled/index.js +20 -0
  318. package/lib/services/untangled/types.d.ts +83 -0
  319. package/lib/services/untangled/types.js +10 -0
  320. package/lib/services/untangled/utils.d.ts +91 -0
  321. package/lib/services/untangled/utils.js +339 -0
  322. package/lib/types/api.d.ts +498 -0
  323. package/lib/types/api.js +3 -0
  324. package/lib/types/index.d.ts +12 -0
  325. package/lib/types/index.js +28 -0
  326. package/lib/types/points.d.ts +28 -0
  327. package/lib/types/points.js +3 -0
  328. package/lib/types/pools.d.ts +144 -0
  329. package/lib/types/pools.js +3 -0
  330. package/lib/types/staking.d.ts +28 -0
  331. package/lib/types/staking.js +3 -0
  332. package/lib/types/sub-accounts.d.ts +150 -0
  333. package/lib/types/sub-accounts.js +3 -0
  334. package/lib/types/subgraph.d.ts +84 -0
  335. package/lib/types/subgraph.js +3 -0
  336. package/lib/types/typed-contract.d.ts +102 -0
  337. package/lib/types/typed-contract.js +3 -0
  338. package/lib/types/user.d.ts +1 -0
  339. package/lib/types/user.js +3 -0
  340. package/lib/types/vaults.d.ts +886 -0
  341. package/lib/types/vaults.js +30 -0
  342. package/lib/types/web3.d.ts +81 -0
  343. package/lib/types/web3.js +14 -0
  344. package/lib/types/webserver.d.ts +730 -0
  345. package/lib/types/webserver.js +3 -0
  346. package/package.json +78 -3
@@ -0,0 +1,1060 @@
1
+ import { type IAddress, type IHistoricalTimeseriesPoint, type IHistoricalTimeseriesResponse, type INormalizedNumber, type ISubgraphReserveDeposit, type ISubgraphTransfer, type ISubgraphUserHistoryItem, type ITokenizedVault, type ISubgraphWithdrawProccessed, type ISubgraphWithdrawRequest, type IVault, type IVaultAllocations, type IVaultAnnualizedApy, type IVaultAvailableRedemption, type IVaultLoan, type IVaultPosition, type IVaultRedemptionHistoryItem, type IVaultSummary, type IVaultWithdrawals, type IVaultPendingRedemptions, type IActiveStakingPosition, type IVaultHistoricalParams, type IVaultUserLifetimePnl, type IVaultBorrowerHealthFactor, type IVaultPnl, type VaultAddress } from '../../types';
2
+ import type { IVaultBaseOptions } from './types';
3
+ /**
4
+ * Vault Data Getters
5
+ *
6
+ * Main query functions for vault data across chains:
7
+ * - getVault: Comprehensive vault details with loans/allocations
8
+ * - getVaultLoans: Active loan data with on-chain enrichment
9
+ * - getVaultAllocations: DeFi/CeFi/OTC allocation breakdowns
10
+ * - getVaultAvailableRedemptions: Claimable redemption requests
11
+ * - getVaultRedemptionHistory: Historical redemption data
12
+ * - getVaultPositions: User positions across vaults
13
+ * - getVaultApy: @deprecated Current and historical APY data
14
+ * - getRewardsStakingPositions: Staking positions and rewards
15
+ * - getVaultTvl: Current and historical TVL
16
+ * - getVaultHistoricalTimeseries: Time series data for vault metrics
17
+ */
18
+ /**
19
+ * Fetch comprehensive vault data including on-chain state and backend metadata.
20
+ * Routes to appropriate chain adapter (EVM v1/v2, Solana, or Stellar) based on vault version.
21
+ * Optionally enriches with loan and allocation data.
22
+ * @param vault - Vault contract address (EVM hex, Stellar C-address, or Solana program ID)
23
+ * @param loans - Include active loan data. EVM vaults only — there is no
24
+ * non-EVM loan book to read, so other families keep the empty default.
25
+ * @param allocations - Include DeFi/CeFi allocation breakdowns. Resolved for EVM
26
+ * vaults (via DeBank), Stellar vaults (via the Untangled portfolio API) and
27
+ * Solana vaults (each operator's cached Octav portfolio). Sui has no
28
+ * portfolio provider and keeps the empty default.
29
+ * @param options - RPC and service configuration
30
+ * @param tokenizedVault - Optional pre-fetched backend row for `vault`. When a
31
+ * caller already holds the row (e.g. `getVaults` fetched the whole list one
32
+ * call earlier), passing it skips this function's own
33
+ * `GET /tokenized_vault/{address}` — a pure de-duplication of backend
34
+ * traffic. The row must have been fetched with the same
35
+ * `loadSubaccounts`/`loadSnapshots` flags the caller passes here.
36
+ * @returns Complete vault object with optional enrichments
37
+ * @throws {@link UpshiftNetworkError} (`NETWORK_ERROR`) when `allocations` is
38
+ * requested and a borrower's portfolio read (DeBank for EVM, Octav for
39
+ * Solana) fails. The whole call fails rather than returning the vault with
40
+ * empty allocations; pass `allocations: false` for a read that does not
41
+ * depend on the portfolio provider.
42
+ */
43
+ export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, tokenizedVault: prefetchedRow, }: {
44
+ vault: IAddress;
45
+ loans?: boolean;
46
+ allocations?: boolean;
47
+ options: IVaultBaseOptions;
48
+ loadSubaccounts?: boolean;
49
+ loadSnapshots?: boolean;
50
+ tokenizedVault?: ITokenizedVault;
51
+ }): Promise<IVault>;
52
+ /**
53
+ * Vault Loans
54
+ */
55
+ export declare function getVaultLoans(vault: VaultAddress | IVault, options: IVaultBaseOptions): Promise<IVaultLoan[]>;
56
+ /**
57
+ * Vault Subaccount Loans
58
+ */
59
+ export declare function getVaultSubaccountLoans(vault: VaultAddress | IVault, options: IVaultBaseOptions): Promise<IVaultLoan[]>;
60
+ /**
61
+ * Vault Allocations
62
+ */
63
+ /**
64
+ * Fetch comprehensive vault asset allocation breakdown.
65
+ * Includes DeFi protocols (via DeBank), CeFi balances, OTC positions, and loans.
66
+ * Categorizes exposures by borrowing, supplying, lending, and wallet holdings.
67
+ *
68
+ * DeFi exposure resolves per chain family: EVM vaults via DeBank, Solana
69
+ * borrowers via Octav.fi, and Stellar vaults via the Untangled portfolio API —
70
+ * one vault-level call covering the idle buffer, Stellar protocol positions,
71
+ * custody wallets, and capital bridged to other chains. The Stellar path adds
72
+ * exactly 1 HTTP call and zero for every other chain; when it fails, the
73
+ * exposure section comes back empty and the CeFi, OTC and loan allocations are
74
+ * still returned.
75
+ *
76
+ * @param vault - Vault address
77
+ * @param options - RPC configuration
78
+ * @param tokenizedVault - Optional pre-fetched backend row for `vault`. When a
79
+ * caller already holds the row (e.g. `getVault` fetched it one call earlier),
80
+ * passing it skips this function's own `GET /tokenized_vault/{address}` — a
81
+ * pure de-duplication of backend traffic. The row must carry the subaccount
82
+ * data this function reads (`.subaccounts`, `.eoa_operators`), so it must not
83
+ * have been fetched with `loadSubaccounts: false`; a row fetched that way
84
+ * would silently resolve zero borrowers.
85
+ * @returns Detailed allocation data with exposure categorization
86
+ * @throws {@link UpshiftNetworkError} (`NETWORK_ERROR`) when any borrower's
87
+ * portfolio read (DeBank for EVM, Octav for Solana) fails.
88
+ */
89
+ export declare function getVaultAllocations(vault: IAddress, options: IVaultBaseOptions, tokenizedVault?: ITokenizedVault): Promise<IVaultAllocations>;
90
+ export declare function getVaultAvailableRedemptions({ vault, wallet, options, prefetchedReads, }: {
91
+ vault: IAddress;
92
+ wallet?: IAddress;
93
+ options: IVaultBaseOptions & {
94
+ verbose?: boolean;
95
+ };
96
+ /**
97
+ * Values already read via a Multicall3 batch (see
98
+ * `modules/vaults/prefetch.ts`). When `lagDuration` is present the
99
+ * per-vault `lagDuration()` RPC is skipped; when omitted, behavior is
100
+ * exactly the pre-batching per-call path.
101
+ * @internal
102
+ */
103
+ prefetchedReads?: {
104
+ lagDuration?: number;
105
+ };
106
+ }): Promise<{
107
+ processedWithdrawals: ISubgraphWithdrawProccessed[];
108
+ requestedWithdrawals: ISubgraphWithdrawRequest[];
109
+ availableRedemptions: IVaultAvailableRedemption[];
110
+ pendingRedemptions: IVaultAvailableRedemption[];
111
+ }>;
112
+ export declare function getVaultRedemptionHistory({ vault, wallet, lookbackBlocks, options, }: {
113
+ vault: IAddress;
114
+ wallet?: IAddress;
115
+ lookbackBlocks?: number;
116
+ options: IVaultBaseOptions;
117
+ }): Promise<IVaultRedemptionHistoryItem[]>;
118
+ export { getSwapRouterDepositResult } from '../../core/helpers/swap-router';
119
+ /**
120
+ * Vault Positions
121
+ */
122
+ export declare function getVaultPositions({ vault, wallet, solanaWallet, stellarWallet, options, prefetchedReads, }: {
123
+ vault: IAddress;
124
+ wallet?: IAddress;
125
+ solanaWallet?: string;
126
+ stellarWallet?: string;
127
+ options: IVaultBaseOptions;
128
+ /**
129
+ * Per-vault values already read via a Multicall3 batch at the fan-out call
130
+ * sites (see `modules/vaults/prefetch.ts`). Supplied fields skip the
131
+ * corresponding `balanceOf` / `lagDuration` RPC for the vault matching the
132
+ * `vault` parameter; when omitted, behavior is exactly the pre-batching
133
+ * per-call path.
134
+ * @internal
135
+ */
136
+ prefetchedReads?: {
137
+ balance?: bigint;
138
+ lagDuration?: number;
139
+ };
140
+ }): Promise<IVaultPosition[]>;
141
+ /**
142
+ * @deprecated use getVaultHistoricalTimeseries instead
143
+ */
144
+ export declare function getVaultApy({ vault, options, historical, }: {
145
+ vault: IAddress;
146
+ options?: IVaultBaseOptions;
147
+ historical?: IVaultHistoricalParams;
148
+ }): Promise<{
149
+ value: number;
150
+ timestamp: string;
151
+ }[]>;
152
+ export declare function getRewardsStakingPositions({ rpcUrl, wallet, coinGeckoKey, }: {
153
+ wallet?: IAddress;
154
+ rpcUrl: string;
155
+ coinGeckoKey?: string;
156
+ }): Promise<IActiveStakingPosition[]>;
157
+ export declare function getVaultTvl({ vault, options, historical, }: {
158
+ vault: IAddress;
159
+ options: IVaultBaseOptions;
160
+ historical?: IVaultHistoricalParams;
161
+ }): Promise<{
162
+ value: INormalizedNumber;
163
+ timestamp: string;
164
+ }[]>;
165
+ /**
166
+ * Build the per-loan borrower / health-factor list for a single vault.
167
+ *
168
+ * Resilience: individual loan reads (`loanState()`, `borrower()`) and the
169
+ * per-borrower Upshift backend call are isolated with `Promise.allSettled` and
170
+ * try/catch so one bad loan — a test loan whose address isn't a real contract,
171
+ * a borrower the backend doesn't recognize, an intermittent RPC error — drops
172
+ * that single row from the result instead of rejecting the whole batch. Failed
173
+ * rows are logged via `Logger.log.warn`; the loan is still returned with
174
+ * `health_factor: undefined` so callers can render an explicit empty state
175
+ * rather than a perpetual loading skeleton.
176
+ *
177
+ * @param vault - Vault address to scope the fetch to.
178
+ * @param options - Standard vault options — `rpcUrl` must point at `vault`'s chain.
179
+ * @returns Array of `IVaultBorrowerHealthFactor`, one entry per active loan.
180
+ */
181
+ export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
182
+ vault: IAddress;
183
+ options: IVaultBaseOptions;
184
+ }): Promise<IVaultBorrowerHealthFactor[]>;
185
+ /**
186
+ * Aggregate borrower-health-factor data, optionally scoped to a single vault.
187
+ *
188
+ * - When `vault` is provided, only that vault's tokenized record is fetched
189
+ * and only its loans are read. This is the path callers should use when
190
+ * they already know which vault they care about — it skips the cross-chain
191
+ * fanout entirely.
192
+ * - When `vault` is omitted, the function fetches every tokenized vault and
193
+ * builds health factors for each, preserving the legacy behavior. Per-vault
194
+ * failures are isolated with `Promise.allSettled` so one bad vault returns
195
+ * an empty array instead of rejecting the whole map.
196
+ *
197
+ * The returned map is keyed by **lowercased** vault address so callers can
198
+ * look up entries without worrying about EIP-55 checksum casing in either the
199
+ * backend response or the caller's input.
200
+ *
201
+ * @param options - Standard vault options — `rpcUrl` should match `vault`'s chain.
202
+ * @param vault - Optional vault address to scope the fetch to.
203
+ * @returns Map of lowercased vault address → array of borrower-health-factor rows.
204
+ */
205
+ export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
206
+ options: IVaultBaseOptions;
207
+ vault?: IAddress;
208
+ }): Promise<Record<string, IVaultBorrowerHealthFactor[]>>;
209
+ /**
210
+ * Fetch user points from the backend API endpoint.
211
+ * This replaces client-side points calculation with server-side processing.
212
+ * @param userAddress - User wallet address (EVM or Solana)
213
+ * @param options - Request options including headers
214
+ * @returns Points data from the backend API
215
+ */
216
+ export declare function getUserPoints({ userAddress, options, }: {
217
+ userAddress: IAddress;
218
+ options?: IVaultBaseOptions;
219
+ }): Promise<any>;
220
+ /**
221
+ * Register a user for the points program, authenticated by a wallet signature.
222
+ *
223
+ * The caller must obtain a personal_sign (EIP-191) signature over the
224
+ * canonical message template below — the backend reconstructs the same
225
+ * string from these fields and verifies the signature recovers to
226
+ * `userAddress`. Building the message client-side and server-side from the
227
+ * same primitives means a hostile client cannot show one message in the
228
+ * wallet prompt while submitting a different one for validation.
229
+ *
230
+ * Canonical message (`\n`-separated, no trailing newline):
231
+ *
232
+ * ```
233
+ * Upshift: register {userAddress.toLowerCase()}
234
+ * referrer: {referrerAddress.toLowerCase() || "none"}
235
+ * chain: {chainId}
236
+ * nonce: {nonce}
237
+ * expires: {expiry}
238
+ * ```
239
+ *
240
+ * @param userAddress - EVM wallet address being registered. Must match the
241
+ * signer that produced `signature`. Lowercased before being embedded in
242
+ * the canonical message.
243
+ * @param referrerAddress - Optional EVM address that referred this user.
244
+ * Lowercased when embedded; the literal string `"none"` is used when
245
+ * absent. Tampering with this field after signing produces 401.
246
+ * @param chainId - Chain on which the wallet signed. For smart-contract wallets
247
+ * (Safe etc.) this is the chain whose RPC the backend will use to run the
248
+ * EIP-1271 `isValidSignature` check; for EOAs it still pins the signature
249
+ * to a chain so it can't be replayed cross-chain. Must be one of the chains
250
+ * Upshift supports (see backend `SUPPORTED_REGISTRATION_CHAINS`).
251
+ * @param signature - `0x`-prefixed hex of the personal_sign signature over
252
+ * the canonical message. Single-use: replays within ~10 min are rejected.
253
+ * @param nonce - Caller-generated random string (8–128 chars). Pair with
254
+ * `userAddress` to form the single-use key in the backend's nonce store.
255
+ * @param expiry - Unix timestamp (seconds). Must be in the future and within
256
+ * the backend's TTL window (currently 10 min).
257
+ * @param options - Request options (headers).
258
+ * @returns Raw `Response` from the backend. 200 on success, 401 for
259
+ * expired / replayed / mismatched-signer / tampered-referrer, 422 for an
260
+ * unsupported `chainId`.
261
+ *
262
+ * @example
263
+ * ```ts
264
+ * const nonce = crypto.randomUUID().replace(/-/g, '');
265
+ * const expiry = Math.floor(Date.now() / 1000) + 300;
266
+ * const message =
267
+ * `Upshift: register ${address.toLowerCase()}\n` +
268
+ * `referrer: ${referrer?.toLowerCase() ?? 'none'}\n` +
269
+ * `chain: ${chainId}\n` +
270
+ * `nonce: ${nonce}\n` +
271
+ * `expires: ${expiry}`;
272
+ * const signature = await walletClient.signMessage({ account: address, message });
273
+ * await registerUserForPoints({ userAddress: address, referrerAddress: referrer, chainId, signature, nonce, expiry });
274
+ * ```
275
+ */
276
+ export declare function registerUserForPoints({ userAddress, referrerAddress, chainId, signature, nonce, expiry, options, }: {
277
+ userAddress: IAddress;
278
+ referrerAddress?: IAddress;
279
+ chainId: number;
280
+ signature: string;
281
+ nonce: string;
282
+ expiry: number;
283
+ options?: IVaultBaseOptions;
284
+ }): Promise<Response>;
285
+ /**
286
+ * Fetch the points leaderboard data.
287
+ * @param params - Optional parameters for pagination and sorting
288
+ * @param options - Request options including headers
289
+ * @returns Leaderboard response data
290
+ */
291
+ export declare function fetchPointsLeaderboard({ params, options, }: {
292
+ params?: {
293
+ page?: number;
294
+ perPage?: number;
295
+ sortBy?: 'streakDays' | 'totalPoints';
296
+ };
297
+ options?: IVaultBaseOptions;
298
+ }): Promise<any>;
299
+ /**
300
+ * Fetch the timestamp when yield was last realized for a vault.
301
+ * Returns the assetsUpdatedOn timestamp from the vault contract.
302
+ * @param vault - Vault contract address
303
+ * @param options - RPC configuration
304
+ * @returns Timestamp (Unix timestamp in seconds) when yield was last realized
305
+ */
306
+ export declare function getYieldLastRealizedOn({ vault, options, }: {
307
+ vault: IAddress;
308
+ options: IVaultBaseOptions;
309
+ }): Promise<number>;
310
+ /** Inputs the lifetime-PnL history guard inspects. */
311
+ export interface PnlHistoryConsistencyParams {
312
+ /** Vault contract address, used for the error message and context. */
313
+ vault: IAddress;
314
+ /** User wallet address, used for the error message and context. */
315
+ wallet: IAddress;
316
+ /**
317
+ * Whether the resolved deposit history contains at least one deposit record
318
+ * (subgraph deposits or LayerZero cross-chain deposits).
319
+ */
320
+ hasDeposits: boolean;
321
+ /**
322
+ * Whether the indexed deposits explain every share mint to the wallet (see
323
+ * {@link historyCoversMints}). Defaults to `true`.
324
+ */
325
+ mintsMatchHistory?: boolean;
326
+ /**
327
+ * Shares received by peer transfer, priced in raw base units (asset
328
+ * decimals) by {@link transferCostBasis}. Defaults to zero.
329
+ */
330
+ receivedByTransferRaw?: bigint;
331
+ /** Total withdrawn, in raw base units (asset decimals). */
332
+ totalWithdrawnRaw: bigint;
333
+ /** Current on-chain position value, in raw base units (asset decimals). */
334
+ currentPositionRaw: bigint;
335
+ }
336
+ /**
337
+ * Guard against lifetime-PnL over-inflation when the deposit history fails to load.
338
+ *
339
+ * Lifetime PnL is `currentPosition + totalWithdrawn - totalDeposited`. When the
340
+ * deposit/withdrawal history fails to load it collapses to empty, so both
341
+ * `totalDeposited` and `totalWithdrawn` read as zero. If the wallet still holds
342
+ * a live on-chain position, the formula degenerates to reporting the entire
343
+ * position as pure profit — a plausible-looking but wrong number.
344
+ *
345
+ * This guard rejects exactly that state: a non-zero position with no recorded
346
+ * deposits, no shares received by transfer *and* no recorded withdrawals. It
347
+ * also rejects a non-zero position with no recorded deposits when a share mint
348
+ * to the wallet has no matching deposit (`mintsMatchHistory: false`): the mint
349
+ * proves a deposit the history failed to return, so neither a peer transfer
350
+ * nor a withdrawal makes the cost basis complete. Otherwise, any of the
351
+ * following is treated as consistent and passes:
352
+ * - deposits are present (the normal, computable case);
353
+ * - shares were received by transfer and priced (see {@link transferCostBasis});
354
+ * - withdrawals are present (a fully-exited-then-re-entered position is still
355
+ * computable — the withdrawal records prove history loaded);
356
+ * - the current position is zero (the wallet never interacted or fully exited,
357
+ * so a zero PnL is correct, not inflated).
358
+ *
359
+ * Pure and synchronous — no RPC, no I/O — so it is safe to call inside the hot
360
+ * path with no added latency.
361
+ *
362
+ * Shares received by a direct token transfer (never deposited, never withdrew)
363
+ * reach this guard as `receivedByTransferRaw`: {@link getVaultUserLifetimePnl}
364
+ * prices them with {@link transferCostBasis} first. The guard still throws for
365
+ * such a wallet when its transfers cannot be read or priced, or when a share
366
+ * mint to it has no indexed deposit.
367
+ *
368
+ * @param params - See {@link PnlHistoryConsistencyParams}.
369
+ * @returns `void` when the history is consistent.
370
+ * @throws {@link UpshiftHistoryUnavailableError} with code `HISTORY_UNAVAILABLE`
371
+ * and `context: { vault, wallet }` when a non-zero position has no deposits
372
+ * recorded and either a share mint without a matching deposit or neither
373
+ * received shares nor withdrawals. The message carries the
374
+ * `#getVaultUserLifetimePnl::<vault>::<wallet>` prefix so it groups with the
375
+ * other errors leaving the getter.
376
+ * @example
377
+ * ```ts
378
+ * assertPnlHistoryConsistent({
379
+ * vault,
380
+ * wallet,
381
+ * hasDeposits: depositsByAsset.size > 0,
382
+ * mintsMatchHistory,
383
+ * receivedByTransferRaw: costBasis.receivedByTransferRaw,
384
+ * totalWithdrawnRaw,
385
+ * currentPositionRaw: currentPositionValue.raw,
386
+ * });
387
+ * ```
388
+ */
389
+ export declare function assertPnlHistoryConsistent({ vault, wallet, hasDeposits, mintsMatchHistory, receivedByTransferRaw, totalWithdrawnRaw, currentPositionRaw, }: PnlHistoryConsistencyParams): void;
390
+ /** Inputs the lifetime-PnL price guard inspects. */
391
+ export interface PnlTokenPriceParams {
392
+ /** Vault contract address, used for the error message and context. */
393
+ vault: IAddress;
394
+ /** User wallet address, used for the error message and context. */
395
+ wallet: IAddress;
396
+ /**
397
+ * The vault's underlying asset (`asset()`) that was priced, or `undefined`
398
+ * when `asset()` could not be read and no price lookup was possible.
399
+ */
400
+ asset: IAddress | undefined;
401
+ /**
402
+ * USD price of `asset` as resolved by the price server. `0` means the lookup
403
+ * failed or the token is unknown to it (`fetchTokenPriceByAddress` never
404
+ * throws).
405
+ */
406
+ tokenPriceUsd: number;
407
+ }
408
+ /**
409
+ * Guard against converting lifetime PnL to USD with a fabricated price.
410
+ *
411
+ * Every USD field `getVaultUserLifetimePnl` returns is a native amount times
412
+ * the underlying asset's USD price. When the price server has no price, the
413
+ * only honest outcome is "no USD value" — substituting a stand-in (the getter
414
+ * previously used `1`) reports a non-dollar vault's position at $1 per asset,
415
+ * a plausible-looking but wrong number that callers cannot detect.
416
+ *
417
+ * Pure and synchronous — no RPC, no I/O.
418
+ *
419
+ * @param params - See {@link PnlTokenPriceParams}.
420
+ * @returns `tokenPriceUsd`, unchanged, when it is a finite number above zero.
421
+ * @throws {@link UpshiftPriceUnavailableError} with code `PRICE_UNAVAILABLE`
422
+ * and `context: { vault, wallet, asset }` when the price is zero, negative,
423
+ * or not finite. The message carries the
424
+ * `#getVaultUserLifetimePnl::<vault>::<wallet>` prefix so it groups with the
425
+ * other errors leaving the getter.
426
+ * @example
427
+ * ```ts
428
+ * const price = assertPnlTokenPrice({
429
+ * vault,
430
+ * wallet,
431
+ * asset: underlyingAssetAddress,
432
+ * tokenPriceUsd: await pricePromise,
433
+ * });
434
+ * ```
435
+ */
436
+ export declare function assertPnlTokenPrice({ vault, wallet, asset, tokenPriceUsd, }: PnlTokenPriceParams): number;
437
+ /**
438
+ * Sum a wallet's per-asset deposits into the vault's own decimals, at face
439
+ * value — 1 unit of any deposited asset is treated as 1 unit of the vault's
440
+ * reporting currency, with no live price conversion.
441
+ *
442
+ * Used by {@link getVaultUserLifetimePnl} for `totalDeposited`. Pre-deposit
443
+ * multi-asset vaults only accept dollar-pegged stablecoins (USDC, USDT, DAI,
444
+ * USDS, RLUSD, etc.) into a dollar-denominated vault, so face value is a
445
+ * reasonable stand-in for USD value. This intentionally does NOT re-quote
446
+ * through a live price oracle: doing so priced a historical deposit at
447
+ * today's market rate, so `totalDeposited` (and lifetimePnl) drifted between
448
+ * calls purely from stablecoin peg noise, and approximately re-inflated
449
+ * deposits back toward face value — which silently excluded the vault's
450
+ * entry fee from PnL. The fee is money the user actually paid, so PnL must
451
+ * be computed net of it.
452
+ *
453
+ * @param depositsByAsset - Raw deposited amount per asset, keyed by
454
+ * lowercased asset address (or `'default'` / `'lz-default'` for
455
+ * single-asset / cross-chain rows).
456
+ * @param assetDecimals - Decimals for each key in `depositsByAsset`.
457
+ * @param vaultDecimals - The vault's own decimals — the target scale every
458
+ * asset is rescaled to.
459
+ * @returns Total deposited, in raw base units at `vaultDecimals`.
460
+ */
461
+ export declare function sumDepositsAtFaceValue(depositsByAsset: Map<string, bigint>, assetDecimals: Map<string, number>, vaultDecimals: number): bigint;
462
+ /** The receipt-token transfer fields the transfer cost basis reads. */
463
+ export type PnlTransfer = Pick<ISubgraphTransfer, 'from' | 'to' | 'value' | 'timestamp_'>;
464
+ /**
465
+ * Keep the receipt-token transfers that moved shares between `wallet` and
466
+ * another holder.
467
+ *
468
+ * Vault shares are transferable ERC-20 tokens, so a wallet can hold a position
469
+ * it never deposited into — a migration airdrop, a DEX purchase, a transfer from
470
+ * another wallet. Mints (from the zero address), burns (to it) and transfers to
471
+ * or from the vault itself are dropped: those are the deposit and withdrawal
472
+ * legs the subgraph history already records, and counting them again would
473
+ * double the cost basis. Transfers to or from `exclude` are dropped too.
474
+ *
475
+ * @param transfers - Receipt-token transfers touching `wallet`, as returned by
476
+ * the vault's transfer subgraph.
477
+ * @param wallet - The wallet whose position is being valued.
478
+ * @param vault - The vault contract address.
479
+ * @param exclude - Other counterparties whose transfers are not peer
480
+ * transfers, such as a LayerZero OVault's hub composer and share OFT
481
+ * (`hubComposer` / `hubShareOFT` in `LAYERZERO_VAULTS`). Defaults to none.
482
+ * @returns The peer-to-peer transfers, in input order. Addresses compare
483
+ * case-insensitively.
484
+ * @example
485
+ * ```ts
486
+ * const peer = selectPeerTransfers(transfers, wallet, vault);
487
+ * ```
488
+ */
489
+ export declare function selectPeerTransfers<T extends PnlTransfer>(transfers: T[], wallet: IAddress, vault: IAddress, exclude?: string[]): T[];
490
+ /** Inputs {@link transferCostBasis} prices. */
491
+ export interface TransferCostBasisParams {
492
+ /** Peer transfers touching `wallet` — see {@link selectPeerTransfers}. */
493
+ transfers: PnlTransfer[];
494
+ /** The wallet whose cost basis is being computed. */
495
+ wallet: IAddress;
496
+ /** The vault contract address, used for the error message and context. */
497
+ vault: IAddress;
498
+ /**
499
+ * The vault's daily history from `fetchVaultHistoricalTimeseries`, keyed by
500
+ * UTC date (`YYYY-MM-DD`). Only `asset_share_ratio` (assets per share) is
501
+ * read.
502
+ */
503
+ history: Record<string, Pick<IHistoricalTimeseriesPoint, 'asset_share_ratio'>>;
504
+ /**
505
+ * Report sent shares even when none were received. Defaults to `false`, which
506
+ * zeroes them so a zero-deposit wallet's history guard still decides; pass
507
+ * `true` when the caller applies that rule itself, as {@link pnlCostBasis}
508
+ * does.
509
+ */
510
+ countSentWithoutReceipt?: boolean;
511
+ }
512
+ /** Asset amounts that peer transfers moved into and out of a position. */
513
+ export interface TransferCostBasis {
514
+ /** Assets the received shares were worth on arrival, raw at vault decimals. */
515
+ receivedRaw: bigint;
516
+ /** Assets the sent shares were worth when they left, raw at vault decimals. */
517
+ sentRaw: bigint;
518
+ }
519
+ /**
520
+ * Value peer share transfers in the vault's asset, at the vault's share ratio
521
+ * on the day each one happened.
522
+ *
523
+ * Used by {@link getVaultUserLifetimePnl} when a wallet has no indexed
524
+ * deposits: received shares become its cost basis and sent shares count as
525
+ * withdrawn, so lifetime PnL for a transfer recipient reads "PnL since the
526
+ * shares arrived" rather than failing or reporting the whole position as
527
+ * profit. A day with no usable ratio takes the latest earlier day's, and a
528
+ * transfer older than the history takes the earliest day's.
529
+ *
530
+ * Sent shares count only against a received basis by default. A wallet that
531
+ * sent shares but received none gets a zero basis, so the lifetime-PnL history
532
+ * guard still decides for it instead of reporting the sent shares as profit.
533
+ * `countSentWithoutReceipt: true` reports them anyway, for a caller that knows
534
+ * the wallet also deposited.
535
+ *
536
+ * Pure and synchronous. Assumes, as the getter does, that shares and assets
537
+ * share the vault's decimals.
538
+ *
539
+ * @param params - See {@link TransferCostBasisParams}.
540
+ * @returns The received and sent asset amounts, raw at the vault's decimals;
541
+ * both zero when no shares were received.
542
+ * @throws {@link UpshiftHistoryUnavailableError} (`HISTORY_UNAVAILABLE`) when no
543
+ * day in `history` carries a positive, finite `asset_share_ratio`.
544
+ * @example
545
+ * ```ts
546
+ * const { data } = await fetchVaultHistoricalTimeseries(vault, nDays);
547
+ * const { receivedRaw, sentRaw } = transferCostBasis({
548
+ * transfers: selectPeerTransfers(transfers, wallet, vault),
549
+ * wallet,
550
+ * vault,
551
+ * history: data,
552
+ * });
553
+ * ```
554
+ */
555
+ export declare function transferCostBasis({ transfers, wallet, vault, history, countSentWithoutReceipt, }: TransferCostBasisParams): TransferCostBasis;
556
+ /** Inputs {@link historyCoversMints} compares. */
557
+ export interface HistoryCoversMintsParams {
558
+ /** Every share-token transfer touching `wallet`, mints included. */
559
+ transfers: Pick<ISubgraphTransfer, 'from' | 'to' | 'transactionHash_'>[];
560
+ /** The wallet whose history is being checked. */
561
+ wallet: IAddress;
562
+ /** Transaction hashes of the wallet's indexed deposits. */
563
+ depositTransactionHashes: string[];
564
+ }
565
+ /**
566
+ * Check that a wallet's indexed deposit history accounts for every share mint
567
+ * its share-token ledger shows.
568
+ *
569
+ * A deposit mints shares to the wallet in the same transaction, so a mint with
570
+ * no deposit of the same hash means the history is missing that deposit (an
571
+ * older deposit the subgraph never indexed, or one a third party made for the
572
+ * wallet). Folding peer transfers into such a history would credit the wallet
573
+ * for shares it sent while missing what it paid for them, so
574
+ * {@link getVaultUserLifetimePnl} only folds transfers for a depositor when
575
+ * this holds.
576
+ *
577
+ * Pure and synchronous. Hashes and addresses compare case-insensitively.
578
+ *
579
+ * @param params - See {@link HistoryCoversMintsParams}.
580
+ * @returns `true` when every mint to `wallet` has a matching deposit, including
581
+ * when there are no mints.
582
+ * @example
583
+ * ```ts
584
+ * const covered = historyCoversMints({
585
+ * transfers,
586
+ * wallet,
587
+ * depositTransactionHashes: history
588
+ * .filter((item) => item.type === 'deposit')
589
+ * .map((item) => item.transactionHash_),
590
+ * });
591
+ * ```
592
+ */
593
+ export declare function historyCoversMints({ transfers, wallet, depositTransactionHashes, }: HistoryCoversMintsParams): boolean;
594
+ /** Inputs {@link selectReserveDeposits} matches. */
595
+ export interface SelectReserveDepositsParams {
596
+ /** The wallet's `ReserveDeposit` events (see `getSubgraphUserReserveDeposits`). */
597
+ reserveDeposits: ISubgraphReserveDeposit[];
598
+ /** Every share-token transfer touching `wallet`, mints included. */
599
+ transfers: Pick<ISubgraphTransfer, 'from' | 'to' | 'transactionHash_'>[];
600
+ /** The wallet whose history is being completed. */
601
+ wallet: IAddress;
602
+ /** Transaction hashes of the wallet's indexed deposits. */
603
+ depositTransactionHashes: string[];
604
+ }
605
+ /**
606
+ * Keep the `ReserveDeposit` events that explain a share mint the indexed
607
+ * deposit history misses.
608
+ *
609
+ * High Growth ETH mints shares for deposits made through Kelp's gain adapter
610
+ * with a `ReserveDeposit` event instead of an ERC-4626 `Deposit`, so those
611
+ * deposits are absent from the user history and fail {@link historyCoversMints}.
612
+ * An event counts only when its transaction mints shares to `wallet` and holds
613
+ * no indexed deposit, so a deposit is never counted twice.
614
+ *
615
+ * Pure and synchronous. Hashes and addresses compare case-insensitively.
616
+ *
617
+ * @param params - See {@link SelectReserveDepositsParams}.
618
+ * @returns The matching events, in input order.
619
+ * @example
620
+ * ```ts
621
+ * const reserve = selectReserveDeposits({
622
+ * reserveDeposits: await getSubgraphUserReserveDeposits(wallet, provider, vault),
623
+ * transfers,
624
+ * wallet,
625
+ * depositTransactionHashes,
626
+ * });
627
+ * ```
628
+ */
629
+ export declare function selectReserveDeposits({ reserveDeposits, transfers, wallet, depositTransactionHashes, }: SelectReserveDepositsParams): ISubgraphReserveDeposit[];
630
+ /** Inputs {@link countWithdrawalRequestsOnce} reads. */
631
+ export interface CountWithdrawalRequestsOnceParams {
632
+ /** The wallet's user history (see `getSubgraphUserHistory`). */
633
+ history: ISubgraphUserHistoryItem[];
634
+ /** Every share-token transfer touching `wallet`. */
635
+ transfers: Pick<ISubgraphTransfer, 'from' | 'to' | 'transactionHash_'>[];
636
+ /** The wallet whose history is being read. */
637
+ wallet: IAddress;
638
+ /** The vault contract address. */
639
+ vault: IAddress;
640
+ }
641
+ /**
642
+ * Drop withdrawal-request rows the vault logged more than once for a single
643
+ * request.
644
+ *
645
+ * A redemption requested through Kelp's gain adapter makes High Growth ETH emit
646
+ * `WithdrawalRequested` twice for one share transfer, and the subgraph indexes
647
+ * both. In a transaction where the share ledger shows the wallet sending shares
648
+ * to the vault `n` times, at most `n` request rows are kept. A transaction the
649
+ * ledger shows no such transfer for keeps every row, so a missing ledger leaves
650
+ * the history unchanged.
651
+ *
652
+ * Pure and synchronous. Hashes and addresses compare case-insensitively.
653
+ *
654
+ * @param params - See {@link CountWithdrawalRequestsOnceParams}.
655
+ * @returns The history without the surplus request rows, in input order.
656
+ * @example
657
+ * ```ts
658
+ * const history = countWithdrawalRequestsOnce({ history: userHistory, transfers, wallet, vault });
659
+ * ```
660
+ */
661
+ export declare function countWithdrawalRequestsOnce({ history, transfers, wallet, vault, }: CountWithdrawalRequestsOnceParams): ISubgraphUserHistoryItem[];
662
+ /** Inputs {@link settleV2Redemptions} values. */
663
+ export interface SettleV2RedemptionsParams {
664
+ /** The wallet's user history (see `getSubgraphUserHistory`). */
665
+ history: ISubgraphUserHistoryItem[];
666
+ /** The vault's `lagDuration()`, in seconds. */
667
+ lagDuration: number;
668
+ /**
669
+ * The vault's daily history from `fetchVaultHistoricalTimeseries`, keyed by
670
+ * UTC date (`YYYY-MM-DD`). Only `asset_share_ratio` (assets per share) is
671
+ * read.
672
+ */
673
+ ratios: Record<string, Pick<IHistoricalTimeseriesPoint, 'asset_share_ratio'>>;
674
+ /** The current time, in unix seconds. */
675
+ now: number;
676
+ }
677
+ /** What a wallet's Tokenized Vault V2 redemption requests are worth. */
678
+ export interface V2RedemptionValue {
679
+ /** Assets paid, or due, for requests past their claim date; raw at vault decimals. */
680
+ settledAssetsRaw: bigint;
681
+ /** Shares to value at the current share price, raw. */
682
+ pendingShares: bigint;
683
+ }
684
+ /**
685
+ * Value a wallet's Tokenized Vault V2 redemption requests, which carry only
686
+ * shares.
687
+ *
688
+ * Every processed withdrawal (`WithdrawalProcessed.assetsAmount`) counts at the
689
+ * assets the vault paid. Its shares, estimated at the vault's
690
+ * `asset_share_ratio` on the day it was processed, retire the oldest requests
691
+ * first. Request shares left over count at the ratio on their claim date (see
692
+ * `computeClaimableDate`) once claimable: the subgraph lacks some processed rows
693
+ * (none for earnAUSD before 2026-02-01), and that ratio lands within about
694
+ * 0.05% of what the vault paid. Shares not yet claimable are left to the
695
+ * current share price. Matching by amount, not by claim date, keeps the result
696
+ * right when a vault processes a request before the date today's `lagDuration`
697
+ * implies. A leftover under 0.5% of a request that a later processed
698
+ * withdrawal followed is rounding from the daily ratio, so it is dropped.
699
+ *
700
+ * Pure and synchronous. Assumes, as the getter does, that shares and assets
701
+ * share the vault's decimals. A day with no usable ratio takes the latest
702
+ * earlier day's, and a date older than the history takes the earliest day's.
703
+ *
704
+ * @param params - See {@link SettleV2RedemptionsParams}.
705
+ * @returns The settled assets and the shares left to the current price; every
706
+ * requested share is pending when `ratios` holds no usable day.
707
+ * @example
708
+ * ```ts
709
+ * const { settledAssetsRaw, pendingShares } = settleV2Redemptions({
710
+ * history,
711
+ * lagDuration: 259_200,
712
+ * ratios: (await fetchVaultHistoricalTimeseries(vault, nDays)).data,
713
+ * now: Math.floor(Date.now() / 1000),
714
+ * });
715
+ * ```
716
+ */
717
+ export declare function settleV2Redemptions({ history, lagDuration, ratios, now, }: SettleV2RedemptionsParams): V2RedemptionValue;
718
+ /** Inputs {@link pnlCostBasis} folds together. */
719
+ export interface PnlCostBasisParams {
720
+ /** Indexed deposits at face value, raw at the vault's decimals. */
721
+ depositedRaw: bigint;
722
+ /** Withdrawals already in asset terms, raw at the vault's decimals. */
723
+ withdrawnAssetsRaw: bigint;
724
+ /** Whether history indexed any deposit, LayerZero deposits included. */
725
+ hasDeposits: boolean;
726
+ /** Whether the history accounts for every share mint (see {@link historyCoversMints}). */
727
+ mintsMatchHistory: boolean;
728
+ /**
729
+ * Peer transfers priced by {@link transferCostBasis} with
730
+ * `countSentWithoutReceipt: true`.
731
+ */
732
+ transfers: TransferCostBasis;
733
+ }
734
+ /** The cost basis {@link getVaultUserLifetimePnl} computes PnL against. */
735
+ export interface PnlCostBasis {
736
+ /** Indexed deposits plus shares received by transfer, raw at vault decimals. */
737
+ depositedRaw: bigint;
738
+ /** Asset-terms withdrawals plus shares sent by transfer, raw at vault decimals. */
739
+ withdrawnAssetsRaw: bigint;
740
+ /** The part of `depositedRaw` that came from shares received by transfer. */
741
+ receivedByTransferRaw: bigint;
742
+ }
743
+ /**
744
+ * Fold peer share transfers into a wallet's lifetime-PnL cost basis.
745
+ *
746
+ * Shares a wallet received from another holder (a migration airdrop, a DEX
747
+ * purchase, a transfer from another wallet) cost the wallet their value on
748
+ * arrival, so they add to the deposited amount; shares it sent away count as
749
+ * withdrawn. This applies whether or not the wallet also deposited, so a holder
750
+ * who received shares and then topped up is not credited with the received
751
+ * shares as profit, and a depositor who moved its shares elsewhere (a lending
752
+ * market, a DEX) is not shown as having lost them. A wallet with no deposit and
753
+ * no received shares keeps a zero basis, so the history guard still decides.
754
+ *
755
+ * A depositor whose history misses a mint ({@link historyCoversMints}) is the
756
+ * exception: its transfers do not count, so the result matches what the getter
757
+ * returned before transfers counted for depositors. A wallet with no deposit
758
+ * still gets a basis here when its history misses a mint, but
759
+ * {@link assertPnlHistoryConsistent} rejects it. On a LayerZero OVault the
760
+ * caller leaves the hub composer and share OFT out of the transfers (see
761
+ * {@link selectPeerTransfers}): the composer's deliveries are already counted
762
+ * as LayerZero deposits, and shares bridged to a spoke chain still count in the
763
+ * position.
764
+ *
765
+ * Pure and synchronous.
766
+ *
767
+ * @param params - See {@link PnlCostBasisParams}.
768
+ * @returns The deposited and withdrawn amounts to compute PnL from, and the
769
+ * transfer-priced part of the deposited amount (zero when transfers did not
770
+ * count).
771
+ * @example
772
+ * ```ts
773
+ * const basis = pnlCostBasis({
774
+ * depositedRaw,
775
+ * withdrawnAssetsRaw,
776
+ * hasDeposits: depositedRaw > BigInt(0),
777
+ * mintsMatchHistory: historyCoversMints({
778
+ * transfers,
779
+ * wallet,
780
+ * depositTransactionHashes,
781
+ * }),
782
+ * transfers: transferCostBasis({
783
+ * transfers,
784
+ * wallet,
785
+ * vault,
786
+ * history,
787
+ * countSentWithoutReceipt: true,
788
+ * }),
789
+ * });
790
+ * ```
791
+ */
792
+ export declare function pnlCostBasis({ depositedRaw, withdrawnAssetsRaw, hasDeposits, mintsMatchHistory, transfers, }: PnlCostBasisParams): PnlCostBasis;
793
+ /**
794
+ * Calculate lifetime PnL for a user in a specific vault.
795
+ *
796
+ * Basic logic:
797
+ * 1. Get user's list of deposits and withdrawals from subgraph
798
+ * 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
799
+ * 3. Calculate PnL = assets withdrawn + current assets - assets deposited
800
+ *
801
+ * `totalDeposited` is the face value of what the user actually paid in
802
+ * (each deposited asset's raw amount, rescaled to the vault's decimals — no
803
+ * live price conversion), so any entry/exit fee the vault charges is
804
+ * automatically counted as a cost against PnL rather than excluded from it.
805
+ * Pre-deposit multi-asset vaults are assumed to only accept dollar-pegged
806
+ * stablecoins into a dollar-denominated vault; a vault accepting a
807
+ * non-pegged deposit asset would need deposit-time price conversion, which
808
+ * this function does not perform.
809
+ *
810
+ * Every USD field is the native amount times the underlying asset's USD price
811
+ * from the price server. There is no stand-in price: when none resolves the
812
+ * getter throws rather than returning USD values it cannot know.
813
+ *
814
+ * Shares moved by transfer: peer transfers of the share token (see
815
+ * {@link selectPeerTransfers}) are valued at the vault's daily share ratio
816
+ * ({@link transferCostBasis}) and folded in by {@link pnlCostBasis} — received
817
+ * shares add to `totalDeposited` (and are reported again as
818
+ * `receivedByTransfer`), sent shares add to `totalWithdrawn`. This holds
819
+ * alongside indexed deposits, so a wallet that received shares and also
820
+ * deposited is not credited with the received shares as profit. On LayerZero
821
+ * OVaults, transfers from or to the hub composer and share OFT do not count,
822
+ * because the composer delivers cross-chain deposits by transfer and those
823
+ * are already counted as LayerZero deposits.
824
+ *
825
+ * Gaps in the indexed history: a share mint with no `Deposit` event counts as
826
+ * a deposit of the assets in its `ReserveDeposit` event
827
+ * ({@link selectReserveDeposits}; High Growth ETH emits it for Kelp gain-adapter
828
+ * deposits), and a withdrawal request the vault logged twice counts once
829
+ * ({@link countWithdrawalRequestsOnce}). Transfers fold in for a depositor only
830
+ * once every mint is explained. A wallet with no indexed deposit and a mint
831
+ * that no deposit explains throws `HISTORY_UNAVAILABLE`.
832
+ *
833
+ * Tokenized Vault V2 redemptions carry only shares, so a settled one counts at
834
+ * the assets the vault paid, or at the share ratio on its claim date when the
835
+ * subgraph has no processed row for it ({@link settleV2Redemptions}). Only a
836
+ * request not yet claimable is valued at the current share price. When the lag
837
+ * or the ratio history cannot be read, every request is valued at the current
838
+ * share price instead.
839
+ *
840
+ * Request cost: one receipt-transfer subgraph query (and a `symbol()` RPC read)
841
+ * per call, plus one backend timeseries request when peer transfers exist and
842
+ * one `reserveDeposits` subgraph query when a mint has no indexed deposit, and
843
+ * for a Tokenized Vault V2 wallet with redemption requests, a `lagDuration()`
844
+ * read plus one backend timeseries request. A timeseries window with no usable
845
+ * ratio (a closed vault whose history stopped earlier) is read again in full,
846
+ * so the latest earlier day still prices it. The transfer query runs for
847
+ * every vault, in parallel with the history read.
848
+ *
849
+ * @param vault - Vault contract address
850
+ * @param wallet - User wallet address
851
+ * @param options - RPC configuration and service options
852
+ * @returns Lifetime PnL data in both native token and USD
853
+ * @throws {@link UpshiftHistoryUnavailableError} (`HISTORY_UNAVAILABLE`) when a
854
+ * live position has no indexed deposits, withdrawals or priceable share
855
+ * transfers, or has no indexed deposit while a share mint to the wallet has
856
+ * no matching deposit.
857
+ * @throws {@link UpshiftPriceUnavailableError} (`PRICE_UNAVAILABLE`) when the
858
+ * underlying asset has no USD price, or `asset()` cannot be read.
859
+ */
860
+ export declare function getVaultUserLifetimePnl({ vault, wallet, options, }: {
861
+ vault: IAddress;
862
+ wallet: IAddress;
863
+ options: IVaultBaseOptions;
864
+ coingeckoKey?: string;
865
+ }): Promise<IVaultUserLifetimePnl>;
866
+ /**
867
+ * Calculate PnL for a vault (vault-level, not user-specific).
868
+ * Returns the vault's overall profit and loss across all users.
869
+ *
870
+ * Sums, over the vault's whole history, each day's change in assets per share
871
+ * times that day's total shares, then prices the result at the receipt
872
+ * token's current USD price. The daily history comes from
873
+ * `GET /tokenized_vault/{vault}/historical-timeseries`, the replacement for the
874
+ * deprecated `load_snapshots` flag on the vault read.
875
+ *
876
+ * Network: one backend vault read, one timeseries read and one price read.
877
+ *
878
+ * @param vault - Vault contract address
879
+ * @param options - RPC configuration and service options
880
+ * @returns Vault PnL in the deposit asset (`totalPnl`) and in USD (`pnlUsd`).
881
+ * Both are zero for a vault with no recorded history. `pnlUsd` is also zero
882
+ * when the receipt token price cannot be fetched.
883
+ * @throws Error when `vault` is missing, is a Stellar vault, is not an
884
+ * address, or the vault or its history cannot be read.
885
+ */
886
+ export declare function getVaultPnl({ vault, options, }: {
887
+ vault: IAddress;
888
+ options: IVaultBaseOptions;
889
+ }): Promise<IVaultPnl>;
890
+ export declare function getVaultHistoricalTimeseries({ vault, nDays, options, }: {
891
+ vault: IAddress;
892
+ nDays?: number;
893
+ options?: IVaultBaseOptions;
894
+ }): Promise<IHistoricalTimeseriesResponse>;
895
+ /**
896
+ * Fetch annualized APY metrics for a vault.
897
+ *
898
+ * Supported Vaults: cUSDO, tETH, wstETH, rsETH
899
+ *
900
+ * @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
901
+ * These fields will be removed in the next major release.
902
+ * Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
903
+ *
904
+ * @param vault - Vault contract address
905
+ * @param options - Request options including headers
906
+ * @returns Annualized APY data including liquidity APY
907
+ */
908
+ export declare function getVaultAnnualizedApy({ vault, options, }: {
909
+ vault: IAddress;
910
+ options?: IVaultBaseOptions;
911
+ }): Promise<IVaultAnnualizedApy>;
912
+ /**
913
+ * Fetch summary data for a vault (name, type, chain, recent returns).
914
+ * @param vault - Vault contract address
915
+ * @param options - Request options including headers
916
+ * @returns Vault summary data
917
+ */
918
+ export declare function getVaultSummary({ vault, options, }: {
919
+ vault: IAddress;
920
+ options?: IVaultBaseOptions;
921
+ }): Promise<IVaultSummary>;
922
+ /**
923
+ * Fetch withdrawal summary and pending queue for a vault.
924
+ * @param vault - Vault contract address
925
+ * @param chain - Chain identifier (e.g., chain ID as string)
926
+ * @param options - Request options including headers
927
+ * @returns Withdrawal summary and pending queue
928
+ */
929
+ export declare function getVaultWithdrawals({ vault, chain, options, }: {
930
+ vault: IAddress;
931
+ chain: string;
932
+ options?: IVaultBaseOptions;
933
+ }): Promise<IVaultWithdrawals>;
934
+ /**
935
+ * Fetch pending redemptions for a vault with liquidity analysis.
936
+ * @param vault - Vault contract address
937
+ * @param pastDays - Number of past days to include (default 7, min 1, max 30)
938
+ * @param futureDays - Number of future days to include (default 14, min 1, max 30)
939
+ * @param options - Request options including headers
940
+ * @returns Pending redemptions grouped by date with liquidity summary
941
+ */
942
+ export declare function getVaultPendingRedemptions({ vault, pastDays, futureDays, options, }: {
943
+ vault: IAddress;
944
+ pastDays?: number;
945
+ futureDays?: number;
946
+ options?: IVaultBaseOptions;
947
+ }): Promise<IVaultPendingRedemptions>;
948
+ /**
949
+ * Preview the amount of assets that would be received for redeeming shares (queued redemption).
950
+ * @param vault - Vault contract address
951
+ * @param sharesAmount - Amount of shares to redeem (human-readable, raw bigint, or string)
952
+ * @param options - RPC configuration
953
+ * @returns The amount of assets as an INormalizedNumber with `normalized` and `raw` fields
954
+ */
955
+ export declare function getPreviewRedemption({ vault, sharesAmount, options, }: {
956
+ vault: IAddress;
957
+ sharesAmount: string | bigint | number;
958
+ options: IVaultBaseOptions;
959
+ }): Promise<INormalizedNumber>;
960
+ /**
961
+ * Withdrawal request with computed claimable date and current processing status.
962
+ * The unique identifier is (receiver, claimableDate).
963
+ *
964
+ * @interface WithdrawalRequestStatus
965
+ */
966
+ export interface WithdrawalRequestStatus {
967
+ /** Transaction hash of the withdrawal request */
968
+ transactionHash: string;
969
+ /** Block timestamp when the withdrawal was requested (seconds, UTC) */
970
+ requestTimestamp: number;
971
+ /** Shares amount being redeemed */
972
+ shares: bigint;
973
+ /** Receiver address for the withdrawal */
974
+ receiver: string;
975
+ /** Computed claimable date in UTC (year, month, day) */
976
+ claimableDate: {
977
+ year: number;
978
+ month: number;
979
+ day: number;
980
+ };
981
+ /** Epoch timestamp when this withdrawal becomes claimable */
982
+ claimableEpoch: number;
983
+ /** Current status of the withdrawal */
984
+ status: 'pending' | 'ready_to_claim' | 'processed';
985
+ /** Transaction hash of the processing transaction (if processed) */
986
+ processedTransactionHash?: string;
987
+ /** Assets received (if processed) */
988
+ assetsReceived?: bigint;
989
+ }
990
+ /**
991
+ * Returns all withdrawal requests for a vault, enriched with computed claimable dates
992
+ * and current processing status.
993
+ *
994
+ * The unique identifier for matching requests to processed events is:
995
+ * (receiver, claimableDate.year, claimableDate.month, claimableDate.day)
996
+ *
997
+ * This is the primary method for integrators to reliably track withdrawal status
998
+ * when multiple requests are submitted by the same receiver.
999
+ *
1000
+ * ## Data sources
1001
+ * - **Withdrawal requests** come from the subgraph (all historical requests).
1002
+ * - **Processed events** come from on-chain `WithdrawalProcessed` logs, which are
1003
+ * limited to a finite lookback window determined by the chain's block parameters.
1004
+ *
1005
+ * ## Lookback window & filtering
1006
+ * On-chain logs only cover a limited number of recent blocks (e.g. ~20 days on Monad,
1007
+ * ~21 days on Ethereum). The `lookbackBlocks` parameter controls how far back to scan
1008
+ * and is applied uniformly to both data sources: it bounds the `WithdrawalProcessed`
1009
+ * log query *and* drops any withdrawal request whose submission timestamp falls outside
1010
+ * the window — regardless of whether a matching processed event was found. Callers who
1011
+ * need deeper history should widen `lookbackBlocks`.
1012
+ *
1013
+ * ## Status determination
1014
+ * - `'processed'` — A matching `WithdrawalProcessed` event was found (by receiver + claimable date).
1015
+ * - `'ready_to_claim'` — Claimable date has passed (within the lookback window) but no processed event found.
1016
+ * - `'pending'` — Claimable date is still in the future.
1017
+ *
1018
+ * @param params - Query parameters:
1019
+ * - `vault` — Vault address to query.
1020
+ * - `receiver` — (Optional) Filter by receiver address.
1021
+ * - `lookbackBlocks` — (Optional) On-chain log lookback window in blocks.
1022
+ * Defaults to a chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
1023
+ * Increasing this scans more history but requires more RPC calls.
1024
+ * - `options` — Standard vault query options (provider, RPC URL, etc.).
1025
+ * @returns Array of withdrawal requests with status and claimable dates
1026
+ *
1027
+ * @worstCaseRpcCalls 1 (`lagDuration`) + the `eth_getLogs` scan in
1028
+ * `getVaultRedemptionHistory` + 1 (`eth_blockNumber`) + one `getTransaction`
1029
+ * per `WithdrawalProcessed` event in the lookback window, run at most
1030
+ * {@link PROCESSED_DECODE_CONCURRENCY} at a time. A vault with 50 processed
1031
+ * withdrawals in the window therefore makes ~53 RPC calls plus the log
1032
+ * scan, never more than 8 of them concurrently.
1033
+ *
1034
+ * @example
1035
+ * ```typescript
1036
+ * const requests = await getWithdrawalRequestsWithStatus({
1037
+ * vault: '0xVault...',
1038
+ * receiver: '0xReceiver...'
1039
+ * });
1040
+ *
1041
+ * // Results show exact status + claimable date
1042
+ * requests.forEach(req => {
1043
+ * console.log(
1044
+ * `${req.claimableDate.year}-${req.claimableDate.month}-${req.claimableDate.day}: ${req.status}`
1045
+ * );
1046
+ * });
1047
+ *
1048
+ * // With custom lookback window (e.g. 30 days on Ethereum ≈ 216,000 blocks)
1049
+ * const moreResults = await getWithdrawalRequestsWithStatus({
1050
+ * vault: '0xVault...',
1051
+ * lookbackBlocks: 216_000,
1052
+ * });
1053
+ * ```
1054
+ */
1055
+ export declare function getWithdrawalRequestsWithStatus(params: {
1056
+ vault: IAddress;
1057
+ receiver?: IAddress;
1058
+ lookbackBlocks?: number;
1059
+ options: IVaultBaseOptions;
1060
+ }): Promise<WithdrawalRequestStatus[]>;