@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,498 @@
1
+ import type { IAddress } from './web3';
2
+ /**
3
+ * A whitelisted token as embedded in loan-book records by the backend
4
+ * `WhitelistedTokenModel` schema. `chain` is the numeric Upshift chain id
5
+ * (backend `Chain` IntEnum value, e.g. `1` for Ethereum mainnet).
6
+ */
7
+ export interface IWhitelistedToken {
8
+ chain: number;
9
+ name: string;
10
+ token_type: string;
11
+ address: IAddress;
12
+ decimals: number;
13
+ symbol: string;
14
+ discount_factor: number;
15
+ img_url: string | null;
16
+ price: number | null;
17
+ }
18
+ /**
19
+ * The amount and due date of a loan's next scheduled payment, as serialized
20
+ * by the backend `UpcomingPayment` schema. `due_date` is an ISO-8601 datetime
21
+ * string.
22
+ */
23
+ export interface ILoanUpcomingPayment {
24
+ amount: number;
25
+ due_date: string;
26
+ }
27
+ /**
28
+ * One loan-book entry from the admin loan-book endpoints (backend
29
+ * `LoanBookInfo` schema). Amounts are decimal-adjusted floats; monetary
30
+ * fields are denominated in the loan's principal token. `deployed_date` is an
31
+ * ISO-8601 datetime string; `state` is the backend `LoanStateStr` value
32
+ * (e.g. `"ACTIVE"`).
33
+ */
34
+ export interface ILoanBookInfo {
35
+ address: IAddress;
36
+ lender: IAddress;
37
+ borrower: IAddress;
38
+ state: string;
39
+ total_repaid: number;
40
+ principal_token: IWhitelistedToken;
41
+ principal_amount: number;
42
+ interest_amount: number;
43
+ upcoming_payment: ILoanUpcomingPayment;
44
+ apr: number;
45
+ initial_principal_amount: number;
46
+ deployed_date: string;
47
+ payment_interval: number;
48
+ total_interest_payment_fees: number;
49
+ lender_apr: number;
50
+ }
51
+ /**
52
+ * A token's discount-factor ladder from `GET /risk/discount_factors`
53
+ * (backend `DiscountFactorRead` schema). `steps` are ascending notional
54
+ * thresholds (in the token's smallest unit) and `factors` the corresponding
55
+ * ascending haircut multipliers in `[0, 1]`; the two arrays are equal length.
56
+ * `chain` is the numeric Upshift chain id.
57
+ */
58
+ export interface IDiscountFactorLadder {
59
+ steps: number[] | null;
60
+ factors: number[] | null;
61
+ address: IAddress;
62
+ chain: number;
63
+ }
64
+ /**
65
+ * Result of `GET /risk/collateral_excess_or_deficit` (backend
66
+ * `CollateralExcessOrDeficit` schema). A positive value is excess collateral
67
+ * that could be withdrawn; a negative value is the shortfall that must be
68
+ * deposited to reach the target health factor.
69
+ */
70
+ export interface ICollateralExcessOrDeficit {
71
+ amount_usd: number;
72
+ amount_token: number;
73
+ }
74
+ /**
75
+ * Request body for `POST /risk/collateral_simulation` (backend
76
+ * `CollateralSimulation` schema). Chain fields are numeric Upshift chain ids.
77
+ * `collateral_tokens` is a list of `[chain, address]` pairs and
78
+ * `collateral_token_allocation` the matching per-token weights (normalized
79
+ * server-side, so relative magnitudes are what matter). When `on_platform`
80
+ * is `true`, both `loan_redeployed_token_*` fields are required by the
81
+ * backend.
82
+ */
83
+ export interface ICollateralSimulationInput {
84
+ loan_token_chain: number;
85
+ loan_token_address: IAddress;
86
+ loan_amount: number;
87
+ on_platform?: boolean;
88
+ loan_redeployed_token_chain?: number | null;
89
+ loan_redeployed_token_address?: IAddress | null;
90
+ collateral_tokens: [number, IAddress][];
91
+ collateral_token_allocation: number[];
92
+ target_health_factor?: number;
93
+ }
94
+ /**
95
+ * Per-collateral-token breakdown within a collateral simulation (backend
96
+ * `CollateralDetailsResult` schema). `chain` is the numeric Upshift chain id.
97
+ */
98
+ export interface ICollateralDetailsResult {
99
+ chain: number;
100
+ token_address: IAddress;
101
+ price: number;
102
+ allocation: number;
103
+ collateral_value_from_redeployed_loan_usd: number;
104
+ collateral_value_usd: number;
105
+ amount_usd: number;
106
+ amount_token: number;
107
+ effective_discount_factor: number;
108
+ is_top_up: boolean;
109
+ }
110
+ /**
111
+ * Result of `POST /risk/collateral_simulation` (backend
112
+ * `CollateralSimulationResults` schema). `collateral_details` is keyed by
113
+ * `"<symbol>_<chainName>"`.
114
+ */
115
+ export interface ICollateralSimulationResults {
116
+ total_debt_usd: number;
117
+ total_required_collateral_usd: number;
118
+ total_collateral_value_from_redeployed_loan_usd: number;
119
+ health_factor: number;
120
+ collateral_details: Record<string, ICollateralDetailsResult>;
121
+ }
122
+ /**
123
+ * Result of the public `GET /revert_reason` endpoint (backend `RevertResponse`
124
+ * schema) — the decoded failure reasons for a reverted transaction, collected
125
+ * from a `debug_traceTransaction` call tree. All three arrays are empty when
126
+ * no matching signal was found in the trace.
127
+ */
128
+ export interface IRevertReason {
129
+ error_messages: string[];
130
+ revert_reasons: string[];
131
+ universal_subaccount_errors: string[];
132
+ }
133
+ /**
134
+ * One transaction record from `GET /transactions/v2` (backend
135
+ * `TransactionAPIRead` schema). `chain` is the numeric Upshift chain id;
136
+ * `value` is decimal-adjusted; `timestamp` is a Unix epoch (seconds).
137
+ * `from_` mirrors the backend field name (`from` is reserved). Nested
138
+ * `logs` / `transfers` / `function_signature` / `otc_cashflow` are passed
139
+ * through as-is. `transaction_name` is the resolved function name (or the raw
140
+ * selector when unknown).
141
+ */
142
+ export interface ISubaccountTransaction {
143
+ id: string;
144
+ tx_hash: string;
145
+ chain: number;
146
+ from_: IAddress;
147
+ to: IAddress;
148
+ value: number;
149
+ block_number: number;
150
+ timestamp: number;
151
+ selector: string | null;
152
+ logs: unknown[];
153
+ transfers: unknown[];
154
+ function_signature: Record<string, unknown> | null;
155
+ otc_cashflow: Record<string, unknown> | null;
156
+ transaction_name: string | null;
157
+ }
158
+ /**
159
+ * DeBank positions and tokens for a single account (backend
160
+ * `DebankAccountData` schema). `positions`, `app_positions`, and `tokens`
161
+ * are passed through as raw DeBank objects.
162
+ */
163
+ export interface ISubaccountDebankData {
164
+ positions: unknown[];
165
+ app_positions: unknown[];
166
+ tokens: unknown[];
167
+ }
168
+ /**
169
+ * Cross-chain DeBank protocol positions for a subaccount and its associated
170
+ * strategies (backend `SubaccountDebankAccountData` schema). `strategies` is
171
+ * keyed by strategy address. This endpoint is slow (300-second server-side
172
+ * cache) as it fans out across every supported chain.
173
+ */
174
+ export interface ISubaccountDebank {
175
+ subaccount: ISubaccountDebankData;
176
+ strategies: Record<string, ISubaccountDebankData>;
177
+ }
178
+ /**
179
+ * A tracked position from `GET /otc/position` (backend `IPositionRead`
180
+ * schema). `configs` is a free-form JSON object of position-specific
181
+ * settings; `category` is the position category (e.g. `"otc"`).
182
+ */
183
+ export interface IOtcPositionRead {
184
+ id: string;
185
+ slug: string;
186
+ position_class: string | null;
187
+ configs: Record<string, unknown> | null;
188
+ category: string | null;
189
+ position_discount_factor: number | null;
190
+ }
191
+ /**
192
+ * An OTC margin requirement from `GET /otc/margin_requirement` (backend
193
+ * `IOTCMarginRequirementRead` schema) — the margin the `payer` must post to
194
+ * the given counterparty.
195
+ */
196
+ export interface IOtcMarginRequirement {
197
+ otc_counter_party_id: string;
198
+ margin_requirement: number;
199
+ payer: IAddress;
200
+ }
201
+ /**
202
+ * On-chain whitelist status of one subaccount linked to a vault, from
203
+ * `GET /curator/vaults/{vault_address}/whitelist` (backend
204
+ * `WhitelistStatusResponse` schema). EVM vaults only.
205
+ */
206
+ export interface ICuratorWhitelistStatus {
207
+ address: IAddress;
208
+ is_whitelisted: boolean;
209
+ }
210
+ /**
211
+ * One timelock request from `GET /timelock-requests` (backend
212
+ * `ITimelockRequestRead` schema). `chain_id` is the numeric chain id;
213
+ * `status` is one of `"scheduled" | "executed" | "cancelled"`; `params` is a
214
+ * free-form JSON object; datetime fields are ISO-8601 strings.
215
+ */
216
+ export interface ITimelockRequest {
217
+ id: string;
218
+ hash: string;
219
+ vault_address: IAddress;
220
+ timelock_address: IAddress;
221
+ chain_id: number;
222
+ action_id: string;
223
+ params: Record<string, unknown>;
224
+ status: string;
225
+ schedule_tx_hash: string;
226
+ execute_tx_hash: string | null;
227
+ cancel_tx_hash: string | null;
228
+ submitted_by: string | null;
229
+ scheduled_at: string;
230
+ resolved_at: string | null;
231
+ created_at: string | null;
232
+ updated_at: string | null;
233
+ }
234
+ /**
235
+ * Performance-fee computation for a vault from
236
+ * `GET /metrics/vault_performance_fees` (backend `UpshiftVaultPerformanceFees`
237
+ * schema). High/low water marks are share-price levels; `*_datetime` fields
238
+ * are ISO-8601 strings. `calculation_period` is `"YearToDate"` /
239
+ * `"MonthToDate"` (null when a custom date range was supplied).
240
+ */
241
+ export interface IVaultPerformanceFees {
242
+ previous_water_mark: number;
243
+ previous_water_mark_datetime: string;
244
+ last_water_mark: number;
245
+ last_water_mark_datetime: string;
246
+ is_in_drawdown: boolean;
247
+ asset_symbol: string | null;
248
+ total_pnl_in_asset: number;
249
+ total_perf_fees_asset: number;
250
+ calculation_period: string | null;
251
+ annualized_fees_pct: number;
252
+ underlying_asset_vs_native_perf: number | null;
253
+ native_token_symbol: string | null;
254
+ }
255
+ /**
256
+ * One row of a vault's NAV-oracle classification table (backend
257
+ * `OracleClassificationRow` schema) — how a single position/token is priced
258
+ * and its USD value.
259
+ */
260
+ export interface IOracleClassificationRow {
261
+ position: string;
262
+ type: string;
263
+ oracle_source: string;
264
+ usd_value: number;
265
+ }
266
+ /**
267
+ * A vault's NAV-oracle classification from the public
268
+ * `GET /upshift/oracle_classification/{vault_address}` endpoint (backend
269
+ * `OracleClassificationResponse` schema). `warnings` lists tokens that could
270
+ * not be resolved (`"unresolved:<symbol>"`). `snapshot_at` is an ISO-8601
271
+ * datetime string.
272
+ */
273
+ export interface IOracleClassification {
274
+ vault_address: IAddress;
275
+ chain_id: number;
276
+ snapshot_at: string;
277
+ methodology: string;
278
+ rows: IOracleClassificationRow[];
279
+ warnings: string[];
280
+ }
281
+ /**
282
+ * Strategy bucket the backend assigns to a position group (backend
283
+ * `StrategyCategory` enum). `Buffer / Idle` is undeployed wallet liquidity;
284
+ * `CeFi` positions are the only ones not inspectable on-chain.
285
+ */
286
+ export type ITransparencyStrategyCategory = 'Lending' | 'Yield Trading' | 'Staking / Vaults' | 'CeFi' | 'Buffer / Idle' | 'Unclassified';
287
+ /** Role of a token leg inside a position. Borrow legs carry NEGATIVE `usd_value` and `balance`. */
288
+ export type ITransparencyTokenRole = 'supply' | 'borrow' | 'reward' | 'wallet';
289
+ /** One token leg of a position (backend `TokenExposureView`). */
290
+ export interface ITransparencyTokenExposure {
291
+ symbol: string;
292
+ /** Native token units; CeFi derivatives carry signed contract units. */
293
+ balance: number;
294
+ /** USD value; negative for borrow legs. */
295
+ usd_value: number;
296
+ role: ITransparencyTokenRole;
297
+ }
298
+ /** One protocol's positions inside a subaccount (backend `IntegrationGroupView`). */
299
+ export interface ITransparencyIntegrationGroup {
300
+ /** Normalized DeFi slug, CeFi venue name, or `_idle` for undeployed wallet balances. */
301
+ protocol: string;
302
+ chain_id: number;
303
+ strategy_category: ITransparencyStrategyCategory;
304
+ /** Wallet that physically holds the position. */
305
+ holding_address: IAddress;
306
+ tokens: ITransparencyTokenExposure[];
307
+ total_usd: number;
308
+ /** Fraction of the subaccount total (0.25 = 25%); can exceed 1.0 slightly by rounding. */
309
+ pct_of_subaccount: number;
310
+ /** Minimum health factor across the grouped DeFi positions; null when none reports one. */
311
+ health_factor?: number | null;
312
+ }
313
+ /** One vault wallet with its positions (backend `SubaccountIntegrationsView`). */
314
+ export interface ITransparencySubaccount {
315
+ subaccount_address: IAddress;
316
+ label: string;
317
+ type: 'subaccount' | 'eoa';
318
+ total_usd: number;
319
+ /** Fraction of NAV (0.25 = 25%). */
320
+ pct_of_nav: number;
321
+ integrations: ITransparencyIntegrationGroup[];
322
+ }
323
+ /**
324
+ * Latest position snapshot for a vault, grouped per wallet — the data behind
325
+ * the Overview tab's strategy breakdown, backing composition, vault buffer and
326
+ * per-wallet table (backend `VaultPositionsResponse`).
327
+ *
328
+ * `total_nav` is the mark-to-market NAV of all positions under the published
329
+ * pricing methodology; `reported_tvl` is the vault-reported total assets
330
+ * captured in the SAME snapshot (use it for a headline that matches the vault
331
+ * contract). The vault's own liquidity buffer is `total_nav − Σ subaccounts[].total_usd`.
332
+ */
333
+ export interface ITransparencyPositions {
334
+ vault_address: IAddress;
335
+ chain_id: number;
336
+ /** ISO-8601 snapshot timestamp; every field on this response is from this instant. */
337
+ snapshot_at: string;
338
+ total_nav: number;
339
+ reported_tvl?: number | null;
340
+ subaccounts: ITransparencySubaccount[];
341
+ }
342
+ /** One point of a vault's unrealized-PnL / ratio series (backend `unrealized_pnl` record, `fields=ratio` projection). */
343
+ export interface ITransparencyRatioPoint {
344
+ timestamp: string;
345
+ /** Backing ÷ supply; > 1 means over-collateralized. Drives the Collateral Ratio chart. */
346
+ adjusted_redeem_ratio: number;
347
+ /** Mark-to-market NAV — the "Backing Assets" series. */
348
+ actual_tvl: number;
349
+ /** Vault-reported TVL — the "Supply" series. */
350
+ tvl_on_vault: number;
351
+ }
352
+ /** One (date, protocol) allocation point (backend `AllocationPoint`). */
353
+ export interface ITransparencyAllocationPoint {
354
+ /** `YYYY-MM-DD`. */
355
+ date: string;
356
+ protocol: string;
357
+ strategy_category: ITransparencyStrategyCategory;
358
+ usd_value: number;
359
+ /** Fraction of TVL (0.25 = 25%). */
360
+ pct_of_tvl: number;
361
+ }
362
+ /** Daily allocation history for the Performance tab's "Allocation Over Time" chart. */
363
+ export interface ITransparencyHistoricalAllocations {
364
+ vault_address: IAddress;
365
+ chain_id: number;
366
+ /** ISO-8601 timestamp of the earliest snapshot, or null when there is none. */
367
+ history_from: string | null;
368
+ points: ITransparencyAllocationPoint[];
369
+ }
370
+ /** Vault fee configuration as shown on the Performance tab (backend `VaultFeesResponse`). `*_pct` fields are already percents (2 = 2%), unlike the `pct_of_*` fractions elsewhere. */
371
+ export interface ITransparencyFees {
372
+ vault_address: IAddress;
373
+ chain_id: number;
374
+ management_fee_bps: number | null;
375
+ management_fee_pct: number | null;
376
+ performance_fee_ppm: number | null;
377
+ performance_fee_pct: number | null;
378
+ weekly_performance_fee_bps: number | null;
379
+ management_fee_waived_until_date: string | null;
380
+ management_fee_waived_until_tvl: number | null;
381
+ performance_fee_waived_until_date: string | null;
382
+ performance_fee_waived_until_tvl: number | null;
383
+ warnings: string[];
384
+ }
385
+ /** Smoothed 7D-APY series (backend `historical_apy/chart`); labels are `M/D/YYYY`, values are decimal fractions (0.0245 = 2.45%). */
386
+ export interface ITransparencyApySeries {
387
+ labels: string[];
388
+ values: number[];
389
+ average_apy?: number | null;
390
+ }
391
+ /** Public-safe summary of one Fordefi transaction-policy rule. */
392
+ export interface ITransparencyFordefiPolicyRule {
393
+ name: string;
394
+ transaction_types: string[];
395
+ recipients: string[];
396
+ assets: string[];
397
+ action: string | null;
398
+ }
399
+ /** One privileged address on the vault with custody enrichment (backend `VaultRoleView`). */
400
+ export interface ITransparencyGovernanceRole {
401
+ role: 'owner' | 'operator';
402
+ address: IAddress;
403
+ chain_id: number;
404
+ is_safe: boolean;
405
+ safe_threshold: number | null;
406
+ safe_owners: IAddress[] | null;
407
+ safe_nonce: number | null;
408
+ has_fordefi_policy: boolean;
409
+ /** Governed by the Upshift operator-policy engine (whitelisted integrations). */
410
+ has_august_policy: boolean;
411
+ /** null = unknown/uncovered — distinct from an explicit 0. */
412
+ fordefi_policy_count: number | null;
413
+ fordefi_policies: ITransparencyFordefiPolicyRule[] | null;
414
+ safe_ui_url: string | null;
415
+ }
416
+ /** Governance tab → "Vault Roles" card (backend `VaultRolesResponse`). `warnings` lists enrichment failures (Safe / Fordefi lookups) that degraded rows rather than failing the call. */
417
+ export interface ITransparencyGovernanceRoles {
418
+ vault_address: IAddress;
419
+ chain_id: number;
420
+ snapshot_at: string;
421
+ roles: ITransparencyGovernanceRole[];
422
+ warnings: string[];
423
+ }
424
+ /** One integration the vault's wallets may operate, with unioned scopes (backend `VaultPermissionView`). */
425
+ export interface ITransparencyGovernancePermission {
426
+ integration: string;
427
+ protocol: string | null;
428
+ /** null for chainless CeFi venue integrations. */
429
+ chain_id: number | null;
430
+ tokens: string[];
431
+ functions: string[];
432
+ spenders: IAddress[];
433
+ wallets: IAddress[];
434
+ fordefi_policy_match: boolean;
435
+ fordefi_policies: ITransparencyFordefiPolicyRule[] | null;
436
+ }
437
+ /** One Fordefi transaction-policy rule attributed to the vault, with the vault wallets it targets. */
438
+ export interface ITransparencyVaultFordefiPolicy extends ITransparencyFordefiPolicyRule {
439
+ wallets: IAddress[];
440
+ }
441
+ /** Governance tab → "Vault Permissions" table (backend `VaultPermissionsResponse`). */
442
+ export interface ITransparencyGovernancePermissions {
443
+ vault_address: IAddress;
444
+ chain_id: number;
445
+ permissions: ITransparencyGovernancePermission[];
446
+ /** null = no policy workspace could answer (unknown, not empty). */
447
+ fordefi_policies: ITransparencyVaultFordefiPolicy[] | null;
448
+ warnings: string[];
449
+ }
450
+ /** Lifecycle of a timelock request (backend `TimelockStatus` enum). */
451
+ export type ITransparencyTimelockStatus = 'scheduled' | 'executed' | 'cancelled';
452
+ /** One request in the vault timelock (backend `VaultTimelockView`). */
453
+ export interface ITransparencyTimelock {
454
+ action_id: string;
455
+ action_label: string;
456
+ target_label: string;
457
+ params: Record<string, unknown>;
458
+ status: ITransparencyTimelockStatus;
459
+ proposer: string | null;
460
+ /** Naive-UTC ISO timestamp. */
461
+ scheduled_at: string;
462
+ /** null when the timelock duration could not be read on-chain (see `warnings`). */
463
+ executable_at: string | null;
464
+ schedule_tx_hash: string;
465
+ execute_tx_hash: string | null;
466
+ cancel_tx_hash: string | null;
467
+ timelock_address: IAddress;
468
+ }
469
+ /** Governance tab → "Pending Timelocks" table (backend `VaultTimelocksResponse`). */
470
+ export interface ITransparencyTimelocks {
471
+ vault_address: IAddress;
472
+ chain_id: number;
473
+ timelocks: ITransparencyTimelock[];
474
+ warnings: string[];
475
+ }
476
+ /** Category pill of an audit-log entry (backend `AuditLogCategory` enum). */
477
+ export type ITransparencyAuditCategory = 'Strategy' | 'Role' | 'Permission' | 'Attestation';
478
+ /** One row of the governance audit log (backend `AuditLogEntryView`). `tx_hash` is set only for on-chain-backed events. */
479
+ export interface ITransparencyAuditLogEntry {
480
+ /** Naive-UTC ISO timestamp (no offset) — pass back verbatim as the `before` cursor. */
481
+ timestamp: string;
482
+ type: ITransparencyAuditCategory;
483
+ summary: string;
484
+ actor: string | null;
485
+ vault_address: IAddress;
486
+ tx_hash: string | null;
487
+ }
488
+ /**
489
+ * One page of the governance audit log, newest first. Paginate with
490
+ * `before` = the last entry's `timestamp` while `has_more` is true.
491
+ */
492
+ export interface ITransparencyAuditLog {
493
+ vault_address: IAddress;
494
+ chain_id: number;
495
+ entries: ITransparencyAuditLogEntry[];
496
+ has_more: boolean;
497
+ warnings: string[];
498
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1,12 @@
1
+ export type IEnv = 'DEV' | 'PROD';
2
+ export * from './web3';
3
+ export * from './typed-contract';
4
+ export * from './user';
5
+ export * from './webserver';
6
+ export * from './pools';
7
+ export * from './staking';
8
+ export * from './subgraph';
9
+ export * from './vaults';
10
+ export * from './points';
11
+ export * from './sub-accounts';
12
+ export * from './api';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./web3"), exports);
18
+ __exportStar(require("./typed-contract"), exports);
19
+ __exportStar(require("./user"), exports);
20
+ __exportStar(require("./webserver"), exports);
21
+ __exportStar(require("./pools"), exports);
22
+ __exportStar(require("./staking"), exports);
23
+ __exportStar(require("./subgraph"), exports);
24
+ __exportStar(require("./vaults"), exports);
25
+ __exportStar(require("./points"), exports);
26
+ __exportStar(require("./sub-accounts"), exports);
27
+ __exportStar(require("./api"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,28 @@
1
+ export interface IUserPoints {
2
+ totalPoints?: number;
3
+ referralEarnings?: number;
4
+ pools?: Record<string, {
5
+ amountDepositedInUsd?: number;
6
+ nativeAmountDeposited?: number;
7
+ totalPoints?: number;
8
+ hasPendingRewards?: boolean;
9
+ }>;
10
+ external?: Record<string, {
11
+ protocol?: string;
12
+ externalName?: string;
13
+ amountDepositedInUsd?: number;
14
+ nativeAmountDeposited?: number;
15
+ totalPoints?: number;
16
+ }>;
17
+ referrals?: Record<string, {
18
+ totalPoints?: number;
19
+ amountDepositedInUsd?: number;
20
+ nativeAmountDeposited?: number;
21
+ }>;
22
+ topVault?: {
23
+ lifetimeDeposit?: number;
24
+ address?: string;
25
+ } | null;
26
+ streak?: number;
27
+ rank?: number | null;
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=points.js.map