aftermath-ts-sdk - v3.3.3
    Preparing search index...

    Provides the low-level on-chain helpers used by the DCA package.

    The class reads DCA package addresses from AftermathApi and builds Move arguments or event type strings. It does not send HTTP requests or submit transactions.

    Index
    addresses: DcaAddresses

    Package and shared-object addresses required by DCA transactions and events.

    eventTypes: {
        closedOrder: string;
        createdOrder: string;
        createdOrderV2: string;
        executedTrade: string;
    }

    Fully qualified event types for the DCA event versions exposed by this API.

    Type Declaration

    • closedOrder: string

      Type of the order-closed event.

    • createdOrder: string

      Type of the version-one order-created event.

    • createdOrderV2: string

      Type of the version-two order-created event.

    • executedTrade: string

      Type of the executed-trade event.

    • Appends the DCA close_order Move call to a transaction.

      This method only mutates the supplied transaction. It does not make a network request, sign the transaction, or execute it. Pass the order ID as a string to create an object argument, or pass an existing TransactionArgument when composing a larger transaction.

      Parameters

      • inputs: {
            allocateCoinType: string;
            buyCoinType: string;
            orderId: string | TransactionArgument;
            tx: Transaction;
        }

        Transaction, coin type arguments, and the DCA order ID.

      Returns TransactionResult

      The Move-call result appended to inputs.tx.

      Error when the configured DCA addresses are unavailable.

      import { Transaction } from "@mysten/sui/transactions";
      import { DcaApi, type AftermathApi } from "aftermath-ts-sdk";

      declare const aftermathApi: AftermathApi;
      const api = new DcaApi(aftermathApi);
      const tx = new Transaction();
      api.createCloseOrderTx({
      tx,
      allocateCoinType: "0x2::sui::SUI",
      buyCoinType: "0xcoin::asset::COIN",
      orderId: "0xorder",
      });