> 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/api/solanaadapter.md).

# SolanaAdapter

[SDK Reference](/developers/typescript-sdk/api.md) / SolanaAdapter

## SolanaAdapter

Solana Adapter for August SDK

### Classes

#### default

Solana Adapter for August SDK

**Example**

To access the Solana adapter instance

```
const sdk = new AugustSDK()
sdk.solana.getVaultState()
```

**Constructors**

**Constructor**

> **new default**(`endpoint`, `network`): [`default`](#default)

**Parameters**

| Parameter  | Type                      | Default value                 |
| ---------- | ------------------------- | ----------------------------- |
| `endpoint` | `` `https://${string}` `` | `undefined`                   |
| `network`  | `ISolanaNetwork`          | `SolanaUtils.fallbackNetwork` |

**Returns**

[`default`](#default)

**Accessors**

**connection**

**Get Signature**

> **get** **connection**(): `Connection`

**Returns**

`Connection`

**endpoint**

**Get Signature**

> **get** **endpoint**(): `` `https://${string}` ``

**Returns**

`` `https://${string}` ``

**network**

**Get Signature**

> **get** **network**(): `ISolanaNetwork`

**Returns**

`ISolanaNetwork`

**provider**

**Get Signature**

> **get** **provider**(): `AnchorProvider`

**Returns**

`AnchorProvider`

**Methods**

**fetchUserShareBalance()**

> **fetchUserShareBalance**(`publicKey`, `shareMint`): `Promise`<`any`>

**Parameters**

| Parameter   | Type                    |
| ----------- | ----------------------- |
| `publicKey` | `string` \| `PublicKey` |
| `shareMint` | `string` \| `PublicKey` |

**Returns**

`Promise`<`any`>

**fetchUserShareBalanceRaw()**

> **fetchUserShareBalanceRaw**(`publicKey`, `shareMint`): `Promise`<{ `amount`: `string`; `decimals`: `number`; }>

BigInt-safe variant of [fetchUserShareBalance](#fetchusersharebalance). Returns the raw u64 `amount` (as a base-units string) plus the mint's `decimals` (or `null` when the scale can't be determined — see Returns), so the caller can produce a correct `INormalizedNumber` without losing precision.

Prefer this anywhere the result feeds BigInt math — positions, max- actions, redemption sizing, allowance checks. `fetchUserShareBalance` returns a JS-number `uiAmount` which silently encodes against 18 decimals when passed through `toNormalizedBn(value)` without an explicit decimals argument; that's exactly how the jitoSOL "missing position" regression manifested.

RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case \~150ms on a healthy mainnet endpoint.

**Parameters**

| Parameter   | Type                    | Description                                         |
| ----------- | ----------------------- | --------------------------------------------------- |
| `publicKey` | `string` \| `PublicKey` | Wallet owner (PublicKey or base58 string).          |
| `shareMint` | `string` \| `PublicKey` | The vault's share-token mint (PublicKey or base58). |

**Returns**

`Promise`<{ `amount`: `string`; `decimals`: `number`; }>

`{ amount, decimals }`. Three observable shapes:

* `{ amount: '<u64>', decimals: <number> }` — token account exists.
* `{ amount: '0', decimals: null }` — no token account for this mint under this wallet, OR `tokenAmount` was missing from the response, OR `publicKey`/`shareMint` was not supplied. Distinguishable from a genuine zero-balance account (`decimals` would be set there).
* `{ amount: '0', decimals: null }` — RPC threw (error is logged).

`decimals === null` means "we could not determine the scale" — callers that need an `INormalizedNumber` must fall back to a known decimals value (typically the deposit mint's decimals from backend metadata) before normalizing. Never throws.

**fetchUserTokenBalance()**

> **fetchUserTokenBalance**(`publicKey`, `depositMint`): `Promise`<`any`>

**Parameters**

| Parameter     | Type                    |
| ------------- | ----------------------- |
| `publicKey`   | `string` \| `PublicKey` |
| `depositMint` | `string` \| `PublicKey` |

**Returns**

`Promise`<`any`>

**getProgram()**

> **getProgram**(`programIdl?`, `programId?`): `Program`<`any`>

Build an Anchor `Program` bound to this adapter's provider and network.

The program id is resolved as: explicit `programId` → the `address` carried by a custom `programIdl` → the canonical deployment for this adapter's network. A copy of the SDK's bundled `vaultIdl` defers to the network default (its embedded `address` is a build stamp, not network-aware), so forwarding it on devnet never silently targets the mainnet program.

**Parameters**

| Parameter     | Type     | Description                                                                                                                                              |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `programIdl?` | `any`    | Anchor IDL to bind. Defaults to the SDK's bundled `august_vault` IDL. A custom IDL's `address` is honoured when it differs from the bundled build stamp. |
| `programId?`  | `string` | Base58 program id that overrides both the IDL's address and the network default. Use this to target a non-canonical deployment.                          |

**Returns**

`Program`<`any`>

An Anchor `Program` for the resolved program id. No RPC is made — construction is offline.

**Throws**

AugustValidationError if no program id can be resolved because this adapter's network has no canonical deployment (e.g. `testnet`) and neither `programId` nor a custom IDL address was supplied.

**Example**

```ts
// canonical program on the adapter's network
const program = sdk.solana.getProgram();

// a different deployment, same interface
const legacy = sdk.solana.getProgram(vaultIdl, '7B8n9vL51b6ibqRAd1adZsi3x3kxtq5NZaondh22Vkyq');
```

**getProgramId()**

> **getProgramId**(`type`): `string`

Canonical program id for a program type on this adapter's network.

**Parameters**

| Parameter | Type      | Description                                                      |
| --------- | --------- | ---------------------------------------------------------------- |
| `type`    | `"vault"` | Program to look up. Only `'vault'` (august\_vault) exists today. |

**Returns**

`string`

The base58 program id.

**Throws**

AugustValidationError if the canonical program is not deployed on this adapter's network (e.g. `testnet`). Previously an unmapped network threw a bare `TypeError`.

**getToken()**

> **getToken**(`mintAddress`): `Promise`<{ `address`: `string`; `decimals`: `number`; `image`: `string`; `name`: `string`; `symbol`: `string`; }>

**Parameters**

| Parameter     | Type                    |
| ------------- | ----------------------- |
| `mintAddress` | `string` \| `PublicKey` |

**Returns**

`Promise`<{ `address`: `string`; `decimals`: `number`; `image`: `string`; `name`: `string`; `symbol`: `string`; }>

**getTokenSymbol()**

> **getTokenSymbol**(`mintAddress`): `Promise`<`string`>

**Parameters**

| Parameter     | Type                    |
| ------------- | ----------------------- |
| `mintAddress` | `string` \| `PublicKey` |

**Returns**

`Promise`<`string`>

**getVaultState()**

> **getVaultState**(`vaultProgramId`, `idl`, `vaultAddress?`): `Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `unknown`; }>

**Parameters**

| Parameter        | Type                    |
| ---------------- | ----------------------- |
| `vaultProgramId` | `string` \| `PublicKey` |
| `idl`            | `any`                   |
| `vaultAddress?`  | `string` \| `PublicKey` |

**Returns**

`Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `unknown`; }>

**getVaultStateReadOnly()**

> **getVaultStateReadOnly**(`vaultProgramId`, `idl`, `vaultAddress?`): `Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `ISolanaVaultState`; }>

**Parameters**

| Parameter        | Type                    |
| ---------------- | ----------------------- |
| `vaultProgramId` | `string` \| `PublicKey` |
| `idl`            | `any`                   |
| `vaultAddress?`  | `string` \| `PublicKey` |

**Returns**

`Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `ISolanaVaultState`; }>

**setWalletProvider()**

> **setWalletProvider**(`_publicKey`, `signTransaction`): `void`

**Parameters**

| Parameter         | Type                                   |
| ----------------- | -------------------------------------- |
| `_publicKey`      | `string` \| `PublicKey`                |
| `signTransaction` | <`T`>(`transaction`) => `Promise`<`T`> |

**Returns**

`void`

**vaultDeposit()**

> **vaultDeposit**(`vaultProgramId`, `idl`, `publicKey`, `depositAmount`, `sendTransaction`, `vaultAddress?`): `Promise`<`any`>

Deposit funds into a Solana August vault.

**Parameters**

| Parameter         | Type                                                             | Description                                            |
| ----------------- | ---------------------------------------------------------------- | ------------------------------------------------------ |
| `vaultProgramId`  | `string` \| `PublicKey`                                          | -                                                      |
| `idl`             | `any`                                                            | -                                                      |
| `publicKey`       | `string` \| `PublicKey`                                          | -                                                      |
| `depositAmount`   | `number` \| `bigint`                                             | `bigint` (raw on-chain units) or `number` (UI amount). |
| `sendTransaction` | (`transaction`, `connection`, `options?`) => `Promise`<`string`> | -                                                      |
| `vaultAddress?`   | `string` \| `PublicKey`                                          | -                                                      |

**Returns**

`Promise`<`any`>

**vaultRedeem()**

> **vaultRedeem**(`vaultProgramId`, `idl`, `publicKey`, `redeemShares`, `sendTransaction`, `vaultAddress?`): `Promise`<`any`>

Redeem vault shares from a Solana August vault.

**Parameters**

| Parameter         | Type                                                             | Description                                         |
| ----------------- | ---------------------------------------------------------------- | --------------------------------------------------- |
| `vaultProgramId`  | `string` \| `PublicKey`                                          | -                                                   |
| `idl`             | `any`                                                            | -                                                   |
| `publicKey`       | `string` \| `PublicKey`                                          | -                                                   |
| `redeemShares`    | `number` \| `bigint`                                             | `bigint` (raw share units) or `number` (UI amount). |
| `sendTransaction` | (`transaction`, `connection`, `options?`) => `Promise`<`string`> | -                                                   |
| `vaultAddress?`   | `string` \| `PublicKey`                                          | -                                                   |

**Returns**

`Promise`<`any`>

### Variables

#### Solana

> `const` **Solana**: `object`

**Type Declaration**

| Name                                  | Type                                                                                                                                        | Default value                                   |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `actions`                             | `__module`                                                                                                                                  | `SolanaActions`                                 |
| `constants`                           | `__module`                                                                                                                                  | `SolanaConstants`                               |
| `getters`                             | `__module`                                                                                                                                  | `SolanaGetters`                                 |
| `utils`                               | `object`                                                                                                                                    | `SolanaUtils`                                   |
| `utils.deriveShareMintPda()`          | (`vaultProgramId`) => `PublicKey`                                                                                                           | -                                               |
| `utils.deriveVaultStatePda()`         | (`vaultProgramId`) => `PublicKey`                                                                                                           | -                                               |
| `utils.deriveVaultTokenAtaPda()`      | (`vaultProgramId`, `depositMint`, `vaultVersion?`) => `PublicKey`                                                                           | -                                               |
| `utils.fallbackDecimals`              | `number`                                                                                                                                    | -                                               |
| `utils.fallbackNetwork`               | `ISolanaNetwork`                                                                                                                            | -                                               |
| `utils.fetchUserShareBalance()`       | (`__namedParameters`) => `Promise`<`any`>                                                                                                   | -                                               |
| `utils.fetchUserShareBalanceRaw()`    | (`__namedParameters`) => `Promise`<{ `amount`: `string`; `decimals`: `number`; }>                                                           | -                                               |
| `utils.fetchUserTokenBalance()`       | (`__namedParameters`) => `Promise`<`any`>                                                                                                   | -                                               |
| `utils.getBestRpcEndpoint()`          | (`__namedParameters`) => `Promise`<`"http://127.0.0.1:8899"` \| `` `https://${string}` ``>                                                  | -                                               |
| `utils.getExplorerLink()`             | (`__namedParameters`) => `string`                                                                                                           | -                                               |
| `utils.getProgram()`                  | (`__namedParameters`) => `Program`<`any`>                                                                                                   | -                                               |
| `utils.getProvider()`                 | (`__namedParameters`) => `AnchorProvider`                                                                                                   | -                                               |
| `utils.getReadOnlyProvider()`         | (`__namedParameters`) => `AnchorProvider`                                                                                                   | -                                               |
| `utils.getToken()`                    | (`__namedParameters`) => `Promise`<{ `address`: `string`; `decimals`: `number`; `image`: `string`; `name`: `string`; `symbol`: `string`; }> | -                                               |
| `utils.getTokenSymbol()`              | (`__namedParameters`) => `Promise`<`string`>                                                                                                | -                                               |
| `utils.getVaultMints()`               | (`__namedParameters`) => `Promise`<{ `depositMint`: `string`; `shareMint`: `string`; `vaultVersion`: `number`; }>                           | -                                               |
| `utils.getVaultState()`               | (`__namedParameters`) => `Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `unknown`; }>                                           | -                                               |
| `utils.getVaultStateReadOnly()`       | (`__namedParameters`) => `Promise`<{ `depositMintDecimals`: `number`; `vaultState`: `ISolanaVaultState`; }>                                 | -                                               |
| `utils.isSolana()`                    | (`signature`) => `boolean`                                                                                                                  | -                                               |
| `utils.isSolanaAddress()`             | (`address`) => `boolean`                                                                                                                    | -                                               |
| `utils.programIds`                    | `object`                                                                                                                                    | -                                               |
| `utils.programIds.devnet`             | `object`                                                                                                                                    | -                                               |
| `utils.programIds.devnet.vault`       | `string`                                                                                                                                    | `'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt'` |
| `utils.programIds.localnet`           | `object`                                                                                                                                    | -                                               |
| `utils.programIds.localnet.vault`     | `string`                                                                                                                                    | `'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt'` |
| `utils.programIds.mainnet-beta`       | `object`                                                                                                                                    | -                                               |
| `utils.programIds.mainnet-beta.vault` | `string`                                                                                                                                    | `'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt'` |
| `utils.resolveProgramId()`            | (`vaultAddress`, `solanaMetadata?`) => `string`                                                                                             | -                                               |
