@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,656 @@
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
+ const errors_1 = require("../../core/errors");
18
+ const write_actions_1 = require("../../modules/vaults/write.actions");
19
+ const swap_router_1 = require("../../core/helpers/swap-router");
20
+ const read_actions_1 = require("../../modules/vaults/read.actions");
21
+ const signer_1 = require("../../core/helpers/signer");
22
+ __exportStar(require("./getters"), exports);
23
+ /**
24
+ * EVM Adapter for Upshift SDK
25
+ * Supports both ethers Signer/Wallet and wagmi/viem WalletClient
26
+ *
27
+ * @example
28
+ * To access the EVM adapter instance
29
+ * ```
30
+ * const sdk = new UpshiftSDK()
31
+ * sdk.evm.vaultRedeem()
32
+ * ```
33
+ */
34
+ class EVMAdapter {
35
+ signer;
36
+ rawSigner;
37
+ getReadProvider;
38
+ /**
39
+ * @param signer - Optional ethers Signer/Wallet or viem WalletClient. Required
40
+ * for writes; reads fall back to `getReadProvider` when absent.
41
+ * @param getReadProvider - Optional thunk returning a read-only provider for
42
+ * the SDK's active network. Called on every signerless read so it tracks
43
+ * `switchNetwork`. `UpshiftSDK` wires this to its configured `providers`.
44
+ */
45
+ constructor(signer, getReadProvider) {
46
+ this.rawSigner = signer;
47
+ this.getReadProvider = getReadProvider;
48
+ // Don't normalize in constructor - do it lazily when needed
49
+ }
50
+ /**
51
+ * Set a new signer (supports both ethers and viem/wagmi)
52
+ * @param signer - Either an ethers Signer/Wallet or viem WalletClient
53
+ */
54
+ setSigner(signer) {
55
+ this.rawSigner = signer;
56
+ this.signer = undefined; // Reset normalized signer
57
+ }
58
+ /**
59
+ * Get the normalized ethers-compatible signer
60
+ * Converts viem WalletClient to ethers Signer if needed
61
+ */
62
+ async _getSigner() {
63
+ if (!this.rawSigner) {
64
+ throw new errors_1.UpshiftSDKError('NO_SIGNER', 'No signer provided: EVM writes require a signer. Call sdk.evm.setSigner(signer) first.');
65
+ }
66
+ // If we already have a normalized signer, return it
67
+ if (this.signer) {
68
+ return this.signer;
69
+ }
70
+ // Normalize and cache the signer. The attribution wrap is unconditional
71
+ // and reads the process-global config at send time, so a cached signer
72
+ // honors attribution enabled or reset after caching.
73
+ this.signer = (0, signer_1.wrapSignerWithAttribution)(await (0, signer_1.normalizeSigner)(this.rawSigner));
74
+ return this.signer;
75
+ }
76
+ /**
77
+ * Resolve the contract runner for a read-only call. Prefers the signer when
78
+ * one is set (preserving the signer's chain), otherwise falls back to the
79
+ * read provider for the SDK's active network, so reads such as `balanceOf`
80
+ * or `previewDeposit` work before `setSigner` is called.
81
+ *
82
+ * No extra RPC calls: the provider comes from the `createProvider` cache.
83
+ *
84
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when neither a signer nor a read
85
+ * provider (configured `providers` entry) is available.
86
+ */
87
+ async _getReadRunner() {
88
+ if (this.rawSigner)
89
+ return this._getSigner();
90
+ const provider = this.getReadProvider?.();
91
+ if (!provider) {
92
+ throw new errors_1.UpshiftSDKError('NO_SIGNER', 'EVM read requires a signer or a configured provider. Pass ' +
93
+ '`providers: { [chainId]: rpcUrl }` to UpshiftSDK, or call ' +
94
+ 'sdk.evm.setSigner(signer).');
95
+ }
96
+ return provider;
97
+ }
98
+ // Core EVM operations
99
+ async vaultApprove(options) {
100
+ const signer = await this._getSigner();
101
+ return (0, write_actions_1.vaultApprove)(signer, options);
102
+ }
103
+ /**
104
+ * Approve a vault to spend a deposit token, returning a discriminated
105
+ * {@link ApproveResult} so callers can tell `sent` from `sufficient`
106
+ * (existing allowance covers) and `native` (no allowance applies).
107
+ * Prefer this over {@link vaultApprove} for new integrations.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const r = await upshiftSdk.evm.approve({
112
+ * target: vaultAddress,
113
+ * wallet: walletAddress,
114
+ * amount: '100',
115
+ * wait: true,
116
+ * });
117
+ * if (r.kind === 'sent') console.log('approve tx', r.hash);
118
+ * ```
119
+ */
120
+ async approve(options) {
121
+ const signer = await this._getSigner();
122
+ return (0, write_actions_1.approve)(signer, options);
123
+ }
124
+ /**
125
+ * Read the ERC-20 allowance the wallet has granted the vault to spend its
126
+ * underlying asset, returned as a normalized number. For the newer typed
127
+ * read that returns a raw `bigint` and accepts an explicit `asset` override,
128
+ * use {@link EVMAdapter.allowance}.
129
+ *
130
+ * Only `target` (vault address) and `wallet` are read from `options`; the
131
+ * remaining {@link IContractWriteOptions} fields are ignored.
132
+ *
133
+ * @param options - `{ target, wallet }` (other fields ignored).
134
+ * @returns Normalized allowance (`{ raw, normalized }`), or `undefined` when
135
+ * `target` / `wallet` fail address validation.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const a = await upshiftSdk.evm.vaultAllowance({
140
+ * target: vaultAddress,
141
+ * wallet: walletAddress,
142
+ * });
143
+ * console.log(a?.normalized);
144
+ * ```
145
+ *
146
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
147
+ * configured provider for the active network.
148
+ */
149
+ async vaultAllowance(options) {
150
+ const runner = await this._getReadRunner();
151
+ return (0, read_actions_1.vaultAllowance)(runner, options);
152
+ }
153
+ // Vault operations (delegate to modules)
154
+ /**
155
+ * Deposit into an Upshift vault. Routes automatically: V1 single-asset vaults
156
+ * deposit the underlying directly; V2 multi-asset vaults route through the
157
+ * adapter for non-underlying `depositAsset`. With `attribution.originCode`
158
+ * configured, eligible deposits go through the SwapRouter instead (see
159
+ * {@link EVMAdapter.getDepositRoute}). If allowance is insufficient
160
+ * the method submits an approve transaction first (the approve step always
161
+ * waits for confirmation to close a race window, regardless of `wait`).
162
+ *
163
+ * @param options - {@link IContractWriteOptions}. `target` and `wallet` are
164
+ * required; pass `amount`, `depositAsset` (defaults to the vault's
165
+ * underlying), `chainId`, `poolName`, `wait`, and `isDepositWithPermit`
166
+ * as needed.
167
+ * @returns The deposit `TransactionResponse`, or `undefined` if an
168
+ * approval-only path was taken and no deposit transaction was sent.
169
+ * @throws UpshiftValidationError on invalid inputs (bad address, bad amount).
170
+ * @throws UpshiftSDKError on RPC / contract revert during the deposit.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const tx = await upshiftSdk.evm.vaultDeposit({
175
+ * target: vaultAddress,
176
+ * wallet: walletAddress,
177
+ * amount: '100',
178
+ * wait: true,
179
+ * });
180
+ * ```
181
+ */
182
+ async vaultDeposit(options) {
183
+ const signer = await this._getSigner();
184
+ return (0, write_actions_1.vaultDeposit)(signer, options);
185
+ }
186
+ /**
187
+ * Resolve whether a deposit goes through the SwapRouter with the instance
188
+ * origin code or takes the vault's native path, and the address to approve
189
+ * (`route.spender`, not necessarily the vault). See {@link getDepositRoute}.
190
+ *
191
+ * @param options - {@link IGetDepositRouteOptions}.
192
+ * @returns `{ via, spender, reason? }` — `reason` explains a native route
193
+ * (`router-paused` while the SwapRouter is paused).
194
+ * @throws UpshiftValidationError on an invalid target, or an unregistered
195
+ * code under `attribution.strictOrigin` while the router is not paused.
196
+ * @throws UpshiftSDKError when a backend, vault or router read fails.
197
+ * @example
198
+ * ```ts
199
+ * const { via, spender } = await upshiftSdk.evm.getDepositRoute({ target: vault });
200
+ * ```
201
+ */
202
+ async getDepositRoute(options) {
203
+ const signer = await this._getSigner();
204
+ return (0, write_actions_1.getDepositRoute)(signer, options);
205
+ }
206
+ /**
207
+ * Submit a redemption request against a vault. Shares are escrowed and the
208
+ * underlying assets are released asynchronously by the protocol; callers
209
+ * collect the matured assets via {@link EVMAdapter.vaultRedeem}, or use the
210
+ * instant-redeem variant by setting `isInstantRedeem: true`.
211
+ *
212
+ * @param options - {@link IContractWriteOptions}. `target`, `wallet`, and
213
+ * `amount` (in shares) are required. Set `isInstantRedeem: true` to take
214
+ * the instant-redeem path when the vault supports it.
215
+ * @returns The request `TransactionResponse`, or `undefined` if the request
216
+ * could not be built (validation failure).
217
+ * @throws UpshiftValidationError on invalid inputs.
218
+ * @throws UpshiftSDKError on RPC / contract revert.
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * const tx = await upshiftSdk.evm.vaultRequestRedeem({
223
+ * target: vaultAddress,
224
+ * wallet: walletAddress,
225
+ * amount: shareAmount,
226
+ * wait: true,
227
+ * });
228
+ * ```
229
+ */
230
+ async vaultRequestRedeem(options) {
231
+ const signer = await this._getSigner();
232
+ return (0, write_actions_1.vaultRequestRedeem)(signer, options);
233
+ }
234
+ /**
235
+ * Deposit the chain's native asset (ETH / AVAX / etc.) into a vault by
236
+ * routing through the `MultiAssetNativeDepositWrapper`. The wrapper handles
237
+ * native-to-wrapped conversion and the subsequent vault deposit in a single
238
+ * transaction.
239
+ *
240
+ * @param options - {@link INativeDepositOptions}: `wrapperAddress`, `amount`
241
+ * (native, scaled by the chain's native decimals), optional `receiver`
242
+ * (defaults to the signer), and optional `wait`.
243
+ * @returns The deposit `TransactionResponse`.
244
+ * @throws UpshiftValidationError on invalid inputs.
245
+ * @throws UpshiftSDKError on RPC / contract revert.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const tx = await upshiftSdk.evm.depositNative({
250
+ * wrapperAddress: nativeWrapperAddress,
251
+ * amount: parseEther('1'),
252
+ * wait: true,
253
+ * });
254
+ * ```
255
+ */
256
+ async depositNative(options) {
257
+ const signer = await this._getSigner();
258
+ return (0, write_actions_1.depositNative)(signer, options);
259
+ }
260
+ /**
261
+ * Swap one or more whitelisted ERC-20s into a vault's reference asset via
262
+ * the on-chain `SwapRouter` and deposit the proceeds. The router handles
263
+ * fee accrual, slippage protection, and the v1/v3 vs v2 deposit-interface
264
+ * branching. Approval is sent automatically for each `swaps[i].tokenIn`
265
+ * when the caller's allowance against the SwapRouter is below `amountIn`.
266
+ *
267
+ * @param options - {@link ISwapAndDepositOptions}.
268
+ * @returns The transaction hash of the `swapAndDeposit` call.
269
+ * @throws UpshiftValidationError on invalid inputs (bad chain, empty swaps).
270
+ * @throws UpshiftSDKError while the SwapRouter is paused (checked before any
271
+ * approval), or on RPC / contract revert.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * const quote = await fetchSwapQuote({
276
+ * chainId: 1, srcToken: WBTC, srcDecimals: 8,
277
+ * destToken: USDC, destDecimals: 6, amount: 100_000_000n,
278
+ * receiver: SWAP_ROUTER_ADDRESSES[1]!,
279
+ * });
280
+ * const hash = await upshiftSdk.evm.swapAndDeposit({
281
+ * chainId: 1, vault, receiver: wallet,
282
+ * swaps: [{ tokenIn: WBTC, tokenOut: USDC, amountIn: 100_000_000n,
283
+ * minAmountOut: quote.minAmountOut, router: quote.router, payload: quote.payload }],
284
+ * });
285
+ * ```
286
+ */
287
+ async swapAndDeposit(options) {
288
+ const signer = await this._getSigner();
289
+ return (0, write_actions_1.swapAndDeposit)(signer, options);
290
+ }
291
+ /**
292
+ * Deposit a vault's reference asset through the SwapRouter — no swap.
293
+ * Use this when the caller already holds the reference asset but wants
294
+ * the origin/referral fee accounting that the SwapRouter path provides.
295
+ *
296
+ * @param options - {@link ISwapRouterDirectDepositOptions}.
297
+ * @returns The transaction hash of the `deposit` call.
298
+ * @throws UpshiftSDKError while the SwapRouter is paused (checked before any
299
+ * approval), or on RPC / contract revert.
300
+ */
301
+ async depositViaSwapRouter(options) {
302
+ const signer = await this._getSigner();
303
+ return (0, write_actions_1.depositViaSwapRouter)(signer, options);
304
+ }
305
+ /**
306
+ * Deposit native ETH (or chain-native equivalent) into a vault via the
307
+ * SwapRouter. Only valid when the vault's reference asset is the chain's
308
+ * wrapped-native token — the SwapRouter wraps `amount` and deposits.
309
+ *
310
+ * @param options - {@link ISwapRouterNativeDepositOptions}.
311
+ * @returns The transaction hash of the `depositNativeToken` call.
312
+ * @throws UpshiftSDKError while the SwapRouter is paused (checked before any
313
+ * approval), or on RPC / contract revert.
314
+ */
315
+ async depositNativeViaSwapRouter(options) {
316
+ const signer = await this._getSigner();
317
+ return (0, write_actions_1.depositNativeViaSwapRouter)(signer, options);
318
+ }
319
+ /**
320
+ * Deposit into a vault through the on-chain `SwapRouter`, choosing the router
321
+ * path from `depositAsset` (direct deposit, native wrap, or a swap to the
322
+ * reference asset). The explicit, opt-in swap entry point —
323
+ * {@link vaultDeposit} never swaps — so a native-deposit vault is never
324
+ * accidentally swapped.
325
+ *
326
+ * Reads the vault's reference asset + decimals on-chain, resolves the swap
327
+ * quote and fail-closes on aggregator/whitelist drift, and sends the ERC-20
328
+ * approval to the SwapRouter when allowance is short.
329
+ *
330
+ * @param options - {@link ISwapRouterDepositOptions}.
331
+ * @returns The transaction hash of the router deposit call.
332
+ * @throws UpshiftValidationError on unsupported chain, invalid address, zero
333
+ * amount, a native deposit into a non-wrapped-native vault, or quote drift.
334
+ * @throws UpshiftSDKError while the SwapRouter is paused (checked before any
335
+ * approval), or on RPC / contract revert.
336
+ * @example
337
+ * ```ts
338
+ * const hash = await upshiftSdk.evm.swapRouterDeposit({
339
+ * chainId: 1, vault, depositAsset: USDT, amount: '100', slippageBps: 50,
340
+ * });
341
+ * ```
342
+ */
343
+ async swapRouterDeposit(options) {
344
+ const signer = await this._getSigner();
345
+ return (0, write_actions_1.swapRouterDeposit)(signer, options);
346
+ }
347
+ /**
348
+ * Resolves the real, post-execution outcome of a SwapRouter deposit from
349
+ * its mined receipt — the actual amount that reached the vault (and shares
350
+ * minted), decoded from the vault's own `Deposit` event, rather than the
351
+ * pre-trade quote shown before submission.
352
+ *
353
+ * @param options - {@link ISwapRouterDepositResultOptions}.
354
+ * @returns The decoded {@link ISwapRouterDepositResult}, or `null` if the
355
+ * receipt isn't found yet or carries no matching `Deposit` log.
356
+ * @example
357
+ * ```ts
358
+ * const hash = await upshiftSdk.evm.swapRouterDeposit({ ... });
359
+ * const result = await upshiftSdk.evm.getSwapRouterDepositResult({ txHash: hash, vault });
360
+ * ```
361
+ */
362
+ async getSwapRouterDepositResult(options) {
363
+ const signer = await this._getSigner();
364
+ return (0, swap_router_1.getSwapRouterDepositResult)(signer, options);
365
+ }
366
+ /**
367
+ * Claim assets from a matured redemption request on a dated-redemption
368
+ * (RWA-style) vault. The `year`, `month`, `day`, and `receiverIndex` tuple
369
+ * identifies which batch of the user's matured requests to redeem from —
370
+ * these are emitted at request-time and indexed by the subgraph.
371
+ *
372
+ * For non-dated vaults that complete their redemption via `instantRedeem`,
373
+ * see {@link EVMAdapter.vaultRequestRedeem} with `isInstantRedeem: true`.
374
+ *
375
+ * @param options - {@link IContractWriteOptions} plus `year` / `month` /
376
+ * `day` / `receiverIndex` identifying the matured batch to claim.
377
+ * @returns The redeem `TransactionResponse`.
378
+ * @throws UpshiftValidationError on invalid inputs.
379
+ * @throws UpshiftSDKError on RPC / contract revert.
380
+ *
381
+ * @example
382
+ * ```ts
383
+ * const tx = await upshiftSdk.evm.vaultRedeem({
384
+ * target: vaultAddress,
385
+ * wallet: walletAddress,
386
+ * amount: shareAmount,
387
+ * year: '2026',
388
+ * month: '06',
389
+ * day: '02',
390
+ * receiverIndex: '0',
391
+ * wait: true,
392
+ * });
393
+ * ```
394
+ */
395
+ async vaultRedeem(options) {
396
+ const signer = await this._getSigner();
397
+ return (0, write_actions_1.vaultRedeem)(signer, options);
398
+ }
399
+ /**
400
+ * Claim a previously-requested queued withdrawal on an EVM-2 (Tokenized
401
+ * Vault V2) vault, once its withdrawal epoch has passed. EVM-2 only — v1/v0
402
+ * vaults use {@link EVMAdapter.vaultRedeem} instead.
403
+ *
404
+ * @param options - {@link IClaimWithdrawalOptions}: `target` / `wallet`
405
+ * plus the `year` / `month` / `day` tuple returned by
406
+ * `vaultRequestRedeem`.
407
+ * @returns Claim transaction hash.
408
+ * @throws UpshiftValidationError on invalid inputs or a non-EVM-2 vault.
409
+ * @throws UpshiftSDKError on RPC / contract revert.
410
+ *
411
+ * @example
412
+ * ```ts
413
+ * const { year, month, day } = await upshiftSdk.evm.vaultRequestRedeem({
414
+ * target: vaultAddress,
415
+ * wallet: walletAddress,
416
+ * amount: '10',
417
+ * });
418
+ * await upshiftSdk.evm.claimWithdrawal({
419
+ * target: vaultAddress,
420
+ * wallet: walletAddress,
421
+ * year,
422
+ * month,
423
+ * day,
424
+ * wait: true,
425
+ * });
426
+ * ```
427
+ */
428
+ async claimWithdrawal(options) {
429
+ const signer = await this._getSigner();
430
+ return (0, write_actions_1.claimWithdrawal)(signer, options);
431
+ }
432
+ async sendersWhitelistAddress(options) {
433
+ const runner = await this._getReadRunner();
434
+ return (0, read_actions_1.sendersWhitelistAddress)(runner, options);
435
+ }
436
+ async isWhitelisted(options) {
437
+ const runner = await this._getReadRunner();
438
+ return (0, read_actions_1.isWhitelisted)(runner, options);
439
+ }
440
+ async getDeposited(options) {
441
+ const runner = await this._getReadRunner();
442
+ return (0, read_actions_1.getDeposited)(runner, options);
443
+ }
444
+ async getRemainingAllocations(options) {
445
+ const runner = await this._getReadRunner();
446
+ return (0, read_actions_1.getRemainingAllocations)(runner, options);
447
+ }
448
+ /**
449
+ * Preview the share output of a deposit without broadcasting a transaction.
450
+ * See {@link readPreviewDeposit} for the routing details (EVM-1 vs EVM-2
451
+ * multi-asset vaults).
452
+ *
453
+ * @returns Shares minted in raw on-chain units (share-token decimals).
454
+ *
455
+ * @example
456
+ * ```ts
457
+ * const shares = await upshiftSdk.evm.previewDeposit({
458
+ * vault: '0x...',
459
+ * amount: 1_000_000n,
460
+ * });
461
+ * ```
462
+ *
463
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
464
+ * configured provider for the active network.
465
+ */
466
+ async previewDeposit(options) {
467
+ const runner = await this._getReadRunner();
468
+ return (0, read_actions_1.previewDeposit)(runner, options);
469
+ }
470
+ /**
471
+ * Preview the assets returned by redeeming a number of shares, without
472
+ * broadcasting a transaction.
473
+ *
474
+ * @returns Assets returned in raw on-chain units (asset decimals).
475
+ *
476
+ * @example
477
+ * ```ts
478
+ * const assets = await upshiftSdk.evm.previewRedeem({
479
+ * vault: '0x...',
480
+ * shares: 1_000_000_000_000_000_000n,
481
+ * });
482
+ * ```
483
+ *
484
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
485
+ * configured provider for the active network.
486
+ */
487
+ async previewRedeem(options) {
488
+ const runner = await this._getReadRunner();
489
+ return (0, read_actions_1.previewRedeem)(runner, options);
490
+ }
491
+ /**
492
+ * Read the ERC-20 allowance an owner has granted the vault. Defaults to the
493
+ * vault's underlying asset; pass `asset` to override.
494
+ *
495
+ * @returns Allowance as a raw `bigint`.
496
+ *
497
+ * @example
498
+ * ```ts
499
+ * const raw = await upshiftSdk.evm.allowance({ vault, owner });
500
+ * ```
501
+ *
502
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
503
+ * configured provider for the active network.
504
+ */
505
+ async allowance(options) {
506
+ const runner = await this._getReadRunner();
507
+ return (0, read_actions_1.allowance)(runner, options);
508
+ }
509
+ /**
510
+ * Read an ERC-20 token balance.
511
+ *
512
+ * @returns Balance as a raw `bigint`.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * const raw = await upshiftSdk.evm.balanceOf({ asset: usdcAddress, owner });
517
+ * ```
518
+ *
519
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
520
+ * configured provider for the active network.
521
+ */
522
+ async balanceOf(options) {
523
+ const runner = await this._getReadRunner();
524
+ return (0, read_actions_1.balanceOf)(runner, options);
525
+ }
526
+ /**
527
+ * Read the maximum deposit accepted by the vault for the supplied
528
+ * receiver. Useful for "vault is full" gates.
529
+ *
530
+ * @returns Max deposit as a raw `bigint`.
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * const cap = await upshiftSdk.evm.maxDeposit({ vault });
535
+ * ```
536
+ *
537
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
538
+ * configured provider for the active network.
539
+ */
540
+ async maxDeposit(options) {
541
+ const runner = await this._getReadRunner();
542
+ return (0, read_actions_1.maxDeposit)(runner, options);
543
+ }
544
+ /**
545
+ * Read an EVM-2 vault's idle liquidity (`getTotalAssets() -
546
+ * externalAssets()`) — the balance available to an instant redemption
547
+ * without a synchronous recall from the settlement module.
548
+ *
549
+ * @returns Idle liquidity as a raw `bigint`.
550
+ *
551
+ * @example
552
+ * ```ts
553
+ * const idle = await upshiftSdk.evm.getIdleLiquidity({ vault });
554
+ * ```
555
+ *
556
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
557
+ * configured provider for the active network.
558
+ */
559
+ async getIdleLiquidity(options) {
560
+ const runner = await this._getReadRunner();
561
+ return (0, read_actions_1.getIdleLiquidity)(runner, options);
562
+ }
563
+ /**
564
+ * Read an EVM-2 vault's queued-withdrawal lag, in seconds.
565
+ *
566
+ * @returns Lag duration as a raw `bigint`.
567
+ *
568
+ * @example
569
+ * ```ts
570
+ * const seconds = await upshiftSdk.evm.lagDuration({ vault });
571
+ * ```
572
+ *
573
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
574
+ * configured provider for the active network.
575
+ */
576
+ async lagDuration(options) {
577
+ const runner = await this._getReadRunner();
578
+ return (0, read_actions_1.lagDuration)(runner, options);
579
+ }
580
+ /**
581
+ * Read an EVM-2 vault's current withdrawal epoch by named field
582
+ * (`year`/`month`/`day`/`claimableEpoch`).
583
+ *
584
+ * @returns {@link IWithdrawalEpoch}.
585
+ *
586
+ * @example
587
+ * ```ts
588
+ * const epoch = await upshiftSdk.evm.getWithdrawalEpoch({ vault });
589
+ * ```
590
+ *
591
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
592
+ * configured provider for the active network.
593
+ */
594
+ async getWithdrawalEpoch(options) {
595
+ const runner = await this._getReadRunner();
596
+ return (0, read_actions_1.getWithdrawalEpoch)(runner, options);
597
+ }
598
+ /**
599
+ * Read how much of a withdrawal-epoch date's queue a receiver can
600
+ * currently claim, before calling {@link EVMAdapter.claimWithdrawal}.
601
+ *
602
+ * @returns Claimable amount as a raw `bigint`.
603
+ *
604
+ * @example
605
+ * ```ts
606
+ * const claimable = await upshiftSdk.evm.getBurnableAmountByReceiver({
607
+ * vault, receiver, year, month, day,
608
+ * });
609
+ * ```
610
+ *
611
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
612
+ * configured provider for the active network.
613
+ */
614
+ async getBurnableAmountByReceiver(options) {
615
+ const runner = await this._getReadRunner();
616
+ return (0, read_actions_1.getBurnableAmountByReceiver)(runner, options);
617
+ }
618
+ /**
619
+ * Read the total shares required to settle a withdrawal-epoch date's
620
+ * entire queue.
621
+ *
622
+ * @returns Required shares as a raw `bigint`.
623
+ *
624
+ * @example
625
+ * ```ts
626
+ * const shares = await upshiftSdk.evm.getRequirementByDate({ vault, year, month, day });
627
+ * ```
628
+ *
629
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
630
+ * configured provider for the active network.
631
+ */
632
+ async getRequirementByDate(options) {
633
+ const runner = await this._getReadRunner();
634
+ return (0, read_actions_1.getRequirementByDate)(runner, options);
635
+ }
636
+ /**
637
+ * Read the scheduled queued-withdrawal volume for a withdrawal-epoch date.
638
+ *
639
+ * @returns {@link IScheduledTransactionsByDate}.
640
+ *
641
+ * @example
642
+ * ```ts
643
+ * const { totalTransactions, executionEpoch } =
644
+ * await upshiftSdk.evm.getScheduledTransactionsByDate({ vault, year, month, day });
645
+ * ```
646
+ *
647
+ * @throws {@link UpshiftSDKError} `NO_SIGNER` when the SDK has no signer and no
648
+ * configured provider for the active network.
649
+ */
650
+ async getScheduledTransactionsByDate(options) {
651
+ const runner = await this._getReadRunner();
652
+ return (0, read_actions_1.getScheduledTransactionsByDate)(runner, options);
653
+ }
654
+ }
655
+ exports.default = EVMAdapter;
656
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @todo
3
+ */
4
+ export declare const functionsToCallMapping: (provider: any, contract: any, functionCalls: any[]) => any[];
5
+ /**
6
+ * @todo
7
+ */
8
+ export declare const functionsToCallReduction: (acc: any, curr: any, i: number, functionCalls: any[], contractCalls: any[]) => any;