@upshiftfinance/sdk 0.0.0-stage → 0.2.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 (344) 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/client.d.ts +83 -0
  116. package/lib/adapters/sui/client.js +216 -0
  117. package/lib/adapters/sui/constants.d.ts +33 -0
  118. package/lib/adapters/sui/constants.js +31 -0
  119. package/lib/adapters/sui/index.d.ts +57 -0
  120. package/lib/adapters/sui/index.js +100 -0
  121. package/lib/adapters/sui/targets.d.ts +171 -0
  122. package/lib/adapters/sui/targets.js +225 -0
  123. package/lib/adapters/sui/utils.d.ts +8 -0
  124. package/lib/adapters/sui/utils.js +17 -0
  125. package/lib/core/analytics/app-name.d.ts +27 -0
  126. package/lib/core/analytics/app-name.js +48 -0
  127. package/lib/core/analytics/chain-name.d.ts +9 -0
  128. package/lib/core/analytics/chain-name.js +34 -0
  129. package/lib/core/analytics/constants.d.ts +15 -0
  130. package/lib/core/analytics/constants.js +28 -0
  131. package/lib/core/analytics/env.d.ts +46 -0
  132. package/lib/core/analytics/env.js +147 -0
  133. package/lib/core/analytics/index.d.ts +39 -0
  134. package/lib/core/analytics/index.js +83 -0
  135. package/lib/core/analytics/instrumentation.d.ts +29 -0
  136. package/lib/core/analytics/instrumentation.js +292 -0
  137. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  138. package/lib/core/analytics/method-taxonomy.js +156 -0
  139. package/lib/core/analytics/metrics.d.ts +48 -0
  140. package/lib/core/analytics/metrics.js +142 -0
  141. package/lib/core/analytics/sanitize.d.ts +57 -0
  142. package/lib/core/analytics/sanitize.js +272 -0
  143. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  144. package/lib/core/analytics/sentry-runtime.js +131 -0
  145. package/lib/core/analytics/sentry.d.ts +100 -0
  146. package/lib/core/analytics/sentry.js +696 -0
  147. package/lib/core/analytics/types.d.ts +55 -0
  148. package/lib/core/analytics/types.js +3 -0
  149. package/lib/core/analytics/user-identity.d.ts +55 -0
  150. package/lib/core/analytics/user-identity.js +218 -0
  151. package/lib/core/analytics/version.d.ts +6 -0
  152. package/lib/core/analytics/version.js +10 -0
  153. package/lib/core/attribution.d.ts +159 -0
  154. package/lib/core/attribution.js +194 -0
  155. package/lib/core/auth/index.d.ts +1 -0
  156. package/lib/core/auth/index.js +18 -0
  157. package/lib/core/auth/verify.d.ts +2 -0
  158. package/lib/core/auth/verify.js +35 -0
  159. package/lib/core/base.class.d.ts +193 -0
  160. package/lib/core/base.class.js +163 -0
  161. package/lib/core/cache.d.ts +9 -0
  162. package/lib/core/cache.js +31 -0
  163. package/lib/core/constants/adapters.d.ts +103 -0
  164. package/lib/core/constants/adapters.js +180 -0
  165. package/lib/core/constants/core.d.ts +162 -0
  166. package/lib/core/constants/core.js +281 -0
  167. package/lib/core/constants/swap-router.d.ts +180 -0
  168. package/lib/core/constants/swap-router.js +203 -0
  169. package/lib/core/constants/vaults.d.ts +93 -0
  170. package/lib/core/constants/vaults.js +277 -0
  171. package/lib/core/constants/web3.d.ts +106 -0
  172. package/lib/core/constants/web3.js +251 -0
  173. package/lib/core/errors/index.d.ts +177 -0
  174. package/lib/core/errors/index.js +257 -0
  175. package/lib/core/fetcher.d.ts +237 -0
  176. package/lib/core/fetcher.js +1103 -0
  177. package/lib/core/helpers/adapters.d.ts +13 -0
  178. package/lib/core/helpers/adapters.js +39 -0
  179. package/lib/core/helpers/chain-address.d.ts +13 -0
  180. package/lib/core/helpers/chain-address.js +47 -0
  181. package/lib/core/helpers/chain-error.d.ts +207 -0
  182. package/lib/core/helpers/chain-error.js +697 -0
  183. package/lib/core/helpers/chain-support.d.ts +98 -0
  184. package/lib/core/helpers/chain-support.js +139 -0
  185. package/lib/core/helpers/concurrency.d.ts +51 -0
  186. package/lib/core/helpers/concurrency.js +79 -0
  187. package/lib/core/helpers/core.d.ts +92 -0
  188. package/lib/core/helpers/core.js +368 -0
  189. package/lib/core/helpers/explorer-link.d.ts +16 -0
  190. package/lib/core/helpers/explorer-link.js +26 -0
  191. package/lib/core/helpers/multicall.d.ts +68 -0
  192. package/lib/core/helpers/multicall.js +103 -0
  193. package/lib/core/helpers/revert-decode.d.ts +248 -0
  194. package/lib/core/helpers/revert-decode.js +515 -0
  195. package/lib/core/helpers/signer.d.ts +61 -0
  196. package/lib/core/helpers/signer.js +184 -0
  197. package/lib/core/helpers/swap-router.d.ts +269 -0
  198. package/lib/core/helpers/swap-router.js +542 -0
  199. package/lib/core/helpers/vault-version.d.ts +24 -0
  200. package/lib/core/helpers/vault-version.js +83 -0
  201. package/lib/core/helpers/vaults.d.ts +89 -0
  202. package/lib/core/helpers/vaults.js +241 -0
  203. package/lib/core/helpers/web3.d.ts +366 -0
  204. package/lib/core/helpers/web3.js +1034 -0
  205. package/lib/core/index.d.ts +23 -0
  206. package/lib/core/index.js +40 -0
  207. package/lib/core/logger/curator-alert.d.ts +217 -0
  208. package/lib/core/logger/curator-alert.js +276 -0
  209. package/lib/core/logger/index.d.ts +99 -0
  210. package/lib/core/logger/index.js +163 -0
  211. package/lib/core/logger/slack.d.ts +49 -0
  212. package/lib/core/logger/slack.js +111 -0
  213. package/lib/core/vault-metadata.d.ts +12 -0
  214. package/lib/core/vault-metadata.js +42 -0
  215. package/lib/core/version-check.d.ts +58 -0
  216. package/lib/core/version-check.js +182 -0
  217. package/lib/evm/index.d.ts +2 -0
  218. package/lib/evm/index.js +19 -0
  219. package/lib/evm/methods/crossChainVault.d.ts +132 -0
  220. package/lib/evm/methods/crossChainVault.js +857 -0
  221. package/lib/evm/methods/crossChainVaultRegistry.d.ts +92 -0
  222. package/lib/evm/methods/crossChainVaultRegistry.js +239 -0
  223. package/lib/evm/methods/index.d.ts +2 -0
  224. package/lib/evm/methods/index.js +19 -0
  225. package/lib/evm/types/crossChain.d.ts +363 -0
  226. package/lib/evm/types/crossChain.js +20 -0
  227. package/lib/evm/types/index.d.ts +1 -0
  228. package/lib/evm/types/index.js +18 -0
  229. package/lib/index.d.ts +30 -0
  230. package/lib/index.js +52 -0
  231. package/lib/main.d.ts +596 -0
  232. package/lib/main.js +681 -0
  233. package/lib/modules/api/fetcher.d.ts +108 -0
  234. package/lib/modules/api/fetcher.js +187 -0
  235. package/lib/modules/api/index.d.ts +1 -0
  236. package/lib/modules/api/index.js +6 -0
  237. package/lib/modules/api/main.d.ts +587 -0
  238. package/lib/modules/api/main.js +911 -0
  239. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  240. package/lib/modules/sub-accounts/fetcher.js +96 -0
  241. package/lib/modules/sub-accounts/index.d.ts +2 -0
  242. package/lib/modules/sub-accounts/index.js +19 -0
  243. package/lib/modules/sub-accounts/main.d.ts +249 -0
  244. package/lib/modules/sub-accounts/main.js +211 -0
  245. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  246. package/lib/modules/sub-accounts/utils.js +112 -0
  247. package/lib/modules/vaults/adapter.helpers.d.ts +84 -0
  248. package/lib/modules/vaults/adapter.helpers.js +202 -0
  249. package/lib/modules/vaults/fetcher.d.ts +147 -0
  250. package/lib/modules/vaults/fetcher.js +357 -0
  251. package/lib/modules/vaults/getters.d.ts +1060 -0
  252. package/lib/modules/vaults/getters.js +4079 -0
  253. package/lib/modules/vaults/index.d.ts +20 -0
  254. package/lib/modules/vaults/index.js +44 -0
  255. package/lib/modules/vaults/main.d.ts +607 -0
  256. package/lib/modules/vaults/main.js +1687 -0
  257. package/lib/modules/vaults/prefetch.d.ts +65 -0
  258. package/lib/modules/vaults/prefetch.js +120 -0
  259. package/lib/modules/vaults/read.actions.d.ts +406 -0
  260. package/lib/modules/vaults/read.actions.js +891 -0
  261. package/lib/modules/vaults/types.d.ts +149 -0
  262. package/lib/modules/vaults/types.js +3 -0
  263. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  264. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  265. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  266. package/lib/modules/vaults/utils/date-utils.js +84 -0
  267. package/lib/modules/vaults/utils.d.ts +153 -0
  268. package/lib/modules/vaults/utils.js +818 -0
  269. package/lib/modules/vaults/write.actions.d.ts +812 -0
  270. package/lib/modules/vaults/write.actions.js +2377 -0
  271. package/lib/polyfills.d.ts +1 -0
  272. package/lib/polyfills.js +12 -0
  273. package/lib/sdk.d.ts +30173 -0
  274. package/lib/services/coingecko/fetcher.d.ts +15 -0
  275. package/lib/services/coingecko/fetcher.js +67 -0
  276. package/lib/services/coingecko/index.d.ts +2 -0
  277. package/lib/services/coingecko/index.js +19 -0
  278. package/lib/services/coingecko/utils.d.ts +1 -0
  279. package/lib/services/coingecko/utils.js +24 -0
  280. package/lib/services/debank/fetcher.d.ts +126 -0
  281. package/lib/services/debank/fetcher.js +47 -0
  282. package/lib/services/debank/index.d.ts +2 -0
  283. package/lib/services/debank/index.js +19 -0
  284. package/lib/services/debank/utils.d.ts +50 -0
  285. package/lib/services/debank/utils.js +325 -0
  286. package/lib/services/layerzero/deposits.d.ts +55 -0
  287. package/lib/services/layerzero/deposits.js +174 -0
  288. package/lib/services/layerzero/redeems.d.ts +20 -0
  289. package/lib/services/layerzero/redeems.js +92 -0
  290. package/lib/services/layerzero/utils.d.ts +9 -0
  291. package/lib/services/layerzero/utils.js +22 -0
  292. package/lib/services/octavfi/fetcher.d.ts +33 -0
  293. package/lib/services/octavfi/fetcher.js +39 -0
  294. package/lib/services/octavfi/index.d.ts +3 -0
  295. package/lib/services/octavfi/index.js +20 -0
  296. package/lib/services/octavfi/types.d.ts +34 -0
  297. package/lib/services/octavfi/types.js +3 -0
  298. package/lib/services/octavfi/utils.d.ts +16 -0
  299. package/lib/services/octavfi/utils.js +244 -0
  300. package/lib/services/subgraph/fetcher.d.ts +2 -0
  301. package/lib/services/subgraph/fetcher.js +66 -0
  302. package/lib/services/subgraph/index.d.ts +2 -0
  303. package/lib/services/subgraph/index.js +19 -0
  304. package/lib/services/subgraph/schema.d.ts +48 -0
  305. package/lib/services/subgraph/schema.js +87 -0
  306. package/lib/services/subgraph/vaults.d.ts +83 -0
  307. package/lib/services/subgraph/vaults.js +1282 -0
  308. package/lib/services/swap-quotes/index.d.ts +105 -0
  309. package/lib/services/swap-quotes/index.js +77 -0
  310. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  311. package/lib/services/swap-quotes/paraswap.js +138 -0
  312. package/lib/services/untangled/fetcher.d.ts +40 -0
  313. package/lib/services/untangled/fetcher.js +110 -0
  314. package/lib/services/untangled/index.d.ts +3 -0
  315. package/lib/services/untangled/index.js +20 -0
  316. package/lib/services/untangled/types.d.ts +83 -0
  317. package/lib/services/untangled/types.js +10 -0
  318. package/lib/services/untangled/utils.d.ts +91 -0
  319. package/lib/services/untangled/utils.js +339 -0
  320. package/lib/types/api.d.ts +498 -0
  321. package/lib/types/api.js +3 -0
  322. package/lib/types/index.d.ts +12 -0
  323. package/lib/types/index.js +28 -0
  324. package/lib/types/points.d.ts +28 -0
  325. package/lib/types/points.js +3 -0
  326. package/lib/types/pools.d.ts +144 -0
  327. package/lib/types/pools.js +3 -0
  328. package/lib/types/staking.d.ts +28 -0
  329. package/lib/types/staking.js +3 -0
  330. package/lib/types/sub-accounts.d.ts +150 -0
  331. package/lib/types/sub-accounts.js +3 -0
  332. package/lib/types/subgraph.d.ts +84 -0
  333. package/lib/types/subgraph.js +3 -0
  334. package/lib/types/typed-contract.d.ts +102 -0
  335. package/lib/types/typed-contract.js +3 -0
  336. package/lib/types/user.d.ts +1 -0
  337. package/lib/types/user.js +3 -0
  338. package/lib/types/vaults.d.ts +886 -0
  339. package/lib/types/vaults.js +30 -0
  340. package/lib/types/web3.d.ts +100 -0
  341. package/lib/types/web3.js +14 -0
  342. package/lib/types/webserver.d.ts +730 -0
  343. package/lib/types/webserver.js +3 -0
  344. package/package.json +79 -3
