@augustdigital/sdk 8.3.2 → 8.5.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 (204) hide show
  1. package/lib/abis/ERC20_Bytes32.d.ts +4 -0
  2. package/lib/abis/ERC20_Bytes32.js +4 -0
  3. package/lib/abis/ERC4626.d.ts +1 -0
  4. package/lib/abis/ERC4626.js +1 -0
  5. package/lib/abis/ERC721.d.ts +1 -0
  6. package/lib/abis/ERC721.js +1 -0
  7. package/lib/abis/FeeOracle.js +1 -0
  8. package/lib/abis/LendingPool.js +1 -0
  9. package/lib/abis/LendingPoolV2.js +1 -0
  10. package/lib/abis/Multicall3.js +3 -0
  11. package/lib/abis/OFT.d.ts +20 -0
  12. package/lib/abis/OFT.js +20 -0
  13. package/lib/abis/SmartAccount.d.ts +1 -0
  14. package/lib/abis/SmartAccount.js +3 -0
  15. package/lib/abis/SwapRouter.d.ts +1 -0
  16. package/lib/abis/SwapRouter.js +1 -0
  17. package/lib/abis/UniversalSignatureValidator.js +3 -0
  18. package/lib/abis/index.d.ts +5 -0
  19. package/lib/abis/index.js +5 -0
  20. package/lib/adapters/evm/getters.d.ts +17 -2
  21. package/lib/adapters/evm/getters.js +35 -3
  22. package/lib/adapters/evm/index.d.ts +262 -0
  23. package/lib/adapters/evm/index.js +268 -1
  24. package/lib/adapters/evm/utils.d.ts +6 -0
  25. package/lib/adapters/evm/utils.js +7 -0
  26. package/lib/adapters/solana/constants.js +4 -1
  27. package/lib/adapters/solana/getters.d.ts +8 -0
  28. package/lib/adapters/solana/getters.js +21 -0
  29. package/lib/adapters/solana/idl/vault-idl.js +9 -0
  30. package/lib/adapters/solana/index.d.ts +55 -0
  31. package/lib/adapters/solana/index.js +57 -0
  32. package/lib/adapters/solana/utils.d.ts +28 -0
  33. package/lib/adapters/solana/utils.js +79 -4
  34. package/lib/adapters/solana/vault.actions.d.ts +19 -0
  35. package/lib/adapters/solana/vault.actions.js +47 -3
  36. package/lib/adapters/stellar/actions.d.ts +25 -0
  37. package/lib/adapters/stellar/actions.js +33 -0
  38. package/lib/adapters/stellar/constants.d.ts +26 -0
  39. package/lib/adapters/stellar/constants.js +29 -0
  40. package/lib/adapters/stellar/getters.d.ts +56 -0
  41. package/lib/adapters/stellar/getters.js +81 -0
  42. package/lib/adapters/stellar/index.d.ts +48 -0
  43. package/lib/adapters/stellar/index.js +48 -0
  44. package/lib/adapters/stellar/soroban.d.ts +20 -0
  45. package/lib/adapters/stellar/soroban.js +46 -0
  46. package/lib/adapters/stellar/submit.d.ts +12 -0
  47. package/lib/adapters/stellar/submit.js +19 -0
  48. package/lib/adapters/stellar/types.d.ts +27 -0
  49. package/lib/adapters/stellar/types.js +3 -0
  50. package/lib/adapters/stellar/utils.d.ts +10 -0
  51. package/lib/adapters/stellar/utils.js +10 -0
  52. package/lib/adapters/sui/getters.d.ts +6 -0
  53. package/lib/adapters/sui/getters.js +6 -0
  54. package/lib/adapters/sui/index.d.ts +15 -0
  55. package/lib/adapters/sui/index.js +15 -0
  56. package/lib/adapters/sui/transformer.d.ts +6 -0
  57. package/lib/adapters/sui/transformer.js +6 -0
  58. package/lib/adapters/sui/utils.d.ts +6 -0
  59. package/lib/adapters/sui/utils.js +6 -0
  60. package/lib/core/analytics/chain-name.d.ts +8 -0
  61. package/lib/core/analytics/chain-name.js +8 -0
  62. package/lib/core/analytics/constants.d.ts +4 -0
  63. package/lib/core/analytics/constants.js +4 -0
  64. package/lib/core/analytics/env.d.ts +25 -0
  65. package/lib/core/analytics/env.js +26 -0
  66. package/lib/core/analytics/index.d.ts +26 -0
  67. package/lib/core/analytics/index.js +35 -0
  68. package/lib/core/analytics/instrumentation.d.ts +26 -0
  69. package/lib/core/analytics/instrumentation.js +66 -2
  70. package/lib/core/analytics/method-taxonomy.d.ts +16 -0
  71. package/lib/core/analytics/method-taxonomy.js +18 -0
  72. package/lib/core/analytics/metrics.d.ts +23 -0
  73. package/lib/core/analytics/metrics.js +40 -0
  74. package/lib/core/analytics/sanitize.d.ts +38 -0
  75. package/lib/core/analytics/sanitize.js +46 -0
  76. package/lib/core/analytics/sentry-runtime.d.ts +11 -0
  77. package/lib/core/analytics/sentry-runtime.js +19 -0
  78. package/lib/core/analytics/sentry.d.ts +45 -0
  79. package/lib/core/analytics/sentry.js +115 -2
  80. package/lib/core/analytics/types.d.ts +27 -0
  81. package/lib/core/analytics/user-identity.d.ts +34 -0
  82. package/lib/core/analytics/user-identity.js +42 -0
  83. package/lib/core/analytics/version.d.ts +6 -1
  84. package/lib/core/analytics/version.js +6 -1
  85. package/lib/core/auth/verify.js +5 -0
  86. package/lib/core/base.class.d.ts +75 -0
  87. package/lib/core/base.class.js +56 -0
  88. package/lib/core/cache.d.ts +5 -0
  89. package/lib/core/cache.js +6 -0
  90. package/lib/core/constants/adapters.d.ts +15 -0
  91. package/lib/core/constants/adapters.js +28 -8
  92. package/lib/core/constants/core.d.ts +12 -1
  93. package/lib/core/constants/core.js +12 -0
  94. package/lib/core/constants/swap-router.d.ts +46 -0
  95. package/lib/core/constants/swap-router.js +50 -0
  96. package/lib/core/constants/vaults.d.ts +56 -0
  97. package/lib/core/constants/vaults.js +66 -1
  98. package/lib/core/constants/web3.d.ts +3 -0
  99. package/lib/core/constants/web3.js +18 -5
  100. package/lib/core/errors/index.d.ts +36 -0
  101. package/lib/core/errors/index.js +29 -0
  102. package/lib/core/fetcher.d.ts +134 -0
  103. package/lib/core/fetcher.js +191 -5
  104. package/lib/core/helpers/adapters.d.ts +9 -0
  105. package/lib/core/helpers/adapters.js +11 -0
  106. package/lib/core/helpers/chain-address.d.ts +10 -0
  107. package/lib/core/helpers/chain-address.js +11 -0
  108. package/lib/core/helpers/core.d.ts +42 -0
  109. package/lib/core/helpers/core.js +66 -1
  110. package/lib/core/helpers/explorer-link.d.ts +14 -0
  111. package/lib/core/helpers/explorer-link.js +14 -0
  112. package/lib/core/helpers/signer.d.ts +26 -0
  113. package/lib/core/helpers/signer.js +39 -0
  114. package/lib/core/helpers/swap-router.d.ts +32 -0
  115. package/lib/core/helpers/swap-router.js +32 -0
  116. package/lib/core/helpers/vault-version.d.ts +1 -0
  117. package/lib/core/helpers/vault-version.js +2 -0
  118. package/lib/core/helpers/vaults.d.ts +8 -0
  119. package/lib/core/helpers/vaults.js +22 -8
  120. package/lib/core/helpers/web3.d.ts +152 -0
  121. package/lib/core/helpers/web3.js +183 -6
  122. package/lib/core/logger/index.d.ts +55 -0
  123. package/lib/core/logger/index.js +19 -0
  124. package/lib/core/logger/slack.d.ts +3 -0
  125. package/lib/core/logger/slack.js +3 -0
  126. package/lib/core/vault-metadata.d.ts +6 -0
  127. package/lib/core/vault-metadata.js +6 -0
  128. package/lib/core/version-check.d.ts +52 -0
  129. package/lib/core/version-check.js +81 -0
  130. package/lib/evm/methods/crossChainVault.d.ts +90 -0
  131. package/lib/evm/methods/crossChainVault.js +186 -1
  132. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  133. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  134. package/lib/evm/methods/index.d.ts +1 -0
  135. package/lib/evm/methods/index.js +1 -0
  136. package/lib/evm/types/crossChain.d.ts +202 -0
  137. package/lib/evm/types/crossChain.js +11 -0
  138. package/lib/index.d.ts +16 -0
  139. package/lib/index.js +19 -0
  140. package/lib/main.d.ts +288 -5
  141. package/lib/main.js +305 -0
  142. package/lib/modules/api/index.d.ts +1 -0
  143. package/lib/modules/api/index.js +6 -0
  144. package/lib/modules/api/main.d.ts +52 -0
  145. package/lib/modules/api/main.js +130 -0
  146. package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
  147. package/lib/modules/sub-accounts/fetcher.js +15 -0
  148. package/lib/modules/sub-accounts/main.d.ts +33 -0
  149. package/lib/modules/sub-accounts/main.js +38 -0
  150. package/lib/modules/sub-accounts/utils.d.ts +3 -0
  151. package/lib/modules/sub-accounts/utils.js +3 -0
  152. package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
  153. package/lib/modules/vaults/adapter.helpers.js +34 -0
  154. package/lib/modules/vaults/fetcher.d.ts +20 -0
  155. package/lib/modules/vaults/fetcher.js +40 -3
  156. package/lib/modules/vaults/getters.d.ts +295 -0
  157. package/lib/modules/vaults/getters.js +552 -12
  158. package/lib/modules/vaults/index.d.ts +12 -0
  159. package/lib/modules/vaults/index.js +12 -0
  160. package/lib/modules/vaults/main.d.ts +292 -4
  161. package/lib/modules/vaults/main.js +379 -7
  162. package/lib/modules/vaults/read.actions.d.ts +168 -0
  163. package/lib/modules/vaults/read.actions.js +143 -0
  164. package/lib/modules/vaults/types.d.ts +34 -0
  165. package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
  166. package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
  167. package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
  168. package/lib/modules/vaults/utils/date-utils.js +47 -1
  169. package/lib/modules/vaults/utils.d.ts +69 -0
  170. package/lib/modules/vaults/utils.js +104 -5
  171. package/lib/modules/vaults/write.actions.d.ts +363 -3
  172. package/lib/modules/vaults/write.actions.js +364 -2
  173. package/lib/polyfills.js +2 -0
  174. package/lib/sdk.d.ts +23705 -0
  175. package/lib/services/coingecko/fetcher.d.ts +13 -0
  176. package/lib/services/coingecko/fetcher.js +17 -0
  177. package/lib/services/debank/fetcher.d.ts +14 -0
  178. package/lib/services/debank/fetcher.js +12 -0
  179. package/lib/services/debank/utils.js +17 -0
  180. package/lib/services/layerzero/deposits.d.ts +11 -0
  181. package/lib/services/layerzero/deposits.js +34 -11
  182. package/lib/services/layerzero/redeems.d.ts +10 -0
  183. package/lib/services/layerzero/redeems.js +13 -0
  184. package/lib/services/layerzero/utils.d.ts +8 -0
  185. package/lib/services/layerzero/utils.js +11 -0
  186. package/lib/services/octavfi/fetcher.d.ts +7 -0
  187. package/lib/services/octavfi/fetcher.js +25 -0
  188. package/lib/services/octavfi/utils.d.ts +12 -0
  189. package/lib/services/octavfi/utils.js +44 -10
  190. package/lib/services/subgraph/fetcher.js +4 -2
  191. package/lib/services/subgraph/vaults.d.ts +12 -0
  192. package/lib/services/subgraph/vaults.js +43 -2
  193. package/lib/services/swap-quotes/index.d.ts +71 -0
  194. package/lib/services/swap-quotes/index.js +25 -0
  195. package/lib/services/swap-quotes/paraswap.d.ts +17 -0
  196. package/lib/services/swap-quotes/paraswap.js +14 -0
  197. package/lib/types/pools.d.ts +3 -0
  198. package/lib/types/typed-contract.d.ts +64 -0
  199. package/lib/types/vaults.d.ts +137 -2
  200. package/lib/types/vaults.js +10 -0
  201. package/lib/types/web3.d.ts +8 -0
  202. package/lib/types/web3.js +1 -0
  203. package/lib/types/webserver.d.ts +45 -0
  204. package/package.json +6 -5
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * The August Vaults Module.
4
+ *
5
+ * @module AugustVaults
6
+ */
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -40,7 +45,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
45
  };
