npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cetusprotocol/dca-sdk

v1.2.1

Published

SDK for cetus dca

Readme

@cetusprotocol/dca-sdk

DCA (Dollar-Cost Averaging) is an efficient and low-risk investment strategy, particularly suitable for markets with high volatility. By using the DCA SDK, developers can easily integrate this strategy into their applications, helping users achieve long-term, stable investment growth. Through automation and regular investments, the DCA SDK helps users reduce the impact of short-term market fluctuations, leading to better investment outcomes.

Getting Started

How to Use the Dca SDK ?

Installation

To start using the Dca SDK, you first need to install it in your TypeScript project:

npm link: https://www.npmjs.com/package/@cetusprotocol/dca-sdk

npm install @cetusprotocol/dca-sdk

Setup

Import the SDK into the TypeScript file where you intend to use it:

import { CetusDcaSDK } from '@cetusprotocol/dca-sdk'

Initializing the SDK

Initialize the SDK with the required configuration parameters. This typically includes setting up the network and API keys, if needed.

If you would like to use the mainnet network and the official Sui rpc url, you can do so as follows:

const sdk = CetusDcaSDK.createSDK()

If you wish to set your own full node URL or network (You have the option to select either 'mainnet' or 'testnet' for the network), you can do so as follows:

const env = 'mainnet'
const full_rpc_url = 'YOUR_FULL_NODE_URL'
const wallet = 'YOUR_WALLET_ADDRESS'

const sdk = CetusDcaSDK.createSDK({ env })

If you wish to set your own full node URL or SuiClient, you can do so as follows:

const sdk = CetusDcaSDK.createSDK({ env, sui_client })
// or
const sdk = CetusDcaSDK.createSDK({ env, full_rpc_url })

Features & Usage

After linking your wallet, you need to set it by sdk.setSenderAddress.

const wallet = 'YOUR_WALLET_ADDRESS'

sdk.setSenderAddress(wallet)

Open Dca Order

const in_coin_type = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'
const out_coin_type = '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
const cycle_count = 4
const in_coin_amount = '40000000000'
const cycle_count_amount = new Decimal(in_coin_amount).div(Math.pow(10, 9)).div(cycle_count)
const min_price = 0.83854
const max_price = 2.172898
const per_cycle_max_out_amount = d(cycle_count_amount).div(d(min_price)).mul(Math.pow(10, 6)).toFixed(0).toString()
const per_cycle_min_out_amount = d(cycle_count_amount).div(d(max_price)).mul(Math.pow(10, 6)).toFixed(0).toString()

const payload = await sdk.Dca.dcaOpenOrderPayload({
  in_coin_type,
  out_coin_type,
  in_coin_amount,
  cycle_frequency: 600,
  cycle_count,
  per_cycle_min_out_amount,
  per_cycle_max_out_amount,
  per_cycle_in_amount_limit: '9744545',
  fee_rate: 0,
  timestamp: 1723719298,
  signature: '004f1929446176bc982043113c7be68d3bf2bdf9bb7f19bcf8cbc4e9d3db8172902a4a60a08405b0acbc5d367b54714...',
})
const send_key_pair = 'THE_KEY_PAIR_GENERATED_BY_YOUR_PRIVATE_KEY'
const result = await sdk.FullClient.sendTransaction(send_key_pair, payload)

Get DCA order by order Id

const order_id = '0xfba94aa36e93ccc7d84a...'
const dca_order = await sdk.Dca.getDcaOrders(order_id)

Withdraw DCA order

const in_coin_type = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'
const out_coin_type = '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'
const order_id = '0xa60c763185a84b87380a0a1e7e677...'

const withdraw_payload = await sdk.Dca.withdrawPayload({
  in_coin_type,
  out_coin_type,
  order_id,
})
const result = await sdk.FullClient.sendTransaction(send_key_pair, withdraw_payload)

Close DCA order

const order_id = '0xfc519e9cccf90f4dfdf3008e529...'
const in_coin_type = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'
const out_coin_type = '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC'

const dca_close_order_payload = await sdk.Dca.dcaCloseOrderPayload([
  {
    order_id,
    in_coin_type,
    out_coin_type,
  },
])
const result = await sdk.FullClient.sendTransaction(send_key_pair, dca_close_order_payload)

Query DCA order transaction history by order Id

const order_id = '0x45b567654b09d291f3c99566922b7...'

const list = await sdk.Dca.getDcaOrdersMakeDeal(order_id)

Query DCA token whitelist

whitelist_mode = 0 , Disable whitelist mode. whitelist_mode = 1 , Enable whitelist mode for in_coin only. whitelist_mode = 2 , Enable whitelist mode for out_coin only. whitelist_mode = 3 , Enable whitelist mode for both in_coin and out_coin.

const whitelist_mode = 3

const whiteList = await sdk.Dca.getDcaCoinWhiteList(whitelist_mode)

More About Cetus

Use the following links to learn more about Cetus:

Learn more about working with Cetus in the Cetus Documentation.

Join the Cetus community on Cetus Discord.

License

MIT