@augustdigital/sdk 8.3.2 → 8.6.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 (213) hide show
  1. package/README.md +207 -117
  2. package/lib/abis/ERC20_Bytes32.d.ts +4 -0
  3. package/lib/abis/ERC20_Bytes32.js +4 -0
  4. package/lib/abis/ERC4626.d.ts +1 -0
  5. package/lib/abis/ERC4626.js +1 -0
  6. package/lib/abis/ERC721.d.ts +1 -0
  7. package/lib/abis/ERC721.js +1 -0
  8. package/lib/abis/FeeOracle.js +1 -0
  9. package/lib/abis/LendingPool.js +1 -0
  10. package/lib/abis/LendingPoolV2.js +1 -0
  11. package/lib/abis/Multicall3.js +3 -0
  12. package/lib/abis/OFT.d.ts +20 -0
  13. package/lib/abis/OFT.js +20 -0
  14. package/lib/abis/SmartAccount.d.ts +1 -0
  15. package/lib/abis/SmartAccount.js +3 -0
  16. package/lib/abis/SwapRouter.d.ts +1 -0
  17. package/lib/abis/SwapRouter.js +1 -0
  18. package/lib/abis/UniversalSignatureValidator.js +3 -0
  19. package/lib/abis/index.d.ts +5 -0
  20. package/lib/abis/index.js +5 -0
  21. package/lib/adapters/evm/getters.d.ts +17 -2
  22. package/lib/adapters/evm/getters.js +35 -3
  23. package/lib/adapters/evm/index.d.ts +266 -4
  24. package/lib/adapters/evm/index.js +270 -1
  25. package/lib/adapters/evm/utils.d.ts +6 -0
  26. package/lib/adapters/evm/utils.js +7 -0
  27. package/lib/adapters/solana/constants.d.ts +1 -1
  28. package/lib/adapters/solana/constants.js +4 -1
  29. package/lib/adapters/solana/getters.d.ts +9 -1
  30. package/lib/adapters/solana/getters.js +21 -0
  31. package/lib/adapters/solana/idl/vault-idl.js +9 -0
  32. package/lib/adapters/solana/index.d.ts +59 -4
  33. package/lib/adapters/solana/index.js +61 -0
  34. package/lib/adapters/solana/types.d.ts +1 -1
  35. package/lib/adapters/solana/utils.d.ts +31 -3
  36. package/lib/adapters/solana/utils.js +79 -4
  37. package/lib/adapters/solana/vault.actions.d.ts +23 -4
  38. package/lib/adapters/solana/vault.actions.js +47 -3
  39. package/lib/adapters/stellar/actions.d.ts +26 -1
  40. package/lib/adapters/stellar/actions.js +33 -0
  41. package/lib/adapters/stellar/constants.d.ts +26 -0
  42. package/lib/adapters/stellar/constants.js +29 -0
  43. package/lib/adapters/stellar/getters.d.ts +56 -0
  44. package/lib/adapters/stellar/getters.js +81 -0
  45. package/lib/adapters/stellar/index.d.ts +70 -0
  46. package/lib/adapters/stellar/index.js +71 -0
  47. package/lib/adapters/stellar/soroban.d.ts +21 -1
  48. package/lib/adapters/stellar/soroban.js +47 -1
  49. package/lib/adapters/stellar/submit.d.ts +29 -0
  50. package/lib/adapters/stellar/submit.js +90 -5
  51. package/lib/adapters/stellar/types.d.ts +27 -0
  52. package/lib/adapters/stellar/types.js +3 -0
  53. package/lib/adapters/stellar/utils.d.ts +10 -0
  54. package/lib/adapters/stellar/utils.js +10 -0
  55. package/lib/adapters/sui/getters.d.ts +7 -1
  56. package/lib/adapters/sui/getters.js +6 -0
  57. package/lib/adapters/sui/index.d.ts +16 -1
  58. package/lib/adapters/sui/index.js +17 -0
  59. package/lib/adapters/sui/transformer.d.ts +8 -2
  60. package/lib/adapters/sui/transformer.js +7 -0
  61. package/lib/adapters/sui/types.d.ts +1 -1
  62. package/lib/adapters/sui/utils.d.ts +6 -0
  63. package/lib/adapters/sui/utils.js +6 -0
  64. package/lib/core/analytics/chain-name.d.ts +8 -0
  65. package/lib/core/analytics/chain-name.js +8 -0
  66. package/lib/core/analytics/constants.d.ts +4 -0
  67. package/lib/core/analytics/constants.js +4 -0
  68. package/lib/core/analytics/env.d.ts +25 -0
  69. package/lib/core/analytics/env.js +26 -0
  70. package/lib/core/analytics/index.d.ts +26 -0
  71. package/lib/core/analytics/index.js +35 -0
  72. package/lib/core/analytics/instrumentation.d.ts +26 -0
  73. package/lib/core/analytics/instrumentation.js +66 -2
  74. package/lib/core/analytics/method-taxonomy.d.ts +16 -0
  75. package/lib/core/analytics/method-taxonomy.js +18 -0
  76. package/lib/core/analytics/metrics.d.ts +23 -0
  77. package/lib/core/analytics/metrics.js +40 -0
  78. package/lib/core/analytics/sanitize.d.ts +38 -0
  79. package/lib/core/analytics/sanitize.js +46 -0
  80. package/lib/core/analytics/sentry-runtime.d.ts +11 -0
  81. package/lib/core/analytics/sentry-runtime.js +20 -1
  82. package/lib/core/analytics/sentry.d.ts +47 -2
  83. package/lib/core/analytics/sentry.js +115 -2
  84. package/lib/core/analytics/types.d.ts +28 -1
  85. package/lib/core/analytics/user-identity.d.ts +36 -2
  86. package/lib/core/analytics/user-identity.js +43 -1
  87. package/lib/core/analytics/version.d.ts +6 -1
  88. package/lib/core/analytics/version.js +6 -1
  89. package/lib/core/auth/verify.js +5 -0
  90. package/lib/core/base.class.d.ts +78 -3
  91. package/lib/core/base.class.js +66 -4
  92. package/lib/core/cache.d.ts +5 -0
  93. package/lib/core/cache.js +6 -0
  94. package/lib/core/constants/adapters.d.ts +16 -1
  95. package/lib/core/constants/adapters.js +28 -8
  96. package/lib/core/constants/core.d.ts +14 -1
  97. package/lib/core/constants/core.js +18 -0
  98. package/lib/core/constants/swap-router.d.ts +83 -1
  99. package/lib/core/constants/swap-router.js +91 -1
  100. package/lib/core/constants/vaults.d.ts +57 -1
  101. package/lib/core/constants/vaults.js +66 -1
  102. package/lib/core/constants/web3.d.ts +4 -1
  103. package/lib/core/constants/web3.js +15 -5
  104. package/lib/core/errors/index.d.ts +38 -2
  105. package/lib/core/errors/index.js +38 -0
  106. package/lib/core/fetcher.d.ts +136 -2
  107. package/lib/core/fetcher.js +229 -25
  108. package/lib/core/helpers/adapters.d.ts +10 -1
  109. package/lib/core/helpers/adapters.js +11 -0
  110. package/lib/core/helpers/chain-address.d.ts +10 -0
  111. package/lib/core/helpers/chain-address.js +11 -0
  112. package/lib/core/helpers/core.d.ts +49 -4
  113. package/lib/core/helpers/core.js +74 -7
  114. package/lib/core/helpers/explorer-link.d.ts +15 -1
  115. package/lib/core/helpers/explorer-link.js +14 -0
  116. package/lib/core/helpers/signer.d.ts +27 -1
  117. package/lib/core/helpers/signer.js +39 -0
  118. package/lib/core/helpers/swap-router.d.ts +33 -1
  119. package/lib/core/helpers/swap-router.js +32 -0
  120. package/lib/core/helpers/vault-version.d.ts +2 -1
  121. package/lib/core/helpers/vault-version.js +2 -0
  122. package/lib/core/helpers/vaults.d.ts +9 -1
  123. package/lib/core/helpers/vaults.js +22 -8
  124. package/lib/core/helpers/web3.d.ts +154 -2
  125. package/lib/core/helpers/web3.js +192 -15
  126. package/lib/core/logger/index.d.ts +55 -0
  127. package/lib/core/logger/index.js +19 -0
  128. package/lib/core/logger/slack.d.ts +3 -0
  129. package/lib/core/logger/slack.js +3 -0
  130. package/lib/core/vault-metadata.d.ts +7 -1
  131. package/lib/core/vault-metadata.js +6 -0
  132. package/lib/core/version-check.d.ts +52 -0
  133. package/lib/core/version-check.js +82 -1
  134. package/lib/evm/methods/crossChainVault.d.ts +90 -0
  135. package/lib/evm/methods/crossChainVault.js +187 -2
  136. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  137. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  138. package/lib/evm/methods/index.d.ts +1 -0
  139. package/lib/evm/methods/index.js +1 -0
  140. package/lib/evm/types/crossChain.d.ts +202 -0
  141. package/lib/evm/types/crossChain.js +12 -1
  142. package/lib/index.d.ts +16 -0
  143. package/lib/index.js +19 -0
  144. package/lib/main.d.ts +289 -6
  145. package/lib/main.js +312 -0
  146. package/lib/modules/api/index.d.ts +1 -0
  147. package/lib/modules/api/index.js +6 -0
  148. package/lib/modules/api/main.d.ts +52 -0
  149. package/lib/modules/api/main.js +130 -0
  150. package/lib/modules/sub-accounts/fetcher.d.ts +17 -2
  151. package/lib/modules/sub-accounts/fetcher.js +15 -0
  152. package/lib/modules/sub-accounts/main.d.ts +35 -2
  153. package/lib/modules/sub-accounts/main.js +39 -1
  154. package/lib/modules/sub-accounts/utils.d.ts +4 -1
  155. package/lib/modules/sub-accounts/utils.js +3 -0
  156. package/lib/modules/vaults/adapter.helpers.d.ts +21 -3
  157. package/lib/modules/vaults/adapter.helpers.js +34 -0
  158. package/lib/modules/vaults/fetcher.d.ts +45 -0
  159. package/lib/modules/vaults/fetcher.js +91 -4
  160. package/lib/modules/vaults/getters.d.ts +295 -0
  161. package/lib/modules/vaults/getters.js +567 -26
  162. package/lib/modules/vaults/index.d.ts +12 -0
  163. package/lib/modules/vaults/index.js +12 -0
  164. package/lib/modules/vaults/main.d.ts +292 -4
  165. package/lib/modules/vaults/main.js +382 -8
  166. package/lib/modules/vaults/read.actions.d.ts +170 -2
  167. package/lib/modules/vaults/read.actions.js +143 -0
  168. package/lib/modules/vaults/types.d.ts +34 -0
  169. package/lib/modules/vaults/utils/call-data-decoder.d.ts +48 -1
  170. package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
  171. package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
  172. package/lib/modules/vaults/utils/date-utils.js +47 -1
  173. package/lib/modules/vaults/utils.d.ts +85 -0
  174. package/lib/modules/vaults/utils.js +139 -7
  175. package/lib/modules/vaults/write.actions.d.ts +363 -3
  176. package/lib/modules/vaults/write.actions.js +399 -3
  177. package/lib/polyfills.js +4 -2
  178. package/lib/sdk.d.ts +23847 -0
  179. package/lib/services/coingecko/fetcher.d.ts +15 -1
  180. package/lib/services/coingecko/fetcher.js +30 -9
  181. package/lib/services/debank/fetcher.d.ts +15 -1
  182. package/lib/services/debank/fetcher.js +12 -0
  183. package/lib/services/debank/utils.d.ts +1 -1
  184. package/lib/services/debank/utils.js +18 -1
  185. package/lib/services/layerzero/deposits.d.ts +12 -1
  186. package/lib/services/layerzero/deposits.js +34 -11
  187. package/lib/services/layerzero/redeems.d.ts +11 -1
  188. package/lib/services/layerzero/redeems.js +13 -0
  189. package/lib/services/layerzero/utils.d.ts +8 -0
  190. package/lib/services/layerzero/utils.js +11 -0
  191. package/lib/services/octavfi/fetcher.d.ts +8 -1
  192. package/lib/services/octavfi/fetcher.js +25 -0
  193. package/lib/services/octavfi/types.d.ts +1 -1
  194. package/lib/services/octavfi/utils.d.ts +14 -2
  195. package/lib/services/octavfi/utils.js +44 -10
  196. package/lib/services/subgraph/fetcher.js +4 -2
  197. package/lib/services/subgraph/vaults.d.ts +12 -0
  198. package/lib/services/subgraph/vaults.js +119 -2
  199. package/lib/services/swap-quotes/index.d.ts +80 -0
  200. package/lib/services/swap-quotes/index.js +27 -1
  201. package/lib/services/swap-quotes/paraswap.d.ts +25 -0
  202. package/lib/services/swap-quotes/paraswap.js +22 -0
  203. package/lib/types/pools.d.ts +5 -2
  204. package/lib/types/staking.d.ts +1 -1
  205. package/lib/types/sub-accounts.d.ts +1 -1
  206. package/lib/types/subgraph.d.ts +10 -1
  207. package/lib/types/typed-contract.d.ts +64 -0
  208. package/lib/types/vaults.d.ts +163 -2
  209. package/lib/types/vaults.js +10 -0
  210. package/lib/types/web3.d.ts +9 -1
  211. package/lib/types/web3.js +1 -0
  212. package/lib/types/webserver.d.ts +47 -2
  213. package/package.json +6 -5
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # August Digital SDK
2
2
 