41
46
  Object.defineProperty(exports, "__esModule", { value: true });
42
47
  exports.AugustVaults = void 0;
48
+ /**
49
+ * Export getters
50
+ */
43
51
  __exportStar(require("./getters"), exports);
52
+ /**
53
+ * AugustVaults class
54
+ */
44
55
  const fetcher_1 = require("./fetcher");
45
56
  const ethers_1 = require("ethers");
46
57
  const getters_1 = require("./getters");
@@ -55,6 +66,10 @@ const constants_1 = require("../../adapters/sui/constants");
55
66
  const vaults_2 = require("../../core/constants/vaults");
56
67
  const write_actions_1 = require("./write.actions");
57
68
  const read_actions_1 = require("./read.actions");
69
+ /**
70
+ * Vault operations class handling multi-chain vault queries and user positions.
71
+ * Supports both EVM and Solana vaults with unified interface.
72
+ */
58
73
  class AugustVaults extends core_1.AugustBase {
59
74
  constructor(baseConfig, solana, sui) {
60
75
  super(baseConfig);
@@ -66,20 +81,51 @@ class AugustVaults extends core_1.AugustBase {
66
81
  'x-user-id': this.monitoring?.['x-user-id'],
67
82
  };
68
83
  }
84
+ /**
85
+ * @description deposit underlying token into the specified pool with adapter support. This is for when we cannot pass in a signer in sdk and need to do so as an arg
86
+ * @param signer signer / wallet object
87
+ * @param options object including pool contract address, user wallet address, string amount, and optional depositAsset
88
+ * @returns deposit tx hash
89
+ */
69
90
  async vaultDeposit(signer, options) {
70
91
  return (0, write_actions_1.vaultDeposit)(signer, options);
71
92
  }
93
+ /**
94
+ * @description deposit native token (ETH/AVAX/etc) into a vault using MultiAssetNativeDepositWrapper
95
+ * @param signer signer / wallet object
96
+ * @param options object including wrapper contract address, receiver address (optional), and amount
97
+ * @returns deposit tx hash
98
+ */
72
99
  async depositNative(signer, options) {
73
100
  return (0, write_actions_1.depositNative)(signer, options);
74
101
  }
102
+ /**
103
+ * Fetch all vaults across configured networks with optional enrichment.
104
+ * Automatically filters by available providers and optionally by chain IDs.
105
+ * Includes closed vaults that are still visible (`status: 'closed'`,
106
+ * `is_visible: true`) so consumers can render positions held in closed
107
+ * vaults; closed vaults with `is_visible: false` are excluded.
108
+ * @param options Filtering and enrichment configuration
109
+ * @returns Array of vault objects with optional loans/allocations/positions
110
+ */
75
111
  async getVaults(options) {
112
+ // if (!(this.authorized && this.augustKey)) // @todo: commented out for integrators
76
113
  const allVaults = await (0, core_1.fetchTokenizedVaults)(undefined, this.headers, options?.loadSubaccounts, options?.loadSnapshots);
77
- const vaultsPerAvailableProviders = allVaults.filter((v) => v?.chain_type === 'stellar' ||
114
+ const vaultsPerAvailableProviders = allVaults.filter((v) =>
115
+ // Stellar vaults are backend-only (no RPC provider required)
116
+ v?.chain_type === 'stellar' ||
117
+ // Solana vaults use this.solanaService (not this.providers). Without
118
+ // an explicit pass-through here they get silently dropped on any
119
+ // instance whose ACTIVE_RPC_URLS() doesn't register chainId -1.
120
+ // Gate on solanaService presence so we don't let a vault through that
121
+ // we have no adapter to fetch — that would crash the inner getter and
122
+ // turn into a PENDING entry that the final filter drops anyway.
78
123
  (v?.chain_type === 'solana' && !!this.solanaService) ||
79
124
  (this.providers?.[v?.chain] ? true : false));
80
125
  const vaultsPerChainId = options?.chainIds
81
126
  ? vaultsPerAvailableProviders.filter((v) => options.chainIds.includes(v.chain))
82
127
  : vaultsPerAvailableProviders;
128
+ // Fetch and transform (filter for active status)
83
129
  const emberVaults = await this.suiService.getEmberVaults({
84
130
  status: 'active',
85
131
  });
@@ -93,11 +139,21 @@ class AugustVaults extends core_1.AugustBase {
93
139
  return constants_1.ALLOWED_SUI_VAULT_ADDRESSES.includes(normalizedAddress);
94
140
  });
95
141
  const transformedVaults = this.suiService.transformEmberVaultsToIVaults(whitelistedEmberVaults);
142
+ // Use comprehensive vault fetching for maximum coverage
96
143
  const vaultFetchResult = await (0, fetcher_1.fetchVaultsComprehensive)(vaultsPerChainId, async (vault) => {
144
+ // Handle fallback RPC if provided
97
145
  const rpcUrl = vault.fallbackRpc || this.providers?.[vault.chain];
98
- const shouldFetchLoans = !vault.minimal &&
146
+ // Closed vaults have no live loans/allocations. In portfolio mode,
147
+ // skip that enrichment so a closed vault is never dropped just because
148
+ // getVaultAllocations re-throws (no debank data / no subaccounts).
149
+ const isClosedVault = vault.status === 'closed';
150
+ const skipClosedEnrichment = !!options?.includeClosed && isClosedVault;
151
+ // Handle minimal data fetching
152
+ const shouldFetchLoans = !skipClosedEnrichment &&
153
+ !vault.minimal &&
99
154
  (typeof options?.loans !== 'undefined' ? options?.loans : true);
100
- const shouldFetchAllocations = !vault.minimal &&
155
+ const shouldFetchAllocations = !skipClosedEnrichment &&
156
+ !vault.minimal &&
101
157
  (typeof options?.allocations !== 'undefined'
102
158
  ? options?.allocations
103
159
  : true);
@@ -111,6 +167,9 @@ class AugustVaults extends core_1.AugustBase {
111
167
  env: this.monitoring?.env,
112
168
  augustKey: this.keys?.august,
113
169
  subgraphKey: this.keys?.graph,
170
+ // Portfolio mode: let the EVM getter resolve closed + invisible
171
+ // vaults instead of null-ing them, so the closed vault survives.
172
+ includeClosed: options?.includeClosed,
114
173
  },
115
174
  loadSubaccounts: options?.loadSubaccounts,
116
175
  loadSnapshots: options?.loadSnapshots,
@@ -125,14 +184,17 @@ class AugustVaults extends core_1.AugustBase {
125
184
  includeInvisible: false,
126
185
  timeout: 60000,
127
186
  fallbackRpcUrls: {
187
+ // Use configured fallback RPC endpoints for each chain
128
188
  1: (0, core_1.getFallbackRpcUrls)(1),
129
189
  56: (0, core_1.getFallbackRpcUrls)(56),
130
190
  43114: (0, core_1.getFallbackRpcUrls)(43114),
131
191
  8453: (0, core_1.getFallbackRpcUrls)(8453),
132
192
  42161: (0, core_1.getFallbackRpcUrls)(42161),
133
193
  137: (0, core_1.getFallbackRpcUrls)(137),
194
+ // [SPECIAL_CHAINS.solana.chainId]: getFallbackRpcUrls(SPECIAL_CHAINS.solana.chainId),
134
195
  },
135
196
  });
197
+ // Log vault fetching results in DEV mode
136
198
  core_1.Logger.log.info('getVaults', `Total: ${vaultFetchResult.coverageReport.totalVaults}, ` +
137
199
  `Success: ${vaultFetchResult.coverageReport.successfulVaults}, ` +
138
200
  `Failed: ${vaultFetchResult.coverageReport.failedVaults}, ` +
@@ -145,6 +207,7 @@ class AugustVaults extends core_1.AugustBase {
145
207
  attempts: f.attempts,
146
208
  })));
147
209
  }
