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

# StellarAdapter

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

## StellarAdapter

Stellar Adapter for August SDK

Provides Stellar vault operations: deposit, redeem, position queries, and on-chain data fetching via Soroban RPC.

### Classes

#### StellarAdapter

Stellar Adapter for August SDK

**Example**

```
const adapter = new StellarAdapter('testnet');
const xdr = await adapter.vaultDeposit({
  contractId: 'CBGWW5...',
  amount: '1000000',
  senderAddress: 'GDLZ...',
});
// Sign xdr with wallet (e.g. Freighter), then submit via adapter.submitTransaction()
```

**Constructors**

**Constructor**

> **new StellarAdapter**(`network`, `options?`): [`StellarAdapter`](#stellaradapter)

**Parameters**

| Parameter                | Type                            | Default value | Description                                                                                                                                                                                                                                                                                                                      |
| ------------------------ | ------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `network`                | `IStellarNetwork`               | `'mainnet'`   | Stellar network to operate on; defaults to `'mainnet'`.                                                                                                                                                                                                                                                                          |
| `options?`               | { `sorobanRpcUrl?`: `string`; } | `undefined`   | Optional adapter configuration. Its `sorobanRpcUrl` field overrides the Soroban RPC endpoint (e.g. a keyed Alchemy URL): it becomes the primary with the SDK's built-in public endpoints kept behind it as failover, and a per-call `sorobanRpcUrl` (on the deposit/redeem params) takes precedence over this adapter-level one. |
| `options.sorobanRpcUrl?` | `string`                        | `undefined`   | -                                                                                                                                                                                                                                                                                                                                |

**Returns**

[`StellarAdapter`](#stellaradapter)

**Accessors**

**network**

**Get Signature**

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

**Returns**

`IStellarNetwork`

**Methods**

**convertToShares()**

> **convertToShares**(`vaultAddress`, `rawAmount`): `Promise`<`string`>

Preview how many vault shares a deposit amount would yield.

**Parameters**

| Parameter      | Type     | Description                                         |
| -------------- | -------- | --------------------------------------------------- |
| `vaultAddress` | `string` | Stellar contract ID (C… address)                    |
| `rawAmount`    | `string` | Deposit amount in the deposit token's smallest unit |

**Returns**

`Promise`<`string`>

Raw share amount as a string, or null if query fails.

**getExplorerLink()**

> **getExplorerLink**(`id`, `type?`): `string`

**Parameters**

| Parameter | Type                                  |
| --------- | ------------------------------------- |
| `id`      | `string`                              |
| `type?`   | `"tx"` \| `"account"` \| `"contract"` |

**Returns**

`string`

**getUserPosition()**

> **getUserPosition**(`vaultAddress`, `walletAddress`): `Promise`<`IStellarUserPosition`>

Get user's vault share balance.

**Parameters**

| Parameter       | Type     |
| --------------- | -------- |
| `vaultAddress`  | `string` |
| `walletAddress` | `string` |

**Returns**

`Promise`<`IStellarUserPosition`>

The position `{ shares, decimals, decimalsFromFallback }`, or null if the balance read fails. When `decimalsFromFallback` is `true` the `decimals()` read failed and `decimals` is the fallback (7) — callers sizing a redeem MUST refuse rather than trust it (see AUGUST-6381).

**isStellarAddress()**

> **isStellarAddress**(`address`): `boolean`

**Parameters**

| Parameter | Type     |
| --------- | -------- |
| `address` | `string` |

**Returns**

`boolean`

**submitTransaction()**

> **submitTransaction**(`signedXdr`): `Promise`<`string`>

Submit a signed Soroban transaction and poll until the network confirms it.

Submits on the network this adapter was constructed with, so `signedXdr` must be signed for that same network.

**Parameters**

| Parameter   | Type     | Description                                   |
| ----------- | -------- | --------------------------------------------- |
| `signedXdr` | `string` | Base64-encoded XDR of the signed transaction. |

**Returns**

`Promise`<`string`>

The transaction hash once the network confirms it as successful.

**Throws**

AugustTimeoutError when the transaction is not confirmed within the poll budget (`MAX_POLL_ATTEMPTS`).

**Throws**

AugustSDKError when the RPC rejects the submission or the transaction confirms as failed. Its `context` carries `{ network, status }` plus, when the result XDR decodes, a `resultCode` string holding the transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode` is `undefined` when the code cannot be decoded.

**Example**

```ts
try {
  const hash = await adapter.submitTransaction(signedXdr);
} catch (err) {
  if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
    // stale sequence number — rebuild the transaction and resubmit
  }
}
```

**vaultDeposit()**

> **vaultDeposit**(`params`): `Promise`<`string`>

Build an unsigned deposit transaction for a Stellar vault.

**Parameters**

| Parameter | Type                                         |
| --------- | -------------------------------------------- |
| `params`  | `Omit`<`IStellarDepositParams`, `"network"`> |

**Returns**

`Promise`<`string`>

Base64-encoded XDR of the unsigned transaction.

**vaultRedeem()**

> **vaultRedeem**(`params`): `Promise`<`string`>

Build an unsigned redeem transaction for a Stellar vault.

**Parameters**

| Parameter | Type                                        |
| --------- | ------------------------------------------- |
| `params`  | `Omit`<`IStellarRedeemParams`, `"network"`> |

**Returns**

`Promise`<`string`>

Base64-encoded XDR of the unsigned transaction.

### Variables

#### Stellar

> `const` **Stellar**: `object`

**Type Declaration**

| Name                       | Type                               | Default value      |
| -------------------------- | ---------------------------------- | ------------------ |
| `actions`                  | `__module`                         | `StellarActions`   |
| `constants`                | `__module`                         | `StellarConstants` |
| `getters`                  | `__module`                         | `StellarGetters`   |
| `submit`                   | `__module`                         | `StellarSubmit`    |
| `utils`                    | `object`                           | `StellarUtils`     |
| `utils.assertNotStellar()` | (`address`, `operation`) => `void` | -                  |
| `utils.getExplorerLink()`  | (`__namedParameters`) => `string`  | -                  |
| `utils.isStellarAddress()` | (`address`) => `boolean`           | -                  |

### References

#### default

Renames and re-exports [StellarAdapter](#stellaradapter)