3
- TypeScript SDK for interacting with August Digital vaults across EVM and Solana chains.
3
+ TypeScript SDK for interacting with August Digital vaults across EVM, Solana, Stellar, and Sui chains.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,17 +20,15 @@ The SDK supports both ethers and wagmi/viem signers. If you're using wagmi in yo
20
20
  npm install viem
21
21
  ```
22
22
 
23
- The SDK will automatically detect and convert viem WalletClient to ethers-compatible signers.
23
+ The SDK automatically converts viem `WalletClient` to an ethers-compatible signer.
24
24
 
25
25
  ## Quick Start
26
26
 
27
27
  ```typescript
28
- import { AugustSDK } from '@augustdigital/sdk';
28
+ import AugustSDK from '@augustdigital/sdk';
29
29
 
30
- // Initialize with RPC providers
31
30
  const sdk = new AugustSDK({
32
- // Required: a stable kebab-case slug identifying your application.
33
- // See "App Name" below for what this is used for.
31
+ // Required: stable kebab-case slug identifying your application.
34
32
  appName: 'acme-trader',
35
33
  providers: {
36
34
  1: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
@@ -38,7 +36,7 @@ const sdk = new AugustSDK({
38
36
  -1: 'https://api.mainnet-beta.solana.com', // Solana
39
37
  },
40
38
  keys: {
41
- august: 'YOUR_API_KEY', // Optional: required for allocations, health factors, and subaccount operations
39
+ august: 'YOUR_API_KEY', // Optional: required for allocations, health factors, and sub-account operations
42
40
  },
43
41
  monitoring: {
44
42
  env: 'DEV', // Optional: 'DEV' enables console logging (defaults to 'PROD')
@@ -48,10 +46,10 @@ const sdk = new AugustSDK({
48
46
  // Fetch all vaults
49
47
  const vaults = await sdk.getVaults();
50
48
 
51
- // Fetch specific vault with loans and allocations
49
+ // Fetch a specific vault with loans and allocations
52
50
  const vault = await sdk.getVault({
53
51
  vault: '0x...',
54
- options: { loans: true, allocations: true }
52
+ options: { loans: true, allocations: true },
55
53
  });
56
54
 
57
55
  // Get user positions
@@ -63,57 +61,25 @@ const positions = await sdk.getVaultPositions({
63
61
 
64
62
  ### App Name
65
63
 
66
- `appName` is required on every `AugustSDK` constructor call. Pass a
67
- stable kebab-case slug identifying your application (e.g.
68
- `'acme-trader'`, `'my-defi-app'`):
69
-
70
- - **What it's used for.** August Digital tags outbound analytics events
71
- with `app.name = <yourSlug>`. We use this to (a) reach out about
72
- breaking changes that will affect you, (b) attribute error spikes to
73
- the right consuming app, and (c) prioritize bug fixes by impact.
74
- - **What it is _not_.** It's not a secret, not a license key, not an
75
- auth token, and despite the friendly name it's **not a display
76
- label**. It's a self-issued identifier — pick a slug once and reuse
77
- it across deployments.
78
- - **Constraints.** 3–64 characters, only `[a-zA-Z0-9._-]`. Use a slug
79
- like `'acme-trader'`, **not** a display name like `'Acme Trader'`
80
- (spaces and special characters will throw). The SDK throws
81
- synchronously from the constructor if the value is missing or
82
- invalid, so a wrong value fails loudly at integration time rather
83
- than silently in production.
64
+ `appName` is required on every `AugustSDK` constructor call. Pass a stable kebab-case slug
65
+ identifying your application (e.g. `'acme-trader'`, `'my-defi-app'`):
66
+
67
+ - **What it's used for.** August Digital tags analytics events with `app.name = <yourSlug>` to
68
+ attribute error spikes and prioritize bug fixes by consuming app.
69
+ - **What it is not.** Not a secret, not a license key, not a display label. Pick a slug once
70
+ and reuse it across deployments.
71
+ - **Constraints.** 3–64 characters, only `[a-zA-Z0-9._-]`. The SDK throws synchronously from
72
+ the constructor if the value is missing or invalid.
84
73
 
85
74
  ```typescript
86
75
  // Will throw — appName is required.
87
- new AugustSDK({
88
- providers: {
89
- /* ... */
90
- },
91
- keys: {
92
- /* ... */
93
- },
94
- } as any);
76
+ new AugustSDK({ providers: { /* ... */ } } as any);
95
77
 
96
- // Will throw — display name, not a slug. Use 'acme-trader' instead.
97
- new AugustSDK({
98
- appName: 'Acme Trader',
99
- providers: {
100
- /* ... */
101
- },
102
- keys: {
103
- /* ... */
104
- },
105
- });
78
+ // Will throw — spaces not allowed. Use 'acme-trader'.
79
+ new AugustSDK({ appName: 'Acme Trader', providers: { /* ... */ } });
106
80
 
107
81
  // Correct.
108
- new AugustSDK({
109
- appName: 'acme-trader',
110
- providers: {
111
- /* ... */
112
- },
113
- keys: {
114
- /* ... */
115
- },
116
- });
82
+ new AugustSDK({ appName: 'acme-trader', providers: { /* ... */ } });
117
83
  ```
118
84
 
119
85
  ## Architecture
@@ -126,13 +92,15 @@ src.ts/
126
92
  │ ├── fetcher.ts # API client with retry logic
127
93
  │ └── web3.helpers.ts # Blockchain utilities
128
94
  ├── adapters/ # Chain-specific implementations
129
- │ ├── evm/ # EVM vault adapters (v1, v2)
130
- └── solana/ # Solana program adapters
95
+ │ ├── evm/ # EVM adapter (approve, deposit, redeem, read helpers)
96
+ ├── solana/ # Solana program adapters
97
+ │ ├── stellar/ # Stellar vault adapters
98
+ │ └── sui/ # Sui (Ember) vault adapters
99
+ ├── evm/ # EVM cross-chain (LayerZero OVault)
131
100
  ├── modules/ # Feature modules
132
- └── vaults/ # Vault operations
133
- ├── main.ts # AugustVaults class
134
- ├── getters.ts # Data fetching functions
135
- │ └── utils.ts # Helper utilities
101
+ ├── vaults/ # Vault read operations
102
+ ├── sub-accounts/ # Sub-account queries
103
+ └── api/ # August backend API integration
136
104
  ├── services/ # External service integrations
137
105
  │ ├── debank/ # DeFi allocation data
138
106
  │ ├── coingecko/ # Token pricing
@@ -144,8 +112,10 @@ src.ts/
144
112
 
145
113
  ### Multi-Chain Support
146
114
 
147
- - **EVM Chains**: Ethereum, Arbitrum, Base, BSC, Avalanche
148
- - **Solana**: Native Solana program support
115
+ - **EVM Chains**: Ethereum, Arbitrum, Base, BSC, Avalanche, and more — `wagmi/viem` and `ethers` signers supported
116
+ - **Solana**: Native Solana program support with full vault functionality
117
+ - **Stellar**: Stellar vault deposit, redeem, and position queries
118
+ - **Sui**: Ember vault read operations
149
119
  - Unified interface across all chains
150
120
 
151
121
  ### Vault Versions
@@ -153,6 +123,7 @@ src.ts/
153
123
  - `evm-0/evm-1`: Legacy vault contracts
154
124
  - `evm-2`: Current EVM vault architecture (separate receipt tokens)
155
125
  - `sol-0`: Solana program-based vaults
126
+ - `stellar-0`: Stellar-based vaults
156
127
 
157
128
  ### Data Enrichment
158
129
 
@@ -162,6 +133,154 @@ All vault queries support optional enrichment:
162
133
  - `allocations`: DeFi/CeFi/OTC position breakdowns
163
134
  - `wallet`: User-specific position data
164
135
 
136
+ ## API Reference
137
+
138
+ ### Vault Queries
139
+
140
+ | Method | Description |
141
+ | --- | --- |
142
+ | `getVaults(options?)` | Fetch all vaults across chains |
143
+ | `getVault({ vault, chainId?, options? })` | Get single vault details |
144
+ | `getVaultLoans({ vault, chainId? })` | Fetch active loans |
145
+ | `getVaultAllocations({ vault, chainId? })` | Get allocation breakdown |
146
+ | `getVaultHistoricalTimeseries({ vault, chainId? })` | Historical APY and TVL timeseries |
147
+ | `getVaultApy({ vault, historical? })` | **@deprecated** — use `getVaultHistoricalTimeseries` |
148
+ | `getVaultTvl({ vault, historical? })` | Current/historical TVL |
149
+ | `getVaultAnnualizedApy({ vault })` | Annualized APY for a vault |
150
+ | `getVaultSummary({ vault })` | Aggregated vault summary |
151
+ | `getVaultPnl({ vault, chainId? })` | Vault-level PnL |
152
+ | `getVaultUnrealizedPnlHistory({ vault, chainId?, ... })` | Unrealized PnL timeseries |
153
+ | `getLatestUnrealizedPnl()` | Latest unrealized PnL snapshot across all vaults |
154
+ | `getYieldLastRealizedOn({ vault, chainId? })` | Timestamp of last yield realization |
155
+ | `getTotalDeposited(options?)` | Total deposited across vaults |
156
+
157
+ ### User Positions
158
+
159
+ | Method | Description |
160
+ | --- | --- |
161
+ | `getVaultPositions({ wallet?, vault?, chainId? })` | User vault positions |
162
+ | `getVaultAvailableRedemptions({ vault, wallet?, chainId, verbose? })` | Claimable redemptions |
163
+ | `getVaultRedemptionHistory({ vault, wallet?, chainId? })` | Historical redemptions |
164
+ | `getVaultUserHistory({ wallet, vault?, chainId? })` | Transaction history |
165
+ | `getVaultUserTransfers({ wallet, vault?, chainId? })` | Transfer history |
166
+ | `getVaultUserLifetimePnl({ wallet, vault?, chainId? })` | Lifetime PnL for a wallet |
167
+ | `getVaultStakingPositions({ wallet, chainId })` | Staking positions |
168
+ | `getVaultBorrowerHealthFactor(props?)` | Borrower health factor |
169
+ | `getVaultWithdrawals({ vault, chainId? })` | Pending withdrawals |
170
+
171
+ ### Points
172
+
173
+ | Method | Description |
174
+ | --- | --- |
175
+ | `getUserPoints(userAddress)` | Points balance for a wallet |
176
+ | `registerUserForPoints({ wallet, referral? })` | Register a wallet for the points program |
177
+ | `fetchPointsLeaderboard(params?)` | Points leaderboard |
178
+
179
+ ### Write Operations (top-level)
180
+
181
+ | Method | Description |
182
+ | --- | --- |
183
+ | `vaultDeposit(signer, options)` | Deposit into a vault |
184
+ | `previewRedemption(props)` | Preview redemption output before broadcasting |
185
+
186
+ ### Cross-Chain (LayerZero)
187
+
188
+ | Method | Description |
189
+ | --- | --- |
190
+ | `getLayerZeroDeposits({ wallet?, chainId? })` | LayerZero deposit history |
191
+ | `getLayerZeroRedeems(props?)` | LayerZero redemption history |
192
+
193
+ ### Utilities
194
+
195
+ | Method | Description |
196
+ | --- | --- |
197
+ | `getPrice(symbol)` | Token price in USD |
198
+ | `switchNetwork(chainId)` | Change active chain |
199
+ | `updateWallet(address)` | Set active wallet for tracking |
200
+
201
+ ### Sub-Accounts (`sdk.subAccountsModule`)
202
+
203
+ | Method | Description |
204
+ | --- | --- |
205
+ | `getSubaccountHealthFactor(address)` | Health factor for a sub-account |
206
+ | `getSubaccountLoans(address)` | Active loans for a sub-account |
207
+ | `getSubaccountCefiPositions(address)` | CeFi positions |
208
+ | `getSubaccountOtcPositions(address)` | OTC positions |
209
+ | `getSubaccountSummary(address)` | Aggregated sub-account summary |
210
+
211
+ ### EVM Adapter (`sdk.evm`)
212
+
213
+ Set a signer before calling write methods:
214
+
215
+ ```typescript
216
+ // ethers
217
+ import { JsonRpcProvider, Wallet } from 'ethers';
218
+ const wallet = new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(rpcUrl));
219
+ sdk.evm.setSigner(wallet);
220
+
221
+ // wagmi/viem (browser)
222
+ import { useWalletClient } from 'wagmi';
223
+ const { data: walletClient } = useWalletClient();
224
+ if (walletClient) sdk.evm.setSigner(walletClient);
225
+ ```
226
+
227
+ **Write methods:**
228
+
229
+ | Method | Description |
230
+ | --- | --- |
231
+ | `vaultApprove(options)` | Approve token spend for a vault |
232
+ | `approve(options)` | Generic ERC-20 approve |
233
+ | `vaultDeposit(options)` | Deposit assets into a vault |
234
+ | `vaultRequestRedeem(options)` | Request a withdrawal/redemption |
235
+ | `vaultRedeem(signer, options)` | Claim an available redemption |
236
+ | `depositNative(options)` | Deposit native tokens (ETH, etc.) |
237
+ | `swapAndDeposit(options)` | Swap and deposit in one call |
238
+ | `depositViaSwapRouter(options)` | Deposit via the swap router |
239
+ | `depositNativeViaSwapRouter(options)` | Deposit native via the swap router |
240
+
241
+ **Read helpers (return raw `bigint`):**
242
+
243
+ | Method | Description |
244
+ | --- | --- |
245
+ | `previewDeposit(options)` | Shares minted for a deposit amount |
246
+ | `previewRedeem(options)` | Assets returned for a share amount |
247
+ | `allowance(options)` | ERC-20 allowance granted to the vault |
248
+ | `balanceOf(options)` | ERC-20 balance for any token/owner |
249
+ | `maxDeposit(options)` | Maximum deposit accepted by the vault |
250
+ | `vaultAllowance(options)` | Vault-specific allowance check |
251
+ | `getDeposited(options)` | Current deposited balance |
252
+ | `getRemainingAllocations(options)` | Remaining allocation capacity |
253
+ | `isWhitelisted(options)` | Check whitelist status |
254
+
255
+ ### Solana Adapter (`sdk.solana`)
256
+
257
+ | Method | Description |
258
+ | --- | --- |
259
+ | `getVaultState(...)` | Vault state from the Solana program |
260
+ | `getVaultStateReadOnly(...)` | Read-only vault state |
261
+ | `getToken(mintAddress)` | SPL token info |
262
+ | `getTokenSymbol(mintAddress)` | Token symbol |
263
+ | `fetchUserTokenBalance(publicKey, mint)` | User SPL token balance |
264
+ | `fetchUserShareBalance(publicKey, vault)` | User share balance |
265
+ | `fetchUserShareBalanceRaw(publicKey, vault)` | Raw share balance (bigint) |
266
+
267
+ ### Stellar Adapter (`sdk.stellar`)
268
+
269
+ | Method | Description |
270
+ | --- | --- |
271
+ | `vaultDeposit(options)` | Deposit into a Stellar vault |
272
+ | `vaultRedeem(options)` | Redeem from a Stellar vault |
273
+ | `submitTransaction(signedXdr)` | Submit a signed XDR transaction |
274
+ | `getUserPosition(options)` | User position in a Stellar vault |
275
+ | `convertToShares(options)` | Convert an asset amount to shares |
276
+
277
+ ### Sui Adapter (`sdk.sui`)
278
+
279
+ | Method | Description |
280
+ | --- | --- |
281
+ | `getEmberVaults()` | List all Ember (Sui) vaults |
282
+ | `getEmberTVL(limit?)` | Total value locked across Ember vaults |
283
+
165
284
  ## Code Conventions
166
285
 
167
286
  ### Naming Patterns
@@ -170,9 +289,9 @@ All vault queries support optional enrichment:
170
289
  - **ABIs**: Prefixed with `ABI_` (e.g., `ABI_LENDING_POOL_V2`)
171
290
  - **Types**: Descriptive names (e.g., `IAddress`, `IChainId`)
172
291
 
173
- ### Important Tags
292
+ ### Special Comment Tags
174
293
 
175
- Search codebase for these comments to find areas needing attention:
294
+ Search the codebase for these to find important areas:
176
295
 
177
296
  - `@todo`: Planned improvements or missing features
178
297
  - `@hardcoded`: Hardcoded values that may need configuration
@@ -180,61 +299,34 @@ Search codebase for these comments to find areas needing attention:
180
299
 
181
300
  ### Error Handling
182
301
 
183
- - Automatic retry logic for network errors with exponential backoff
184
- - 90-second request timeout (configurable via `REQUEST_TIMEOUT_MS`)
185
- - Correlation IDs logged for debugging failed requests
186
- - Write actions throw errors instead of silent failures
187
-
188
- ### Environment Configuration
302
+ Every public method throws typed errors that subclass `AugustSDKError`:
189
303
 
190
304
  ```typescript
191
- // Development mode (enables console logging)
192
- const devSdk = new AugustSDK({
193
- providers: {
194
- /* ... */
195
- },
196
- monitoring: {
197
- env: 'DEV',
198
- },
199
- });
200
-
201
- // Production mode (default - no console logs)
202
- const prodSdk = new AugustSDK({
203
- providers: {
204
- /* ... */
205
- },
206
- // monitoring is optional - defaults to PROD
207
- });
305
+ import { AugustValidationError, AugustTimeoutError, AugustSDKError } from '@augustdigital/sdk';
306
+
307
+ try {
308
+ await sdk.evm.vaultDeposit({ target: '0x...', wallet: owner, amount: '1' });
309
+ } catch (err) {
310
+ if (err instanceof AugustValidationError) showFormError(err.message);
311
+ else if (err instanceof AugustTimeoutError) scheduleRetry(err.timeoutMs);
312
+ else if (err instanceof AugustSDKError) reportError(err.code, err.cause);
313
+ else throw err;
314
+ }
208
315
  ```
209
316
 
210
- - `env: 'DEV'` - Enables console logging for debugging
211
- - `env: 'PROD'` or omitted - Disables console, uses custom logger only (safer default)
212
-
213
- ## API Reference
214
-
215
- ### Main Methods
216
-
217
- #### Vault Queries
218
-
219
- - `getVaults(options?)`: Fetch all vaults across chains
220
- - `getVault({ vault, chainId?, options? })`: Get single vault details
221
- - `getVaultLoans({ vault, chainId })`: Fetch active loans
222
- - `getVaultAllocations({ vault, chainId })`: Get allocation breakdown
223
- - `getVaultApy({ vault, historical? })`: Current/historical APY
224
- - `getVaultTvl({ vault, historical? })`: Current/historical TVL
225
-
226
- #### User Positions
317
+ - Automatic retry with exponential backoff for network errors
318
+ - 90-second request timeout (configurable via `REQUEST_TIMEOUT_MS`)
319
+ - Correlation IDs in errors for debugging
227
320
 
228
- - `getVaultPositions({ wallet?, vault?, chainId? })`: User vault positions
229
- - `getVaultAvailableRedemptions({ vault, wallet?, chainId, verbose?})`: Claimable redemptions
230
- - `getVaultUserHistory({ wallet, vault?, chainId? })`: Transaction history
231
- - `getVaultStakingPositions({ wallet, chainId })`: Staking positions
321
+ ### Environment Configuration
232
322
 
233
- #### Utilities
323
+ ```typescript
324
+ // Development mode — enables console logging
325
+ const sdk = new AugustSDK({ appName: 'my-app', providers: { /* ... */ }, monitoring: { env: 'DEV' } });
234
326
 
235
- - `getPrice(symbol)`: Get token price in USD
236
- - `switchNetwork(chainId)`: Change active chain
237
- - `updateWallet(address)`: Set active wallet for tracking
327
+ // Production mode default, no console logs
328
+ const sdk = new AugustSDK({ appName: 'my-app', providers: { /* ... */ } });
329
+ ```
238
330
 
239
331
  ## Development
240
332
 
@@ -250,10 +342,8 @@ pnpm test
250
342
  pnpm build
251
343
  ```
252
344
 
253
- ### Type Checking
254
-
255
- All exports are fully typed. Use TypeScript for best developer experience.
256
-
257
345
  ## Support
258
346
 
259
- For issues or questions, refer to the [main repository](https://github.com/fractal-protocol/js-sdk) or contact the August Digital team.
347
+ - **Issues**: [GitHub Issues](https://github.com/fractal-protocol/js-sdk/issues)
348
+ - **Documentation**: [docs.augustdigital.io](https://docs.augustdigital.io/developers/javascript-sdk)
349
+ - **Example App**: [starter.upshift.finance](https://starter.upshift.finance/)
@@ -1,3 +1,7 @@
1
+ /**
2
+ * [bytes32-flavored ERC-20](https://docs.makerdao.com/smart-contract-modules/mkr-module#4.-gotchas-potential-source-of-user-error)
3
+ * for tokens (ie. Maker) that use bytes32 instead of string.
4
+ */
1
5
  export declare const ABI_ERC20_BYTES32: readonly [{
2
6
  readonly type: "event";
3
7
  readonly name: "Approval";
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC20_BYTES32 = void 0;
4
+ /**
5
+ * [bytes32-flavored ERC-20](https://docs.makerdao.com/smart-contract-modules/mkr-module#4.-gotchas-potential-source-of-user-error)
6
+ * for tokens (ie. Maker) that use bytes32 instead of string.
7
+ */
4
8
  exports.ABI_ERC20_BYTES32 = [
5
9
  {
6
10
  type: 'event',
@@ -1,3 +1,4 @@
1
+ /** [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626) */
1
2
  export declare const ABI_ERC4626: readonly [{
2
3
  readonly anonymous: false;
3
4
  readonly inputs: readonly [{
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC4626 = void 0;
4
+ /** [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626) */
4
5
  exports.ABI_ERC4626 = [
5
6
  {
6
7
  anonymous: false,
@@ -1,3 +1,4 @@
1
+ /** [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721) */
1
2
  export declare const ABI_ERC721: readonly [{
2
3
  readonly type: "event";
3
4
  readonly name: "Approval";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC721 = void 0;
4
+ /** [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721) */
4
5
  exports.ABI_ERC721 = [
5
6
  {
6
7
  type: 'event',
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_FEE_ORACLE = void 0;
4
+ // export const ABI_FEE_ORACLE = [{"type":"constructor","inputs":[{"name":"ownerAddr","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"FEES_DIVISOR","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getContextFeeAmount","inputs":[{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[{"name":"feePercent","type":"uint256","internalType":"uint256"},{"name":"feeAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getContextFeeRate","inputs":[{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"setContextFeeRate","inputs":[{"name":"feePercent","type":"uint256","internalType":"uint256"},{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false}] as const;
4
5
  exports.ABI_FEE_ORACLE = [
5
6
  {
6
7
  inputs: [
@@ -1155,6 +1155,7 @@ exports.ABI_LENDING_POOLS = [
1155
1155
  type: 'function',
1156
1156
  },
1157
1157
  {
1158
+ // TokenizedVaults only
1158
1159
  inputs: [],
1159
1160
  name: 'operator',
1160
1161
  outputs: [
@@ -1168,6 +1168,7 @@ exports.ABI_LENDING_POOL_V2 = [
1168
1168
  type: 'function',
1169
1169
  },
1170
1170
  {
1171
+ // Tokenized Vaults only
1171
1172
  inputs: [],
1172
1173
  name: 'operator',
1173
1174
  outputs: [
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_MULTICALL3 = void 0;
4
+ /* [Multicall3](https://github.com/mds1/multicall) */
4
5
  exports.ABI_MULTICALL3 = [
5
6
  {
6
7
  inputs: [
@@ -44,6 +45,8 @@ exports.ABI_MULTICALL3 = [
44
45
  type: 'function',
45
46
  },
46
47
  ];
48
+ // Universal resolver error definitions (reserved for future use)
49
+ // @ts-expect-error - Reserved for future ENS integration
47
50
  const universalResolverErrors = [
48
51
  {
49
52
  inputs: [],
package/lib/abis/OFT.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ /**
2
+ * ABI fragments for OFT (Omnichain Fungible Token) and related contracts
3
+ * used in LayerZero cross-chain vault operations.
4
+ *
5
+ * @module ABIs/OFT
6
+ */
7
+ /** ERC20 allowance + approve ABI for cross-chain approval checks */
1
8
  export declare const ABI_CROSS_CHAIN_ERC20: readonly [{
2
9
  readonly inputs: readonly [{
3
10
  readonly internalType: "address";
@@ -35,6 +42,11 @@ export declare const ABI_CROSS_CHAIN_ERC20: readonly [{
35
42
  readonly stateMutability: "nonpayable";
36
43
  readonly type: "function";
37
44
  }];
45
+ /**
46
+ * Multi-asset vault previewDeposit ABI.
47
+ * Uses `previewDeposit(address, uint256)` instead of standard ERC4626's
48
+ * `previewDeposit(uint256)` to specify which asset is being deposited.
49
+ */
38
50
  export declare const ABI_MULTI_ASSET_PREVIEW_DEPOSIT: readonly [{
39
51
  readonly type: "function";
40
52
  readonly name: "previewDeposit";
@@ -58,6 +70,11 @@ export declare const ABI_MULTI_ASSET_PREVIEW_DEPOSIT: readonly [{
58
70
  }];
59
71
  readonly stateMutability: "view";
60
72
  }];
73
+ /**
74
+ * Multi-asset vault previewRedemption ABI.
75
+ * Uses `previewRedemption(uint256, bool)` to preview redeem output
76
+ * with an `isInstant` flag.
77
+ */
61
78
  export declare const ABI_MULTI_ASSET_PREVIEW_REDEEM: readonly [{
62
79
  readonly type: "function";
63
80
  readonly name: "previewRedemption";
@@ -81,6 +98,9 @@ export declare const ABI_MULTI_ASSET_PREVIEW_REDEEM: readonly [{
81
98
  }];
82
99
  readonly stateMutability: "view";
83
100
  }];
101
+ /**
102
+ * Standard ERC4626 previewRedeem ABI.
103
+ */
84
104
  export declare const ABI_STANDARD_PREVIEW_REDEEM: readonly [{
85
105
  readonly type: "function";
86
106
  readonly name: "previewRedeem";
package/lib/abis/OFT.js CHANGED
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
+ /**
3
+ * ABI fragments for OFT (Omnichain Fungible Token) and related contracts
4
+ * used in LayerZero cross-chain vault operations.
5
+ *
6
+ * @module ABIs/OFT
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.ABI_STANDARD_PREVIEW_REDEEM = exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = exports.ABI_CROSS_CHAIN_ERC20 = void 0;
10
+ /** ERC20 allowance + approve ABI for cross-chain approval checks */
4
11
  exports.ABI_CROSS_CHAIN_ERC20 = [
5
12
  {
6
13
  inputs: [
@@ -23,6 +30,11 @@ exports.ABI_CROSS_CHAIN_ERC20 = [
23
30
  type: 'function',
24
31
  },
25
32
  ];
33
+ /**
34
+ * Multi-asset vault previewDeposit ABI.
35
+ * Uses `previewDeposit(address, uint256)` instead of standard ERC4626's
36
+ * `previewDeposit(uint256)` to specify which asset is being deposited.
37
+ */
26
38
  exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = [
27
39
  {
28
40
  type: 'function',
@@ -38,6 +50,11 @@ exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = [
38
50
  stateMutability: 'view',
39
51
  },
40
52
  ];
53
+ /**
54
+ * Multi-asset vault previewRedemption ABI.
55
+ * Uses `previewRedemption(uint256, bool)` to preview redeem output
56
+ * with an `isInstant` flag.
57
+ */
41
58
  exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = [
42
59
  {
43
60
  type: 'function',
@@ -53,6 +70,9 @@ exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = [
53
70
  stateMutability: 'view',
54
71
  },
55
72
  ];
73
+ /**
74
+ * Standard ERC4626 previewRedeem ABI.
75
+ */
56
76
  exports.ABI_STANDARD_PREVIEW_REDEEM = [
57
77
  {
58
78
  type: 'function',
@@ -1,3 +1,4 @@
1
+ /** @internal */
1
2
  export declare const ABI_SMART_ACCOUNT: readonly [{
2
3
  readonly name: "isValidSignature";
3
4
  readonly type: "function";
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_SMART_ACCOUNT = void 0;
4
+ // ERC-1271
5
+ // isValidSignature(bytes32 hash, bytes signature) → bytes4 magicValue
6
+ /** @internal */
4
7
  exports.ABI_SMART_ACCOUNT = [
5
8
  {
6
9
  name: 'isValidSignature',
@@ -1,3 +1,4 @@
1
+ /** ABI for the August `SwapRouter` periphery contract. */
1
2
  export declare const ABI_SWAP_ROUTER: readonly [{
2
3
  readonly inputs: readonly [];
3
4
  readonly stateMutability: "nonpayable";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_SWAP_ROUTER = void 0;
4
+ /** ABI for the August `SwapRouter` periphery contract. */
4
5
  exports.ABI_SWAP_ROUTER = [
5
6
  { inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
6
7
  { inputs: [], name: 'AlreadyConfigured', type: 'error' },
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_UNIVERSAL_SIGNATURE_VALIDATOR = void 0;
4
+ // ERC-6492 - universal deployless signature validator contract
5
+ // constructor(address _signer, bytes32 _hash, bytes _signature) → bytes4 returnValue
6
+ // returnValue is either 0x1 (valid) or 0x0 (invalid)
4
7
  exports.ABI_UNIVERSAL_SIGNATURE_VALIDATOR = [
5
8
  {
6
9
  inputs: [