> For the complete documentation index, see [llms.txt](https://docs.augustdigital.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augustdigital.io/developers/typescript-sdk/javascript-sdk.md).

# 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 supported
* **Solana**: Native Solana program support with full vault functionality
* **Stellar**: Stellar vault deposit, redeem, and position queries
* **Sui**: Ember vault read operations
* 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 AugustSDK from '@augustdigital/sdk';

const sdk = new AugustSDK({
  // Required: stable kebab-case slug identifying your application.
  appName: 'acme-trader',
  // Provide the RPC endpoints for onchain interactions.
  // At least one RPC endpoint is required.
  providers: {
    1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,
    42161: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`,
  },
  keys: {
    august: 'YOUR_AUGUST_API_KEY',   // Optional: required for vault allocations, health factors, and sub-account operations
  },
});
```

*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({
  appName: 'your-app-name', // required
  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({
  appName: 'your-app-name', // required
  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
  },
});
```

## End-to-End Deposit Walkthrough

The snippets below show a complete deposit flow against an EVM vault. Substitute the vault address with the one you're integrating against.

### 1. Connect a wallet

Either ethers or wagmi/viem works — `setSigner` accepts both. With ethers:

```typescript
import { JsonRpcProvider, Wallet } from 'ethers';

const provider = new JsonRpcProvider(
  'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);
sdk.evm.setSigner(wallet);
```

With wagmi/viem (browser):

```typescript
import { useWalletClient } from 'wagmi';

const { data: walletClient } = useWalletClient();
if (walletClient) sdk.evm.setSigner(walletClient);
```

### 2. Preview the deposit

`previewDeposit` returns the shares you would receive without broadcasting a transaction:

```typescript
const shares = await sdk.evm.previewDeposit({
  vault: '0x...', // your vault address
  amount: 1_000_000n, // 1 USDC (6 decimals)
});
```

### 3. Check the allowance

```typescript
const owner = await wallet.getAddress();
const current = await sdk.evm.allowance({ vault: '0x...', owner });
if (current < 1_000_000n) {
  await sdk.evm.vaultApprove({
    target: '0x...',
    wallet: owner,
    amount: '1',
    wait: true,
  });
}
```

### 4. Deposit

```typescript
const txHash = await sdk.evm.vaultDeposit({
  target: '0x...',
  wallet: owner,
  amount: '1',
});
```

### 5. Request a redemption

Standard (queued) redemption:

```typescript
await sdk.evm.vaultRequestRedeem({
  target: '0x...',
  wallet: owner,
  amount: '0.5',
});
```

Instant redemption (if supported by the vault):

```typescript
await sdk.evm.vaultRequestRedeem({
  target: '0x...',
  wallet: owner,
  amount: '0.5',
  isInstantRedeem: true,
});
```

### 6. Handle errors

Every public method throws typed errors that subclass `AugustSDKError`. See the [Error Handling](/developers/typescript-sdk/errors.md) page for the full reference; the short version:

```typescript
import {
  AugustValidationError,
  AugustTimeoutError,
  AugustSDKError,
} from '@augustdigital/sdk';

try {
  await sdk.evm.vaultDeposit({ target, wallet: owner, amount: '1' });
} catch (err) {
  if (err instanceof AugustValidationError) showFormError(err.message);
  else if (err instanceof AugustTimeoutError) scheduleRetry(err.timeoutMs);
  else if (err instanceof AugustSDKError) reportError(err.code, err.cause);
  else throw err;
}
```

## Read Helpers Reference

The EVM adapter exposes typed read helpers so you don't have to reach into the ABIs:

| Method           | Description                                           |
| ---------------- | ----------------------------------------------------- |
| `previewDeposit` | Shares minted for a given deposit amount.             |
| `previewRedeem`  | Assets returned for a given share amount.             |
| `allowance`      | Raw ERC-20 allowance the owner has granted the vault. |
| `balanceOf`      | Raw ERC-20 balance for any token / owner.             |
| `maxDeposit`     | Maximum deposit currently accepted by the vault.      |

All return raw `bigint` values so BigInt math stays precise.

## Example App

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/>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.augustdigital.io/developers/typescript-sdk/javascript-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
