@augustdigital/sdk
v4.13.2
Published
JS SDK powering the August Digital ecosystem.
Readme
August Digital SDK
TypeScript SDK for interacting with August Digital vaults across EVM and Solana chains.
Installation
npm install @augustdigital/sdk ethers
# or
pnpm add @augustdigital/sdk ethers
# or
yarn add @augustdigital/sdk ethersWagmi/Viem Support
The SDK supports both ethers and wagmi/viem signers. If you're using wagmi in your React app, also install viem:
npm install viemThe SDK will automatically detect and convert viem WalletClient to ethers-compatible signers.
Quick Start
import { AugustSDK } from '@augustdigital/sdk';
// Initialize with RPC providers
const sdk = new AugustSDK({
providers: {
1: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
42161: 'https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY',
-1: 'https://api.mainnet-beta.solana.com', // Solana
},
keys: {
august: 'YOUR_API_KEY', // Optional
},
monitoring: {
env: 'DEV', // Optional: 'DEV' enables console logging (defaults to 'PROD')
},
});
// Fetch all vaults
const vaults = await sdk.getVaults();
// Fetch specific vault with loans and allocations
const vault = await sdk.getVault({
vault: '0x...',
options: { loans: true, allocations: true }
});
// Get user positions
const positions = await sdk.getVaultPositions({
wallet: '0x...',
showAllVaults: true,
});Architecture
src.ts/
├── main.ts # Main SDK class (AugustSDK)
├── core/ # Base utilities
│ ├── base.class.ts # Base SDK functionality
│ ├── fetcher.ts # API client with retry logic
│ └── web3.helpers.ts # Blockchain utilities
├── adapters/ # Chain-specific implementations
│ ├── evm/ # EVM vault adapters (v1, v2)
│ └── solana/ # Solana program adapters
├── modules/ # Feature modules
│ └── vaults/ # Vault operations
│ ├── main.ts # AugustVaults class
│ ├── getters.ts # Data fetching functions
│ └── utils.ts # Helper utilities
├── services/ # External service integrations
│ ├── debank/ # DeFi allocation data
│ ├── coingecko/ # Token pricing
│ └── subgraph/ # Historical transaction data
└── types/ # TypeScript interfacesKey Concepts
Multi-Chain Support
- EVM Chains: Ethereum, Arbitrum, Base, BSC, Avalanche
- Solana: Native Solana program support
- Unified interface across all chains
Vault Versions
evm-0/evm-1: Legacy vault contractsevm-2: Current EVM vault architecture (separate receipt tokens)sol-0: Solana program-based vaults
Data Enrichment
All vault queries support optional enrichment:
loans: Include active loan dataallocations: DeFi/CeFi/OTC position breakdownswallet: User-specific position data
Code Conventions
Naming Patterns
- Interfaces: Prefixed with
I(e.g.,IVault,IVaultLoan) - ABIs: Prefixed with
ABI_(e.g.,ABI_LENDING_POOL_V2) - Types: Descriptive names (e.g.,
IAddress,IChainId)
Important Tags
Search codebase for these comments to find areas needing attention:
@todo: Planned improvements or missing features@hardcoded: Hardcoded values that may need configuration@solana: Solana-specific logic or notes
Error Handling
- Automatic retry logic for network errors with exponential backoff
- 90-second request timeout (configurable via
REQUEST_TIMEOUT_MS) - Correlation IDs logged for debugging failed requests
- Write actions throw errors instead of silent failures
Environment Configuration
// Development mode (enables console logging)
const devSdk = new AugustSDK({
providers: {
/* ... */
},
monitoring: {
env: 'DEV',
},
});
// Production mode (default - no console logs)
const prodSdk = new AugustSDK({
providers: {
/* ... */
},
// monitoring is optional - defaults to PROD
});env: 'DEV'- Enables console logging for debuggingenv: 'PROD'or omitted - Disables console, uses custom logger only (safer default)
API Reference
Main Methods
Vault Queries
getVaults(options?): Fetch all vaults across chainsgetVault({ vault, chainId?, options? }): Get single vault detailsgetVaultLoans({ vault, chainId }): Fetch active loansgetVaultAllocations({ vault, chainId }): Get allocation breakdowngetVaultApy({ vault, historical? }): Current/historical APYgetVaultTvl({ vault, historical? }): Current/historical TVL
User Positions
getVaultPositions({ wallet?, vault?, chainId? }): User vault positionsgetVaultAvailableRedemptions({ vault, wallet?, chainId, verbose?}): Claimable redemptionsgetVaultUserHistory({ wallet, vault?, chainId? }): Transaction historygetVaultStakingPositions({ wallet, chainId }): Staking positions
Utilities
getPrice(symbol): Get token price in USDswitchNetwork(chainId): Change active chainupdateWallet(address): Set active wallet for tracking
Development
Running Tests
pnpm testBuilding
pnpm buildType Checking
All exports are fully typed. Use TypeScript for best developer experience.
Support
For issues or questions, refer to the main repository or contact the August Digital team.
