@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
package/lib/main.js ADDED
@@ -0,0 +1,681 @@
1
+ "use strict";
2
+ /**
3
+ * The main Upshift SDK class.
4
+ *
5
+ * @module UpshiftSDK
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.UpshiftSDK = void 0;
45
+ const solana_1 = __importDefault(require("./adapters/solana"));
46
+ const sui_1 = __importDefault(require("./adapters/sui"));
47
+ const stellar_1 = __importDefault(require("./adapters/stellar"));
48
+ const evm_1 = __importDefault(require("./adapters/evm"));
49
+ const core_1 = require("./core");
50
+ const vaults_1 = require("./modules/vaults");
51
+ const analytics_1 = require("./core/analytics");
52
+ const sub_accounts_1 = require("./modules/sub-accounts");
53
+ const api_1 = require("./modules/api");
54
+ /**
55
+ * Main SDK class for interacting with Upshift vaults and services.
56
+ * Provides unified access to EVM, Solana, Sui, and Stellar blockchain adapters.
57
+ */
58
+ class UpshiftSDK extends core_1.UpshiftBase {
59
+ vaults;
60
+ subaccounts;
61
+ api;
62
+ solana;
63
+ sui;
64
+ stellar;
65
+ evm;
66
+ /**
67
+ * Initialize the Upshift SDK with provider configuration.
68
+ * Automatically sets up EVM adapter and optionally initializes Solana if RPC URL is provided.
69
+ */
70
+ constructor(baseConfig) {
71
+ super(baseConfig);
72
+ // @todo: change this later when upshift key is required
73
+ this.authorized = true;
74
+ // EVM adapter is always available. Signerless reads (balanceOf,
75
+ // previewDeposit, …) resolve a provider for the active network at call
76
+ // time so they follow switchNetwork; createProvider caches per URL+chain.
77
+ // A blank rpcUrl counts as "no provider" so the adapter throws its typed
78
+ // NO_SIGNER error instead of createProvider's raw Error.
79
+ this.evm = new evm_1.default(undefined, () => this.activeNetwork?.rpcUrl?.trim()
80
+ ? (0, core_1.createProvider)(this.activeNetwork.rpcUrl, this.activeNetwork.chainId)
81
+ : undefined);
82
+ // @solana: handle solana service initialization
83
+ //
84
+ // Two accepted entry points, treated as exclusive sources so url+network
85
+ // can never come from different configs:
86
+ // 1) `baseConfig.solana = { rpcUrl, network }` — preferred. Both fields
87
+ // come from the same place; the caller controls the network.
88
+ // 2) `baseConfig.providers[-1] = rpcUrl` — legacy "Solana as another
89
+ // EVM chain" shape. Network is derived from the URL substring.
90
+ //
91
+ // Without one of these `this.solana` stays undefined and every Solana
92
+ // vault is silently dropped from getVaults / getVaultPositions (the
93
+ // filter in modules/vaults/main.ts gates on `!!this.solanaService`).
94
+ const solanaConfig = (() => {
95
+ if (baseConfig.solana?.rpcUrl) {
96
+ return {
97
+ rpcUrl: baseConfig.solana.rpcUrl,
98
+ network: baseConfig.solana.network,
99
+ commitment: baseConfig.solana.commitment,
100
+ };
101
+ }
102
+ const legacyRpcUrl = baseConfig.providers?.[core_1.SPECIAL_CHAINS.solana.chainId];
103
+ if (legacyRpcUrl) {
104
+ // No commitment here: `ISolanaConfig` requires `rpcUrl` + `network`, so
105
+ // a commitment-only `solana` object alongside this legacy path is not
106
+ // expressible in TypeScript. Set `solana: { rpcUrl, network,
107
+ // commitment }` to configure it.
108
+ return {
109
+ rpcUrl: legacyRpcUrl,
110
+ network: legacyRpcUrl.includes('devnet')
111
+ ? 'devnet'
112
+ : 'mainnet-beta',
113
+ commitment: undefined,
114
+ };
115
+ }
116
+ return null;
117
+ })();
118
+ if (solanaConfig) {
119
+ this.solana = new solana_1.default(solanaConfig.rpcUrl, solanaConfig.network, solanaConfig.commitment);
120
+ (0, analytics_1.instrumentClass)(this.solana, () => core_1.SPECIAL_CHAINS.solana.chainId);
121
+ }
122
+ this.sui = new sui_1.default(baseConfig.sui);
123
+ // @stellar: mirror the Solana injection — the consumer may supply a keyed
124
+ // Soroban RPC (e.g. Alchemy) via `baseConfig.stellar`; otherwise the adapter
125
+ // uses its built-in public endpoints. Endpoint is injected, not hardcoded.
126
+ this.stellar = new stellar_1.default(baseConfig.stellar?.network, {
127
+ sorobanRpcUrl: baseConfig.stellar?.rpcUrl,
128
+ });
129
+ this.vaults = new vaults_1.UpshiftVaults(baseConfig, this.solana);
130
+ this.subaccounts = new sub_accounts_1.UpshiftSubAccounts(baseConfig);
131
+ this.api = new api_1.UpshiftApi(baseConfig);
132
+ // Instrument all SDK methods for analytics tracking
133
+ (0, analytics_1.instrumentClass)(this, () => this.activeNetwork?.chainId);
134
+ (0, analytics_1.instrumentClass)(this.evm, () => this.activeNetwork?.chainId);
135
+ (0, analytics_1.instrumentClass)(this.sui, () => core_1.SPECIAL_CHAINS.sui.chainId);
136
+ (0, analytics_1.instrumentClass)(this.stellar, () => core_1.SPECIAL_CHAINS.stellar?.chainId);
137
+ (0, analytics_1.instrumentClass)(this.vaults, () => this.activeNetwork?.chainId);
138
+ (0, analytics_1.instrumentClass)(this.subaccounts, () => this.activeNetwork?.chainId);
139
+ (0, analytics_1.instrumentClass)(this.api, () => this.activeNetwork?.chainId);
140
+ }
141
+ /**
142
+ * Get the Sub-Accounts module instance.
143
+ */
144
+ get subAccountsModule() {
145
+ return this.subaccounts;
146
+ }
147
+ /**
148
+ * Get the Vaults module instance.
149
+ */
150
+ get vaultsModule() {
151
+ return this.vaults;
152
+ }
153
+ /**
154
+ * Get the backend API module instance ({@link UpshiftApi}) — read-only
155
+ * access to backend-computed data with no on-chain equivalent: the
156
+ * unrealized-PnL series and the transparency dashboard (position snapshot,
157
+ * backing series, smoothed APY, allocations, fee config, governance).
158
+ */
159
+ get apiModule() {
160
+ return this.api;
161
+ }
162
+ /**
163
+ * Switch the active network for vault operations.
164
+ * Updates the SDK's active chain and RPC provider.
165
+ */
166
+ switchNetwork(chainId) {
167
+ super.switchNetwork(chainId);
168
+ this.vaults.switchNetwork(chainId);
169
+ // Track network switch for analytics
170
+ (0, analytics_1.trackNetworkSwitch)(chainId);
171
+ }
172
+ /**
173
+ * Set the active wallet address for tracking user-specific vault data.
174
+ * Updates monitoring headers with the wallet address.
175
+ */
176
+ updateWallet(address) {
177
+ if (!address)
178
+ return;
179
+ if (this.monitoring) {
180
+ this.monitoring['x-user-id'] = address;
181
+ }
182
+ this.vaults.updateWallet(address);
183
+ }
184
+ /**
185
+ * Clear the active wallet address from the SDK state and monitoring headers.
186
+ */
187
+ clearWallet() {
188
+ if (this.monitoring) {
189
+ this.monitoring['x-user-id'] = undefined;
190
+ }
191
+ this.vaults.clearWallet();
192
+ }
193
+ /**
194
+ * Pricing and Market Data
195
+ */
196
+ /**
197
+ * Get the current USD price of a token by symbol or contract address.
198
+ * Falls back to CoinGecko if primary price source fails.
199
+ *
200
+ * @param symbol - Token symbol or contract address
201
+ * @returns Current price in USD
202
+ */
203
+ async getPrice(symbol) {
204
+ if (!this.authorized)
205
+ throw new Error('Not authorized.');
206
+ if (!symbol)
207
+ throw new Error(`Symbol input parameter is not defined.`);
208
+ return await (0, core_1.fetchTokenPrice)(symbol, null, this.keys?.coingecko);
209
+ }
210
+ /**
211
+ * Vault Data and Operations
212
+ */
213
+ /**
214
+ * Fetch all available vaults across configured networks.
215
+ * Optionally filter by chain IDs and include loan/allocation data.
216
+ * @param options - Configuration for filtering and enriching vault data —
217
+ * see {@link IGetVaultsOptions} for the full surface (`includeClosed`
218
+ * portfolio mode, `maxRetries`/`baseDelay` retry tuning)
219
+ * @returns Array of vault objects with metadata and optional position data
220
+ */
221
+ async getVaults(options) {
222
+ return await this.vaults.getVaults(options);
223
+ }
224
+ async getTotalDeposited(options) {
225
+ return await this.vaults.getTotalDeposited(options);
226
+ }
227
+ /**
228
+ * Deposit into a vault with an explicit signer. When `depositAsset` differs
229
+ * from the vault's underlying asset the deposit goes through the vault's
230
+ * multi-asset `deposit`, permit path, or configured adapter. It never swaps
231
+ * (use `evm.swapRouterDeposit` for that); with `attribution.originCode` set,
232
+ * eligible deposits go through the SwapRouter (see `evm.getDepositRoute`).
233
+ * @param signer - ethers Signer or Wallet that sends the transaction
234
+ * @param options - Vault address (`target`), depositor `wallet`, `amount`, and optional `depositAsset`, `wait`, `isDepositWithPermit`
235
+ * @returns Deposit transaction hash
236
+ */
237
+ async vaultDeposit(signer, options) {
238
+ return await this.vaults.vaultDeposit(signer, options);
239
+ }
240
+ /**
241
+ * Fetch detailed information for a specific vault.
242
+ * @param props - Vault address, chain ID, and optional enrichment options
243
+ * @returns Single vault object with full metadata
244
+ */
245
+ async getVault(props) {
246
+ return await this.vaults.getVault(props);
247
+ }
248
+ /**
249
+ * Get active loans deployed from a vault.
250
+ * @param props - Vault address and chain ID
251
+ * @returns Array of loan details including borrower, principal, APR
252
+ */
253
+ async getVaultLoans(props) {
254
+ return await this.vaults.getVaultLoans(props);
255
+ }
256
+ /**
257
+ * Get vault asset allocations across DeFi protocols, CeFi, and OTC positions.
258
+ *
259
+ * This is the data behind the "Vault Exposure" section of the Upshift app —
260
+ * a partner rendering that section in their own frontend needs only this
261
+ * call. Read `exposurePerCategory` for the pre-bucketed view the UI renders
262
+ * (`supplying` / `borrowing` / `wallet` / `lending` legs plus per-category
263
+ * USD totals) and `netValue` for the headline figure; the raw `defi` /
264
+ * `cefi` / `otc` arrays back the drill-downs. See the "Rendering the Vault
265
+ * Exposure section" guide in the vaults docs for a faithful reproduction.
266
+ *
267
+ * Stellar vaults resolve their DeFi exposure through the Untangled portfolio
268
+ * API instead of DeBank — one extra HTTP call, covering the idle buffer,
269
+ * Stellar protocol positions, custody wallets and bridged capital. If that
270
+ * call fails the exposure legs come back empty rather than throwing, so CeFi,
271
+ * OTC and loan allocations still resolve.
272
+ *
273
+ * @param props - Vault address and chain ID
274
+ * @returns Detailed breakdown of vault allocations by category
275
+ * @example
276
+ * ```ts
277
+ * const { exposurePerCategory, netValue } = await sdk.getVaultAllocations({
278
+ * vault: '0xcd69123b3FBBfC666E1f6a501da27B564C00De54',
279
+ * chainId: 1,
280
+ * });
281
+ * for (const item of exposurePerCategory?.supplying ?? []) {
282
+ * console.log(item.protocol, item.symbol, item.amount);
283
+ * }
284
+ * ```
285
+ */
286
+ async getVaultAllocations(props) {
287
+ return await this.vaults.getVaultAllocations(props);
288
+ }
289
+ /**
290
+ * Get current or historical APY for a vault.
291
+ *
292
+ * @deprecated use getVaultHistoricalTimeseries instead
293
+ *
294
+ * @param props - Vault address and optional historical lookback period
295
+ * @returns APY data including rewards breakdown
296
+ */
297
+ async getVaultApy(props) {
298
+ return await this.vaults.getVaultApy(props);
299
+ }
300
+ /**
301
+ * Get current or historical TVL for a vault.
302
+ * @param props - Vault address and optional historical parameters
303
+ * @returns TVL in vault's base asset units
304
+ */
305
+ async getVaultTvl(props) {
306
+ return await this.vaults.getVaultTvl(props);
307
+ }
308
+ /**
309
+ * Get historical timeseries data for a vault.
310
+ * @param props - Vault address and optional number of days
311
+ * @returns Historical timeseries data with TVL, APY, PnL, share price, and other metrics
312
+ */
313
+ async getVaultHistoricalTimeseries(props) {
314
+ return await this.vaults.getVaultHistoricalTimeseries(props);
315
+ }
316
+ /**
317
+ * Get the timestamp when yield was last realized for a vault.
318
+ * @param props - Vault address and optional chain ID
319
+ * @returns Timestamp (Unix timestamp in seconds) when yield was last realized
320
+ */
321
+ async getYieldLastRealizedOn(props) {
322
+ return await this.vaults.getYieldLastRealizedOn(props);
323
+ }
324
+ /**
325
+ * Get redemption requests that are ready to be claimed.
326
+ *
327
+ * For a Solana vault, `wallet` is the holder's base58 address and the result
328
+ * lists their withdrawal-queue requests: waiting (`AWAITING_COOLDOWN`) and
329
+ * past-window (`EXPIRED`, cancel-only) ones in `availableRedemptions`, and
330
+ * claimable ones (`READY_TO_CLAIM`) in `pendingRedemptions`, each with
331
+ * `estimatedAssets`, the net payout at the current share price. Without a
332
+ * Solana wallet, or for a vault with no queue, both lists are empty. Solana
333
+ * RPC: the vault state, one `getAccountInfo` for the queue, and, when it
334
+ * exists, one `getProgramAccounts` and one `getMultipleAccountsInfo` (the
335
+ * vault state, share mint and payout accounts, read together).
336
+ *
337
+ * @param props - Vault address, chain ID, and optional wallet filter
338
+ * @returns Array of available redemption requests with amounts and timestamps
339
+ * @example
340
+ * ```ts
341
+ * const { availableRedemptions, pendingRedemptions } =
342
+ * await sdk.getVaultAvailableRedemptions({ vault: solanaVault, wallet: holder });
343
+ * ```
344
+ */
345
+ async getVaultAvailableRedemptions(props) {
346
+ return await this.vaults.getVaultAvailableRedemptions(props);
347
+ }
348
+ /**
349
+ * Get historical redemption requests for a vault (settled, cancelled,
350
+ * pending-but-out-of-window), optionally filtered to one wallet.
351
+ *
352
+ * @param props - Vault address, chain ID, optional wallet, and an
353
+ * optional `lookbackBlocks` for how far back to scan.
354
+ * @returns Historical redemption records, newest first.
355
+ */
356
+ async getVaultRedemptionHistory(props) {
357
+ return await this.vaults.getVaultRedemptionHistory(props);
358
+ }
359
+ /**
360
+ * Get user positions across vaults including shares and claimable redemptions.
361
+ * Supports both EVM and Solana vaults.
362
+ * @param props - Wallet address, chain ID, and optional vault filter
363
+ * @returns Array of positions with balances and pending redemptions
364
+ * @throws {@link UpshiftValidationError} (`INVALID_ADDRESS`) when `suiWallet`
365
+ * is not a Sui address.
366
+ */
367
+ async getVaultPositions(props) {
368
+ return await this.vaults.getVaultPositions(props);
369
+ }
370
+ /**
371
+ * Get user's historical vault interactions including deposits and withdrawals.
372
+ * @param props - Wallet address and optional vault/chain filters
373
+ * @returns Array of historical transactions with amounts and timestamps
374
+ */
375
+ async getVaultUserHistory(props) {
376
+ return await this.vaults.getUserHistory(props);
377
+ }
378
+ /**
379
+ * Get user's vault share transfer history from subgraph.
380
+ * @param props - Wallet address and optional vault/chain filters
381
+ * @returns Array of transfer events
382
+ */
383
+ async getVaultUserTransfers(props) {
384
+ return await this.vaults.getUserTransfers(props);
385
+ }
386
+ /**
387
+ * Get a vault's deposit/withdrawal activity across every participant.
388
+ *
389
+ * The vault-wide counterpart to {@link UpshiftSDK.getVaultUserHistory} — use
390
+ * it to answer flow questions ("how many deposits in the last 7 days", "net
391
+ * flow this week") that point-in-time TVL cannot. Reads from the Goldsky
392
+ * subgraph, paginated so busy vaults are not truncated; a `sinceTs` window
393
+ * keeps short lookbacks cheap.
394
+ * @param props - Vault address, optional chain id, optional `sinceTs`/`untilTs`
395
+ * Unix-second bounds, and an optional `types` filter.
396
+ * @returns Array of activity items (oldest-first) with normalized amounts,
397
+ * actor addresses, event type, and transaction hashes.
398
+ * @throws If `vault` is not a valid address or no chain id can be resolved.
399
+ * @example
400
+ * ```ts
401
+ * const weekAgo = Math.floor(Date.now() / 1000) - 7 * 86_400;
402
+ * const items = await sdk.getVaultActivity({ vault, chainId: 143, sinceTs: weekAgo });
403
+ * ```
404
+ */
405
+ async getVaultActivity(props) {
406
+ return await this.vaults.getVaultActivity(props);
407
+ }
408
+ /**
409
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
410
+ * chain — the any-token set a deposit UI can offer as swap-and-deposit inputs.
411
+ *
412
+ * Delegates to {@link UpshiftVaults.getSwapRouterWhitelistedTokens}, which
413
+ * reconstructs the set from the router's `TokenEnabled` events and verifies
414
+ * each against the on-chain `whitelistedTokens` mapping (not enumerable).
415
+ * Returns `[]` when no router is deployed on `chainId` or no provider is
416
+ * configured for it.
417
+ *
418
+ * @param chainId - EVM chain ID to resolve the allowlist for.
419
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
420
+ * @returns Checksummed whitelisted token addresses; `[]` when unavailable.
421
+ * @throws UpshiftSDKError when an `eth_getLogs` scan chunk fails.
422
+ * @example
423
+ * ```ts
424
+ * const tokens = await upshiftSdk.getSwapRouterWhitelistedTokens(1);
425
+ * ```
426
+ */
427
+ async getSwapRouterWhitelistedTokens(chainId, options) {
428
+ return await this.vaults.getSwapRouterWhitelistedTokens(chainId, options);
429
+ }
430
+ /**
431
+ * Resolve the vaults that offer the any-token `SwapRouter` deposit surface
432
+ * (swap tokens) on a chain — every vault the Upshift API marks
433
+ * `swaps_enabled`.
434
+ *
435
+ * Delegates to {@link UpshiftVaults.getSwapRouterEligibleVaults}. Returns
436
+ * `[]` when no router is deployed on `chainId`. App-level policy (e.g.
437
+ * OVault exclusions) remains the caller's responsibility.
438
+ *
439
+ * @param chainId - EVM chain ID to resolve eligible vaults for.
440
+ * @param options - Kept for compatibility; `fromBlock` is no longer read.
441
+ * @returns Checksummed `swaps_enabled` vault addresses; `[]` when unavailable.
442
+ * @throws When the Upshift API vault-list request fails.
443
+ * @example
444
+ * ```ts
445
+ * const vaults = await upshiftSdk.getSwapRouterEligibleVaults(1);
446
+ * ```
447
+ */
448
+ async getSwapRouterEligibleVaults(chainId, options) {
449
+ return await this.vaults.getSwapRouterEligibleVaults(chainId, options);
450
+ }
451
+ /**
452
+ * Read a SwapRouter origin code's on-chain registration (registered, fee in
453
+ * bps, collector). Delegates to {@link UpshiftVaults.getOriginInfo}.
454
+ * @param options - `chainId` and the `bytes32` `originCode` to look up.
455
+ * @returns `{ registered, originFeeBps, collector }`.
456
+ * @throws UpshiftValidationError when no provider is configured for `chainId`
457
+ * or `originCode` is malformed.
458
+ * @example
459
+ * ```ts
460
+ * const { registered } = await upshiftSdk.getOriginInfo({ chainId: 1, originCode });
461
+ * ```
462
+ */
463
+ async getOriginInfo(options) {
464
+ return await this.vaults.getOriginInfo(options);
465
+ }
466
+ /**
467
+ * Get lifetime PnL for a user in a specific vault.
468
+ * Calculates realized and unrealized PnL based on deposit/withdrawal history and current position.
469
+ * @param props - Vault address, wallet address, and optional chain ID
470
+ * @returns Lifetime PnL data including realized and unrealized PnL in both native token and USD
471
+ * @throws {@link UpshiftHistoryUnavailableError} (`HISTORY_UNAVAILABLE`) when a
472
+ * live position has no indexed deposits, withdrawals or priceable share
473
+ * transfers.
474
+ * @throws {@link UpshiftPriceUnavailableError} (`PRICE_UNAVAILABLE`) when the
475
+ * vault's underlying asset has no USD price — the USD fields are never
476
+ * computed from a stand-in price.
477
+ */
478
+ async getVaultUserLifetimePnl(props) {
479
+ return await this.vaults.getVaultUserLifetimePnl(props);
480
+ }
481
+ /**
482
+ * Get PnL for a vault (vault-level, not user-specific).
483
+ * Returns the vault's overall profit and loss across all users.
484
+ * @param props - Vault address and optional chain ID
485
+ * @returns Vault PnL in USD and notional value
486
+ */
487
+ async getVaultPnl(props) {
488
+ return await this.vaults.getVaultPnl(props);
489
+ }
490
+ /**
491
+ * Get user's staking positions for vault receipt tokens.
492
+ * @param props - Wallet address and optional chain ID
493
+ * @returns Array of staking positions with rewards
494
+ */
495
+ async getVaultStakingPositions(props) {
496
+ return await this.vaults.getStakingPositions(props.wallet, props.chainId);
497
+ }
498
+ /**
499
+ * Get the borrower's health factor by vault.
500
+ *
501
+ * Pass `vault` whenever the caller knows which pool it cares about — it
502
+ * skips the all-vaults cross-chain fanout and only reads the loans for
503
+ * that one pool. The response map is keyed by **lowercased** vault
504
+ * address; look entries up with `address.toLowerCase()`.
505
+ *
506
+ * @param props.chainId Optional chain to scope the read to.
507
+ * @param props.vault Optional vault address. When provided alongside
508
+ * `chainId`, only that vault's borrower-health-factor data is fetched.
509
+ * @returns Object containing the borrower's health factor by vault.
510
+ */
511
+ async getVaultBorrowerHealthFactor(props) {
512
+ return await this.vaults.getVaultBorrowerHealthFactor(props?.chainId, props?.vault);
513
+ }
514
+ /**
515
+ * Get user points from the backend API.
516
+ * This fetches processed points data directly from the backend,
517
+ * removing the need for client-side points calculation.
518
+ * @param userAddress - User wallet address
519
+ * @returns Points data from the backend API
520
+ */
521
+ async getUserPoints(userAddress) {
522
+ return await this.vaults.getUserPoints(userAddress);
523
+ }
524
+ /**
525
+ * Register a user for the points program, authenticated by a wallet signature.
526
+ *
527
+ * The caller produces a personal_sign signature over a canonical message
528
+ * containing the user address, referrer (or `"none"`), chain, nonce, and
529
+ * expiry — see `UpshiftVaults.registerUserForPoints` for the exact template.
530
+ *
531
+ * @param userAddress - EVM wallet address being registered.
532
+ * @param referrerAddress - Optional EVM referrer address.
533
+ * @param chainId - Chain on which the wallet signed; powers the EIP-1271
534
+ * fallback for smart-contract wallets and pins the signature cross-chain.
535
+ * @param signature - 0x-prefixed personal_sign signature over the canonical message.
536
+ * @param nonce - Single-use random string (8–128 chars).
537
+ * @param expiry - Unix seconds; must be in the future, within the backend's TTL.
538
+ * @returns Raw `Response` from the backend.
539
+ */
540
+ async registerUserForPoints(userAddress, referrerAddress, chainId, signature, nonce, expiry) {
541
+ return await this.vaults.registerUserForPoints(userAddress, referrerAddress, chainId, signature, nonce, expiry);
542
+ }
543
+ /**
544
+ * Fetch the points leaderboard data.
545
+ * @param params - Optional parameters for pagination and sorting
546
+ * @returns Leaderboard response data
547
+ */
548
+ async fetchPointsLeaderboard(params) {
549
+ return await this.vaults.fetchPointsLeaderboard(params);
550
+ }
551
+ /**
552
+ * Fetch the historical unrealized-PnL series for a vault, newest first.
553
+ * Delegates to {@link UpshiftApi.getVaultUnrealizedPnlHistory} — see it for
554
+ * parameter semantics and thrown errors.
555
+ */
556
+ async getVaultUnrealizedPnlHistory(params) {
557
+ return await this.api.getVaultUnrealizedPnlHistory(params);
558
+ }
559
+ /**
560
+ * Fetch the latest unrealized-PnL snapshot for every tracked vault.
561
+ * Delegates to {@link UpshiftApi.getLatestUnrealizedPnl} — see it for
562
+ * return shape and thrown errors.
563
+ */
564
+ async getLatestUnrealizedPnl() {
565
+ return await this.api.getLatestUnrealizedPnl();
566
+ }
567
+ /**
568
+ * Get annualized APY metrics for a vault.
569
+ *
570
+ * Supported Vaults: cUSDO, tETH, wstETH, rsETH
571
+ *
572
+ * @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
573
+ * These fields will be removed in the next major release.
574
+ * Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
575
+ *
576
+ * @param props - Vault address
577
+ * @returns Annualized APY data including liquidity APY
578
+ */
579
+ async getVaultAnnualizedApy(props) {
580
+ return await this.vaults.getVaultAnnualizedApy(props.vault);
581
+ }
582
+ /**
583
+ * Get summary data for a vault (name, type, chain, recent returns).
584
+ * @param props - Vault address
585
+ * @returns Vault summary data
586
+ */
587
+ async getVaultSummary(props) {
588
+ return await this.vaults.getVaultSummary(props.vault);
589
+ }
590
+ /**
591
+ * Get withdrawal summary and pending queue for a vault.
592
+ * @param props - Vault address and optional chain ID
593
+ * @returns Withdrawal summary and pending queue
594
+ */
595
+ async getVaultWithdrawals(props) {
596
+ return await this.vaults.getVaultWithdrawals(props.vault, props.chainId);
597
+ }
598
+ /**
599
+ * Preview the amount of assets that would be received for redeeming shares (queued redemption).
600
+ * @param props - Vault contract address, shares amount, and optional chain ID
601
+ * @returns The amount of assets as {@link INormalizedNumber}
602
+ */
603
+ async previewRedemption(props) {
604
+ return await this.vaults.previewRedemption(props);
605
+ }
606
+ /**
607
+ * Query LayerZero USDC deposits from the august-layerzero subgraphs.
608
+ * Returns all deposits or filters by sender wallet address if provided.
609
+ *
610
+ * **Important Notes:**
611
+ * - Only deposit transactions are tracked (not withdrawals or other operations)
612
+ * - Sender and recipient addresses are stored in bytes32 format in the subgraph
613
+ * - Timestamps are available from the subgraph
614
+ *
615
+ * **Supported Vaults:**
616
+ * - `upusdc`: 0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42
617
+ * - `coreusdc`: 0xE9B725010A9E419412ed67d0fA5f3A5f40159D32
618
+ * - `earnausd`: 0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA
619
+ *
620
+ * @param props - Receipt token type ('upusdc', 'coreusdc', or 'earnausd') and optional wallet address to filter by sender
621
+ * @returns Array of deposit events with the following structure:
622
+ * - `assetAmt`: Amount of assets deposited (as string)
623
+ * - `shareAmt`: Amount of shares received (as string)
624
+ * - `sender`: Sender address in bytes32 format
625
+ * - `recipient`: Recipient address in bytes32 format
626
+ * - `dstEid`: Destination endpoint ID (LayerZero chain identifier)
627
+ * - `transactionHash_`: Transaction hash
628
+ *
629
+ * @throws Error if receipt token is invalid or GraphQL request fails
630
+ *
631
+ * @example
632
+ * ```typescript
633
+ * // Get all coreUSDC deposits
634
+ * const allDeposits = await sdk.getLayerZeroDeposits({
635
+ * receiptToken: 'coreusdc'
636
+ * });
637
+ *
638
+ * // Get deposits for a specific wallet
639
+ * const userDeposits = await sdk.getLayerZeroDeposits({
640
+ * receiptToken: 'upusdc',
641
+ * wallet: '0xb0280B58F541131b29D1B33319CD440a99eA0305'
642
+ * });
643
+ * ```
644
+ */
645
+ async getLayerZeroDeposits(props) {
646
+ // Runtime validation for receipt token
647
+ const validTokens = ['upusdc', 'coreusdc', 'earnausd'];
648
+ if (!validTokens.includes(props.receiptToken)) {
649
+ throw new Error(`Invalid receiptToken: ${props.receiptToken}. Must be 'upusdc', 'coreusdc', or 'earnausd'.`);
650
+ }
651
+ const { queryLayerZeroDeposits } = await Promise.resolve().then(() => __importStar(require('./services/layerzero/deposits')));
652
+ // Map receipt token to vault key
653
+ const vaultKeyMap = {
654
+ upusdc: 'upUSDC',
655
+ coreusdc: 'coreUSDC',
656
+ earnausd: 'earnAUSD',
657
+ };
658
+ const vaultKey = vaultKeyMap[props.receiptToken];
659
+ return await queryLayerZeroDeposits(vaultKey, props.wallet);
660
+ }
661
+ /**
662
+ * Get LayerZero redeems for earnAUSD vault
663
+ *
664
+ * @example
665
+ * ```typescript
666
+ * // Get all earnAUSD redeems
667
+ * const allRedeems = await sdk.getLayerZeroRedeems();
668
+ *
669
+ * // Get redeems for a specific wallet
670
+ * const userRedeems = await sdk.getLayerZeroRedeems({
671
+ * wallet: '0x2de1DCB8EaAd40fAd327fa3eE3F48774b8e20649'
672
+ * });
673
+ * ```
674
+ */
675
+ async getLayerZeroRedeems(props) {
676
+ const { queryLayerZeroRedeems } = await Promise.resolve().then(() => __importStar(require('./services/layerzero/redeems')));
677
+ return await queryLayerZeroRedeems(props?.wallet);
678
+ }
679
+ }
680
+ exports.UpshiftSDK = UpshiftSDK;
681
+ //# sourceMappingURL=main.js.map