Overview
Starkzap supports Dollar-Cost Averaging (DCA) through AVNU and Ekubo. Users can create recurring buy orders (sell token X, buy token Y on a schedule), preview the expected swap per cycle, and cancel orders. DCA providers handle order creation, execution, and cancellation independently. Swap providers are only used forpreviewCycle quoting.
What users can do with DCA:
- 📅 Create recurring orders - Set token pair, amount per cycle, and frequency (e.g. daily); optional min/max bounds with AVNU
- 📊 Preview a cycle - See the expected buy amount for the next cycle before creating or on existing orders
- 📋 List orders - Fetch active (and optionally past) DCA orders for the wallet
- ❌ Cancel orders - Cancel by order id or order address
- 📦 Batch with other actions - Use the transaction builder to combine DCA create/cancel with transfers or swaps
DCA providers (AVNU, Ekubo) handle cycle execution on their own backend — swap providers are not involved in execution. However,
previewCycle uses the wallet’s default (or specified) swap provider to quote the next cycle. Register swap providers if you want to use previewCycle.Configuration
Registering DCA providers
Register DCA providers when connecting the wallet (or at runtime). The wallet’sdca() client uses these providers for create/cancel and for cycle preview (which uses the swap provider to quote the next cycle).
wallet.dca().registerProvider(provider), wallet.dca().setDefaultProvider(providerId).
Register swap providers and a default swap provider if you want to use
previewCycle. Cycle execution is handled by the DCA provider backend and does not require swap providers.Creating a DCA order
Create a recurring order with token pair, amount per cycle, frequency, and optional bounds (AVNU supports min/max buy amount per cycle; Ekubo uses TWAMM-style continuous execution)..dcaCreate(...)).
Previewing a cycle
Show users the expected outcome of the next DCA cycle (quote from the swap provider) before they create the order or to display on an existing order:Listing and cancelling orders
List active (and optionally past) DCA orders for the wallet, then cancel by order id or order address:Using the transaction builder
Batch DCA create or cancel with other actions:DCA providers
Provider-specific options (e.g. AVNU bounds, Ekubo time alignment) are documented in the SDK types. Use
wallet.dca().listProviders() to see registered DCA provider ids and setDefaultProvider(providerId) to change the default.
Best practices
- Register swap providers if you want
previewCycleto have a quote source (not required for DCA execution itself). - Use token presets from
getPresets(chainId)ormainnetTokens/sepoliaTokensfortokenInandtokenOutso addresses and decimals match the chain. - Preview before create — call
previewCycleand show users the expected buy amount per cycle before they confirm the order. - Handle provider differences — AVNU supports discrete cycles and optional min/max bounds; Ekubo is continuous (TWAMM). Validate inputs per provider when building forms.
Troubleshooting
”No default DCA provider configured”
Register at least one DCA provider and callsetDefaultProvider(providerId) (or pass defaultDcaProviderId when connecting). Alternatively, pass provider: "avnu" or provider: "ekubo" on each DCA request.
DCA relies on swap providers
IfpreviewCycle fails, ensure swap providers are registered and a default swap provider is set. Swap providers are only used for cycle quoting — actual cycle execution is handled by the DCA provider backend (AVNU/Ekubo).
Chain or provider mismatch
Ensure the wallet is on a chain supported by the chosen DCA provider (AVNU and Ekubo support mainnet and Sepolia). Align the SDK network config with the RPC/wallet chain.Next steps
- Swaps — One-off quotes and swaps (used by
previewCyclefor quoting) - Bitcoin, Stablecoins, and Tokens — Token presets and amounts
- Tx Builder — Batching DCA with other operations
- API Reference — Full method signatures