210
+ // Use intelligent filtering to preserve more vaults
148
211
  const vaultResponses = vaultFetchResult.successful
149
212
  .sort((a, b) => a.index - b.index)
150
213
  .map((item) => item.data);
@@ -153,13 +216,23 @@ class AugustVaults extends core_1.AugustBase {
153
216
  includeInvisible: true,
154
217
  minStatus: ['active', 'closed'],
155
218
  });
219
+ // Closed vaults are included in the result ONLY when the caller opts in via
220
+ // `includeClosed` (portfolio mode). By default they are dropped, so the
221
+ // marketplace / discovery callers never receive a closed vault and don't
222
+ // have to filter `status === 'closed'` themselves. The portfolio passes
223
+ // `includeClosed: true` so a user's position in a closed vault can be
224
+ // joined against this list. Note: closed + invisible vaults land in the
225
+ // `closed` bucket (the status check precedes the visibility check in
226
+ // filterVaultsIntelligently), so this single gate covers them too.
156
227
  const filteredResponses = [
157
228
  ...filteredResults.active,
229
+ ...(options?.includeClosed ? filteredResults.closed : []),
158
230
  ...filteredResults.invisible,
159
231
  ];
160
232
  if ((options.wallet && (0, ethers_1.isAddress)(options.wallet)) ||
161
233
  (options.solanaWallet &&
162
234
  utils_1.SolanaUtils.isSolanaAddress(options.solanaWallet))) {
235
+ // fetch all positions for user wallet
163
236
  const vaultResponses = await (0, core_1.promiseSettle)(vaultsPerAvailableProviders.map((v) => (0, getters_1.getVaultPositions)({
164
237
  vault: v.address,
165
238
  wallet: options.wallet,
@@ -172,7 +245,9 @@ class AugustVaults extends core_1.AugustBase {
172
245
  augustKey: this.keys?.august,
173
246
  subgraphKey: this.keys?.graph,
174
247
  },
175
- })), 5, 2000);
248
+ })), 5, // 5 retries
249
+ 2000);
250
+ // return vault object with position property
176
251
  const positions = vaultResponses
