UpshiftDocs

StellarAdapter

Stellar adapter for the Upshift SDK — Soroban vault deposits, redemptions, position queries, and signed-transaction submission.

Generated from @augustdigital/sdk 9.3.0

This page is produced from the SDK's TSDoc on every release. To correct it, edit the TSDoc in the SDK repository — an edit here is overwritten by the next release.

Stellar Adapter for August SDK

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

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

ParameterTypeDefault valueDescription
networkIStellarNetwork'mainnet'Stellar network to operate on; defaults to 'mainnet'.
options?{ sorobanRpcUrl?: string; }undefinedOptional 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?stringundefined-

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

ParameterTypeDescription
vaultAddressstringStellar contract ID (C… address)
rawAmountstringDeposit amount in the deposit token's smallest unit

Returns

Promise<string>

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

getExplorerLink(id, type?): string

Parameters

ParameterType
idstring
type?"tx" | "account" | "contract"

Returns

string

getUserPosition()

getUserPosition(vaultAddress, walletAddress): Promise<IStellarUserPosition>

Get user's vault share balance.

Parameters

ParameterType
vaultAddressstring
walletAddressstring

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

ParameterType
addressstring

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

ParameterTypeDescription
signedXdrstringBase64-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

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

ParameterType
paramsOmit<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

ParameterType
paramsOmit<IStellarRedeemParams, "network">

Returns

Promise<string>

Base64-encoded XDR of the unsigned transaction.

Variables

Stellar

const Stellar: object

Type Declaration

NameTypeDefault value
actions__moduleStellarActions
constants__moduleStellarConstants
getters__moduleStellarGetters
submit__moduleStellarSubmit
utilsobjectStellarUtils
utils.assertNotStellar()(address, operation) => void-
utils.getExplorerLink()(__namedParameters) => string-
utils.isStellarAddress()(address) => boolean-

References

default

Renames and re-exports StellarAdapter