@@ -0,0 +1,886 @@
1
+ import type { IAddress, INormalizedNumber, VaultAddress } from './web3';
2
+ import type { IDebankProtocolExposure, IDebankTokenExposure, IOTCPosition, IWSSubaccountCefi, IWSSubaccountLoan, IWSTokenEntry, ITokenizedVaultOperator, ITokenizedVaultEoaOperator, IHIstoricalSnapshot, IApyOverride } from './webserver';
3
+ import type { InterfaceAbi } from 'ethers';
4
+ export interface IVaultLoan {
5
+ vault: VaultAddress;
6
+ address: IAddress;
7
+ lender: IAddress;
8
+ borrower: IAddress;
9
+ state: string;
10
+ totalRepaid: number;
11
+ principalToken: IWSTokenEntry;
12
+ principalAmount: number;
13
+ interestAmount: number;
14
+ upcomingPayment: {
15
+ amount: number;
16
+ dueDate: string;
17
+ };
18
+ apr: number;
19
+ initialPrincipalAmount: number;
20
+ deployedDate: string;
21
+ paymentInterval: number;
22
+ isIdleCapital: boolean;
23
+ allocation: number;
24
+ }
25
+ /**
26
+ * One row of borrower-health-factor data for a vault. `health_factor` is
27
+ * absent when the upstream Upshift backend has no record for `borrower`
28
+ * (e.g. test loans whose borrower is not a registered subaccount), or when
29
+ * the per-borrower fetch failed — callers must handle the undefined case
30
+ * rather than assume a numeric value is present.
31
+ */
32
+ export interface IVaultBorrowerHealthFactor {
33
+ borrower: IAddress;
34
+ loan: IAddress;
35
+ health_factor?: {
36
+ datetime: string;
37
+ health_factor: number;
38
+ id: string;
39
+ total_collateral_value: number;
40
+ total_loan_value: number;
41
+ };
42
+ }
43
+ export type IVaultUserHistoryItem = {
44
+ timestamp: number;
45
+ address: IAddress;
46
+ amount: INormalizedNumber;
47
+ pool: IAddress;
48
+ chainId: number;
49
+ type: 'withdraw-request' | 'deposit' | 'withdraw-processed' | 'redeem';
50
+ transactionHash: IAddress;
51
+ /**
52
+ * The token address that was actually deposited, when known. Pre-deposit
53
+ * vaults accept multiple deposit assets (e.g. a sentUSD vault taking RLUSD,
54
+ * USDC, and USDT), so the vault's own metadata cannot tell a consumer which
55
+ * asset a given deposit used — only this per-row address can. UIs should
56
+ * resolve the displayed asset symbol/logo from `assetIn` rather than assuming
57
+ * the vault's first deposit asset. Absent for single-asset vaults and for
58
+ * withdraw/redeem rows, where the vault's underlying asset applies.
59
+ */
60
+ assetIn?: IAddress;
61
+ /**
62
+ * Receipt-token (vault share) amount burned on a withdraw **request**. An
63
+ * async withdrawal burns shares immediately, but the assets received are not
64
+ * known until the request settles (share price can drift), so `amount`'s
65
+ * asset figure is only a preview. UIs rendering a pending request should show
66
+ * these `shares` with the receipt symbol — the concrete on-chain fact — and
67
+ * reserve the asset amount for the settled ("processed") row. Present only on
68
+ * `withdraw-request` items.
69
+ */
70
+ shares?: INormalizedNumber;
71
+ };
72
+ /**
73
+ * A single reward paired with its backend-provided logo.
74
+ *
75
+ * `id` is the reward's stable backend identifier ({@link ITokenizedVaultReward.id})
76
+ * and is the key consumers should join on — it is unique even when two rewards
77
+ * share a multiplier and text. `label` is display-only: it mirrors the
78
+ * corresponding {@link IVaultRewards.additionalPoints} string (and so carries a
79
+ * leading space when `multiplier === 1`, e.g. `" Cores"`), so it is fine to
80
+ * print but must not be treated as a unique key.
81
+ *
82
+ * `imgUrl` is `null` when the backend has no logo for the reward, in which
83
+ * case consumers fall back to a bundled asset.
84
+ */
85
+ export type IVaultRewardDetail = {
86
+ id: string;
87
+ label: string;
88
+ text: string;
89
+ imgUrl: string | null;
90
+ multiplier: number;
91
+ };
92
+ export type IVaultRewards = {
93
+ points: string;
94
+ multiplier: number;
95
+ multipliers: {
96
+ value: number;
97
+ timestamp: number;
98
+ }[];
99
+ additionalPoints: string[];
100
+ /**
101
+ * Optional so this addition is non-breaking for external code that
102
+ * constructs an {@link IVaultRewards}. `getVaultRewards` always populates it;
103
+ * readers should treat an absent value as an empty list.
104
+ */
105
+ additionalPointsDetailed?: IVaultRewardDetail[];
106
+ };
107
+ export type IVaultExposureItem = {
108
+ amount: number;
109
+ chain: string;
110
+ decimals: number;
111
+ exposureType?: string;
112
+ id: string;
113
+ logoUrl?: string;
114
+ name: string;
115
+ protocol?: string;
116
+ symbol: string;
117
+ /** DeBank `pool.id` of the portfolio item the token belongs to — tells
118
+ * apart two positions in the same protocol holding the same token. */
119
+ poolId?: string;
120
+ };
121
+ export type IExposurePerCategory = {
122
+ borrowing: IVaultExposureItem[];
123
+ supplying: IVaultExposureItem[];
124
+ lending: IWSSubaccountLoan[];
125
+ wallet: IVaultExposureItem[];
126
+ cefiBalance: number;
127
+ defiBalance: number;
128
+ walletBalance: number;
129
+ loanBalance: number;
130
+ };
131
+ /**
132
+ * @todo clean up to minimize data transfer
133
+ * ```typescript
134
+ * {
135
+ * defi: IOctavfiPortfolio[]
136
+ * cefi: IWSSubaccountCefi[]
137
+ * otc: Record<string, IOTCPosition>
138
+ * breakdown: { // this will be total net values
139
+ * defi: number;
140
+ * cefi: number;
141
+ * otc: number;
142
+ * total: number;
143
+ * }
144
+ * }
145
+ * ```
146
+ */
147
+ /**
148
+ * How far a Solana vault's allocations fall short of its on-chain AUM.
149
+ *
150
+ * Portfolio indexers miss positions (Octav once skipped ~$1M of Kamino Multiply
151
+ * obligations for one vault), and nothing else in {@link IVaultAllocations}
152
+ * would show it. All values are USD, and they add up:
153
+ * `defiBalance + walletBalance + cefiBalance + idleUsd + usd === onChainAumUsd`,
154
+ * with the balances from `exposurePerCategory`.
155
+ */
156
+ export interface IVaultUnattributed {
157
+ /**
158
+ * On-chain deployed AUM minus the allocations' total. Signed and not
159
+ * thresholded: positive is value no allocation accounts for, such as a
160
+ * protocol the indexer doesn't cover; negative is double counting or a
161
+ * mispriced token. A small value either way is price drift between the
162
+ * indexer's read and the chain, so apply a display floor of your own.
163
+ */
164
+ usd: number;
165
+ /** The vault's on-chain AUM (`local_aum + deployed_aum`), read fresh. */
166
+ onChainAumUsd: number;
167
+ /**
168
+ * What the vault program itself holds (`local_aum`). It sits with no
169
+ * operator, so no allocation covers it; show it as its own slice.
170
+ */
171
+ idleUsd: number;
172
+ }
173
+ export interface IVaultAllocations {
174
+ defi: IDebankProtocolExposure[];
175
+ /**
176
+ * The vault's asset composition, in USD (`amount` is a dollar value).
177
+ *
178
+ * On Stellar this is Untangled's `byAsset` breakdown, which decomposes the
179
+ * same `tvlUsd` that `defi` does along a different axis — assets rather than
180
+ * venues. The two do not join: which venue holds which asset is not published,
181
+ * so this is the only place a Stellar vault's assets are stated, and reading a
182
+ * per-venue asset split out of `exposurePerCategory` is not supported for
183
+ * multi-asset Stellar vaults.
184
+ */
185
+ tokens: IDebankTokenExposure[];
186
+ cefi: IWSSubaccountCefi[];
187
+ unfilteredTokens: IDebankTokenExposure[];
188
+ otc: Record<string, IOTCPosition>;
189
+ exposurePerCategory?: IExposurePerCategory;
190
+ netValue?: number;
191
+ /**
192
+ * Solana vaults only: the gap between the allocations and the vault's
193
+ * on-chain AUM. Absent for other chains, and for a Solana vault whose state
194
+ * or deposit-token price could not be read.
195
+ */
196
+ unattributed?: IVaultUnattributed;
197
+ defiPerBorrower: Record<`0x${string}`, {
198
+ /**
199
+ * De-duplicated exposure rows: `value` is a token id or pool controller,
200
+ * `label` its symbol or adapter id, `usd` the summed USD value.
201
+ */
202
+ exposure: {
203
+ value: string;
204
+ label: string;
205
+ usd: number;
206
+ }[];
207
+ /** Protocols the borrower has positions in: `value` is the logo URL. */
208
+ positions: {
209
+ value: string;
210
+ label: string;
211
+ }[];
212
+ }>;
213
+ }
214
+ /**
215
+ * A vault's APY breakdown.
216
+ *
217
+ * **Unit contract: every rate on this type is a PERCENTAGE, not a decimal
218
+ * fraction.** `7.95` means 7.95%. The backend reports these as decimal fractions
219
+ * (`0.0795`); the SDK multiplies by 100 exactly once, uniformly across every rate
220
+ * field, before returning them. Consumers must therefore divide by 100 at most once
221
+ * — and must apply the same treatment to `apy`, `liquidApy`, `pointsApy`,
222
+ * `campaignApy` and `underlyingApy`, because they all arrive in the same unit.
223
+ *
224
+ * This is stated explicitly because the convention going undocumented let a
225
+ * consumer scale a subset of these fields twice, making them contribute 1/100th of
226
+ * their value to a displayed total. The unit is uniform here by
227
+ * design; treating some of these fields as decimals and others as percentages is
228
+ * always a bug on the consumer side.
229
+ */
230
+ export interface IVaultApy {
231
+ /** Base vault APY as a percentage (7.95 = 7.95%). */
232
+ apy: number;
233
+ /** Human-readable note on how the APY is derived; empty or null when unset. */
234
+ explainer: string;
235
+ /** Liquid-yield component as a percentage. */
236
+ liquidApy: number;
237
+ /** Points-program APY as a percentage, or null when the vault has no points. */
238
+ pointsApy: number | null;
239
+ /** Campaign-boost APY as a percentage, or null when no campaign is running. */
240
+ campaignApy: number | null;
241
+ /** Claimable rewards, in the reward token's own units — not a percentage. */
242
+ rewardsClaimable: number;
243
+ /** Compounded rewards, in the reward token's own units — not a percentage. */
244
+ rewardsCompounded: number;
245
+ /** Underlying-asset APY as a percentage (e.g. staking yield on the deposit asset). */
246
+ underlyingApy: number;
247
+ }
248
+ export interface IVaultStrategist {
249
+ address: IAddress;
250
+ logo: string;
251
+ name: string;
252
+ type?: string;
253
+ website_url: string | null;
254
+ }
255
+ export type IVaultVersion = 'evm-0' | 'evm-1' | 'evm-2' | 'sol-0' | 'sui-0' | 'stellar-0';
256
+ export type { ChainType } from './web3';
257
+ /**
258
+ * Adapter configuration for vaults that support deposits with alternative tokens
259
+ */
260
+ export interface IVaultAdapterConfig {
261
+ lpTokenAddress?: IAddress;
262
+ isNativeTokenDeposit: boolean;
263
+ isWrappedTokenDeposit: boolean;
264
+ wrappedTokenAddress?: IAddress;
265
+ referralId?: IAddress | string;
266
+ abi?: InterfaceAbi;
267
+ wrapperAddress?: IAddress;
268
+ viewAdapter?: IAddress;
269
+ tokens?: IAddress[];
270
+ bridgeId?: number;
271
+ }
272
+ /**
273
+ * Provenance timestamps for a vault's server-side data, mapped from the backend
274
+ * `freshness` object.
275
+ *
276
+ * A vault's share price and its APY come from two different pipelines: the SDK
277
+ * reads share price live from chain (`totalAssets()/totalSupply()`), while APY is a
278
+ * backend column recomputed on a schedule. These stamps make the remaining gap
279
+ * visible so a UI can render "data as of X" instead of implying both numbers are
280
+ * equally current.
281
+ *
282
+ * The three fields are **independently nullable and independently meaningful** —
283
+ * none of them is a fallback for another. In particular, when
284
+ * `shareRatioSnapshotAt` is later than `apyComputedAt`, a share-price snapshot has
285
+ * landed that the APY has not yet been recomputed from: that ordering is the
286
+ * staleness signal.
287
+ *
288
+ * Every value is an RFC 3339 UTC string with a trailing `Z`, exactly as the backend
289
+ * sends it — the SDK does not reformat or reinterpret them. Keep the `Z` if you
290
+ * pass these anywhere: `new Date('2026-07-25T00:01:46')` (no `Z`) is parsed as
291
+ * *local* time and silently shifts by the viewer's UTC offset.
292
+ *
293
+ * @example
294
+ * ```ts
295
+ * const vault = await sdk.vaults.getVault(address);
296
+ * const { apyComputedAt, shareRatioSnapshotAt } = vault.freshness ?? {};
297
+ * // Only comparable when BOTH are present.
298
+ * const apyLagsSharePrice =
299
+ * !!apyComputedAt &&
300
+ * !!shareRatioSnapshotAt &&
301
+ * new Date(shareRatioSnapshotAt) > new Date(apyComputedAt);
302
+ * ```
303
+ */
304
+ export interface IVaultFreshness {
305
+ /**
306
+ * When the backend last recomputed `historical_apy`, TVL and drawdown for this
307
+ * vault. Null if never computed.
308
+ */
309
+ apyComputedAt: string | null;
310
+ /**
311
+ * Timestamp of the newest persisted share-price snapshot the backend holds. Null
312
+ * only when the vault has no snapshot yet.
313
+ *
314
+ * Populated regardless of whether the read loaded snapshots — the backend stamps
315
+ * it from a scalar `max(snapshot_datetime)`, so it is present even on
316
+ * `load_snapshots=false` reads (the basic and sub-accounts views). When it is
317
+ * null, treat it as absent: do not fall back to `apyComputedAt` or `cachedAt` in
318
+ * its place.
319
+ */
320
+ shareRatioSnapshotAt: string | null;
321
+ /**
322
+ * When the backend assembled the response body this vault came from, before its
323
+ * own response cache. Note this does **not** account for the SDK's client-side
324
+ * LRU (10–15 min on `fetchTokenizedVault` / `fetchTokenizedVaults`), so a vault
325
+ * served from that cache can be older than this stamp suggests is possible.
326
+ */
327
+ cachedAt: string | null;
328
+ }
329
+ export interface IVault {
330
+ max_drawdown?: number | null;
331
+ historical_apy?: Record<number, number> | null;
332
+ /**
333
+ * Compound-annualized historical APY keyed by horizon in days (1/7/30), as
334
+ * decimal fractions. Same shape and per-horizon null semantics as
335
+ * `historical_apy`. Display is opted in per vault via
336
+ * `apyOverride.is_show_compound_apy`; absent on older/cached responses.
337
+ */
338
+ historical_compound_apy?: Record<number, number> | null;
339
+ /** @deprecated Use getVaultHistoricalTimeseries instead */
340
+ historical_snapshots?: IHIstoricalSnapshot[];
341
+ depositCap?: INormalizedNumber;
342
+ maxDepositAmount?: INormalizedNumber;
343
+ /**
344
+ * Vault contract address. May be an EVM hex address, Solana base58 address,
345
+ * or Stellar base32 address depending on the vault's chain.
346
+ */
347
+ address: VaultAddress;
348
+ chainId: number;
349
+ name: string;
350
+ logoUrl: string;
351
+ receipt: {
352
+ address: VaultAddress;
353
+ symbol: string;
354
+ decimals: number;
355
+ };
356
+ description: string;
357
+ startDatetime: string;
358
+ status: 'active' | 'closed' | 'testing';
359
+ version: IVaultVersion;
360
+ tags: string[];
361
+ isFeatured: boolean;
362
+ isSpotlighted?: boolean;
363
+ withdrawalOnly?: boolean;
364
+ isVisible: boolean;
365
+ reserveTarget: number;
366
+ reserveTolerance: number;
367
+ decimals: number;
368
+ totalAssets: INormalizedNumber;
369
+ totalSupply: INormalizedNumber;
370
+ maxSupply: INormalizedNumber;
371
+ operators: ITokenizedVaultOperator[];
372
+ eoa_operators: ITokenizedVaultEoaOperator[];
373
+ depositAssets: {
374
+ address: VaultAddress;
375
+ symbol: string;
376
+ decimals: number;
377
+ }[];
378
+ apy: IVaultApy;
379
+ operator: IAddress;
380
+ rewards: IVaultRewards;
381
+ strategists: IVaultStrategist[];
382
+ fees: {
383
+ management: number;
384
+ isManagementWaived: boolean;
385
+ managementFeeWaivedUntilDate: string | null;
386
+ managementFeeWaivedUntilTvl: number | null;
387
+ performance: number;
388
+ isPerformanceWaived: boolean;
389
+ performanceFeeWaivedUntilDate: string | null;
390
+ performanceFeeWaivedUntilTvl: number | null;
391
+ };
392
+ lagDuration: number;
393
+ /**
394
+ * Backend-configured display buffer in seconds added on top of
395
+ * `lagDuration` for the withdrawal period shown to users. Null when the
396
+ * backend has not set a value — consumers apply their own default.
397
+ */
398
+ withdrawalMarginSeconds?: number | null;
399
+ /**
400
+ * IAT trader wallet addresses for the vault, from the backend
401
+ * `iat_traders` field. Address format follows the vault's chain
402
+ * (EVM hex / Solana base58 / Stellar). Null when not configured.
403
+ */
404
+ iatTraders?: string[] | null;
405
+ maxDailyDrawdown: number;
406
+ risk: string;
407
+ isWithdrawalPaused: boolean;
408
+ isDepositPaused: boolean;
409
+ idleAssets: INormalizedNumber;
410
+ loans?: IVaultLoan[];
411
+ allocations?: IVaultAllocations;
412
+ position?: IVaultPosition;
413
+ linkOnly?: boolean;
414
+ composabilityIntegrations?: Array<{
415
+ name: string;
416
+ description: string;
417
+ earningMultiplier: number;
418
+ protocolUrl: string;
419
+ logoUrl: string;
420
+ tokenizedVaultId: string;
421
+ id: string;
422
+ }>;
423
+ dailyPnlPerShare?: {
424
+ timestamp: string;
425
+ value: number;
426
+ }[];
427
+ enabled_historical_price_horizons?: number[];
428
+ defaultApyHorizon?: 7 | 30 | null;
429
+ latest_reported_tvl?: number | null;
430
+ /**
431
+ * Wrapper vaults only: the vault this one wraps, which holds the assets. A
432
+ * wrapper's own on-chain `totalAssets` reads 0, so its TVL is the underlying
433
+ * vault's. Null on a non-wrapper vault. Address casing is preserved verbatim.
434
+ */
435
+ underlyingVaultAddress?: VaultAddress | null;
436
+ /** Chain id of {@link IVault.underlyingVaultAddress}; null on a non-wrapper vault. */
437
+ underlyingChainId?: number | null;
438
+ cachedAt?: string | null;
439
+ /**
440
+ * Provenance timestamps for the vault's server-side data — when its APY was last
441
+ * recomputed, when its newest share-price snapshot was taken, and when the
442
+ * backend built the response. Null (or a null member) when the backend did not
443
+ * report that stamp; see {@link IVaultFreshness}.
444
+ */
445
+ freshness?: IVaultFreshness | null;
446
+ showCapFilled?: boolean | null;
447
+ /** Controls how the vault's APY is displayed; null when the backend has not set an override. */
448
+ apyOverride?: IApyOverride | null;
449
+ programId?: string;
450
+ /**
451
+ * Solana only: the vault's withdrawal queue, when it has one. Absent for
452
+ * other chains and for Solana vaults that never had a queue. See
453
+ * {@link IVaultWithdrawalQueue}.
454
+ */
455
+ withdrawalQueue?: IVaultWithdrawalQueue;
456
+ /** Instant redemption config, populated from backend instant_redeem_config */
457
+ instant_redeem_config?: {
458
+ subaccountAddress: IAddress;
459
+ outputAssetSymbol: string;
460
+ redeemableAssets: Array<{
461
+ address: IAddress;
462
+ symbol: string;
463
+ decimals: number;
464
+ spreadBps: number;
465
+ }>;
466
+ isPaused: boolean;
467
+ availableLiquidity: number;
468
+ } | null;
469
+ }
470
+ export declare enum VaultRedemptionStatus {
471
+ AWAITING_COOLDOWN = "awaiting_cooldown",
472
+ READY_TO_CLAIM = "ready_to_claim",
473
+ /**
474
+ * Solana withdrawal queue only: the request's fulfillment window has closed.
475
+ * It can no longer be claimed, only cancelled, which returns its shares.
476
+ */
477
+ EXPIRED = "expired"
478
+ }
479
+ /**
480
+ * A Solana vault's withdrawal queue, as `IVault.withdrawalQueue`.
481
+ *
482
+ * With a queue attached, holders cannot redeem directly: they request a
483
+ * withdrawal, wait out the cooldown, then claim. Read from the queue account on
484
+ * each vault fetch, so the counts are live.
485
+ */
486
+ export interface IVaultWithdrawalQueue {
487
+ /** The queue account (PDA) address, base58. */
488
+ address: string;
489
+ /**
490
+ * Whether the vault's redeem gate points at this queue, i.e. whether new
491
+ * requests are accepted and direct redemption is closed. `false` for a
492
+ * released queue, which may still hold requests made before the release.
493
+ */
494
+ enabled: boolean;
495
+ /** Seconds between a new request and when it can be claimed. */
496
+ cooldownSeconds: number;
497
+ /**
498
+ * Seconds after the cooldown that a new request stays claimable, or `0` for
499
+ * no limit. A request past its window can only be cancelled.
500
+ */
501
+ fulfillmentWindowSeconds: number;
502
+ /** Number of requests not yet claimed or cancelled, across all holders. */
503
+ pendingCount: number;
504
+ /** Shares escrowed across all pending requests, in share-token units. */
505
+ pendingShares: INormalizedNumber;
506
+ }
507
+ export type IVaultAvailableRedemption = {
508
+ id: string;
509
+ hash: string;
510
+ timestamp: number;
511
+ receiver: IAddress;
512
+ day: INormalizedNumber;
513
+ month: INormalizedNumber;
514
+ year: INormalizedNumber;
515
+ amount: INormalizedNumber;
516
+ date: Date;
517
+ vault: IAddress;
518
+ status?: VaultRedemptionStatus;
519
+ /**
520
+ * Solana withdrawal queue only: what claiming would pay now, in deposit-token
521
+ * units and net of the vault's withdrawal fee. The payout is priced when the
522
+ * request is claimed, so this moves with the share price. Absent when the
523
+ * vault has no share price to quote.
524
+ */
525
+ estimatedAssets?: INormalizedNumber;
526
+ };
527
+ export type IVaultRedemptionHistoryItem = {
528
+ receiver: IAddress;
529
+ amount: INormalizedNumber;
530
+ processed: Date;
531
+ requested: Date;
532
+ vault: IAddress;
533
+ transactionHash?: string;
534
+ };
535
+ export interface IVaultPosition {
536
+ vault: VaultAddress;
537
+ status: string;
538
+ availableRedemptions: IVaultAvailableRedemption[];
539
+ pendingRedemptions: IVaultAvailableRedemption[];
540
+ redeemable: INormalizedNumber;
541
+ walletBalance: INormalizedNumber;
542
+ /**
543
+ * `true` when the on-chain reads for this vault threw (e.g. the RPC
544
+ * rejected or the receipt token could not be resolved), so the row is a
545
+ * zero `PENDING` placeholder rather than a real empty position. Absent on
546
+ * successful reads.
547
+ *
548
+ * Today this only covers the EVM path. The Solana and Stellar branches
549
+ * handle their own read failures internally and return an unflagged zero
550
+ * row, so an absent flag on a non-EVM row does not guarantee the read
551
+ * succeeded.
552
+ *
553
+ * `getVaultPositions` drops `PENDING` rows by default, so failed rows are
554
+ * only returned when the caller passes `showAllVaults: true`. Treat a
555
+ * flagged row as "unknown", not "no position".
556
+ */
557
+ readFailed?: boolean;
558
+ }
559
+ export type IVaultOrderParam = 'asc' | 'desc';
560
+ export type IVaultHistoricalParams = {
561
+ daysAgo?: number;
562
+ order?: IVaultOrderParam;
563
+ interval?: 'days' | 'weeks' | 'months' | 'years';
564
+ };
565
+ export interface IVaultUserLifetimePnl {
566
+ tokenSymbol: string;
567
+ totalDeposited: INormalizedNumber;
568
+ totalDepositedUsd: number;
569
+ totalWithdrawn: INormalizedNumber;
570
+ totalWithdrawnUsd: number;
571
+ currentPositionValue: INormalizedNumber;
572
+ currentPositionValueUsd: number;
573
+ lifetimePnl: INormalizedNumber;
574
+ lifetimePnlUsd: number;
575
+ pnlPercentage: number;
576
+ /**
577
+ * The part of `totalDeposited` that is shares the wallet received from
578
+ * another holder (a migration airdrop, a DEX purchase, a transfer from
579
+ * another wallet), valued at the vault's share ratio on the day each
580
+ * arrived. Zero when no such shares counted. Optional only so objects built
581
+ * before it existed still type-check; `getVaultUserLifetimePnl` always sets
582
+ * it.
583
+ */
584
+ receivedByTransfer?: INormalizedNumber;
585
+ /** `receivedByTransfer` in USD, at the same price as the other USD fields. */
586
+ receivedByTransferUsd?: number;
587
+ }
588
+ export interface IVaultPnl {
589
+ totalPnl: INormalizedNumber;
590
+ pnlUsd: number;
591
+ }
592
+ /**
593
+ * Response for GET /tokenized_vault/annualized_apy/{vault_address}
594
+ *
595
+ * Supported Vaults: cUSDO, tETH, wstETH, rsETH
596
+ *
597
+ * @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` fields are deprecated.
598
+ * These fields will be removed in the next major release.
599
+ * Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
600
+ */
601
+ export interface IVaultAnnualizedApy {
602
+ vaultAddress: IAddress;
603
+ liquidityApy: number;
604
+ annualizedApy: number;
605
+ /** @deprecated Use `liquidAPY7Day` instead. Will be removed in the next major release. */
606
+ hgETH7dLiquidAPY?: number;
607
+ /** @deprecated Use `liquidAPY30Day` instead. Will be removed in the next major release. */
608
+ hgETH30dLiquidAPY?: number;
609
+ liquidAPY7Day?: number;
610
+ liquidAPY30Day?: number;
611
+ }
612
+ /**
613
+ * Response for GET /tokenized_vault/vault_summary/{vault_address}
614
+ */
615
+ export interface IVaultSummary {
616
+ vaultAddress: IAddress;
617
+ name: string;
618
+ type: string;
619
+ chain: string;
620
+ recentReturns: {
621
+ day: number;
622
+ week: number;
623
+ month: number;
624
+ };
625
+ }
626
+ /**
627
+ * Response for GET /withdrawals/{chain}/{vault_address}
628
+ */
629
+ export interface IVaultWithdrawals {
630
+ vaultAddress: IAddress;
631
+ chain: string;
632
+ totalWithdrawals: INormalizedNumber;
633
+ pendingQueue: Array<{
634
+ id: string;
635
+ amount: INormalizedNumber;
636
+ requestedAt: string;
637
+ estimatedCompletionDate: string;
638
+ receiver: IAddress;
639
+ }>;
640
+ }
641
+ /**
642
+ * Response for GET /vaults/\{vault_addr\}/pending-redemptions
643
+ */
644
+ export interface IVaultPendingRedemptions {
645
+ vault: {
646
+ address: string;
647
+ chainId: number;
648
+ name: string | null;
649
+ symbol: string | null;
650
+ };
651
+ asset: {
652
+ address: string;
653
+ symbol: string | null;
654
+ decimals: number | null;
655
+ };
656
+ liquidity: {
657
+ available: number;
658
+ };
659
+ summary: {
660
+ totalPending: number;
661
+ pendingCount: number;
662
+ pendingToLiquidityRatio: number | null;
663
+ isLiquiditySufficient: boolean;
664
+ shortfall: number | null;
665
+ nextRedemptionDate: string | null;
666
+ isOverdue: boolean;
667
+ };
668
+ redemptionsByDate: Array<{
669
+ date: string;
670
+ assets: number;
671
+ daysUntilDue: number;
672
+ isOverdue: boolean;
673
+ }>;
674
+ }
675
+ /**
676
+ * One unrealized-PnL snapshot for a vault, computed by the Upshift backend
677
+ * from periodic vault state. `timestamp` is an ISO-8601 datetime; monetary
678
+ * fields are denominated in the vault's reference asset
679
+ * (`referenceAsset`) except `assetPrice`, which is the asset's USD price.
680
+ */
681
+ export type IUnrealizedPnlSnapshot = {
682
+ timestamp: string;
683
+ vaultName: string;
684
+ vaultAddress: string;
685
+ strategistName: string | null;
686
+ referenceAsset: string;
687
+ assetPrice: number;
688
+ tvlOnVault: number;
689
+ currentRedeemRatio: number;
690
+ actualTvl: number;
691
+ adjustedRedeemRatio: number;
692
+ unrealizedPnl: number;
693
+ unrealizedPnlInAsset: number;
694
+ };
695
+ /**
696
+ * Vault metadata item from upshift API
697
+ */
698
+ export interface IVaultMetadataItem {
699
+ symbol: string;
700
+ subgraph: string;
701
+ address: string;
702
+ /**
703
+ * Subgraph indexing the vault's separate receipt token (evm-2 vaults), when
704
+ * one is deployed. Absent for vaults whose shares are the vault token itself.
705
+ */
706
+ receipt_subgraph?: string;
707
+ }
708
+ /**
709
+ * Response type for getVaultMetadata
710
+ * Keys are lowercase of the symbol value
711
+ */
712
+ export type IVaultMetadata = Record<string, IVaultMetadataItem>;
713
+ /**
714
+ * Numeric vault-type tag used by the on-chain `SwapRouter` to branch between
715
+ * the ERC-4626 (`deposit(uint256, address)`) and multi-asset
716
+ * (`deposit(address, uint256, address)`) deposit interfaces.
717
+ *
718
+ * Values match the contract's `VAULT_TYPE_ERC4626` / `VAULT_TYPE_TOKENIZED_VAULT_V2`
719
+ * constants exactly. The v2 router has no vault registry, so the caller passes
720
+ * this on every deposit. SDK callers normally do not pass it: the SDK derives
721
+ * it from the vault version (a multi-asset `evm-2` vault is
722
+ * `TokenizedVaultV2`, any other EVM vault `ERC4626`).
723
+ */
724
+ export declare enum SwapRouterVaultType {
725
+ ERC4626 = 1,
726
+ TokenizedVaultV2 = 2
727
+ }
728
+ /**
729
+ * One swap leg passed to `SwapRouter.swapAndDeposit`.
730
+ *
731
+ * The router pulls `amountIn` of `tokenIn` from the caller, approves the
732
+ * configured `tokenTransferProxies[router]` address, and calls `router` with
733
+ * `payload`. Output is measured by balance-diff and must clear `minAmountOut`
734
+ * or the call reverts with `SlippageError`.
735
+ *
736
+ * For a single-hop swap, `tokenOut` is typically the vault's reference asset.
737
+ * For multi-hop, intermediate legs use any whitelisted token.
738
+ */
739
+ export interface ISwapParams {
740
+ /** ERC-20 address pulled from the caller. Must be whitelisted via `whitelistedTokens`. */
741
+ tokenIn: IAddress;
742
+ /** ERC-20 address the router is expected to produce. */
743
+ tokenOut: IAddress;
744
+ /** Input amount in `tokenIn`'s smallest unit (no decimals). */
745
+ amountIn: bigint;
746
+ /** Minimum acceptable `tokenOut` output. Below this the call reverts. */
747
+ minAmountOut: bigint;
748
+ /** Whitelisted DEX router target (enabled via `enableRouter`). */
749
+ router: IAddress;
750
+ /** ABI-encoded calldata to invoke on `router`. */
751
+ payload: `0x${string}`;
752
+ }
753
+ /**
754
+ * Common options shared by every public SwapRouter SDK method.
755
+ */
756
+ export interface ISwapRouterBaseOptions {
757
+ /** EVM chain ID — must have an entry in `SWAP_ROUTER_ADDRESSES`. */
758
+ chainId: number;
759
+ /** Upshift vault address. */
760
+ vault: IAddress;
761
+ /**
762
+ * The vault's router type, sent with the deposit so the router calls the
763
+ * right deposit interface. When omitted, the SDK reads the vault's version
764
+ * from the Upshift API (`evm-2` → `TokenizedVaultV2`, otherwise `ERC4626`).
765
+ * A wrong value makes the router call the wrong interface and revert.
766
+ */
767
+ vaultType?: SwapRouterVaultType;
768
+ /** Address that receives the minted vault shares. */
769
+ receiver: IAddress;
770
+ /**
771
+ * 32-byte origin/referral code registered via `addOrigin`. Drives the
772
+ * origin-fee accrual. Defaults to the SDK instance's `attribution.originCode`
773
+ * when omitted on Ethereum mainnet, else {@link ORIGIN_CODES.default}. A code
774
+ * passed here that is not registered throws before any approval; an
775
+ * unregistered instance code falls back to the sentinel with an
776
+ * `attribution-skipped` warning (or throws under `attribution.strictOrigin`).
777
+ */
778
+ originCode?: `0x${string}`;
779
+ /** When `true`, the helper awaits a single confirmation before returning. */
780
+ wait?: boolean;
781
+ }
782
+ /**
783
+ * Options for `swapAndDeposit` — ERC-20 in, vault reference asset out.
784
+ */
785
+ export interface ISwapAndDepositOptions extends ISwapRouterBaseOptions {
786
+ /** One or more swap legs. Capped by the contract's `MAX_SWAPS`. */
787
+ swaps: ISwapParams[];
788
+ }
789
+ /**
790
+ * Options for `depositViaSwapRouter` — direct deposit (no swap) of an
791
+ * already-held asset, routed through the SwapRouter so origin/swap-fee
792
+ * accounting still applies.
793
+ */
794
+ export interface ISwapRouterDirectDepositOptions extends ISwapRouterBaseOptions {
795
+ /** Deposited ERC-20 asset. For ERC-4626 vaults this must equal the reference asset. */
796
+ asset: IAddress;
797
+ /** Amount in `asset`'s smallest unit. */
798
+ amount: bigint;
799
+ }
800
+ /**
801
+ * Options for `depositNativeViaSwapRouter` — wraps `msg.value` to the
802
+ * chain's wrapped-native token and deposits. Only valid when the vault's
803
+ * reference asset equals `wrappedNativeTokenAddress`.
804
+ */
805
+ export interface ISwapRouterNativeDepositOptions extends ISwapRouterBaseOptions {
806
+ /** Native token amount in wei. Sent as `msg.value`. */
807
+ amount: bigint;
808
+ }
809
+ /**
810
+ * Options for {@link swapRouterDeposit} — the high-level, explicit SwapRouter
811
+ * deposit entry point. It reads the vault's reference asset and decimals
812
+ * on-chain, then picks the correct router path from `depositAsset`, so callers
813
+ * do not hand-build swap legs or pre-resolve decimals themselves.
814
+ *
815
+ * `vaultDeposit` never swaps; this is the explicit, opt-in entry point for
816
+ * swap deposits, so a vault is never silently routed through a swap it does
817
+ * not need — the failure mode that broke native multi-asset deposits when
818
+ * `vaultDeposit` still auto-routed allowlisted vaults.
819
+ *
820
+ * Unlike {@link ISwapRouterBaseOptions}, `receiver` is optional here and
821
+ * defaults to the signer's resolved EOA.
822
+ */
823
+ export interface ISwapRouterDepositOptions extends Omit<ISwapRouterBaseOptions, 'receiver'> {
824
+ /**
825
+ * Token being deposited, held by the signer. Its relationship to the vault's
826
+ * reference asset selects the router path:
827
+ * - equals the reference asset → direct router deposit (no swap);
828
+ * - the zero address → native-token deposit (only when the reference asset
829
+ * is the chain's wrapped-native token);
830
+ * - any other ERC-20 → a swap to the reference asset via the chain's
831
+ * whitelisted DEX aggregator, bundled into the deposit.
832
+ */
833
+ depositAsset: IAddress;
834
+ /** Amount in `depositAsset`'s smallest unit (decimal string or bigint). */
835
+ amount: string | bigint;
836
+ /** Address that receives the minted shares. Defaults to the signer's EOA. */
837
+ receiver?: IAddress;
838
+ /**
839
+ * Max slippage in basis points for the swap leg. Only used when `depositAsset`
840
+ * differs from the reference asset; passed through to the swap quote, whose
841
+ * own default applies when omitted.
842
+ */
843
+ slippageBps?: number;
844
+ }
845
+ /**
846
+ * Options for {@link getSwapRouterDepositResult} — resolves the real,
847
+ * post-execution outcome of a SwapRouter deposit from its mined transaction
848
+ * receipt, rather than the pre-trade quote shown before submission.
849
+ */
850
+ export interface ISwapRouterDepositResultOptions {
851
+ /** Hash of a mined SwapRouter deposit transaction (e.g. from {@link swapRouterDeposit}). */
852
+ txHash: string;
853
+ /** The vault that was deposited into — isolates its own `Deposit` event from the router's unrelated logs. */
854
+ vault: IAddress;
855
+ }
856
+ /** Options for {@link getOriginInfo}. */
857
+ export interface IGetOriginInfoOptions {
858
+ /** EVM chain ID whose `SwapRouter` to read. */
859
+ chainId: number;
860
+ /** The `bytes32` origin code, `0x` + 64 hex chars. */
861
+ originCode: `0x${string}`;
862
+ /** RPC endpoint for `chainId`. */
863
+ rpcUrl: string;
864
+ }
865
+ /** A SwapRouter origin code's registration, from `origins(bytes32)`. */
866
+ export interface IOriginInfo {
867
+ /** `true` when registered via `addOrigin` and not revoked (non-zero collector). */
868
+ registered: boolean;
869
+ /** Origin fee in basis points; `0` for an attribution-only code. */
870
+ originFeeBps: number;
871
+ /** Fee recipient; the zero address when the code is not registered. */
872
+ collector: IAddress;
873
+ }
874
+ /**
875
+ * Real, on-chain outcome of a SwapRouter deposit, decoded from the vault's own
876
+ * `Deposit` event (the SwapRouter contract itself emits no deposit/amount-out
877
+ * event — see {@link getSwapRouterDepositResult}). For a swap deposit this is
878
+ * the actual post-swap amount that reached the vault, which can differ from
879
+ * the pre-trade quote a UI shows before the user submits.
880
+ */
881
+ export interface ISwapRouterDepositResult {
882
+ /** Raw amount of the vault's reference asset recorded as deposited (reference-asset decimals). */
883
+ amountOut: bigint;
884
+ /** Raw vault shares minted to the receiver (share-token decimals). */
885
+ sharesOut: bigint;
886
+ }