177
252
  .flat()
178
253
  .filter((v) => v.status !== 'PENDING');
@@ -181,11 +256,18 @@ class AugustVaults extends core_1.AugustBase {
181
256
  position: positions?.find((pos) => pos.vault?.toLowerCase() === r.address?.toLowerCase()) || null,
182
257
  }));
183
258
  }
184
- if (!!options.wallet && !(0, ethers_1.isAddress)(options.wallet)) {
259
+ if (options.wallet && !(0, ethers_1.isAddress)(options.wallet)) {
185
260
  core_1.Logger.log.warn('getVaults:invalid_wallet', options.wallet);
186
261
  }
262
+ // console.log(`#getVaults:`, filteredResponses);
187
263
  return [...filteredResponses, ...transformedVaults];
188
264
  }
265
+ /**
266
+ * Calculate total deposited across all tokenized vaults by summing latest_reported_tvl.
267
+ * Uses the /tokenized_vault endpoint which returns latest_reported_tvl in USD.
268
+ * @param options Optional configuration for loading vaults
269
+ * @returns Total deposited amount in USD (sum of all latest_reported_tvl values)
270
+ */
189
271
  async getTotalDeposited(options) {
190
272
  const allVaults = await (0, core_1.fetchTokenizedVaults)(undefined, this.headers, options?.loadSubaccounts, options?.loadSnapshots);
191
273
  let total = 0;
@@ -199,15 +281,28 @@ class AugustVaults extends core_1.AugustBase {
199
281
  });
200
282
  return total;
201
283
  }
284
+ /**
285
+ * Fetch detailed data for a single vault with optional enrichment.
286
+ * Automatically includes loans and allocations unless explicitly disabled.
287
+ * @param vault Vault contract address
288
+ * @param chainId Optional chain ID (uses active network if not provided)
289
+ * @param options Enrichment and wallet options
290
+ * @returns Single vault object with optional position data
291
+ */
202
292
  async getVault({ vault, chainId, options, loadSubaccounts, loadSnapshots, }) {
203
293
  if (!vault)
204
294
  throw new Error('Vault input parameter is undefined.');
295
+ // if (!isAddress(vault))
296
+ // throw new Error(
297
+ // `Vault input parameter is not an address: ${String(vault)}`,
298
+ // );
205
299
  if (typeof chainId !== 'undefined') {
206
300
  if (!this.providers?.[chainId]) {
207
301
  const error = new Error(`Missing RPC URL for chainId ${chainId}`);
208
302
  core_1.Logger.log.error('getVault:missing_provider', error, { chainId });
209
303
  }
210
304
  }
305
+ // get vault data
211
306
  const vaultResponse = await (0, getters_1.getVault)({
212
307
  vault: vault,
213
308
  loans: typeof options?.loans !== 'undefined' ? options?.loans : true,
@@ -232,6 +327,7 @@ class AugustVaults extends core_1.AugustBase {
232
327
  (options?.solanaWallet &&
233
328
  utils_1.SolanaUtils.isSolanaAddress(options?.solanaWallet)) ||
234
329
  (options?.stellarWallet && (0, utils_2.isStellarAddress)(options?.stellarWallet)))) {
330
+ // fetch all positions for user wallet
235
331
  const vaultResponses = await (0, getters_1.getVaultPositions)({
236
332
  vault: vault,
237
333
  solanaWallet: options?.solanaWallet,
@@ -248,18 +344,25 @@ class AugustVaults extends core_1.AugustBase {
248
344
  headers: this.headers,
249
345
  },
250
346
  });
347
+ // return vault object with position property
251
348
  const positions = vaultResponses.filter((v) => v.status !== 'PENDING');
252
349
  return {
253
350
  ...vaultResponse,
254
351
  position: positions?.find((pos) => pos.vault?.toLowerCase() === vault?.toLowerCase()) || null,
255
352
  };
256
353
  }
257
- if (!!options?.wallet && !(0, ethers_1.isAddress)(options?.wallet)) {
354
+ if (options?.wallet && !(0, ethers_1.isAddress)(options?.wallet)) {
258
355
  core_1.Logger.log.warn('getVault:invalid_wallet', options?.wallet);
259
356
  }
357
+ // console.log(`#getVault::${vaultResponse.symbol}:`, vaultResponse);
260
358
  return vaultResponse;
261
359
  }
360
+ /**
361
+ *
362
+ */
262
363
  async getVaultLoans({ vault, chainId, }) {
364
+ // Sanitize
365
+ // if (!this.authorized) throw new Error('Not authorized.');
263
366
  if (!vault)
264
367
  throw new Error('Vault input parameter is undefined.');
265
368
  if (!(0, ethers_1.isAddress)(vault))
@@ -270,6 +373,7 @@ class AugustVaults extends core_1.AugustBase {
270
373
  core_1.Logger.log.error('getVaultLoans:missing_provider', error, { chainId });
271
374
  }
272
375
  }
376
+ // get vault loans data
273
377
  const vaultResponse = await (0, getters_1.getVaultLoans)(vault, {
274
378
  rpcUrl: chainId
275
379
  ? this.providers?.[chainId]
@@ -283,7 +387,11 @@ class AugustVaults extends core_1.AugustBase {
283
387
  });
284
388
  return vaultResponse;
285
389
  }
390
+ /**
391
+ *
392
+ */
286
393
  async getVaultSubaccountLoans({ vault, chainId, }) {
394
+ // Sanitize
287
395
  if (!vault)
288
396
  throw new Error('Vault input parameter is undefined.');
289
397
  if (!(0, ethers_1.isAddress)(vault))
@@ -296,6 +404,7 @@ class AugustVaults extends core_1.AugustBase {
296
404
  });
297
405
  }
298
406
  }
407
+ // get vault subaccount loans data
299
408
  const vaultResponse = await (0, getters_1.getVaultSubaccountLoans)(vault, {
300
409
  rpcUrl: chainId
301
410
  ? this.providers?.[chainId]
@@ -309,7 +418,12 @@ class AugustVaults extends core_1.AugustBase {
309
418
  });
310
419
  return vaultResponse;
311
420
  }
421
+ /**
422
+ *
423
+ */
312
424
  async getVaultAllocations({ vault, chainId, }) {
425
+ // Sanitize
426
+ // if (!this.authorized) throw new Error('Not authorized.');
313
427
  if (!vault)
314
428
  throw new Error('Vault input parameter is undefined.');
315
429
  if (!(0, ethers_1.isAddress)(vault) &&
@@ -324,6 +438,7 @@ class AugustVaults extends core_1.AugustBase {
324
438
  });
325
439
  }
