# Quick Start

[![npm version](https://badge.fury.io/js/@augustdigital%2Fsdk.svg?icon=si%3Anpm)](https://www.npmjs.com/package/@augustdigital/sdk)

The August Digital SDK provides a comprehensive TypeScript methods for interacting with August Digital vaults and services across multiple blockchain networks. Whether you're building web applications, backend services, or integrations, the SDK offers a unified interface for EVM and Solana chains.\
If you would like to integrate our SDK on your own front end, please reach out to us\
as we would need to add your domain to our whitelist so you do not get restricted by CORS.

### Key Features

#### Multi-Chain Support

* **EVM Chains**: Ethereum, Arbitrum, Base, BSC, Avalanche, and more
  * `wagmi/viem` and `ethers` Signers are supported
* **Solana**: Native Solana program support with full vault functionality
* Unified interface across all supported chains

#### Comprehensive Vault Operations

* Query all vaults or specific vault details
* Fetch user positions and balances
* Get loan data and allocations
* Retrieve historical APY and TVL data
* Track user transaction history

#### Transaction Support

* Deposit assets into vaults (EVM and Solana)
* **Adapter deposits** with alternative tokens (ETH, WETH, native tokens)
* Multi-asset vault deposits
* Request withdrawals/redemptions
* Claim available redemptions
* Approve token spending

## Getting Started

### Installation

Install the package in your project directory with:

```shell-session
npm install @augustdigital/sdk
```

{% embed url="<https://www.npmjs.com/package/@augustdigital/sdk>" %}

### Initialization

Then, initialize the SDK in your project using your August API key and various provider RPC URLs:

```typescript
import AugustDigitalSDK from '@augustdigital/sdk';

const AugustSDK = new AugustDigitalSDK({
  // Provide the RPC endpoints for onchain interactions
  // At least one RPC endpoint is required
  providers: {
    <CHAIN_ID>: <JSON_RPC_URL>,
    // Mainnet Example:
    // 1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,
  },
  keys: {
    august: 'YOUR_AUGUST_API_KEY',      // Optional: required for vault allocations, health factors, and subaccount operations
    coingecko: 'YOUR_COINGECKO_KEY',    // Optional: used strictly as a fallback for asset prices
  },
})
```

*Note: the first provider in the `providers` object will be what network the SDK is initially connected to.*

#### Development Mode

Enable console logging for debugging:

```typescript
const sdk = new AugustSDK({
  providers: {
    1: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
  },
  monitoring: {
    env: 'DEV', // Enables console logs
  },
});
```

#### With Solana Support

Include Solana by adding its RPC endpoint with chain ID `-1`:

```typescript
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 Mainnet
  },
});
```

We also have an example app that can be found in this repo: <https://github.com/upshift-protocol/example-sdk-app>\
The example app can be found at <https://starter.upshift.finance/>
