Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

StellarAdapter

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

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

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.

isStellarAddress()

isStellarAddress(address): boolean

Parameters

Parameter
Type

address

string

Returns

boolean

submitTransaction()

submitTransaction(signedXdr): Promise<string>

Side effect: a submitted transaction that the network reports as a failed redeem operation is reported to that vault's curator, on the same fire-and-forget terms as StellarAdapter.vaultRedeem.

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

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.

Side effect on failure: a redemption the vault cannot serve is reported to that vault's curator, since Stellar vaults are instant-redeem only and this is the curator's only signal. Fire-and-forget — it never delays or alters the error you receive. On by default in production; see monitoring.curatorAlerts and the Curator Notifications section of the Stellar Actions guide for exactly what is sent and how to opt out.

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

Last updated