326
440
  }
441
+ // get vault allocations data
327
442
  try {
328
443
  const vaultResponse = await (0, getters_1.getVaultAllocations)(vault, {
329
444
  rpcUrl: chainId
@@ -351,7 +466,15 @@ class AugustVaults extends core_1.AugustBase {
351
466
  };
352
467
  }
353
468
  }
469
+ /**
470
+ * @deprecated use getVaultHistoricalTimeseries instead
471
+ * @function getVaultApy gets the vault/pool APR, both current and historical
472
+ * @param vault pool/vault contract address
473
+ * @param historical (optional) When passed, returns the historical records of the pool/vault APR
474
+ * @returns a value or array of objects containing the APR and timestamp
475
+ */
354
476
  async getVaultApy({ vault, historical, }) {
477
+ // if (!this.authorized) throw new Error('Not authorized.');
355
478
  if (!vault)
356
479
  throw new Error('Vault input parameter is undefined.');
357
480
  if (!(0, ethers_1.isAddress)(vault) && !(0, utils_2.isStellarAddress)(vault))
@@ -366,6 +489,12 @@ class AugustVaults extends core_1.AugustBase {
366
489
  },
367
490
  });
368
491
  }
492
+ /**
493
+ * @function getVaultHistoricalTimeseries gets historical timeseries data for a vault
494
+ * @param vault Vault contract address
495
+ * @param nDays Number of days of historical data (default 30, min 1)
496
+ * @returns Historical timeseries data with TVL, APY, PnL, share price, and other metrics
497
+ */
369
498
  async getVaultHistoricalTimeseries({ vault, nDays, }) {
370
499
  if (!vault)
371
500
  throw new Error('Vault input parameter is undefined.');
@@ -378,6 +507,9 @@ class AugustVaults extends core_1.AugustBase {
378
507
  },
379
508
  });
380
509
  }
510
+ /**
511
+ *
512
+ */
381
513
  async getVaultAvailableRedemptions({ vault, chainId, wallet, verbose, }) {
382
514
  if (!this.authorized)
383
515
  throw new Error('Not authorized.');
@@ -401,6 +533,35 @@ class AugustVaults extends core_1.AugustBase {
401
533
  },
402
534
  });
403
535
  }
536
+ /**
537
+ * Historical redemption requests for a vault (settled, cancelled, and
538
+ * pending-but-out-of-window). Filterable by wallet.
539
+ *
540
+ * Stellar vaults return `[]` — on-chain redemption history is not yet
541
+ * indexed for that adapter.
542
+ *
543
+ * @param vault - Vault address (EVM or Stellar). Stellar input is
544
+ * accepted but always resolves to an empty array for now.
545
+ * @param chainId - Chain id to resolve the RPC URL against. Falls
546
+ * back to the active network.
547
+ * @param wallet - Optional EVM wallet filter; when omitted the
548
+ * response includes every wallet that has ever redeemed against
549
+ * the vault.
550
+ * @param lookbackBlocks - How far back to scan for redemption logs.
551
+ * Defaults to the SDK's internal lookback when omitted.
552
+ * @returns The same array shape `getVaultRedemptionHistory` returns
553
+ * at the module level — historical redemption records, newest
554
+ * first.
555
+ *
556
+ * @example
557
+ * ```ts
558
+ * const history = await sdk.vaultsModule.getVaultRedemptionHistory({
559
+ * vault: '0xVault',
560
+ * chainId: 8453,
561
+ * wallet: '0xWallet',
562
+ * });
563
+ * ```
564
+ */
404
565
  async getVaultRedemptionHistory({ vault, chainId, wallet, lookbackBlocks, }) {
405
566
  if (!this.authorized)
406
567
  throw new Error('Not authorized.');
@@ -424,10 +585,16 @@ class AugustVaults extends core_1.AugustBase {
424
585
  },
425
586
  });
426
587
  }
