@augustdigital/sdk 8.3.1 → 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 +7 -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 +70 -0
  170. package/lib/modules/vaults/utils.js +108 -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 +139 -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,3 +1,12 @@
1
+ /**
2
+ * TypedContract type definitions for ethers v6 with abitype.
3
+ *
4
+ * This is a local copy of types from ethers-abitype to avoid the global
5
+ * abitype module augmentation that pollutes AddressType with `string | Addressable`,
6
+ * which breaks viem type compatibility.
7
+ *
8
+ * @see https://github.com/ethers-io/ethers.js/issues/4475
9
+ */
1
10
  import type { BaseContract, ContractTransaction, ContractTransactionResponse, DeferredTopicFilter, EventFragment, FunctionFragment, Result, Overrides } from 'ethers';
2
11
  import type { Abi, AbiParametersToPrimitiveTypes, ExtractAbiEvent, ExtractAbiEventNames, ExtractAbiEvents, ExtractAbiFunction, ExtractAbiFunctionNames, ExtractAbiFunctions } from 'abitype';
3
12
  type AsArray<T> = T extends readonly unknown[] ? T : never;
@@ -11,26 +20,81 @@ export type TypedFragment<TAbi extends Abi, TFunctionName extends string, TFunct
11
20
  };
12
21
  export interface TypedContractFunction<TAbi extends Abi, TFunctionName extends string, TFunction extends ExtractAbiFunctions<TAbi> = ExtractAbiFunction<TAbi, TFunctionName>, TInputArgs extends readonly unknown[] = AsArray<AbiParametersToPrimitiveTypes<TFunction['inputs']>>, TResult = TypedContractFunctionResult<TAbi, TFunctionName>, TFragment = TypedFragment<TAbi, TFunctionName>> {
13
22
  (...args: [...TInputArgs, overrides?: Overrides]): Promise<TFunction['stateMutability'] extends 'view' | 'pure' ? TResult : ContractTransactionResponse>;
23
+ /**
24
+ * The name of the Contract method.
25
+ */
14
26
  name: TFunctionName;
27
+ /**
28
+ * The fragment of the Contract method. This will throw on ambiguous
29
+ * method names.
30
+ */
15
31
  fragment: TFragment;
32
+ /**
33
+ * Returns the fragment constrained by %%args%%. This can be used to
34
+ * resolve ambiguous method names.
35
+ */
16
36
  getFragment(...args: [...TInputArgs]): TFragment;
37
+ /**
38
+ * Returns a populated transaction that can be used to perform the
39
+ * contract method with %%args%%.
40
+ */
17
41
  populateTransaction(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransaction>;
42
+ /**
43
+ * Call the contract method with %%args%% and return the value.
44
+ *
45
+ * If the return value is a single type, it will be dereferenced and
46
+ * returned directly, otherwise the full Result will be returned.
47
+ */
18
48
  staticCall(...args: [...TInputArgs, overrides?: Overrides]): Promise<TResult>;
49
+ /**
50
+ * Send a transaction for the contract method with %%args%%.
51
+ */
19
52
  send(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransactionResponse>;
53
+ /**
54
+ * Estimate the gas to send the contract method with %%args%%.
55
+ */
20
56
  estimateGas(...args: [...TInputArgs, overrides?: Overrides]): Promise<bigint>;
57
+ /**
58
+ * Call the contract method with %%args%% and return the Result
59
+ * without any dereferencing.
60
+ */
21
61
  staticCallResult(...args: [...TInputArgs, overrides?: Overrides]): Promise<Result>;
22
62
  }
23
63
  export interface TypedContractEvent<TAbi extends Abi, TEventName extends string, TEvent extends ExtractAbiEvents<TAbi> = ExtractAbiEvent<TAbi, TEventName>, TEventArgs extends readonly unknown[] = AsArray<Partial<AbiParametersToPrimitiveTypes<TEvent['inputs']>>>> {
24
64
  (...args: [...TEventArgs]): DeferredTopicFilter;
65
+ /**
66
+ * The name of the Contract event.
67
+ */
25
68
  name: TEventName;
69
+ /**
70
+ * The fragment of the Contract event. This will throw on ambiguous
71
+ * method names.
72
+ */
26
73
  fragment: EventFragment;
74
+ /**
75
+ * Returns the fragment constrained by %%args%%. This can be used to
76
+ * resolve ambiguous event names.
77
+ */
27
78
  getFragment(...args: [...TEventArgs]): EventFragment;
28
79
  }
29
80
  export type TypedContract<TAbi extends Abi> = Omit<BaseContract, 'getFunction' | 'getEvent'> & {
30
81
  [Method in ExtractAbiFunctionNames<TAbi>]: TypedContractFunction<TAbi, Method>;
31
82
  } & {
83
+ /**
84
+ * Return the function for a given name. This is useful when a contract
85
+ * method name conflicts with a JavaScript name such as ``prototype`` or
86
+ * when using a Contract programatically.
87
+ */
32
88
  getFunction<T extends ExtractAbiFunctionNames<TAbi>>(key: T | TypedFragment<TAbi, T>): TypedContractFunction<TAbi, T>;
89
+ /**
90
+ * Return the event for a given name. This is useful when a contract
91
+ * event name conflicts with a JavaScript name such as ``prototype`` or
92
+ * when using a Contract programatically.
93
+ */
33
94
  getEvent<T extends ExtractAbiEventNames<TAbi>>(key: T | EventFragment): TypedContractEvent<TAbi, T>;
95
+ /**
96
+ * All the Events available on this contract.
97
+ */
34
98
  filters: {
35
99
  [EventName in ExtractAbiEventNames<TAbi>]: TypedContractEvent<TAbi, EventName>;
36
100
  };
@@ -1,5 +1,5 @@
1
- import { IAddress, INormalizedNumber, VaultAddress } from './web3';
2
- import { IDebankProtocolExposure, IDebankTokenExposure, IOTCPosition, IWSSubaccountCefi, IWSSubaccountLoan, IWSTokenEntry, ITokenizedVaultOperator, ITokenizedVaultEoaOperator, IHIstoricalSnapshot } from './webserver';
1
+ import type { IAddress, INormalizedNumber, VaultAddress } from './web3';
2
+ import type { IDebankProtocolExposure, IDebankTokenExposure, IOTCPosition, IWSSubaccountCefi, IWSSubaccountLoan, IWSTokenEntry, ITokenizedVaultOperator, ITokenizedVaultEoaOperator, IHIstoricalSnapshot, IApyOverride } from './webserver';
3
3
  import type { InterfaceAbi } from 'ethers';
4
4
  export interface IVaultLoan {
5
5
  vault: VaultAddress;
@@ -22,6 +22,13 @@ export interface IVaultLoan {
22
22
  isIdleCapital: boolean;
23
23
  allocation: number;
24
24
  }
25
+ /**
26
+ * One row of borrower-health-factor data for a vault. `health_factor` is
27
+ * absent when the upstream August backend has no record for `borrower`
28
+ * (e.g. test loans whose borrower is not a registered subaccount), or when
29
+ * the per-borrower fetch failed — callers must handle the undefined case
30
+ * rather than assume a numeric value is present.
31
+ */
25
32
  export interface IVaultBorrowerHealthFactor {
26
33
  borrower: IAddress;
27
34
  loan: IAddress;
@@ -72,6 +79,22 @@ export type IExposurePerCategory = {
72
79
  walletBalance: number;
73
80
  loanBalance: number;
74
81
  };
82
+ /**
83
+ * @todo clean up to minimize data transfer
84
+ * ```typescript
85
+ * {
86
+ * defi: IOctavfiPortfolio[]
87
+ * cefi: IWSSubaccountCefi[]
88
+ * otc: Record<string, IOTCPosition>
89
+ * breakdown: { // this will be total net values
90
+ * defi: number;
91
+ * cefi: number;
92
+ * otc: number;
93
+ * total: number;
94
+ * }
95
+ * }
96
+ * ```
97
+ */
75
98
  export interface IVaultAllocations {
76
99
  defi: IDebankProtocolExposure[];
77
100
  tokens: IDebankTokenExposure[];
@@ -100,9 +123,13 @@ export interface IVaultStrategist {
100
123
  logo: string;
101
124
  name: string;
102
125
  type?: string;
126
+ website_url: string | null;
103
127
  }
104
128
  export type IVaultVersion = 'evm-0' | 'evm-1' | 'evm-2' | 'sol-0' | 'sui-0' | 'stellar-0';
105
129
  export type { ChainType } from './web3';
130
+ /**
131
+ * Adapter configuration for vaults that support deposits with alternative tokens
132
+ */
106
133
  export interface IVaultAdapterConfig {
107
134
  lpTokenAddress?: IAddress;
108
135
  isNativeTokenDeposit: boolean;
@@ -118,9 +145,14 @@ export interface IVaultAdapterConfig {
118
145
  export interface IVault {
119
146
  max_drawdown?: number | null;
120
147
  historical_apy?: Record<number, number> | null;
148
+ /** @deprecated Use getVaultHistoricalTimeseries instead */
121
149
  historical_snapshots?: IHIstoricalSnapshot[];
122
150
  depositCap?: INormalizedNumber;
123
151
  maxDepositAmount?: INormalizedNumber;
152
+ /**
153
+ * Vault contract address. May be an EVM hex address, Solana base58 address,
154
+ * or Stellar base32 address depending on the vault's chain.
155
+ */
124
156
  address: VaultAddress;
125
157
  chainId: number;
126
158
  name: string;
@@ -194,7 +226,10 @@ export interface IVault {
194
226
  latest_reported_tvl?: number | null;
195
227
  cachedAt?: string | null;
196
228
  showCapFilled?: boolean | null;
229
+ /** Controls how the vault's APY is displayed; null when the backend has not set an override. */
230
+ apyOverride?: IApyOverride | null;
197
231
  programId?: string;
232
+ /** Instant redemption config, populated from backend instant_redeem_config */
198
233
  instant_redeem_config?: {
199
234
  subaccountAddress: IAddress;
200
235
  outputAssetSymbol: string;
@@ -263,15 +298,29 @@ export interface IVaultPnl {
263
298
  totalPnl: INormalizedNumber;
264
299
  pnlUsd: number;
265
300
  }
301
+ /**
302
+ * Response for GET /tokenized_vault/annualized_apy/{vault_address}
303
+ *
304
+ * Supported Vaults: cUSDO, tETH, wstETH, rsETH
305
+ *
306
+ * @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` fields are deprecated.
307
+ * These fields will be removed on 2026-01-01.
308
+ * Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
309
+ */
266
310
  export interface IVaultAnnualizedApy {
267
311
  vaultAddress: IAddress;
268
312
  liquidityApy: number;
269
313
  annualizedApy: number;
314
+ /** @deprecated Use `liquidAPY7Day` instead. Will be removed on 2026-01-01. */
270
315
  hgETH7dLiquidAPY?: number;
316
+ /** @deprecated Use `liquidAPY30Day` instead. Will be removed on 2026-01-01. */
271
317
  hgETH30dLiquidAPY?: number;
272
318
  liquidAPY7Day?: number;
273
319
  liquidAPY30Day?: number;
274
320
  }
321
+ /**
322
+ * Response for GET /tokenized_vault/vault_summary/{vault_address}
323
+ */
275
324
  export interface IVaultSummary {
276
325
  vaultAddress: IAddress;
277
326
  name: string;
@@ -283,6 +332,9 @@ export interface IVaultSummary {
283
332
  month: number;
284
333
  };
285
334
  }
335
+ /**
336
+ * Response for GET /withdrawals/{chain}/{vault_address}
337
+ */
286
338
  export interface IVaultWithdrawals {
287
339
  vaultAddress: IAddress;
288
340
  chain: string;
@@ -295,6 +347,9 @@ export interface IVaultWithdrawals {
295
347
  receiver: IAddress;
296
348
  }>;
297
349
  }
350
+ /**
351
+ * Response for GET /vaults/\{vault_addr\}/pending-redemptions
352
+ */
298
353
  export interface IVaultPendingRedemptions {
299
354
  vault: {
300
355
  address: string;
@@ -326,38 +381,120 @@ export interface IVaultPendingRedemptions {
326
381
  isOverdue: boolean;
327
382
  }>;
328
383
  }
384
+ /**
385
+ * One unrealized-PnL snapshot for a vault, computed by the August backend
386
+ * from periodic vault state. `timestamp` is an ISO-8601 datetime; monetary
387
+ * fields are denominated in the vault's reference asset
388
+ * (`referenceAsset`) except `assetPrice`, which is the asset's USD price.
389
+ */
390
+ export type IUnrealizedPnlSnapshot = {
391
+ timestamp: string;
392
+ vaultName: string;
393
+ vaultAddress: string;
394
+ strategistName: string | null;
395
+ referenceAsset: string;
396
+ assetPrice: number;
397
+ tvlOnVault: number;
398
+ currentRedeemRatio: number;
399
+ actualTvl: number;
400
+ adjustedRedeemRatio: number;
401
+ unrealizedPnl: number;
402
+ unrealizedPnlInAsset: number;
403
+ };
404
+ /**
405
+ * Vault metadata item from upshift API
406
+ */
329
407
  export interface IVaultMetadataItem {
330
408
  symbol: string;
331
409
  subgraph: string;
332
410
  address: string;
333
411
  }
412
+ /**
413
+ * Response type for getVaultMetadata
414
+ * Keys are lowercase of the symbol value
415
+ */
334
416
  export type IVaultMetadata = Record<string, IVaultMetadataItem>;
417
+ /**
418
+ * Numeric vault-type tag used by the on-chain `SwapRouter` to branch between
419
+ * the ERC-4626 (`deposit(uint256, address)`) and multi-asset
420
+ * (`deposit(address, uint256, address)`) deposit interfaces.
421
+ *
422
+ * Values match the contract's `VAULT_TYPE_ERC4626` / `VAULT_TYPE_TOKENIZED_VAULT_V2`
423
+ * constants exactly. Set by an admin per-vault via `enableVault` and looked
424
+ * up via `vaultInfo(vaultAddr).vaultType`. SDK callers normally do not pass
425
+ * this — the router resolves it internally.
426
+ */
335
427
  export declare enum SwapRouterVaultType {
336
428
  ERC4626 = 1,
337
429
  TokenizedVaultV2 = 2
338
430
  }
431
+ /**
432
+ * One swap leg passed to `SwapRouter.swapAndDeposit`.
433
+ *
434
+ * The router pulls `amountIn` of `tokenIn` from the caller, approves the
435
+ * configured `tokenTransferProxies[router]` address, and calls `router` with
436
+ * `payload`. Output is measured by balance-diff and must clear `minAmountOut`
437
+ * or the call reverts with `SlippageError`.
438
+ *
439
+ * For a single-hop swap, `tokenOut` is typically the vault's reference asset.
440
+ * For multi-hop, intermediate legs use any whitelisted token.
441
+ */
339
442
  export interface ISwapParams {
443
+ /** ERC-20 address pulled from the caller. Must be whitelisted via `whitelistedTokens`. */
340
444
  tokenIn: IAddress;
445
+ /** ERC-20 address the router is expected to produce. */
341
446
  tokenOut: IAddress;
447
+ /** Input amount in `tokenIn`'s smallest unit (no decimals). */
342
448
  amountIn: bigint;
449
+ /** Minimum acceptable `tokenOut` output. Below this the call reverts. */
343
450
  minAmountOut: bigint;
451
+ /** Whitelisted DEX router target (enabled via `enableRouter`). */
344
452
  router: IAddress;
453
+ /** ABI-encoded calldata to invoke on `router`. */
345
454
  payload: `0x${string}`;
346
455
  }
456
+ /**
457
+ * Common options shared by every public SwapRouter SDK method.
458
+ */
347
459
  export interface ISwapRouterBaseOptions {
460
+ /** EVM chain ID — must have an entry in `SWAP_ROUTER_ADDRESSES`. */
348
461
  chainId: number;
462
+ /** August vault address. Must be registered via `enableVault` on the router. */
349
463
  vault: IAddress;
464
+ /** Address that receives the minted vault shares. */
350
465
  receiver: IAddress;
466
+ /**
467
+ * 32-byte origin/referral code registered via `addOrigin`. Drives the
468
+ * origin-fee accrual. Defaults to {@link ORIGIN_CODES.default} when omitted.
469
+ */
351
470
  originCode?: `0x${string}`;
471
+ /** When `true`, the helper awaits a single confirmation before returning. */
352
472
  wait?: boolean;
353
473
  }
474
+ /**
475
+ * Options for `swapAndDeposit` — ERC-20 in, vault reference asset out.
476
+ */
354
477
  export interface ISwapAndDepositOptions extends ISwapRouterBaseOptions {
478
+ /** One or more swap legs. Capped by the contract's `MAX_SWAPS`. */
355
479
  swaps: ISwapParams[];
356
480
  }
481
+ /**
482
+ * Options for `depositViaSwapRouter` — direct deposit (no swap) of an
483
+ * already-held asset, routed through the SwapRouter so origin/swap-fee
484
+ * accounting still applies.
485
+ */
357
486
  export interface ISwapRouterDirectDepositOptions extends ISwapRouterBaseOptions {
487
+ /** Deposited ERC-20 asset. For ERC-4626 vaults this must equal the reference asset. */
358
488
  asset: IAddress;
489
+ /** Amount in `asset`'s smallest unit. */
359
490
  amount: bigint;
360
491
  }
492
+ /**
493
+ * Options for `depositNativeViaSwapRouter` — wraps `msg.value` to the
494
+ * chain's wrapped-native token and deposits. Only valid when the vault's
495
+ * reference asset equals `wrappedNativeTokenAddress`.
496
+ */
361
497
  export interface ISwapRouterNativeDepositOptions extends ISwapRouterBaseOptions {
498
+ /** Native token amount in wei. Sent as `msg.value`. */
362
499
  amount: bigint;
363
500
  }
@@ -6,6 +6,16 @@ var VaultRedemptionStatus;
6
6
  VaultRedemptionStatus["AWAITING_COOLDOWN"] = "awaiting_cooldown";
7
7
  VaultRedemptionStatus["READY_TO_CLAIM"] = "ready_to_claim";
8
8
  })(VaultRedemptionStatus || (exports.VaultRedemptionStatus = VaultRedemptionStatus = {}));
9
+ /**
10
+ * Numeric vault-type tag used by the on-chain `SwapRouter` to branch between
11
+ * the ERC-4626 (`deposit(uint256, address)`) and multi-asset
12
+ * (`deposit(address, uint256, address)`) deposit interfaces.
13
+ *
14
+ * Values match the contract's `VAULT_TYPE_ERC4626` / `VAULT_TYPE_TOKENIZED_VAULT_V2`
15
+ * constants exactly. Set by an admin per-vault via `enableVault` and looked
16
+ * up via `vaultInfo(vaultAddr).vaultType`. SDK callers normally do not pass
17
+ * this — the router resolves it internally.
18
+ */
9
19
  var SwapRouterVaultType;
10
20
  (function (SwapRouterVaultType) {
11
21
  SwapRouterVaultType[SwapRouterVaultType["ERC4626"] = 1] = "ERC4626";
@@ -1,8 +1,16 @@
1
1
  import { Signer, Provider } from 'ethers';
2
2
  export type IAddress = `0x${string}`;
3
+ /**
4
+ * Address type for vault contracts across all supported chains.
5
+ * EVM vaults use `0x`-prefixed hex addresses, Solana vaults use base58,
6
+ * and Stellar vaults use 56-character base32 addresses (G/C prefix).
7
+ *
8
+ * Use this instead of `IAddress` when the address may belong to any chain.
9
+ */
3
10
  export type VaultAddress = string;
4
11
  export type IChainId = number;
5
12
  export type ChainType = 'evm' | 'solana' | 'sui' | 'stellar';
13
+ /** Runtime type guard for ChainType values (e.g. at API deserialization boundaries). */
6
14
  export declare function isChainType(value: unknown): value is ChainType;
7
15
  export type IChainObj = {
8
16
  chainId: number;
package/lib/types/web3.js CHANGED
@@ -7,6 +7,7 @@ const VALID_CHAIN_TYPES = new Set([
7
7
  'sui',
8
8
  'stellar',
9
9
  ]);
10
+ /** Runtime type guard for ChainType values (e.g. at API deserialization boundaries). */
10
11
  function isChainType(value) {
11
12
  return typeof value === 'string' && VALID_CHAIN_TYPES.has(value);
12
13
  }
@@ -1,5 +1,15 @@
1
1
  import { IUserRoles } from './user';
2
2
  import { IAddress, type ChainType, type IStellarNetwork } from './web3';
3
+ /**
4
+ * Table of Contents
5
+ * 1) Subaccounts
6
+ * 2) Metrics
7
+ * 3) Tokens
8
+ * 4) Users
9
+ * 5) Statuses
10
+ * 6) Integrations
11
+ * 7) Lending Pools
12
+ */
3
13
  export type IHIstoricalSnapshot = {
4
14
  total_assets: number;
5
15
  total_shares: number;
@@ -14,6 +24,9 @@ export interface IWSMonitorHeaders {
14
24
  'x-user-id'?: string;
15
25
  'x-environment'?: string;
16
26
  }
27
+ /**
28
+ * Subaccounts
29
+ */
17
30
  export type IWSSubaccountPermission = {
18
31
  name: string;
19
32
  chain: number;
@@ -117,6 +130,9 @@ export interface IWSSubaccountLoan {
117
130
  payment_interval: number;
118
131
  lender_apr: number;
119
132
  }
133
+ /**
134
+ * Metrics
135
+ */
120
136
  export type IWSMetricsPnlAttributes = {
121
137
  pnl: number;
122
138
  percent_return: number;
@@ -289,6 +305,9 @@ export type IWSMetricsTimeseries = {
289
305
  total_pnl_7d: number | null;
290
306
  total_pnl_30d: number | null;
291
307
  };
308
+ /**
309
+ * Tokens
310
+ */
292
311
  export type IWSTokenEntry = {
293
312
  symbol: string;
294
313
  address: `0x${string}`;
@@ -306,6 +325,9 @@ export type IWSTokenPrice = {
306
325
  price: number;
307
326
  dt: string;
308
327
  };
328
+ /**
329
+ * Users
330
+ */
309
331
  export type IWSUserSubaccount = {
310
332
  internal_name: string;
311
333
  friendly_name: string;
@@ -332,12 +354,21 @@ export type IWSUser = {
332
354
  disabled: boolean;
333
355
  id: string;
334
356
  };
357
+ /**
358
+ * Statuses
359
+ */
335
360
  export type IWSFireblocksTxStatus = 'SUBMITTED' | 'PENDING_AML_SCREENING' | 'PENDING_AUTHORIZATION' | 'QUEUED' | 'PENDING_SIGNATURE' | 'PENDING_3RD_PARTY_MANUAL_APPROVAL' | 'PENDING_3RD_PARTY' | 'BROADCASTING' | 'CONFIRMING' | 'COMPLETED' | 'CANCELLING' | 'BLOCKED' | 'REJECTED' | 'FAILED';
361
+ /**
362
+ * Integrations
363
+ */
336
364
  export interface IWSIntegrationMorphoApy {
337
365
  apy: number;
338
366
  vault_positions: any[];
339
367
  token: IWSTokenEntry;
340
368
  }
369
+ /**
370
+ * Lending Pools
371
+ */
341
372
  export interface IWSVaultLoan {
342
373
  address: IAddress;
343
374
  lender: IAddress;
@@ -392,14 +423,23 @@ export interface ITokenizedVaultEoaOperator {
392
423
  id: string;
393
424
  name: string;
394
425
  }
426
+ /**
427
+ * Controls how the vault's APY is displayed in the UI.
428
+ * When `is_show_target_apy` is true, the UI should show a target/projected APY.
429
+ * When `is_show_hardcoded_apy` is true, `hardcoded_apy` overrides the computed APY.
430
+ */
395
431
  export interface IApyOverride {
432
+ /** Whether to display a target APY rather than historical performance. */
396
433
  is_show_target_apy: boolean;
434
+ /** Whether to display `hardcoded_apy` in place of the computed APY. */
397
435
  is_show_hardcoded_apy: boolean;
436
+ /** The fixed APY value to display when `is_show_hardcoded_apy` is true, or null. */
398
437
  hardcoded_apy: number | null;
399
438
  }
400
439
  export interface ITokenizedVaultStrategist {
401
440
  strategist_name: string;
402
441
  strategist_logo: string;
442
+ /** URL of the strategist's website, or null if not provided. */
403
443
  website_url: string | null;
404
444
  id: string;
405
445
  }
@@ -534,6 +574,7 @@ export interface ITokenizedVault {
534
574
  stellar_vault_metadata?: IStellarVaultMetadata | null;
535
575
  lagDuration: number;
536
576
  historical_apy: Record<number, number> | null;
577
+ /** @deprecated Use getVaultHistoricalTimeseries instead */
537
578
  historical_snapshots?: IHIstoricalSnapshot[];
538
579
  max_drawdown: number | null;
539
580
  daily_pnl_per_share: Record<string, number>;
@@ -552,8 +593,12 @@ export interface ITokenizedVault {
552
593
  }>;
553
594
  };
554
595
  show_cap_filled: boolean | null;
596
+ /** Controls APY display behaviour in the UI; null when the server has not set an override. */
555
597
  apy_override: IApyOverride | null;
556
598
  }
599
+ /**
600
+ * @deprecated
601
+ */
557
602
  export interface IWSVaultHistoricalApy {
558
603
  data: {
559
604
  labels: string[];
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@augustdigital/sdk",
3
- "version": "8.3.1",
3
+ "version": "8.5.0",
4
4
  "main": "lib/index.js",
5
+ "types": "lib/sdk.d.ts",
5
6
  "keywords": [
6
7
  "augustdigital",
7
8
  "sdk",
@@ -59,11 +60,11 @@
59
60
  }
60
61
  },
61
62
  "scripts": {
62
- "build": "tsc",
63
+ "build": "tsc && node ../../scripts/run-api-extractor.mjs --only sdk",
63
64
  "test": "pnpm build && cross-env node dist/test",
64
- "test:jest": "jest",
65
- "test:jest:watch": "jest --watch",
66
- "test:jest:coverage": "jest --coverage",
65
+ "test:jest": "jest --config jest.config.unit.js",
66
+ "test:jest:watch": "jest --config jest.config.unit.js --watch",
67
+ "test:jest:coverage": "jest --config jest.config.unit.js --coverage",
67
68
  "test:forknet": "node tests/forknet/run.mjs",
68
69
  "clean": "rm -rf ./lib",
69
70
  "format": "biome check --write .",