Creates a new instance of the Dca class, responsible for
managing DCA orders (querying, creating, closing).
Optionalconfig: CallerConfig
Optional caller configuration, such as network, API host, access token, and API path.
The mutable configuration used for subsequent requests.
Static ReadonlyconstantsContains static values related to DCA on the Aftermath platform, such as default gas usage for DCA transactions.
The default gas budget for DCA-related transactions, in MIST.
50_000_000n equals 0.05 SUI.
Sends a signed request to cancel one or more DCA orders.
Sign the exact string returned by
UserData.createTermsAndConditionsMessage() as a personal message over
its UTF-8 bytes. Send those signed bytes and the signature in inputs.
The order IDs are sent in orderObjectIds; the deprecated per-action
message from closeDcaOrdersMessageToSign is not the current credential.
Wallet address, signed terms-message bytes, signature, and the order object IDs to cancel.
The backend cancellation result. false is a valid response.
Builds the legacy per-action message for canceling DCA orders.
This method performs no network I/O. The current cancellation endpoint
authenticates with the canonical terms message instead. Put the order IDs
in closeDcaOrder's orderObjectIds field.
An object containing orderIds, an array of order object IDs to cancel.
{ action: "CANCEL_DCA_ORDERS", order_object_ids: inputs.orderIds }.
Deprecated. Generates a message object used in older flows to create
a DCA user account. Use the userData package for user key storage or account creation.
{ action: "CREATE_DCA_ACCOUNT" }. No network request is made.
Deprecated. Creates the user's public key in the older DCA system.
Please use createUserPublicKey from the userData package instead.
User address, signed message bytes, and the corresponding signature.
true if the public key was stored. false is also a valid backend response.
Retrieves the currently active DCA orders for a specific user.
An object containing the user's walletAddress.
A promise that resolves to an array of DcaOrderObject for the active orders.
Deprecated. Fetches both active and past DCA orders for a given user in one response.
Use getActiveDcaOrders and getPastDcaOrders for a more explicit approach.
Object containing the user's walletAddress.
A DcaOrdersObject grouping active and past orders.
Requests a transaction block from the Aftermath API to create a new DCA order.
The returned Transaction is not signed or executed.
The DCA order parameters. Coin amounts are in the smallest
units of their coin, and time values ending in Ms are milliseconds.
A parsed Transaction with the wallet address set as its sender.
Retrieves the past (completed or canceled) DCA orders for a specific user.
An object containing the user's walletAddress.
A promise that resolves to an array of DcaOrderObject for the past orders.
Deprecated. Fetches the user's public key from the older DCA system.
Please use getUserPublicKey from the userData package instead.
Contains the user's walletAddress.
The stored public key, or undefined when the API returns no key.
StaticapiReturns the canonical Aftermath API host for a Sui network.
To target a custom or local host, pass baseUrl in CallerConfig to the
constructor instead.
The Sui network whose host to return.
The network's HTTPS or local HTTP API host.
StaticdefaultReturns the canonical Sui fullnode URL for a network.
The network whose fullnode URL to return. undefined
defaults to mainnet.
The network's fullnode URL.
The
Dcaclass provides functionality for automating Dollar-Cost Averaging (DCA) strategies on the Aftermath platform. It allows you to create, query, and close DCA orders that execute periodic trades based on user-defined parameters.Example