588
+ /**
589
+ *
590
+ */
427
591
  async getVaultPositions({ vault, wallet, chainId, showAllVaults, solanaWallet, stellarWallet, options, }) {
592
+ // if (!this.authorized) throw new Error('Not authorized.');
593
+ // Validate that at least one wallet type is provided
428
594
  if (solanaWallet && !utils_1.SolanaUtils.isSolanaAddress(solanaWallet)) {
429
595
  throw new Error('Solana wallet parameter must be provided and be a valid Solana address');
430
596
  }
597
+ // Validate EVM wallet if provided
431
598
  if (wallet && !(0, ethers_1.isAddress)(wallet)) {
432
599
  throw new Error(`Wallet parameter is not a valid address: ${String(wallet)}`);
433
600
  }
@@ -478,7 +645,16 @@ class AugustVaults extends core_1.AugustBase {
478
645
  core_1.Logger.log.info(`getPositions::${chainId || 'all'}:`, final.map((v) => v.vault));
479
646
  return final;
480
647
  }
481
- const vaultsPerAvailableProviders = allVaults.filter((v) => v?.chain_type === 'stellar' ||
648
+ const vaultsPerAvailableProviders = allVaults.filter((v) =>
649
+ // Stellar vaults are backend-only (no RPC provider required)
650
+ v?.chain_type === 'stellar' ||
651
+ // Solana vaults use this.solanaService (not this.providers). Without
652
+ // this clause every Solana position is dropped on any instance where
653
+ // ACTIVE_RPC_URLS() doesn't register chainId -1 — which is exactly
654
+ // how the jitoSOL "missing position" regression manifested. Gate on
655
+ // solanaService presence so we don't pass Solana vaults through with
656
+ // no adapter to read them — the inner getter would crash, hit the
657
+ // outer catch, and silently return PENDING (then get filtered out).
482
658
  (v?.chain_type === 'solana' && !!this.solanaService) ||
483
659
  (this.providers?.[v?.chain] ? true : false));
484
660
  const vaultResponses = await Promise.all(vaultsPerAvailableProviders.map((v) => (0, getters_1.getVaultPositions)({
@@ -501,15 +677,23 @@ class AugustVaults extends core_1.AugustBase {
501
677
  final = flattened;
502
678
  else
503
679
  final = flattened.filter((v) => v?.status !== 'PENDING');
680
+ // console.log(`#getPositions::${chainId || 'all'}:`, final);
504
681
  return final;
505
682
  }
683
+ /**
684
+ *
685
+ */
506
686
  async getUserHistory({ wallet, chainId, vault, }) {
687
+ // Santize
688
+ // if (!this.authorized) throw new Error('Not authorized.');
507
689
  if (!(0, ethers_1.isAddress)(wallet))
508
690
  throw new Error(`Wallet parameter is not an address: ${String(wallet)}`);
691
+ // Get Chain ID — required for subgraph queries
509
692
  const _chainId = chainId || this.activeNetwork?.chainId;
510
693
  if (!_chainId) {
511
694
  throw new Error('Chain ID is required for getUserHistory. Pass chainId explicitly or configure an active network.');
512
695
  }
696
+ // Format history initialization
513
697
  let finalArray = [];
514
698
  function formatHistory(history) {
515
699
  return history.map((h) => ({
@@ -522,10 +706,17 @@ class AugustVaults extends core_1.AugustBase {
522
706
  transactionHash: h.transactionHash_,
523
707
  }));
524
708
  }
709
+ // Helper function to fetch history for a vault
710
+ // For LayerZero-enabled vaults (coreUSDC, upUSDC), queries BOTH the standard
711
+ // subgraph and the LayerZero subgraph, since deposits can be either same-chain
712
+ // or cross-chain via LayerZero
525
713
  const fetchVaultHistory = async (vaultAddress, vaultChainId) => {
714
+ // Always query the standard subgraph
526
715
  const provider = (0, core_1.createProvider)(this.providers?.[vaultChainId]);
527
716
  const standardHistory = await (0, vaults_1.getSubgraphUserHistory)(wallet, provider, vaultAddress);
528
717
  const formattedStandard = formatHistory(standardHistory);
718
+ // If this vault also supports LayerZero cross-chain deposits,
719
+ // query the LayerZero subgraph and merge results
529
720
  const layerZeroVaultKey = (0, deposits_1.isLayerZeroVault)(vaultAddress);
530
721
  if (layerZeroVaultKey) {
531
722
  try {
@@ -539,6 +730,7 @@ class AugustVaults extends core_1.AugustBase {
539
730
  type: 'deposit',
540
731
  transactionHash: deposit.transactionHash_,
541
732
  }));
733
+ // For earnAUSD, also query LayerZero redeems
542
734
  let formattedLayerZeroRedeems = [];
543
735
  if (layerZeroVaultKey === 'earnAUSD') {
544
736
  try {
@@ -557,6 +749,9 @@ class AugustVaults extends core_1.AugustBase {
557
749
  core_1.Logger.log.warn('getUserHistory:layerzero:redeems', `Failed to fetch LayerZero redeems for earnAUSD: ${redeemError.message}`);
558
750
  }
559
751
  }
752
+ // Deduplicate against standard subgraph history only — LZ deposits and
753
+ // LZ redeems are not deduped against each other because a single tx can
754
+ // legitimately emit both a Deposited and a Redeemed event.
560
755
  const seenTxHashes = new Set(formattedStandard.map((h) => h.transactionHash?.toLowerCase()));
561
756
  const uniqueLayerZero = formattedLayerZero.filter((h) => !seenTxHashes.has(h.transactionHash?.toLowerCase()));
562
757
  const uniqueLayerZeroRedeems = formattedLayerZeroRedeems.filter((h) => !seenTxHashes.has(h.transactionHash?.toLowerCase()));
@@ -567,17 +762,21 @@ class AugustVaults extends core_1.AugustBase {
567
762
  ];
568
763
  }
569
764
  catch (error) {
765
+ // If LayerZero query fails, still return standard history
570
766
  core_1.Logger.log.warn('getUserHistory:layerzero', `Failed to fetch LayerZero deposits for ${layerZeroVaultKey}: ${error.message}`);
571
767
  return formattedStandard;
572
768
  }
573
769
  }
574
770
  return formattedStandard;
575
771
  };
772
+ // If vault is provided, return history for that vault
576
773
  if (vault) {
577
774
  finalArray = await fetchVaultHistory(vault, chainId);
578
775
  }
579
776
  else {
777
+ // Fetch all vaults
580
778
  const allVaults = await (0, core_1.fetchTokenizedVaults)(undefined, this.headers, false, false);
779
+ // If chainId is provided, return history for all vaults on that chain
581
780
  if (chainId) {
582
781
  const vaultsPerChain = allVaults.filter((v) => v.chain === chainId);
583
782
  const vaultResponses = await Promise.all(vaultsPerChain.map((v) => fetchVaultHistory(v.address, v.chain)));
@@ -585,6 +784,8 @@ class AugustVaults extends core_1.AugustBase {
585
784
  finalArray = flattened;
586
785
  }
587
786
  else {
787
+ // Else, fetch all history for all vaults across all initialized chains
788
+ // LayerZero vaults query subgraphs directly and don't need a provider
588
789
  const vaultsPerAvailableProviders = allVaults.filter((v) => this.providers?.[v?.chain] || (0, deposits_1.isLayerZeroVault)(v.address));
589
790
  const vaultResponses = await Promise.all(vaultsPerAvailableProviders.map((v) => fetchVaultHistory(v.address, v.chain)));
590
791
  const flattened = vaultResponses.flat();
@@ -594,6 +795,11 @@ class AugustVaults extends core_1.AugustBase {
594
795
  core_1.Logger.log.info('getUserHistory', `${wallet}::${finalArray.length}`);
595
796
  return finalArray;
596
797
  }
798
+ /**
799
+ * Get lifetime PnL for a user in a specific vault.
800
+ * @param props Vault address, wallet address, and optional chain ID
801
+ * @returns Lifetime PnL data including realized and unrealized PnL
802
+ */
597
803
  async getVaultUserLifetimePnl({ vault, wallet, chainId, }) {
598
804
  if (!(0, ethers_1.isAddress)(wallet))
599
805
  throw new Error(`Wallet parameter is not an address: ${String(wallet)}`);
@@ -616,6 +822,12 @@ class AugustVaults extends core_1.AugustBase {
616
822
  coingeckoKey: this.keys?.coingecko,
617
823
  });
618
824
  }
825
+ /**
826
+ * Get PnL for a vault (vault-level, not user-specific).
827
+ * Returns the vault's overall profit and loss across all users.
828
+ * @param props Vault address and optional chain ID
829
+ * @returns Vault PnL in USD and notional value
830
+ */
619
831
  async getVaultPnl({ vault, chainId, }) {
620
832
  if (!(0, ethers_1.isAddress)(vault))
621
833
  throw new Error(`Vault parameter is not an address: ${String(vault)}`);
@@ -634,9 +846,15 @@ class AugustVaults extends core_1.AugustBase {
634
846
  },
635
847
  });
636
848
  }
849
+ /**
850
+ *
851
+ */
637
852
  async getUserTransfers({ wallet, chainId, vault, options, }) {
853
+ // Santize
854
+ // if (!this.authorized) throw new Error('Not authorized.');
638
855
  if (!(0, ethers_1.isAddress)(wallet))
639
856
  throw new Error(`Wallet parameter is not an address: ${String(wallet)}`);
857
+ // Format history initialization
640
858
  let finalArray = [];
641
859
  function formatTransfers(transfers) {
642
860
  return transfers.map((t) => ({
@@ -650,13 +868,16 @@ class AugustVaults extends core_1.AugustBase {
650
868
  transactionHash: t.transactionHash_,
651
869
  }));
652
870
  }
871
+ // If vault is provided, return history for that vault
653
872
  if (vault) {
654
873
  const provider = (0, core_1.createProvider)(this.providers?.[chainId]);
655
874
  const userHistory = await (0, vaults_1.getSubgraphUserTransfers)(wallet, provider, vault);
656
875
  finalArray = formatTransfers(userHistory);
657
876
  }
658
877
  else {
878
+ // Fetch all vaults
659
879
  const allVaults = await (0, core_1.fetchTokenizedVaults)(undefined, this.headers, false, false);
880
+ // If chainId is provided, return history for all vaults on that chain
660
881
  if (chainId) {
661
882
  const vaultsPerChain = allVaults.filter((v) => v.chain === chainId);
662
883
  const vaultResponses = await Promise.all(vaultsPerChain.map(async (v) => {
@@ -668,6 +889,7 @@ class AugustVaults extends core_1.AugustBase {
668
889
  finalArray = formatTransfers(flattened);
669
890
  }
670
891
  else {
892
+ // Else, fetch all history for all vaults across all initialized chains
671
893
  const vaultsPerAvailableProviders = allVaults.filter((v) => this.providers?.[v?.chain] ? true : false);
672
894
  const vaultResponses = await Promise.all(vaultsPerAvailableProviders.map(async (v) => {
673
895
  const provider = (0, core_1.createProvider)(this.providers?.[v.chain]);
@@ -681,6 +903,12 @@ class AugustVaults extends core_1.AugustBase {
681
903
  core_1.Logger.log.info('getUserTransfers', `${wallet}::${finalArray.length}`);
682
904
  return finalArray;
683
905
  }
906
+ /**
907
+ * @function getStakingPositions gets all available reward staking positions
908
+ * @param wallet optionally passed user wallet address
909
+ * @param chainId optionally passed chainId
910
+ * @returns all available staking positions for connected or passed network(s)
911
+ */
684
912
  async getStakingPositions(wallet, chainId) {
685
913
  if (chainId) {
686
914
  const positions = await (0, getters_1.getRewardsStakingPositions)({
@@ -699,6 +927,12 @@ class AugustVaults extends core_1.AugustBase {
699
927
  }));
700
928
  return positions.flat();
701
929
  }
930
+ /**
931
+ * @function getVaultTvl gets the vault/pool TVL, both current and historical
932
+ * @param vault pool/vault contract address
933
+ * @param historical (optional) When passed, returns the historical records of the pool/vault TVL
934
+ * @returns an object or array of objects containing the TVL and timestamp
935
+ */
702
936
  async getVaultTvl({ vault, chainId, historical, }) {
703
937
  if (!this.authorized)
704
938
  throw new Error('Not authorized.');
@@ -724,6 +958,12 @@ class AugustVaults extends core_1.AugustBase {
724
958
  historical: historical,
725
959
  });
726
960
  }
961
+ /**
962
+ * @function getYieldLastRealizedOn gets the timestamp when yield was last realized for a vault
963
+ * @param vault Vault contract address
964
+ * @param chainId Optional chain ID (uses active network if not provided)
965
+ * @returns Timestamp (Unix timestamp in seconds) when yield was last realized
966
+ */
727
967
  async getYieldLastRealizedOn({ vault, chainId, }) {
728
968
  const rpcUrl = chainId
729
969
  ? this.providers?.[chainId]
@@ -740,6 +980,27 @@ class AugustVaults extends core_1.AugustBase {
740
980
  },
741
981
  });
742
982
  }
983
+ /**
984
+ * Gets borrower health-factor data for vaults on a chain, optionally
985
+ * scoped to a single vault.
986
+ *
987
+ * Pass `vault` whenever the caller knows which pool it cares about —
988
+ * this skips the all-vaults cross-chain fanout and only reads the loans
989
+ * for that one pool. The response map is keyed by **lowercased** vault
990
+ * address; look entries up with `address.toLowerCase()`.
991
+ *
992
+ * Individual loan failures (bad/test loan contracts, unrecognized
993
+ * borrowers) are isolated and logged rather than rejecting the batch.
994
+ *
995
+ * @param chainId Optional chain to scope the read to. When omitted,
996
+ * iterates the SDK's configured providers and returns the flattened
997
+ * list (legacy shape — prefer passing a chain).
998
+ * @param vault Optional vault address. When provided alongside
999
+ * `chainId`, only that vault's data is fetched.
1000
+ * @returns When `chainId` is set, an object map of lowercased vault
1001
+ * address → array of borrower-health-factor rows. When `chainId` is
1002
+ * omitted, a flat array (legacy behavior, kept for backward compat).
1003
+ */
743
1004
  async getVaultBorrowerHealthFactor(chainId, vault) {
744
1005
  if (chainId) {
745
1006
  const health_factors = await (0, getters_1.getHealthFactorOfBorrowersByVault)({
@@ -769,6 +1030,11 @@ class AugustVaults extends core_1.AugustBase {
769
1030
  }));
770
1031
  return health_factors.flat();
771
1032
  }
1033
+ /**
1034
+ * @function getUserPoints fetches user points from the backend API
1035
+ * @param userAddress User wallet address
1036
+ * @returns Points data from the backend API
1037
+ */
772
1038
  async getUserPoints(userAddress) {
773
1039
  const { getUserPoints } = await Promise.resolve().then(() => __importStar(require('./getters')));
774
1040
  return await getUserPoints({
@@ -782,6 +1048,22 @@ class AugustVaults extends core_1.AugustBase {
782
1048
  },
783
1049
  });
784
1050
  }
1051
+ /**
1052
+ * Register a user for the points program, authenticated by a wallet signature.
1053
+ *
1054
+ * The caller produces a personal_sign signature over a canonical message
1055
+ * built from these primitives — see `registerUserForPoints` in
1056
+ * `./getters` for the exact template and a worked example.
1057
+ *
1058
+ * @param userAddress EVM wallet address being registered.
1059
+ * @param referrerAddress Optional referrer EVM address.
1060
+ * @param chainId Chain on which the wallet signed; powers the EIP-1271
1061
+ * fallback for smart-contract wallets and pins the signature cross-chain.
1062
+ * @param signature 0x-prefixed hex personal_sign signature over the canonical message.
1063
+ * @param nonce Single-use random string (8–128 chars).
1064
+ * @param expiry Unix seconds; must be in the future, within the backend's TTL.
1065
+ * @returns Raw `Response` from the backend.
1066
+ */
785
1067
  async registerUserForPoints(userAddress, referrerAddress, chainId, signature, nonce, expiry) {
786
1068
  const { registerUserForPoints } = await Promise.resolve().then(() => __importStar(require('./getters')));
787
1069
  return await registerUserForPoints({
@@ -800,6 +1082,11 @@ class AugustVaults extends core_1.AugustBase {
800
1082
  },
801
1083
  });
802
1084
  }
1085
+ /**
1086
+ * @function fetchPointsLeaderboard fetches the points leaderboard data
1087
+ * @param params Optional parameters for pagination and sorting
1088
+ * @returns Leaderboard response data
1089
+ */
803
1090
  async fetchPointsLeaderboard(params) {
804
1091
  const { fetchPointsLeaderboard } = await Promise.resolve().then(() => __importStar(require('./getters')));
805
1092
  return await fetchPointsLeaderboard({
@@ -813,6 +1100,18 @@ class AugustVaults extends core_1.AugustBase {
813
1100
  },
814
1101
  });
815
1102
  }
1103
+ /**
1104
+ * Get annualized APY metrics for a vault.
1105
+ *
1106
+ * Supported Vaults: cUSDO, tETH, wstETH, rsETH
1107
+ *
1108
+ * @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
1109
+ * These fields will be removed on 2026-01-01.
1110
+ * Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
1111
+ *
1112
+ * @param vault Vault address
1113
+ * @returns Annualized APY data including liquidity APY
1114
+ */
816
1115
  async getVaultAnnualizedApy(vault) {
817
1116
  if (!vault)
818
1117
  throw new Error('Vault address parameter is undefined.');
@@ -831,6 +1130,11 @@ class AugustVaults extends core_1.AugustBase {
831
1130
  },
832
1131
  });
833
1132
  }
1133
+ /**
1134
+ * Get summary data for a vault (name, type, chain, recent returns).
1135
+ * @param vault Vault address
1136
+ * @returns Vault summary data
1137
+ */
834
1138
  async getVaultSummary(vault) {
835
1139
  if (!vault)
836
1140
  throw new Error('Vault address parameter is undefined.');
@@ -849,6 +1153,12 @@ class AugustVaults extends core_1.AugustBase {
849
1153
  },
850
1154
  });
851
1155
  }
1156
+ /**
1157
+ * Get withdrawal summary and pending queue for a vault.
1158
+ * @param vault Vault address
1159
+ * @param chainId Chain ID (will be converted to chain name)
1160
+ * @returns Withdrawal summary and pending queue
1161
+ */
852
1162
  async getVaultWithdrawals(vault, chainId) {
853
1163
  if (!vault)
854
1164
  throw new Error('Vault address parameter is undefined.');
@@ -869,6 +1179,13 @@ class AugustVaults extends core_1.AugustBase {
869
1179
  },
870
1180
  });
871
1181
  }
1182
+ /**
1183
+ * Fetch pending redemptions for a vault with liquidity analysis.
1184
+ * @param vault - Vault contract address
1185
+ * @param pastDays - Number of past days to include (default 7, min 1, max 30)
1186
+ * @param futureDays - Number of future days to include (default 14, min 1, max 30)
1187
+ * @returns Pending redemptions grouped by date with liquidity summary
1188
+ */
872
1189
  async getVaultPendingRedemptions({ vault, pastDays, futureDays, }) {
873
1190
  if (!vault)
874
1191
  throw new Error('Vault address parameter is undefined.');
@@ -888,6 +1205,13 @@ class AugustVaults extends core_1.AugustBase {
888
1205
  },
889
1206
  });
890
1207
  }
1208
+ /**
1209
+ * Preview the amount of assets that would be received for redeeming shares (queued redemption).
1210
+ * @param vault Vault contract address
1211
+ * @param sharesAmount Amount of shares to redeem (human-readable, raw bigint, or string)
1212
+ * @param chainId Optional chain ID (uses active network if not provided)
1213
+ * @returns The amount of assets as INormalizedNumber { normalized, raw }
1214
+ */
891
1215
  async previewRedemption({ vault, sharesAmount, chainId, }) {
892
1216
  const rpcUrl = chainId
893
1217
  ? this.providers?.[chainId]
@@ -901,6 +1225,28 @@ class AugustVaults extends core_1.AugustBase {
901
1225
  },
902
1226
  });
903
1227
  }
1228
+ /**
1229
+ * Get all withdrawal requests for a vault with deterministic status tracking.
1230
+ *
1231
+ * Matches requests to processed events by `(receiver, claimableDate)` tuple.
1232
+ *
1233
+ * **Status values:**
1234
+ * - `'processed'` — Matching `WithdrawalProcessed` event found on-chain.
1235
+ * - `'ready_to_claim'` — Claimable date has passed, no processed event found yet.
1236
+ * - `'pending'` — Claimable date is still in the future.
1237
+ *
1238
+ * **Lookback window:** Processed events are fetched from on-chain logs, which
1239
+ * only cover a finite block range. Requests whose claimable date is older than
1240
+ * this window with no matching processed event are excluded (assumed already
1241
+ * processed). Use `lookbackBlocks` to widen or narrow the scan range.
1242
+ *
1243
+ * @param vault - Vault contract address
1244
+ * @param receiver - Optional receiver address to filter by
1245
+ * @param lookbackBlocks - Optional on-chain log lookback window in blocks.
1246
+ * Defaults to chain-specific value (e.g. 150,000 for Ethereum, 3,456,000 for Monad).
1247
+ * @param chainId - Optional chain id for the vault address
1248
+ * @returns Array of withdrawal requests with status and claimable dates
1249
+ */
904
1250
  async getWithdrawalRequestsWithStatus(vault, receiver, lookbackBlocks, chainId) {
905
1251
  if (!vault)
906
1252
  throw new Error('Vault address parameter is undefined.');
@@ -923,9 +1269,23 @@ class AugustVaults extends core_1.AugustBase {
923
1269
  },
924
1270
  });
925
1271
  }
1272
+ /**
1273
+ * Redeem vault shares for an underlying asset via instant redemption (RWA subaccount).
1274
+ * Resolves the vault address to the RwaRedeemSubaccount internally.
1275
+ * Handles vault share approval automatically.
1276
+ * @param signer - Signer / wallet object
1277
+ * @param vault - Vault contract address
1278
+ * @param asset - Redeemable asset address (e.g. USDC, USDT)
1279
+ * @param amount - Amount of vault shares to redeem
1280
+ * @param minOut - Minimum output amount in output asset units (slippage protection)
1281
+ * @param chainId - Optional chain ID (uses active network if not provided)
1282
+ * @param wait - Wait for transaction confirmation
1283
+ * @returns transaction hash
1284
+ */
926
1285
  async rwaRedeemAsset(signer, { vault, asset, amount, minOut, chainId, wait, }) {
927
1286
  if (!vault)
928
1287
  throw new Error('Vault address parameter is undefined.');
1288
+ // Fetch vault data to resolve subaccount address and decimals
929
1289
  const vaultData = await (0, getters_1.getVault)({
930
1290
  vault,
931
1291
  loans: false,
@@ -945,6 +1305,7 @@ class AugustVaults extends core_1.AugustBase {
945
1305
  throw new Error(`Vault ${vault} does not support instant redemption.`);
946
1306
  }
947
1307
  const { subaccountAddress, redeemableAssets } = vaultData.instant_redeem_config;
1308
+ // Resolve output asset decimals from config
948
1309
  const redeemableAsset = redeemableAssets.find((a) => a.address.toLowerCase() === asset.toLowerCase());
949
1310
  if (!redeemableAsset) {
950
1311
  throw new Error(`Asset ${asset} is not redeemable for vault ${vault}.`);
@@ -961,12 +1322,22 @@ class AugustVaults extends core_1.AugustBase {
961
1322
  wait,
962
1323
  });
963
1324
  }
1325
+ /**
1326
+ * Preview the output amount for an RWA instant redemption.
1327
+ * Resolves the vault address to the RwaRedeemSubaccount internally.
1328
+ * @param vault - Vault contract address
1329
+ * @param asset - Redeemable asset address (e.g. USDC, USDT)
1330
+ * @param amount - Amount of vault shares to preview
1331
+ * @param chainId - Optional chain ID (uses active network if not provided)
1332
+ * @returns normalized number of the expected output amount (in output asset decimals)
1333
+ */
964
1334
  async previewRwaRedemption({ vault, asset, amount, chainId, }) {
965
1335
  if (!vault)
966
1336
  throw new Error('Vault address parameter is undefined.');
967
1337
  const rpcUrl = chainId
968
1338
  ? this.providers?.[chainId]
969
1339
  : this.activeNetwork.rpcUrl;
1340
+ // Fetch vault data to resolve subaccount address and decimals
970
1341
  const vaultData = await (0, getters_1.getVault)({
971
1342
  vault,
972
1343
  loans: false,
@@ -986,6 +1357,7 @@ class AugustVaults extends core_1.AugustBase {
986
1357
  throw new Error(`Vault ${vault} does not support instant redemption.`);
987
1358
  }
988
1359
  const { subaccountAddress, redeemableAssets } = vaultData.instant_redeem_config;
1360
+ // Resolve output asset decimals from config
989
1361
  const redeemableAsset = redeemableAssets.find((a) => a.address.toLowerCase() === asset.toLowerCase());
990
1362
  if (!redeemableAsset) {
991
1363
  throw new Error(`Asset ${asset} is not redeemable for vault ${vault}.`);