Skip to main content

The transaction builder pattern

The existing API prepares calldata and leaves signing to the integrator. On Stellar the same custody boundary remains, but the artifact is transaction XDR with Soroban resources and account authorization, not {to, data, value}.

The flow​

  1. Read the network manifest and account capabilities.
  2. Request a builder using the intended account, event, amounts, and bounds.
  3. Build and simulate the invocation against Stellar RPC.
  4. Return the unsigned XDR, required authorization context, fee information, and human-readable operation preview.
  5. Ask the wallet to authorize the exact transfers and invocation and sign the envelope using the pinned SDK flow.
  6. Submit to RPC or the optional relay; wait for confirmed success and read the contract result.

Material changes to recipient, network, terms, or authorization invalidate the user's previous approval. Sequence conflicts may require rebuilding and signing again. A simulation success is neither a guarantee of future execution nor a ledger receipt.

Proposed BuiltStellarTx​

// Proposed integration type; not an existing SDK export.
type BuiltStellarTx = {
network: 'testnet' | 'mainnet';
networkPassphrase: string;
transactionXdr: string;
contractId: string;
function: string;
account: string;
feeStroops: string;
resourceFeeStroops: string;
expiresAt: number;
authorizationRequired: boolean;
};

The actual XDR contains the authorization entries and resource data produced by the implementation. The SDK must verify they match the preview. A decimal amount string never becomes a JavaScript floating-point token value. Supported account adapters must be tested for the auth-entry and envelope signing steps separately.

Migration from EVM builders​

EVM ERC20 approval, RLP transactions, EIP-1559 gas, EIP-712 signature recovery, and Solidity function selectors are not Stellar transaction fields. Use a SAC transfer in the tested authorization flow, resource fees and sequence numbers, and typed G/C accounts. See SDK guide.

Reference: Stellar transaction simulation.