UpshiftDocs

StellarAdapter

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

Stellar Adapter for the Upshift SDK.

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

Classes

StellarAdapter

Stellar Adapter for the Upshift 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()

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>

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.

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