upshift-finance 1.0.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 (316) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  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 +1043 -0
  40. package/lib/abis/SwapRouter.js +740 -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 +209 -0
  65. package/lib/adapters/evm/index.d.ts +353 -0
  66. package/lib/adapters/evm/index.js +434 -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/constants.d.ts +33 -0
  70. package/lib/adapters/solana/constants.js +52 -0
  71. package/lib/adapters/solana/getters.d.ts +11 -0
  72. package/lib/adapters/solana/getters.js +165 -0
  73. package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
  74. package/lib/adapters/solana/idl/vault-idl.js +1084 -0
  75. package/lib/adapters/solana/index.d.ts +233 -0
  76. package/lib/adapters/solana/index.js +291 -0
  77. package/lib/adapters/solana/types.d.ts +67 -0
  78. package/lib/adapters/solana/types.js +3 -0
  79. package/lib/adapters/solana/utils.d.ts +141 -0
  80. package/lib/adapters/solana/utils.js +595 -0
  81. package/lib/adapters/solana/vault.actions.d.ts +57 -0
  82. package/lib/adapters/solana/vault.actions.js +379 -0
  83. package/lib/adapters/stellar/actions.d.ts +28 -0
  84. package/lib/adapters/stellar/actions.js +77 -0
  85. package/lib/adapters/stellar/constants.d.ts +43 -0
  86. package/lib/adapters/stellar/constants.js +53 -0
  87. package/lib/adapters/stellar/getters.d.ts +68 -0
  88. package/lib/adapters/stellar/getters.js +290 -0
  89. package/lib/adapters/stellar/index.d.ts +114 -0
  90. package/lib/adapters/stellar/index.js +175 -0
  91. package/lib/adapters/stellar/soroban.d.ts +123 -0
  92. package/lib/adapters/stellar/soroban.js +613 -0
  93. package/lib/adapters/stellar/submit.d.ts +34 -0
  94. package/lib/adapters/stellar/submit.js +149 -0
  95. package/lib/adapters/stellar/types.d.ts +58 -0
  96. package/lib/adapters/stellar/types.js +6 -0
  97. package/lib/adapters/stellar/utils.d.ts +24 -0
  98. package/lib/adapters/stellar/utils.js +34 -0
  99. package/lib/adapters/sui/constants.d.ts +14 -0
  100. package/lib/adapters/sui/constants.js +29 -0
  101. package/lib/adapters/sui/getters.d.ts +9 -0
  102. package/lib/adapters/sui/getters.js +60 -0
  103. package/lib/adapters/sui/index.d.ts +45 -0
  104. package/lib/adapters/sui/index.js +101 -0
  105. package/lib/adapters/sui/transformer.d.ts +10 -0
  106. package/lib/adapters/sui/transformer.js +107 -0
  107. package/lib/adapters/sui/types.d.ts +66 -0
  108. package/lib/adapters/sui/types.js +3 -0
  109. package/lib/adapters/sui/utils.d.ts +10 -0
  110. package/lib/adapters/sui/utils.js +29 -0
  111. package/lib/core/analytics/chain-name.d.ts +9 -0
  112. package/lib/core/analytics/chain-name.js +34 -0
  113. package/lib/core/analytics/constants.d.ts +5 -0
  114. package/lib/core/analytics/constants.js +9 -0
  115. package/lib/core/analytics/env.d.ts +29 -0
  116. package/lib/core/analytics/env.js +59 -0
  117. package/lib/core/analytics/index.d.ts +36 -0
  118. package/lib/core/analytics/index.js +79 -0
  119. package/lib/core/analytics/instrumentation.d.ts +29 -0
  120. package/lib/core/analytics/instrumentation.js +277 -0
  121. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  122. package/lib/core/analytics/method-taxonomy.js +128 -0
  123. package/lib/core/analytics/metrics.d.ts +33 -0
  124. package/lib/core/analytics/metrics.js +116 -0
  125. package/lib/core/analytics/sanitize.d.ts +44 -0
  126. package/lib/core/analytics/sanitize.js +260 -0
  127. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  128. package/lib/core/analytics/sentry-runtime.js +97 -0
  129. package/lib/core/analytics/sentry.d.ts +67 -0
  130. package/lib/core/analytics/sentry.js +613 -0
  131. package/lib/core/analytics/types.d.ts +48 -0
  132. package/lib/core/analytics/types.js +3 -0
  133. package/lib/core/analytics/user-identity.d.ts +41 -0
  134. package/lib/core/analytics/user-identity.js +141 -0
  135. package/lib/core/analytics/version.d.ts +6 -0
  136. package/lib/core/analytics/version.js +10 -0
  137. package/lib/core/attribution.d.ts +111 -0
  138. package/lib/core/attribution.js +142 -0
  139. package/lib/core/auth/index.d.ts +1 -0
  140. package/lib/core/auth/index.js +18 -0
  141. package/lib/core/auth/verify.d.ts +2 -0
  142. package/lib/core/auth/verify.js +31 -0
  143. package/lib/core/base.class.d.ts +152 -0
  144. package/lib/core/base.class.js +172 -0
  145. package/lib/core/cache.d.ts +9 -0
  146. package/lib/core/cache.js +31 -0
  147. package/lib/core/constants/adapters.d.ts +103 -0
  148. package/lib/core/constants/adapters.js +180 -0
  149. package/lib/core/constants/core.d.ts +133 -0
  150. package/lib/core/constants/core.js +209 -0
  151. package/lib/core/constants/swap-router.d.ts +150 -0
  152. package/lib/core/constants/swap-router.js +169 -0
  153. package/lib/core/constants/vaults.d.ts +93 -0
  154. package/lib/core/constants/vaults.js +273 -0
  155. package/lib/core/constants/web3.d.ts +91 -0
  156. package/lib/core/constants/web3.js +229 -0
  157. package/lib/core/errors/index.d.ts +114 -0
  158. package/lib/core/errors/index.js +183 -0
  159. package/lib/core/fetcher.d.ts +198 -0
  160. package/lib/core/fetcher.js +903 -0
  161. package/lib/core/helpers/adapters.d.ts +13 -0
  162. package/lib/core/helpers/adapters.js +39 -0
  163. package/lib/core/helpers/chain-address.d.ts +13 -0
  164. package/lib/core/helpers/chain-address.js +47 -0
  165. package/lib/core/helpers/chain-error.d.ts +207 -0
  166. package/lib/core/helpers/chain-error.js +682 -0
  167. package/lib/core/helpers/chain-support.d.ts +80 -0
  168. package/lib/core/helpers/chain-support.js +115 -0
  169. package/lib/core/helpers/core.d.ts +68 -0
  170. package/lib/core/helpers/core.js +285 -0
  171. package/lib/core/helpers/explorer-link.d.ts +16 -0
  172. package/lib/core/helpers/explorer-link.js +26 -0
  173. package/lib/core/helpers/multicall.d.ts +68 -0
  174. package/lib/core/helpers/multicall.js +103 -0
  175. package/lib/core/helpers/revert-decode.d.ts +248 -0
  176. package/lib/core/helpers/revert-decode.js +515 -0
  177. package/lib/core/helpers/signer.d.ts +52 -0
  178. package/lib/core/helpers/signer.js +145 -0
  179. package/lib/core/helpers/swap-router.d.ts +211 -0
  180. package/lib/core/helpers/swap-router.js +480 -0
  181. package/lib/core/helpers/vault-version.d.ts +23 -0
  182. package/lib/core/helpers/vault-version.js +75 -0
  183. package/lib/core/helpers/vaults.d.ts +89 -0
  184. package/lib/core/helpers/vaults.js +235 -0
  185. package/lib/core/helpers/web3.d.ts +353 -0
  186. package/lib/core/helpers/web3.js +992 -0
  187. package/lib/core/index.d.ts +23 -0
  188. package/lib/core/index.js +40 -0
  189. package/lib/core/logger/index.d.ts +98 -0
  190. package/lib/core/logger/index.js +144 -0
  191. package/lib/core/logger/slack.d.ts +16 -0
  192. package/lib/core/logger/slack.js +57 -0
  193. package/lib/core/vault-metadata.d.ts +12 -0
  194. package/lib/core/vault-metadata.js +42 -0
  195. package/lib/core/version-check.d.ts +58 -0
  196. package/lib/core/version-check.js +182 -0
  197. package/lib/evm/index.d.ts +2 -0
  198. package/lib/evm/index.js +19 -0
  199. package/lib/evm/methods/crossChainVault.d.ts +128 -0
  200. package/lib/evm/methods/crossChainVault.js +853 -0
  201. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  202. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  203. package/lib/evm/methods/index.d.ts +2 -0
  204. package/lib/evm/methods/index.js +19 -0
  205. package/lib/evm/types/crossChain.d.ts +363 -0
  206. package/lib/evm/types/crossChain.js +20 -0
  207. package/lib/evm/types/index.d.ts +1 -0
  208. package/lib/evm/types/index.js +18 -0
  209. package/lib/index.d.ts +30 -0
  210. package/lib/index.js +52 -0
  211. package/lib/main.d.ts +527 -0
  212. package/lib/main.js +601 -0
  213. package/lib/modules/api/fetcher.d.ts +82 -0
  214. package/lib/modules/api/fetcher.js +150 -0
  215. package/lib/modules/api/index.d.ts +1 -0
  216. package/lib/modules/api/index.js +6 -0
  217. package/lib/modules/api/main.d.ts +313 -0
  218. package/lib/modules/api/main.js +479 -0
  219. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  220. package/lib/modules/sub-accounts/fetcher.js +120 -0
  221. package/lib/modules/sub-accounts/index.d.ts +2 -0
  222. package/lib/modules/sub-accounts/index.js +19 -0
  223. package/lib/modules/sub-accounts/main.d.ts +243 -0
  224. package/lib/modules/sub-accounts/main.js +205 -0
  225. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  226. package/lib/modules/sub-accounts/utils.js +112 -0
  227. package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
  228. package/lib/modules/vaults/adapter.helpers.js +184 -0
  229. package/lib/modules/vaults/fetcher.d.ts +147 -0
  230. package/lib/modules/vaults/fetcher.js +368 -0
  231. package/lib/modules/vaults/getters.d.ts +570 -0
  232. package/lib/modules/vaults/getters.js +3051 -0
  233. package/lib/modules/vaults/index.d.ts +20 -0
  234. package/lib/modules/vaults/index.js +44 -0
  235. package/lib/modules/vaults/main.d.ts +601 -0
  236. package/lib/modules/vaults/main.js +1623 -0
  237. package/lib/modules/vaults/prefetch.d.ts +65 -0
  238. package/lib/modules/vaults/prefetch.js +120 -0
  239. package/lib/modules/vaults/read.actions.d.ts +225 -0
  240. package/lib/modules/vaults/read.actions.js +596 -0
  241. package/lib/modules/vaults/types.d.ts +71 -0
  242. package/lib/modules/vaults/types.js +3 -0
  243. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  244. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  245. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  246. package/lib/modules/vaults/utils/date-utils.js +84 -0
  247. package/lib/modules/vaults/utils.d.ts +140 -0
  248. package/lib/modules/vaults/utils.js +799 -0
  249. package/lib/modules/vaults/write.actions.d.ts +529 -0
  250. package/lib/modules/vaults/write.actions.js +1749 -0
  251. package/lib/polyfills.d.ts +1 -0
  252. package/lib/polyfills.js +12 -0
  253. package/lib/sdk.d.ts +26721 -0
  254. package/lib/services/coingecko/fetcher.d.ts +15 -0
  255. package/lib/services/coingecko/fetcher.js +67 -0
  256. package/lib/services/coingecko/index.d.ts +2 -0
  257. package/lib/services/coingecko/index.js +19 -0
  258. package/lib/services/coingecko/utils.d.ts +1 -0
  259. package/lib/services/coingecko/utils.js +24 -0
  260. package/lib/services/debank/fetcher.d.ts +126 -0
  261. package/lib/services/debank/fetcher.js +47 -0
  262. package/lib/services/debank/index.d.ts +2 -0
  263. package/lib/services/debank/index.js +19 -0
  264. package/lib/services/debank/utils.d.ts +38 -0
  265. package/lib/services/debank/utils.js +297 -0
  266. package/lib/services/layerzero/deposits.d.ts +49 -0
  267. package/lib/services/layerzero/deposits.js +166 -0
  268. package/lib/services/layerzero/redeems.d.ts +20 -0
  269. package/lib/services/layerzero/redeems.js +92 -0
  270. package/lib/services/layerzero/utils.d.ts +9 -0
  271. package/lib/services/layerzero/utils.js +22 -0
  272. package/lib/services/octavfi/fetcher.d.ts +9 -0
  273. package/lib/services/octavfi/fetcher.js +103 -0
  274. package/lib/services/octavfi/index.d.ts +3 -0
  275. package/lib/services/octavfi/index.js +20 -0
  276. package/lib/services/octavfi/types.d.ts +34 -0
  277. package/lib/services/octavfi/types.js +3 -0
  278. package/lib/services/octavfi/utils.d.ts +16 -0
  279. package/lib/services/octavfi/utils.js +212 -0
  280. package/lib/services/subgraph/fetcher.d.ts +2 -0
  281. package/lib/services/subgraph/fetcher.js +61 -0
  282. package/lib/services/subgraph/index.d.ts +2 -0
  283. package/lib/services/subgraph/index.js +19 -0
  284. package/lib/services/subgraph/schema.d.ts +45 -0
  285. package/lib/services/subgraph/schema.js +75 -0
  286. package/lib/services/subgraph/vaults.d.ts +25 -0
  287. package/lib/services/subgraph/vaults.js +1106 -0
  288. package/lib/services/swap-quotes/index.d.ts +105 -0
  289. package/lib/services/swap-quotes/index.js +77 -0
  290. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  291. package/lib/services/swap-quotes/paraswap.js +138 -0
  292. package/lib/types/api.d.ts +280 -0
  293. package/lib/types/api.js +3 -0
  294. package/lib/types/index.d.ts +12 -0
  295. package/lib/types/index.js +28 -0
  296. package/lib/types/points.d.ts +28 -0
  297. package/lib/types/points.js +3 -0
  298. package/lib/types/pools.d.ts +144 -0
  299. package/lib/types/pools.js +3 -0
  300. package/lib/types/staking.d.ts +28 -0
  301. package/lib/types/staking.js +3 -0
  302. package/lib/types/sub-accounts.d.ts +140 -0
  303. package/lib/types/sub-accounts.js +3 -0
  304. package/lib/types/subgraph.d.ts +74 -0
  305. package/lib/types/subgraph.js +3 -0
  306. package/lib/types/typed-contract.d.ts +102 -0
  307. package/lib/types/typed-contract.js +3 -0
  308. package/lib/types/user.d.ts +1 -0
  309. package/lib/types/user.js +3 -0
  310. package/lib/types/vaults.d.ts +714 -0
  311. package/lib/types/vaults.js +24 -0
  312. package/lib/types/web3.d.ts +51 -0
  313. package/lib/types/web3.js +14 -0
  314. package/lib/types/webserver.d.ts +698 -0
  315. package/lib/types/webserver.js +3 -0
  316. package/package.json +78 -0
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Chain-ID validation for public SDK entry points.
3
+ *
4
+ * Two distinct failure modes are covered here, and they are deliberately kept
5
+ * separate because they have different remediations:
6
+ *
7
+ * 1. **Unknown chain ID** — the caller passed an ID the SDK has no concept of
8
+ * (a typo, a stale constant, an off-by-one on a non-EVM synthetic ID). No
9
+ * configuration can make this work; the call site is wrong.
10
+ * 2. **Known EVM chain, no RPC configured** — the ID is valid but the SDK was
11
+ * constructed without a provider for it. Remediated by passing an RPC URL.
12
+ *
13
+ * Both used to be logged-and-ignored, letting execution continue with an
14
+ * `undefined` RPC URL. That produced a cascade of misleading downstream
15
+ * failures (`connect ECONNREFUSED 127.0.0.1:8545` from ethers' localhost
16
+ * default, `missing revert data` from `decimals()` reads issued against the
17
+ * wrong chain, and `TypeError: Cannot read properties of undefined`). Failing
18
+ * fast at the boundary replaces that cascade with one actionable error.
19
+ *
20
+ * @module core/helpers/chain-support
21
+ */
22
+ /**
23
+ * Whether `chainId` is an EVM chain the SDK knows about (i.e. has an entry in
24
+ * {@link NETWORKS}).
25
+ *
26
+ * @param chainId - Numeric chain ID to test.
27
+ * @returns `true` for supported EVM chains, `false` for non-EVM synthetic IDs
28
+ * (Solana, Stellar, Sui) and for anything unrecognised.
29
+ */
30
+ export declare function isEvmChainId(chainId: number): boolean;
31
+ /**
32
+ * Whether `chainId` is recognised by the SDK at all — either a supported EVM
33
+ * chain or one of the non-EVM chain IDs in {@link NON_EVM_CHAIN_IDS}.
34
+ *
35
+ * @param chainId - Numeric chain ID to test.
36
+ * @returns `true` when the ID maps to a chain the SDK can route to.
37
+ */
38
+ export declare function isKnownChainId(chainId: number): boolean;
39
+ /**
40
+ * Throw when `chainId` is not a chain the SDK recognises.
41
+ *
42
+ * Called at public vault entry points so an unroutable ID surfaces as one
43
+ * typed error instead of an opaque downstream RPC failure.
44
+ *
45
+ * @param chainId - Chain ID supplied by the caller. `undefined` is a no-op —
46
+ * omitting the chain is valid and falls back to the SDK's active network.
47
+ * @param providers - The SDK's configured `chainId → RPC URL` map. A chain
48
+ * with a caller-configured provider is routable even if it is missing from
49
+ * {@link NETWORKS} (the SDK ships fallback RPCs/oracles for some EVM chains
50
+ * ahead of adding them to `NETWORKS`), so it is accepted here too.
51
+ * @param method - Public method name, used to make the message actionable.
52
+ * @throws {@link AugustValidationError} with code `INVALID_CHAIN` when the ID
53
+ * is not in {@link NETWORKS} or {@link NON_EVM_CHAIN_IDS}, and has no
54
+ * caller-configured provider.
55
+ * @example
56
+ * ```ts
57
+ * assertKnownChainId(-2, undefined, 'getVault');
58
+ * // AugustValidationError: getVault: unknown chainId -2.
59
+ * ```
60
+ */
61
+ export declare function assertKnownChainId(chainId: number | undefined, providers: Partial<Record<number, string>> | undefined, method: string): void;
62
+ /**
63
+ * Throw when a known EVM `chainId` has no RPC URL configured on the SDK.
64
+ *
65
+ * Non-EVM chain IDs are exempt: Solana, Stellar and Sui vaults route through
66
+ * their adapters and never read from the `providers` map, so a missing entry
67
+ * is expected rather than a misconfiguration.
68
+ *
69
+ * @param chainId - Chain ID supplied by the caller. `undefined` is a no-op.
70
+ * @param providers - The SDK's configured `chainId → RPC URL` map.
71
+ * @param method - Public method name, used to make the message actionable.
72
+ * @throws {@link AugustValidationError} with code `INVALID_CHAIN` when
73
+ * `chainId` is an EVM chain with no configured provider.
74
+ * @example
75
+ * ```ts
76
+ * assertEvmProviderConfigured(143, {}, 'getVault');
77
+ * // AugustValidationError: getVault: no RPC URL configured for chainId 143 (Monad).
78
+ * ```
79
+ */
80
+ export declare function assertEvmProviderConfigured(chainId: number | undefined, providers: Partial<Record<number, string>> | undefined, method: string): void;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * Chain-ID validation for public SDK entry points.
4
+ *
5
+ * Two distinct failure modes are covered here, and they are deliberately kept
6
+ * separate because they have different remediations:
7
+ *
8
+ * 1. **Unknown chain ID** — the caller passed an ID the SDK has no concept of
9
+ * (a typo, a stale constant, an off-by-one on a non-EVM synthetic ID). No
10
+ * configuration can make this work; the call site is wrong.
11
+ * 2. **Known EVM chain, no RPC configured** — the ID is valid but the SDK was
12
+ * constructed without a provider for it. Remediated by passing an RPC URL.
13
+ *
14
+ * Both used to be logged-and-ignored, letting execution continue with an
15
+ * `undefined` RPC URL. That produced a cascade of misleading downstream
16
+ * failures (`connect ECONNREFUSED 127.0.0.1:8545` from ethers' localhost
17
+ * default, `missing revert data` from `decimals()` reads issued against the
18
+ * wrong chain, and `TypeError: Cannot read properties of undefined`). Failing
19
+ * fast at the boundary replaces that cascade with one actionable error.
20
+ *
21
+ * @module core/helpers/chain-support
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.isEvmChainId = isEvmChainId;
25
+ exports.isKnownChainId = isKnownChainId;
26
+ exports.assertKnownChainId = assertKnownChainId;
27
+ exports.assertEvmProviderConfigured = assertEvmProviderConfigured;
28
+ const web3_1 = require("../constants/web3");
29
+ const errors_1 = require("../errors");
30
+ /**
31
+ * Whether `chainId` is an EVM chain the SDK knows about (i.e. has an entry in
32
+ * {@link NETWORKS}).
33
+ *
34
+ * @param chainId - Numeric chain ID to test.
35
+ * @returns `true` for supported EVM chains, `false` for non-EVM synthetic IDs
36
+ * (Solana, Stellar, Sui) and for anything unrecognised.
37
+ */
38
+ function isEvmChainId(chainId) {
39
+ return Object.hasOwn(web3_1.NETWORKS, chainId);
40
+ }
41
+ /**
42
+ * Whether `chainId` is recognised by the SDK at all — either a supported EVM
43
+ * chain or one of the non-EVM chain IDs in {@link NON_EVM_CHAIN_IDS}.
44
+ *
45
+ * @param chainId - Numeric chain ID to test.
46
+ * @returns `true` when the ID maps to a chain the SDK can route to.
47
+ */
48
+ function isKnownChainId(chainId) {
49
+ return isEvmChainId(chainId) || web3_1.NON_EVM_CHAIN_IDS.has(chainId);
50
+ }
51
+ /**
52
+ * Throw when `chainId` is not a chain the SDK recognises.
53
+ *
54
+ * Called at public vault entry points so an unroutable ID surfaces as one
55
+ * typed error instead of an opaque downstream RPC failure.
56
+ *
57
+ * @param chainId - Chain ID supplied by the caller. `undefined` is a no-op —
58
+ * omitting the chain is valid and falls back to the SDK's active network.
59
+ * @param providers - The SDK's configured `chainId → RPC URL` map. A chain
60
+ * with a caller-configured provider is routable even if it is missing from
61
+ * {@link NETWORKS} (the SDK ships fallback RPCs/oracles for some EVM chains
62
+ * ahead of adding them to `NETWORKS`), so it is accepted here too.
63
+ * @param method - Public method name, used to make the message actionable.
64
+ * @throws {@link AugustValidationError} with code `INVALID_CHAIN` when the ID
65
+ * is not in {@link NETWORKS} or {@link NON_EVM_CHAIN_IDS}, and has no
66
+ * caller-configured provider.
67
+ * @example
68
+ * ```ts
69
+ * assertKnownChainId(-2, undefined, 'getVault');
70
+ * // AugustValidationError: getVault: unknown chainId -2.
71
+ * ```
72
+ */
73
+ function assertKnownChainId(chainId, providers, method) {
74
+ if (typeof chainId === 'undefined')
75
+ return;
76
+ if (isKnownChainId(chainId))
77
+ return;
78
+ if (providers?.[chainId])
79
+ return;
80
+ throw new errors_1.AugustValidationError('INVALID_CHAIN', `${method}: unknown chainId ${chainId}. ` +
81
+ 'Pass a supported EVM chain ID (see NETWORKS) or a non-EVM chain ID ' +
82
+ '(-1 Solana, -3 Stellar, 101 Sui).', { context: { method, chainId } });
83
+ }
84
+ /**
85
+ * Throw when a known EVM `chainId` has no RPC URL configured on the SDK.
86
+ *
87
+ * Non-EVM chain IDs are exempt: Solana, Stellar and Sui vaults route through
88
+ * their adapters and never read from the `providers` map, so a missing entry
89
+ * is expected rather than a misconfiguration.
90
+ *
91
+ * @param chainId - Chain ID supplied by the caller. `undefined` is a no-op.
92
+ * @param providers - The SDK's configured `chainId → RPC URL` map.
93
+ * @param method - Public method name, used to make the message actionable.
94
+ * @throws {@link AugustValidationError} with code `INVALID_CHAIN` when
95
+ * `chainId` is an EVM chain with no configured provider.
96
+ * @example
97
+ * ```ts
98
+ * assertEvmProviderConfigured(143, {}, 'getVault');
99
+ * // AugustValidationError: getVault: no RPC URL configured for chainId 143 (Monad).
100
+ * ```
101
+ */
102
+ function assertEvmProviderConfigured(chainId, providers, method) {
103
+ if (typeof chainId === 'undefined')
104
+ return;
105
+ if (!isEvmChainId(chainId))
106
+ return;
107
+ if (providers?.[chainId])
108
+ return;
109
+ const name = web3_1.NETWORKS[chainId]?.name;
110
+ throw new errors_1.AugustValidationError('INVALID_CHAIN', `${method}: no RPC URL configured for chainId ${chainId}` +
111
+ `${name ? ` (${name})` : ''}. ` +
112
+ 'Pass one when constructing AugustSDK: ' +
113
+ `new AugustSDK({ providers: { ${chainId}: '<rpc-url>' } }).`, { context: { method, chainId } });
114
+ }
115
+ //# sourceMappingURL=chain-support.js.map
@@ -0,0 +1,68 @@
1
+ import type { INormalizedNumber } from '../../types';
2
+ /**
3
+ * Table of Contents
4
+ * - Formatters
5
+ * - Datetime
6
+ * - Arrays
7
+ * - Caching
8
+ */
9
+ export declare function toNormalizedBn(value: string | bigint | number, decimals?: number | bigint): INormalizedNumber;
10
+ /**
11
+ * Get fallback RPC URLs for a specific chain
12
+ */
13
+ export declare function getFallbackRpcUrls(chainId: number): string[];
14
+ export declare const filterOutBySize: (usdAmount: number) => boolean;
15
+ /**
16
+ * Formatters
17
+ */
18
+ export declare function toTitleCase(str: string, type?: 'camel'): string;
19
+ export declare function truncate(s: string, amount?: number): string;
20
+ /**
21
+ * Formats any numeric value (number, string, or bigint) to a standardized string.
22
+ *
23
+ * @param value - amount to be formatted
24
+ * @param options - formatting options:
25
+ * `showing` is the number of decimals to cut off at (or `'all'`);
26
+ * `usd` toggles USD-value display;
27
+ * `decimals` is how many decimals to parse to when `value` is a bigint.
28
+ *
29
+ * @returns standardized string type value
30
+ */
31
+ export declare function round(value: number | string | bigint, options?: {
32
+ showing?: number | 'all';
33
+ usd?: boolean;
34
+ decimals?: number;
35
+ }): string;
36
+ export declare function loanStateToReadable(loanState: number | bigint): "PREAPPROVED" | "FUNDING_REQUIRED" | "FUNDED" | "ACTIVE" | "CANCELLED" | "MATURED" | "CLOSED";
37
+ /**
38
+ * Datetime
39
+ */
40
+ export declare function dateToUnix(date: Date): number;
41
+ export declare function unixToDate(epoch: number): Date;
42
+ export declare function isEarlierThanNow(startTime: Date): boolean;
43
+ export declare function daysAgo(days: number): Date;
44
+ export declare function prepareDateForDb(date: string | Date): string;
45
+ /**
46
+ * Arrays
47
+ */
48
+ export declare function orderObjArrByDate<T extends Record<string, unknown>>(objectArray: T[], options?: {
49
+ key?: string;
50
+ order?: 'asc' | 'desc';
51
+ }): T[];
52
+ /**
53
+ * Calculate weights based on a specific property in array of objects.
54
+ * @param data - Array of objects to calculate weights for
55
+ * @param weightProperty - Property name to base weights on
56
+ * @returns Original data with each item's `weight` added
57
+ */
58
+ export declare function calculateWeights<T extends Record<string, unknown>>(data?: T[], weightProperty?: string): Array<T & {
59
+ weight: number;
60
+ }>;
61
+ /**
62
+ * Calculate weighted average for array of objects.
63
+ * @param data - Array of objects with values
64
+ * @param valueProperty - Property name containing the value to average
65
+ * @param weightProperty - Optional property to base weights on
66
+ * @returns Weighted average
67
+ */
68
+ export declare function calculateWeightedAverage<T extends Record<string, unknown>>(data?: T[], valueProperty?: string, weightProperty?: string): number;
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterOutBySize = void 0;
4
+ exports.toNormalizedBn = toNormalizedBn;
5
+ exports.getFallbackRpcUrls = getFallbackRpcUrls;
6
+ exports.toTitleCase = toTitleCase;
7
+ exports.truncate = truncate;
8
+ exports.round = round;
9
+ exports.loanStateToReadable = loanStateToReadable;
10
+ exports.dateToUnix = dateToUnix;
11
+ exports.unixToDate = unixToDate;
12
+ exports.isEarlierThanNow = isEarlierThanNow;
13
+ exports.daysAgo = daysAgo;
14
+ exports.prepareDateForDb = prepareDateForDb;
15
+ exports.orderObjArrByDate = orderObjArrByDate;
16
+ exports.calculateWeights = calculateWeights;
17
+ exports.calculateWeightedAverage = calculateWeightedAverage;
18
+ const web3_1 = require("../constants/web3");
19
+ const ethers_1 = require("ethers");
20
+ /**
21
+ * Table of Contents
22
+ * - Formatters
23
+ * - Datetime
24
+ * - Arrays
25
+ * - Caching
26
+ */
27
+ function toNormalizedBn(value, decimals = 18) {
28
+ if (!value)
29
+ return { normalized: '0', raw: BigInt(0).toString() };
30
+ const sanitize = (val, decimals) => {
31
+ const [whole, frac = ''] = val.split('.');
32
+ const trimmedFrac = frac.slice(0, decimals); // trim to allowed precision
33
+ return trimmedFrac ? `${whole}.${trimmedFrac}` : whole;
34
+ };
35
+ // Convert number or exponential string to fixed decimal string
36
+ const toFixedDecimalString = (val) => {
37
+ const strRep = typeof val === 'number' ? String(val) : val;
38
+ // Check if the string representation contains exponential notation
39
+ if (strRep.includes('e') || strRep.includes('E')) {
40
+ // Parse as number and use toFixed with high precision to convert exponential to fixed decimal
41
+ // 100 decimals should handle even extremely small numbers like 1e-20
42
+ const num = typeof val === 'number' ? val : parseFloat(strRep);
43
+ return num.toFixed(100).replace(/\.?0+$/, '');
44
+ }
45
+ // For regular numbers/strings, return as is
46
+ return strRep;
47
+ };
48
+ if (typeof value === 'string' || typeof value === 'number') {
49
+ // Convert to fixed decimal string to avoid exponential notation
50
+ const strVal = toFixedDecimalString(value);
51
+ const safeVal = sanitize(strVal, Number(decimals));
52
+ return {
53
+ normalized: safeVal,
54
+ raw: (0, ethers_1.parseUnits)(safeVal, Number(decimals)).toString(),
55
+ };
56
+ }
57
+ else {
58
+ return {
59
+ normalized: (0, ethers_1.formatUnits)(value, Number(decimals)) ?? '0',
60
+ raw: value.toString(),
61
+ };
62
+ }
63
+ }
64
+ /**
65
+ * Get fallback RPC URLs for a specific chain
66
+ */
67
+ function getFallbackRpcUrls(chainId) {
68
+ return web3_1.FALLBACK_RPC_URLS[chainId] || [];
69
+ }
70
+ const filterOutBySize = (usdAmount) => usdAmount > 3_000;
71
+ exports.filterOutBySize = filterOutBySize;
72
+ /**
73
+ * Formatters
74
+ */
75
+ function toTitleCase(str, type) {
76
+ if (!str)
77
+ return;
78
+ switch (type) {
79
+ case 'camel': {
80
+ const words = Array.from(str)
81
+ .map((letter) => {
82
+ // letter is uppercase
83
+ if (letter === letter.toUpperCase()) {
84
+ return ` ${letter}`;
85
+ }
86
+ // else
87
+ return letter;
88
+ })
89
+ .join('');
90
+ const _words = str.split(' ')?.map((w) => w.toLowerCase());
91
+ for (let i = 0; i < words.length; i++) {
92
+ _words[i] = _words[i][0].toUpperCase() + _words[i].substr(1);
93
+ }
94
+ return _words.join(' ');
95
+ }
96
+ default: {
97
+ const words = str.split(' ')?.map((w) => w.toLowerCase());
98
+ for (let i = 0; i < words.length; i++) {
99
+ words[i] = words[i][0].toUpperCase() + words[i].substr(1);
100
+ }
101
+ return words.join(' ');
102
+ }
103
+ }
104
+ }
105
+ function truncate(s, amount) {
106
+ if (typeof s !== 'string') {
107
+ // Leaf string util: importing Logger here would create an import cycle
108
+ // (helpers/core → logger/index → slack → helpers/core) that the madge CI
109
+ // check forbids (CLAUDE.md §9). Keep a direct console.error for this
110
+ // defensive type-guard diagnostic.
111
+ // biome-ignore lint/suspicious/noConsole: leaf util cannot import Logger without a cycle (CLAUDE.md §9); keep a direct console.error for this defensive type-guard diagnostic.
112
+ if (s !== undefined)
113
+ console.error('#truncate: not a string', s);
114
+ return '';
115
+ }
116
+ if (!s)
117
+ return s;
118
+ if (s === 'N/A')
119
+ return s;
120
+ return `${s.slice(0, amount ? amount : 4)}...${s.slice(amount ? amount * -1 : -4)}`;
121
+ }
122
+ /**
123
+ * Formats any numeric value (number, string, or bigint) to a standardized string.
124
+ *
125
+ * @param value - amount to be formatted
126
+ * @param options - formatting options:
127
+ * `showing` is the number of decimals to cut off at (or `'all'`);
128
+ * `usd` toggles USD-value display;
129
+ * `decimals` is how many decimals to parse to when `value` is a bigint.
130
+ *
131
+ * @returns standardized string type value
132
+ */
133
+ function round(value, options) {
134
+ // standardize to string
135
+ let _value;
136
+ if (typeof value === 'bigint') {
137
+ _value = toNormalizedBn(value, options?.decimals ?? web3_1.FALLBACK_DECIMALS).normalized;
138
+ }
139
+ else {
140
+ _value = String(value);
141
+ // if string passed includes something like a symbol (i.e. 0.1 ETH --> 0.1)
142
+ if (_value.includes(' '))
143
+ _value = _value.split(' ')[0];
144
+ }
145
+ // if wanting USD value
146
+ if (options?.usd) {
147
+ const usdFormatter = new Intl.NumberFormat('en-US', {
148
+ style: 'currency',
149
+ currency: 'USD',
150
+ });
151
+ const valueNumber = Number(_value);
152
+ return usdFormatter.format(valueNumber) !== 'NaN'
153
+ ? usdFormatter.format(valueNumber)
154
+ : '0';
155
+ }
156
+ // else slice if decimal places is more than 6 and display
157
+ if (_value === '0' || _value === '0.0')
158
+ return '0.000';
159
+ if (options?.showing === 'all') {
160
+ return _value;
161
+ }
162
+ else {
163
+ const _showing = () => {
164
+ if (options?.showing && typeof options.showing === 'number')
165
+ return options?.showing;
166
+ if (options?.usd)
167
+ return 2;
168
+ if (_value?.includes('.') && _value.split('.')[0].length > 2)
169
+ return 3;
170
+ if (_value?.length && _value?.length > 6)
171
+ return 6;
172
+ return 4;
173
+ };
174
+ const numberFormatter = new Intl.NumberFormat('en-US', {
175
+ minimumFractionDigits: _showing(),
176
+ maximumFractionDigits: _showing(),
177
+ });
178
+ return numberFormatter.format(Number(_value)) !== 'NaN'
179
+ ? numberFormatter.format(Number(_value))
180
+ : '0';
181
+ }
182
+ }
183
+ function loanStateToReadable(loanState) {
184
+ switch (Number(loanState)) {
185
+ case 1:
186
+ return 'PREAPPROVED';
187
+ case 2:
188
+ return 'FUNDING_REQUIRED';
189
+ case 3:
190
+ return 'FUNDED';
191
+ case 4:
192
+ return 'ACTIVE';
193
+ case 5:
194
+ return 'CANCELLED';
195
+ case 6:
196
+ return 'MATURED';
197
+ case 7:
198
+ return 'CLOSED';
199
+ }
200
+ }
201
+ /**
202
+ * Datetime
203
+ */
204
+ function dateToUnix(date) {
205
+ if (!date)
206
+ return Math.floor(Date.now());
207
+ return Math.floor(new Date(date).getTime());
208
+ }
209
+ function unixToDate(epoch) {
210
+ if (!epoch)
211
+ return new Date();
212
+ return new Date(new Date(epoch).getTime());
213
+ }
214
+ function isEarlierThanNow(startTime) {
215
+ if (!startTime)
216
+ return true;
217
+ if (startTime <= new Date())
218
+ return true;
219
+ return false;
220
+ }
221
+ function daysAgo(days) {
222
+ const today = new Date();
223
+ return new Date(new Date().setDate(today.getDate() - days));
224
+ }
225
+ function prepareDateForDb(date) {
226
+ return new Date(date).toISOString();
227
+ }
228
+ /**
229
+ * Arrays
230
+ */
231
+ function orderObjArrByDate(objectArray, options) {
232
+ const selectedOrder = options?.order ?? 'desc';
233
+ const selectedKey = options?.key ?? 'date';
234
+ const toTime = (item) => new Date(item[selectedKey]).valueOf();
235
+ return objectArray.sort((a, b) => {
236
+ // Turn your strings into dates, and then subtract them
237
+ // to get a value that is either negative, positive, or zero.
238
+ if (selectedOrder === 'asc')
239
+ return toTime(a) - toTime(b);
240
+ return toTime(b) - toTime(a);
241
+ });
242
+ }
243
+ /**
244
+ * Calculate weights based on a specific property in array of objects.
245
+ * @param data - Array of objects to calculate weights for
246
+ * @param weightProperty - Property name to base weights on
247
+ * @returns Original data with each item's `weight` added
248
+ */
249
+ function calculateWeights(data, weightProperty) {
250
+ if (!data || data.length === 0 || !weightProperty)
251
+ return [];
252
+ // Get total of the property we're using for weight calculation
253
+ const total = data.reduce((sum, item) => sum + item[weightProperty], 0);
254
+ // Add weight property to each item
255
+ return data.map((item) => ({
256
+ ...item,
257
+ weight: item[weightProperty] / total,
258
+ }));
259
+ }
260
+ /**
261
+ * Calculate weighted average for array of objects.
262
+ * @param data - Array of objects with values
263
+ * @param valueProperty - Property name containing the value to average
264
+ * @param weightProperty - Optional property to base weights on
265
+ * @returns Weighted average
266
+ */
267
+ function calculateWeightedAverage(data, valueProperty, weightProperty) {
268
+ if (!data || data.length === 0 || !valueProperty)
269
+ return 0;
270
+ let weightedData;
271
+ // If no weightProperty specified, use equal weights
272
+ if (!weightProperty) {
273
+ weightedData = data.map((item) => ({
274
+ ...item,
275
+ weight: 1 / data.length,
276
+ }));
277
+ }
278
+ else {
279
+ weightedData = calculateWeights(data, weightProperty);
280
+ }
281
+ // Calculate weighted average
282
+ const weightedAverage = weightedData.reduce((acc, item) => acc + item[valueProperty] * item.weight, 0);
283
+ return weightedAverage;
284
+ }
285
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1,16 @@
1
+ import type { IAddress, IChainId, IExplorerType } from '../../types';
2
+ /**
3
+ * Generate a block-explorer URL for an address or transaction hash.
4
+ *
5
+ * Returns an empty string when `chain` is falsy or unknown so the return
6
+ * type stays assignable to `string` — preserves the historical public
7
+ * shape from before the file split out of `web3.ts`, where the SDK's
8
+ * `strictNullChecks: false` masked the implicit `undefined` branch and
9
+ * consumers pinned to `string` via the emitted `.d.ts`.
10
+ *
11
+ * @param hex Address or transaction hash
12
+ * @param chain Chain ID
13
+ * @param type Explorer view type (`address`, `tx`, `block`)
14
+ * @returns Full explorer URL, or `''` when `chain` is falsy / unknown.
15
+ */
16
+ export declare const explorerLink: (hex: IAddress, chain: IChainId, type: IExplorerType) => string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.explorerLink = void 0;
4
+ const web3_1 = require("../constants/web3");
5
+ /**
6
+ * Generate a block-explorer URL for an address or transaction hash.
7
+ *
8
+ * Returns an empty string when `chain` is falsy or unknown so the return
9
+ * type stays assignable to `string` — preserves the historical public
10
+ * shape from before the file split out of `web3.ts`, where the SDK's
11
+ * `strictNullChecks: false` masked the implicit `undefined` branch and
12
+ * consumers pinned to `string` via the emitted `.d.ts`.
13
+ *
14
+ * @param hex Address or transaction hash
15
+ * @param chain Chain ID
16
+ * @param type Explorer view type (`address`, `tx`, `block`)
17
+ * @returns Full explorer URL, or `''` when `chain` is falsy / unknown.
18
+ */
19
+ const explorerLink = (hex, chain, type) => {
20
+ const network = chain ? web3_1.NETWORKS[chain] : undefined;
21
+ if (!network)
22
+ return '';
23
+ return `${network.explorer}/${type}/${hex}`;
24
+ };
25
+ exports.explorerLink = explorerLink;
26
+ //# sourceMappingURL=explorer-link.js.map
@@ -0,0 +1,68 @@
1
+ import { type InterfaceAbi } from 'ethers';
2
+ import type { IAddress, IContractRunner } from '../../types';
3
+ /**
4
+ * One read to fold into a Multicall3 `aggregate3` batch.
5
+ * @internal
6
+ */
7
+ export interface IMulticall3Request {
8
+ /** Contract to call. */
9
+ target: IAddress;
10
+ /** ABI containing `functionName` (full or minimal fragment). */
11
+ abi: InterfaceAbi;
12
+ /** View function to encode. */
13
+ functionName: string;
14
+ /** Positional arguments for the function. */
15
+ args?: unknown[];
16
+ }
17
+ /**
18
+ * Per-call result of an `aggregate3` batch. `success: false` means that one
19
+ * call reverted (or its chunk failed at the transport level) — it never
20
+ * implies anything about the other calls in the batch.
21
+ * @internal
22
+ */
23
+ export interface IMulticall3Result {
24
+ success: boolean;
25
+ /** First decoded return value; `undefined` when `success` is `false`. */
26
+ value?: unknown;
27
+ }
28
+ /**
29
+ * Calls per `aggregate3` chunk. Mirrors the `batchMaxCount: 10` cap on
30
+ * `createProvider` — some RPC providers (e.g. rpc.hypurrscan.io) enforce
31
+ * their own batch/response-size limits, so an unbounded batch for a wallet
32
+ * with many vaults risks exceeding response-size or `eth_call` gas ceilings.
33
+ * @internal
34
+ */
35
+ export declare const MULTICALL3_BATCH_SIZE = 10;
36
+ /**
37
+ * Whether Multicall3 read-aggregation is enabled for a chain. Only chains in
38
+ * {@link MULTICALL3_VERIFIED_CHAINS} (deployment verified via `eth_getCode`,
39
+ * never assumed) qualify — callers must fall back to individual reads for
40
+ * every other chain.
41
+ * @internal
42
+ */
43
+ export declare function isMulticall3Supported(chainId: number | undefined): boolean;
44
+ /**
45
+ * Aggregate independent view calls into chunked Multicall3 `aggregate3`
46
+ * batches (`allowFailure: true` per call).
47
+ *
48
+ * Failure semantics — the load-bearing detail:
49
+ * - A reverting inner call (paused/deprecated vault) yields `success: false`
50
+ * for that call only; every other call in the batch decodes normally.
51
+ * - A transport-level failure of one chunk degrades that chunk's calls to
52
+ * `success: false` instead of throwing, so a caller can always fall back
53
+ * to its per-call path. This function never rejects for RPC reasons.
54
+ *
55
+ * RPC cost: `ceil(calls.length / batchSize)` `eth_call`s, versus
56
+ * `calls.length` without aggregation.
57
+ *
58
+ * @param provider Provider for the target chain.
59
+ * @param chainId Chain the provider is connected to — must be in the
60
+ * verified allowlist; gate with {@link isMulticall3Supported} first.
61
+ * @param calls Reads to aggregate, in order.
62
+ * @param batchSize Max calls per `aggregate3` chunk.
63
+ * @returns One {@link IMulticall3Result} per request, index-aligned.
64
+ * @throws AugustValidationError when `chainId` is not on the verified
65
+ * allowlist — programming error, not a runtime condition to swallow.
66
+ * @internal
67
+ */
68
+ export declare function multicall3Aggregate(provider: IContractRunner, chainId: number, calls: IMulticall3Request[], batchSize?: number): Promise<IMulticall3Result[]>;