upshift-config 0.5.14

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,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./fetcher"), exports);
18
+ __exportStar(require("./main"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,243 @@
1
+ import { AugustBase, type IAugustBase } from '../../core';
2
+ import type { IAddress, ILoanBookInfo, ISubaccountDebank, ISubaccountTransaction, IWSSubaccountListItem } from '../../types';
3
+ /**
4
+ * Subaccount operation class interacting with August Subaccounts
5
+ * Subaccount is a smart contract wallet that serves as the fundamental infrastructure for August's platform.
6
+ * It functions as a cross-margin account designed for optimal capital efficiency.
7
+ * Most of the operations require a August API key to perform
8
+ */
9
+ export declare class AugustSubAccounts extends AugustBase {
10
+ private headers;
11
+ constructor(baseConfig: IAugustBase);
12
+ /**
13
+ * Retrieves one page of the directory of all August subaccounts.
14
+ *
15
+ * Backed by the admin-only `GET /subaccount` backend endpoint, so the
16
+ * August API key configured on the SDK must belong to an admin user —
17
+ * non-admin keys are rejected with an auth error by the backend. Makes
18
+ * exactly one HTTP request and no RPC calls.
19
+ *
20
+ * @param options - Pagination window over the subaccount directory
21
+ * @param options.offset - Number of records to skip. Defaults to 0; must be a non-negative integer.
22
+ * @param options.limit - Page size. Defaults to 100; must be an integer between 1 and 1000 (backend maximum).
23
+ * @returns The page of subaccount records (address, internal/friendly names, status, type, linked chains, risk metadata). An empty array means the offset is past the end of the directory.
24
+ * @throws AugustValidationError when `offset` or `limit` is out of range
25
+ * @throws AugustAuthError when the API key is missing or not admin-scoped
26
+ * @example
27
+ * const page = await augustSdk.subAccountsModule.getAllSubaccounts({
28
+ * offset: 0,
29
+ * limit: 200,
30
+ * });
31
+ * console.log(page.map((s) => `${s.internal_name}: ${s.address}`));
32
+ */
33
+ getAllSubaccounts(options?: {
34
+ offset?: number;
35
+ limit?: number;
36
+ }): Promise<IWSSubaccountListItem[]>;
37
+ /**
38
+ * Retrieves the health factor for a subaccount.
39
+ * @param subaccountAddress - The address of the subaccount to query
40
+ * @returns The health factor data including collateral value, loan value, and health factor ratio
41
+ */
42
+ getSubaccountHealthFactor(subaccountAddress: IAddress): Promise<{
43
+ id: `0x${string}`;
44
+ dateTime: string;
45
+ healthFactor: number;
46
+ totalCollateral: number;
47
+ totalLoan: number;
48
+ }>;
49
+ /**
50
+ * Retrieves loan positions for a subaccount.
51
+ * @param subaccountAddress - The address of the subaccount to query
52
+ * @param side - Filter by loan side: 'BOTH' for all loans, 'LENDER' for lent positions, 'BORROWER' for borrowed positions
53
+ * @param active - When true, returns only active loans; when false, returns all loans including closed ones
54
+ * @returns List of loan positions matching the specified filters
55
+ */
56
+ getSubaccountLoans(subaccountAddress: IAddress, side: 'BOTH' | 'LENDER' | 'BORROWER', active: boolean): Promise<import("../../types").IWSSubaccountLoan[]>;
57
+ /**
58
+ * Retrieves CeFi (Centralized Finance) positions for a subaccount.
59
+ * @param subaccountAddress - The address of the subaccount to query
60
+ * @returns List of CeFi positions held by the subaccount
61
+ */
62
+ getSubaccountCefiPositions(subaccountAddress: IAddress): Promise<import("../../types").IWSSubaccountCefi[]>;
63
+ /**
64
+ * Retrieves OTC (Over-The-Counter) positions for a subaccount.
65
+ * @param subaccountAddress - The address of the subaccount to query
66
+ * @returns List of OTC positions held by the subaccount
67
+ */
68
+ getSubaccountOtcPositions(subaccountAddress: IAddress): Promise<import("../../types").IOTCPosition[]>;
69
+ /**
70
+ * Retrieves the summary view for a subaccount or EOA operator.
71
+ * @param subaccountAddress - The address of the subaccount to query
72
+ * @returns The full summary including portfolio, loanbook, tokens, and account values
73
+ */
74
+ getSubaccountSummary(subaccountAddress: IAddress): Promise<{
75
+ address: `0x${string}`;
76
+ name: string;
77
+ type: "eoa" | "subaccount";
78
+ portfolio: {
79
+ tokens: {
80
+ value: number;
81
+ balance: number;
82
+ token: {
83
+ type: string;
84
+ name: string;
85
+ address: string;
86
+ chain: number;
87
+ symbol: string;
88
+ decimals: number;
89
+ imgUrl: string;
90
+ };
91
+ }[];
92
+ marginBalances: unknown[];
93
+ collateralBalances: unknown[];
94
+ cefiPositions: unknown[];
95
+ defiPositions: unknown[];
96
+ trsPositions: unknown[];
97
+ strategyContractPositions: unknown[];
98
+ legacyHedgerPositions: unknown[];
99
+ otcPositions: unknown[];
100
+ totalValue: number;
101
+ discountedValue: number;
102
+ };
103
+ loanbook: {
104
+ loans: {
105
+ subaccountAddress: `0x${string}`;
106
+ book: {
107
+ address: `0x${string}`;
108
+ lender: `0x${string}`;
109
+ borrower: `0x${string}`;
110
+ state: string;
111
+ totalRepaid: number;
112
+ principalToken: {
113
+ type: string;
114
+ name: string;
115
+ address: string;
116
+ chain: number;
117
+ symbol: string;
118
+ decimals: number;
119
+ imgUrl: string;
120
+ tokenType: number;
121
+ discountFactor: number;
122
+ price: number;
123
+ };
124
+ principalAmount: number;
125
+ interestAmount: number;
126
+ upcomingPayment: {
127
+ amount: number;
128
+ dueDate: string;
129
+ };
130
+ apr: number;
131
+ initialPrincipalAmount: number;
132
+ deployedDate: string;
133
+ paymentInterval: number;
134
+ totalInterestPaymentFees: number;
135
+ };
136
+ isBorrow: boolean;
137
+ debtInfo: {
138
+ interestOwed: number;
139
+ principalDebtOwed: number;
140
+ interestRepaid: number;
141
+ };
142
+ creditInfo: {
143
+ netInterestOwed: number;
144
+ principalDebtOwed: number;
145
+ netInterestRepaid: number;
146
+ };
147
+ }[];
148
+ totalDebt: number;
149
+ totalCredit: number;
150
+ aggregatesByToken: unknown[];
151
+ };
152
+ chains: {
153
+ name: string;
154
+ chainId: number;
155
+ }[];
156
+ tokens: {
157
+ type: string;
158
+ name: string;
159
+ address: string;
160
+ chain: number;
161
+ symbol: string;
162
+ decimals: number;
163
+ imgUrl: string;
164
+ price: number;
165
+ rawBalance: number;
166
+ balance: number;
167
+ value: number;
168
+ }[];
169
+ totalAccountValue: number;
170
+ totalCollateralValue: number;
171
+ totalLoanValue: number;
172
+ healthFactor: number;
173
+ netAccountValue: number;
174
+ totalEquityValue: number;
175
+ }>;
176
+ /**
177
+ * Retrieves a subaccount's on-chain transaction history, newest first,
178
+ * optionally windowed by a time range.
179
+ *
180
+ * Backed by the authenticated `GET /transactions/v2` backend endpoint,
181
+ * which resolves and authorizes the subaccount, so the configured August
182
+ * API key must be authorized for it (an admin-scoped key always is). Makes
183
+ * exactly one HTTP request and no RPC calls.
184
+ *
185
+ * @param subaccountAddress - The address of the subaccount to query
186
+ * @param options - Optional time window
187
+ * @param options.startTime - ISO-8601 datetime lower bound (inclusive); omit for no lower bound
188
+ * @param options.endTime - ISO-8601 datetime upper bound (inclusive); omit for no upper bound
189
+ * @returns The subaccount's transactions with decoded logs, transfers, and function names
190
+ * @throws AugustValidationError When `subaccountAddress` is not a valid EVM address
191
+ * @throws AugustAuthError When the API key is missing or not authorized for the subaccount
192
+ * @throws AugustServerError When the API responds with a non-2xx status
193
+ * @example
194
+ * const txs = await augustSdk.subAccountsModule.getSubaccountTransactions(
195
+ * '0xabc…',
196
+ * { startTime: '2026-01-01T00:00:00Z' },
197
+ * );
198
+ */
199
+ getSubaccountTransactions(subaccountAddress: IAddress, options?: {
200
+ startTime?: string;
201
+ endTime?: string;
202
+ }): Promise<ISubaccountTransaction[]>;
203
+ /**
204
+ * Retrieves the full loan-book detail for a single loan by its address and
205
+ * chain.
206
+ *
207
+ * Backed by the admin-only `GET /subaccount/loans/{loan_address}` backend
208
+ * endpoint (60-second server-side cache), so the configured August API key
209
+ * must belong to an admin user. Makes exactly one HTTP request and no RPC
210
+ * calls.
211
+ *
212
+ * @param loanAddress - The loan contract address
213
+ * @param chainId - Numeric August chain id the loan lives on (e.g. `1` for Ethereum mainnet)
214
+ * @returns The loan's {@link ILoanBookInfo} detail
215
+ * @throws AugustValidationError When `chainId` is not an integer
216
+ * @throws AugustAuthError When the API key is missing or not admin-scoped
217
+ * @throws AugustServerError When the loan or chain is not found, or the API otherwise responds non-2xx
218
+ * @example
219
+ * const loan = await augustSdk.subAccountsModule.getSubaccountLoanByAddress(
220
+ * '0xloan…',
221
+ * 1,
222
+ * );
223
+ */
224
+ getSubaccountLoanByAddress(loanAddress: string, chainId: number): Promise<ILoanBookInfo>;
225
+ /**
226
+ * Retrieves cross-chain DeBank protocol positions and token balances for a
227
+ * subaccount and its associated strategies.
228
+ *
229
+ * Backed by `GET /subaccount/{subaccount_address}/debank` (300-second
230
+ * server-side cache). This is a slow endpoint — it fans out to DeBank
231
+ * across every supported chain — so expect higher latency than other
232
+ * subaccount reads. Makes exactly one HTTP request and no RPC calls.
233
+ *
234
+ * @param subaccountAddress - The address of the subaccount to query
235
+ * @returns The subaccount's DeBank positions/tokens plus per-strategy breakdowns
236
+ * @throws AugustValidationError When `subaccountAddress` is not a valid EVM address
237
+ * @throws AugustServerError When the API responds with a non-2xx status
238
+ * @example
239
+ * const debank = await augustSdk.subAccountsModule.getSubaccountDebank('0xabc…');
240
+ * console.log(debank.subaccount.positions.length);
241
+ */
242
+ getSubaccountDebank(subaccountAddress: IAddress): Promise<ISubaccountDebank>;
243
+ }
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AugustSubAccounts = void 0;
4
+ /**
5
+ * The August Sub Accounts Module.
6
+ *
7
+ * @module AugustSubAccounts
8
+ */
9
+ const fetcher_1 = require("./fetcher");
10
+ const ethers_1 = require("ethers");
11
+ const utils_1 = require("./utils");
12
+ const core_1 = require("../../core");
13
+ /**
14
+ * Validates that a subaccount address is a well-formed EVM address, throwing a
15
+ * typed {@link AugustValidationError} if not. August subaccounts are EVM
16
+ * smart-contract wallets, so an invalid value should fail fast in the SDK
17
+ * rather than reaching the backend.
18
+ */
19
+ function assertSubaccountAddress(address, method) {
20
+ if (typeof address !== 'string' || !(0, ethers_1.isAddress)(address)) {
21
+ throw new core_1.AugustValidationError('INVALID_ADDRESS', `${method}: "${address}" is not a valid subaccount address — pass the subaccount's EVM (0x…) address.`);
22
+ }
23
+ }
24
+ /**
25
+ * Subaccount operation class interacting with August Subaccounts
26
+ * Subaccount is a smart contract wallet that serves as the fundamental infrastructure for August's platform.
27
+ * It functions as a cross-margin account designed for optimal capital efficiency.
28
+ * Most of the operations require a August API key to perform
29
+ */
30
+ class AugustSubAccounts extends core_1.AugustBase {
31
+ headers = null;
32
+ constructor(baseConfig) {
33
+ super(baseConfig);
34
+ this.headers = {
35
+ 'x-environment': this.monitoring?.['x-environment'],
36
+ 'x-user-id': this.monitoring?.['x-user-id'],
37
+ };
38
+ }
39
+ /**
40
+ * Retrieves one page of the directory of all August subaccounts.
41
+ *
42
+ * Backed by the admin-only `GET /subaccount` backend endpoint, so the
43
+ * August API key configured on the SDK must belong to an admin user —
44
+ * non-admin keys are rejected with an auth error by the backend. Makes
45
+ * exactly one HTTP request and no RPC calls.
46
+ *
47
+ * @param options - Pagination window over the subaccount directory
48
+ * @param options.offset - Number of records to skip. Defaults to 0; must be a non-negative integer.
49
+ * @param options.limit - Page size. Defaults to 100; must be an integer between 1 and 1000 (backend maximum).
50
+ * @returns The page of subaccount records (address, internal/friendly names, status, type, linked chains, risk metadata). An empty array means the offset is past the end of the directory.
51
+ * @throws AugustValidationError when `offset` or `limit` is out of range
52
+ * @throws AugustAuthError when the API key is missing or not admin-scoped
53
+ * @example
54
+ * const page = await augustSdk.subAccountsModule.getAllSubaccounts({
55
+ * offset: 0,
56
+ * limit: 200,
57
+ * });
58
+ * console.log(page.map((s) => `${s.internal_name}: ${s.address}`));
59
+ */
60
+ async getAllSubaccounts(options = {}) {
61
+ const offset = options.offset ?? 0;
62
+ const limit = options.limit ?? 100;
63
+ if (!Number.isInteger(offset) || offset < 0) {
64
+ throw new core_1.AugustValidationError('INVALID_INPUT', `getAllSubaccounts: offset must be a non-negative integer, got ${offset}`);
65
+ }
66
+ if (!Number.isInteger(limit) || limit < 1 || limit > 1000) {
67
+ throw new core_1.AugustValidationError('INVALID_INPUT', `getAllSubaccounts: limit must be an integer between 1 and 1000, got ${limit}`);
68
+ }
69
+ return (0, fetcher_1.fetchAllSubaccounts)({ offset, limit }, this.keys.august, this.headers);
70
+ }
71
+ /**
72
+ * Retrieves the health factor for a subaccount.
73
+ * @param subaccountAddress - The address of the subaccount to query
74
+ * @returns The health factor data including collateral value, loan value, and health factor ratio
75
+ */
76
+ async getSubaccountHealthFactor(subaccountAddress) {
77
+ const response = await (0, fetcher_1.fetchSubaccountHeathFactor)(subaccountAddress, this.keys.august, this.headers);
78
+ return {
79
+ id: response.id,
80
+ dateTime: response.datetime,
81
+ healthFactor: response.health_factor,
82
+ totalCollateral: response.total_collateral_value,
83
+ totalLoan: response.total_loan_value,
84
+ };
85
+ }
86
+ /**
87
+ * Retrieves loan positions for a subaccount.
88
+ * @param subaccountAddress - The address of the subaccount to query
89
+ * @param side - Filter by loan side: 'BOTH' for all loans, 'LENDER' for lent positions, 'BORROWER' for borrowed positions
90
+ * @param active - When true, returns only active loans; when false, returns all loans including closed ones
91
+ * @returns List of loan positions matching the specified filters
92
+ */
93
+ async getSubaccountLoans(subaccountAddress, side, active) {
94
+ const response = await (0, fetcher_1.fetchSubaccountLoans)({ address: subaccountAddress, active, side }, this.keys.august, this.headers);
95
+ return response;
96
+ }
97
+ /**
98
+ * Retrieves CeFi (Centralized Finance) positions for a subaccount.
99
+ * @param subaccountAddress - The address of the subaccount to query
100
+ * @returns List of CeFi positions held by the subaccount
101
+ */
102
+ async getSubaccountCefiPositions(subaccountAddress) {
103
+ const response = await (0, fetcher_1.fetchSubaccountCefiPositions)(subaccountAddress, this.keys.august, this.headers);
104
+ return response;
105
+ }
106
+ /**
107
+ * Retrieves OTC (Over-The-Counter) positions for a subaccount.
108
+ * @param subaccountAddress - The address of the subaccount to query
109
+ * @returns List of OTC positions held by the subaccount
110
+ */
111
+ async getSubaccountOtcPositions(subaccountAddress) {
112
+ const response = await (0, fetcher_1.fetchSubaccountOtcPositions)(subaccountAddress, this.keys.august, this.headers);
113
+ return response;
114
+ }
115
+ /**
116
+ * Retrieves the summary view for a subaccount or EOA operator.
117
+ * @param subaccountAddress - The address of the subaccount to query
118
+ * @returns The full summary including portfolio, loanbook, tokens, and account values
119
+ */
120
+ async getSubaccountSummary(subaccountAddress) {
121
+ const response = await (0, fetcher_1.fetchSubaccountSummary)(subaccountAddress, this.keys.august, this.headers);
122
+ return (0, utils_1.transformSubaccountSummary)(response);
123
+ }
124
+ /**
125
+ * Retrieves a subaccount's on-chain transaction history, newest first,
126
+ * optionally windowed by a time range.
127
+ *
128
+ * Backed by the authenticated `GET /transactions/v2` backend endpoint,
129
+ * which resolves and authorizes the subaccount, so the configured August
130
+ * API key must be authorized for it (an admin-scoped key always is). Makes
131
+ * exactly one HTTP request and no RPC calls.
132
+ *
133
+ * @param subaccountAddress - The address of the subaccount to query
134
+ * @param options - Optional time window
135
+ * @param options.startTime - ISO-8601 datetime lower bound (inclusive); omit for no lower bound
136
+ * @param options.endTime - ISO-8601 datetime upper bound (inclusive); omit for no upper bound
137
+ * @returns The subaccount's transactions with decoded logs, transfers, and function names
138
+ * @throws AugustValidationError When `subaccountAddress` is not a valid EVM address
139
+ * @throws AugustAuthError When the API key is missing or not authorized for the subaccount
140
+ * @throws AugustServerError When the API responds with a non-2xx status
141
+ * @example
142
+ * const txs = await augustSdk.subAccountsModule.getSubaccountTransactions(
143
+ * '0xabc…',
144
+ * { startTime: '2026-01-01T00:00:00Z' },
145
+ * );
146
+ */
147
+ async getSubaccountTransactions(subaccountAddress, options = {}) {
148
+ assertSubaccountAddress(subaccountAddress, 'getSubaccountTransactions');
149
+ return (0, fetcher_1.fetchSubaccountTransactions)({
150
+ address: subaccountAddress,
151
+ startTime: options.startTime,
152
+ endTime: options.endTime,
153
+ }, this.keys.august, this.headers);
154
+ }
155
+ /**
156
+ * Retrieves the full loan-book detail for a single loan by its address and
157
+ * chain.
158
+ *
159
+ * Backed by the admin-only `GET /subaccount/loans/{loan_address}` backend
160
+ * endpoint (60-second server-side cache), so the configured August API key
161
+ * must belong to an admin user. Makes exactly one HTTP request and no RPC
162
+ * calls.
163
+ *
164
+ * @param loanAddress - The loan contract address
165
+ * @param chainId - Numeric August chain id the loan lives on (e.g. `1` for Ethereum mainnet)
166
+ * @returns The loan's {@link ILoanBookInfo} detail
167
+ * @throws AugustValidationError When `chainId` is not an integer
168
+ * @throws AugustAuthError When the API key is missing or not admin-scoped
169
+ * @throws AugustServerError When the loan or chain is not found, or the API otherwise responds non-2xx
170
+ * @example
171
+ * const loan = await augustSdk.subAccountsModule.getSubaccountLoanByAddress(
172
+ * '0xloan…',
173
+ * 1,
174
+ * );
175
+ */
176
+ async getSubaccountLoanByAddress(loanAddress, chainId) {
177
+ if (!Number.isInteger(chainId)) {
178
+ throw new core_1.AugustValidationError('INVALID_CHAIN', `getSubaccountLoanByAddress: chainId must be an integer August chain id, got ${chainId}.`);
179
+ }
180
+ return (0, fetcher_1.fetchSubaccountLoanByAddress)(loanAddress, chainId, this.keys.august, this.headers);
181
+ }
182
+ /**
183
+ * Retrieves cross-chain DeBank protocol positions and token balances for a
184
+ * subaccount and its associated strategies.
185
+ *
186
+ * Backed by `GET /subaccount/{subaccount_address}/debank` (300-second
187
+ * server-side cache). This is a slow endpoint — it fans out to DeBank
188
+ * across every supported chain — so expect higher latency than other
189
+ * subaccount reads. Makes exactly one HTTP request and no RPC calls.
190
+ *
191
+ * @param subaccountAddress - The address of the subaccount to query
192
+ * @returns The subaccount's DeBank positions/tokens plus per-strategy breakdowns
193
+ * @throws AugustValidationError When `subaccountAddress` is not a valid EVM address
194
+ * @throws AugustServerError When the API responds with a non-2xx status
195
+ * @example
196
+ * const debank = await augustSdk.subAccountsModule.getSubaccountDebank('0xabc…');
197
+ * console.log(debank.subaccount.positions.length);
198
+ */
199
+ async getSubaccountDebank(subaccountAddress) {
200
+ assertSubaccountAddress(subaccountAddress, 'getSubaccountDebank');
201
+ return (0, fetcher_1.fetchSubaccountDebank)(subaccountAddress, this.keys.august, this.headers);
202
+ }
203
+ }
204
+ exports.AugustSubAccounts = AugustSubAccounts;
205
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,106 @@
1
+ import type { IWSSubaccountSummary } from '../../types';
2
+ /**
3
+ * Transform the raw API response to camelCase
4
+ */
5
+ export declare const transformSubaccountSummary: (response: IWSSubaccountSummary) => {
6
+ address: `0x${string}`;
7
+ name: string;
8
+ type: "eoa" | "subaccount";
9
+ portfolio: {
10
+ tokens: {
11
+ value: number;
12
+ balance: number;
13
+ token: {
14
+ type: string;
15
+ name: string;
16
+ address: string;
17
+ chain: number;
18
+ symbol: string;
19
+ decimals: number;
20
+ imgUrl: string;
21
+ };
22
+ }[];
23
+ marginBalances: unknown[];
24
+ collateralBalances: unknown[];
25
+ cefiPositions: unknown[];
26
+ defiPositions: unknown[];
27
+ trsPositions: unknown[];
28
+ strategyContractPositions: unknown[];
29
+ legacyHedgerPositions: unknown[];
30
+ otcPositions: unknown[];
31
+ totalValue: number;
32
+ discountedValue: number;
33
+ };
34
+ loanbook: {
35
+ loans: {
36
+ subaccountAddress: `0x${string}`;
37
+ book: {
38
+ address: `0x${string}`;
39
+ lender: `0x${string}`;
40
+ borrower: `0x${string}`;
41
+ state: string;
42
+ totalRepaid: number;
43
+ principalToken: {
44
+ type: string;
45
+ name: string;
46
+ address: string;
47
+ chain: number;
48
+ symbol: string;
49
+ decimals: number;
50
+ imgUrl: string;
51
+ tokenType: number;
52
+ discountFactor: number;
53
+ price: number;
54
+ };
55
+ principalAmount: number;
56
+ interestAmount: number;
57
+ upcomingPayment: {
58
+ amount: number;
59
+ dueDate: string;
60
+ };
61
+ apr: number;
62
+ initialPrincipalAmount: number;
63
+ deployedDate: string;
64
+ paymentInterval: number;
65
+ totalInterestPaymentFees: number;
66
+ };
67
+ isBorrow: boolean;
68
+ debtInfo: {
69
+ interestOwed: number;
70
+ principalDebtOwed: number;
71
+ interestRepaid: number;
72
+ };
73
+ creditInfo: {
74
+ netInterestOwed: number;
75
+ principalDebtOwed: number;
76
+ netInterestRepaid: number;
77
+ };
78
+ }[];
79
+ totalDebt: number;
80
+ totalCredit: number;
81
+ aggregatesByToken: unknown[];
82
+ };
83
+ chains: {
84
+ name: string;
85
+ chainId: number;
86
+ }[];
87
+ tokens: {
88
+ type: string;
89
+ name: string;
90
+ address: string;
91
+ chain: number;
92
+ symbol: string;
93
+ decimals: number;
94
+ imgUrl: string;
95
+ price: number;
96
+ rawBalance: number;
97
+ balance: number;
98
+ value: number;
99
+ }[];
100
+ totalAccountValue: number;
101
+ totalCollateralValue: number;
102
+ totalLoanValue: number;
103
+ healthFactor: number;
104
+ netAccountValue: number;
105
+ totalEquityValue: number;
106
+ };
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformSubaccountSummary = void 0;
4
+ /**
5
+ * Transform the raw API response to camelCase
6
+ */
7
+ const transformSubaccountSummary = (response) => {
8
+ return {
9
+ address: response.address,
10
+ name: response.name,
11
+ type: response.type,
12
+ portfolio: {
13
+ tokens: response.portfolio.tokens.map((t) => ({
14
+ value: t.value,
15
+ balance: t.balance,
16
+ token: {
17
+ type: t.token.type,
18
+ name: t.token.name,
19
+ address: t.token.address,
20
+ chain: t.token.chain,
21
+ symbol: t.token.symbol,
22
+ decimals: t.token.decimals,
23
+ imgUrl: t.token.img_url,
24
+ },
25
+ })),
26
+ marginBalances: response.portfolio.margin_balances,
27
+ collateralBalances: response.portfolio.collateral_balances,
28
+ cefiPositions: response.portfolio.cefi_positions,
29
+ defiPositions: response.portfolio.defi_positions,
30
+ trsPositions: response.portfolio.trs_positions,
31
+ strategyContractPositions: response.portfolio.strategy_contract_positions,
32
+ legacyHedgerPositions: response.portfolio.legacy_hedger_positions,
33
+ otcPositions: response.portfolio.otc_positions,
34
+ totalValue: response.portfolio.total_value,
35
+ discountedValue: response.portfolio.discounted_value,
36
+ },
37
+ loanbook: {
38
+ loans: response.loanbook.loans.map((loan) => ({
39
+ subaccountAddress: loan.subaccount_address,
40
+ book: {
41
+ address: loan.book.address,
42
+ lender: loan.book.lender,
43
+ borrower: loan.book.borrower,
44
+ state: loan.book.state,
45
+ totalRepaid: loan.book.total_repaid,
46
+ principalToken: {
47
+ type: loan.book.principal_token.type,
48
+ name: loan.book.principal_token.name,
49
+ address: loan.book.principal_token.address,
50
+ chain: loan.book.principal_token.chain,
51
+ symbol: loan.book.principal_token.symbol,
52
+ decimals: loan.book.principal_token.decimals,
53
+ imgUrl: loan.book.principal_token.img_url,
54
+ tokenType: loan.book.principal_token.token_type,
55
+ discountFactor: loan.book.principal_token.discount_factor,
56
+ price: loan.book.principal_token.price,
57
+ },
58
+ principalAmount: loan.book.principal_amount,
59
+ interestAmount: loan.book.interest_amount,
60
+ upcomingPayment: {
61
+ amount: loan.book.upcoming_payment.amount,
62
+ dueDate: loan.book.upcoming_payment.due_date,
63
+ },
64
+ apr: loan.book.apr,
65
+ initialPrincipalAmount: loan.book.initial_principal_amount,
66
+ deployedDate: loan.book.deployed_date,
67
+ paymentInterval: loan.book.payment_interval,
68
+ totalInterestPaymentFees: loan.book.total_interest_payment_fees,
69
+ },
70
+ isBorrow: loan.is_borrow,
71
+ debtInfo: {
72
+ interestOwed: loan.debt_info.interest_owed,
73
+ principalDebtOwed: loan.debt_info.principal_debt_owed,
74
+ interestRepaid: loan.debt_info.interest_repaid,
75
+ },
76
+ creditInfo: {
77
+ netInterestOwed: loan.credit_info.net_interest_owed,
78
+ principalDebtOwed: loan.credit_info.principal_debt_owed,
79
+ netInterestRepaid: loan.credit_info.net_interest_repaid,
80
+ },
81
+ })),
82
+ totalDebt: response.loanbook.total_debt,
83
+ totalCredit: response.loanbook.total_credit,
84
+ aggregatesByToken: response.loanbook.aggregates_by_token,
85
+ },
86
+ chains: response.chains.map((c) => ({
87
+ name: c.name,
88
+ chainId: c.chain_id,
89
+ })),
90
+ tokens: response.tokens.map((t) => ({
91
+ type: t.type,
92
+ name: t.name,
93
+ address: t.address,
94
+ chain: t.chain,
95
+ symbol: t.symbol,
96
+ decimals: t.decimals,
97
+ imgUrl: t.img_url,
98
+ price: t.price,
99
+ rawBalance: t.raw_balance,
100
+ balance: t.balance,
101
+ value: t.value,
102
+ })),
103
+ totalAccountValue: response.total_account_value,
104
+ totalCollateralValue: response.total_collateral_value,
105
+ totalLoanValue: response.total_loan_value,
106
+ healthFactor: response.health_factor,
107
+ netAccountValue: response.net_account_value,
108
+ totalEquityValue: response.total_equity_value,
109
+ };
110
+ };
111
+ exports.transformSubaccountSummary = transformSubaccountSummary;
112
+ //# sourceMappingURL=utils.js.map