Documentation
¶
Overview ¶
Package classic holds the platform's non-Soroban Stellar operations: creating accounts, establishing trustlines, and moving USDC. Every operation runs against the treasury account, which is the source and fee payer for the work this package does.
Service is the single interface. CreateSponsoredAccount and EstablishSponsoredTrustline manage child accounts; SponsoredPaymentTransaction and SendUSDC move funds; CheckUSDCTrustline reads trustline state. Build one with NewService, or NewServiceWithClient to supply your own RPCClient (the seam the tests use).
Sponsorship ¶
Child accounts hold zero XLM. The treasury sponsors their base reserve and any per-entry reserves through a BeginSponsoringFutureReserves / EndSponsoringFutureReserves envelope, so a sponsored transaction carries two signatures: the treasury as source and fee payer, and the child authorizing the operations on itself. CreateSponsoredAccount and EstablishSponsoredTrustline both follow this shape.
Child accounts and trustlines ¶
Children are tracking and audit markers, not custody accounts. They are created without a USDC trustline because they never receive USDC — borrowed funds land in the treasury and payouts leave it via SendUSDC. Add a trustline to a child only when one genuinely needs to hold the asset, using EstablishSponsoredTrustline. SponsoredPaymentTransaction sources from a child and therefore requires that trustline to exist first.
Submission and confirmation ¶
Mutating operations follow the same path: build the transaction, sign it, submit it, then poll. A successful submit returns a PENDING status, which only means stellar-core accepted the envelope — it is not confirmation. Each operation hands the returned hash to rpc.PollTransaction and treats anything other than a successful on-ledger result as a failure. Trustline reads (CheckUSDCTrustline) query ledger entries directly and do not submit a transaction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCClient ¶
type RPCClient interface {
LoadAccount(ctx context.Context, address string) (txnbuild.Account, error)
SendTransaction(ctx context.Context, req protocol.SendTransactionRequest) (protocol.SendTransactionResponse, error)
GetTransaction(ctx context.Context, req protocol.GetTransactionRequest) (protocol.GetTransactionResponse, error)
GetLedgerEntries(ctx context.Context, req protocol.GetLedgerEntriesRequest) (protocol.GetLedgerEntriesResponse, error)
}
RPCClient defines the interface for Stellar RPC operations
type Service ¶
type Service interface {
// CreateSponsoredAccount creates a new sponsored child account.
CreateSponsoredAccount(ctx context.Context, req types.CreateAccountRequest) error
// EstablishSponsoredTrustline adds a treasury-sponsored USDC trustline to an existing child account.
EstablishSponsoredTrustline(ctx context.Context, req types.EstablishTrustlineRequest) error
// SponsoredPaymentTransaction executes a sponsored payment from a child account.
SponsoredPaymentTransaction(ctx context.Context, req types.SponsoredPaymentTransactionRequest) (*types.SponsoredPaymentTransactionResponse, error)
// SendUSDC sends USDC directly from the treasury wallet to an external Stellar address with a memo.
SendUSDC(ctx context.Context, req types.SendUSDCRequest) (*types.SendUSDCResponse, error)
// CheckUSDCTrustline checks if an external address has a trustline for our USDC asset.
CheckUSDCTrustline(ctx context.Context, address string) (bool, error)
// AccountExists reports whether the given address is a funded/created account
// on the Stellar network. A failed load is reported as "not present" so the
// caller can attempt creation.
AccountExists(ctx context.Context, address string) (bool, error)
}
Service defines the interface for Stellar classic operations.