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/limit-sdk

v1.2.1

Published

SDK for cetus limit order

Downloads

66

Readme

@cetusprotocol/limit-sdk

Cetus Limit Order SDK is a powerful tool that enables developers to integrate limit order trading functionality into their applications. With this SDK, users can place orders at a specific price, ensuring more control over their trades compared to market orders.

Getting Started

How to Use the Limit SDK ?

Installation

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

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

npm install @cetusprotocol/limit-sdk

Setup

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

import { CetusLimitSDK } from '@cetusprotocol/limit-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 = CetusLimitSDK.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 = CetusLimitSDK.createSDK({ env })

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

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

Features & Usage

After linking your wallet, if you need use your wallet address to do something, you should set it by sdk.setSenderAddress.

const wallet = 'YOUR_WALLET_ADDRESS'

sdk.setSenderAddress(wallet)

Place a limit order

const pool = {
  pay_coin_type: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC',
  target_coin_type: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT',
  indexer_id: '0xc420fb32c3dd279d20b55daeb08973e577df5fed1b758b839d4eec22da54bde8',
}
const LimitOrderStatus = {
  Running: 'Running',
  PartialCompleted: 'PartialCompleted',
  Completed: 'Completed',
  Cancelled: 'Cancelled',
}
const pay_coin_amount = 2000000
const price = 1.7
const expired_ts = Date.parse(new Date().toString()) + 7 * 24 * 60 * 60 * 1000
const send_key_pair = 'THE_KEY_PAIR_GENERATED_BY_YOUR_PRIVATE_KEY'

const payload = await sdk.LimitOrder.placeLimitOrder({
  pay_coin_amount,
  price,
  expired_ts,
  pay_coin_type: pool.pay_coin_type,
  target_coin_type: pool.target_coin_type,
  target_decimal: 6,
  pay_decimal: 6,
})

const tx_result = await sdk.FullClient.executeTx(send_key_pair, payload, false)

Cancel a limit order

const order = await sdk.LimitOrder.getLimitOrder('0xcadb63c2ffabd9ef7112cacb92304e660e2e...')
if (order && order.status === LimitOrderStatus.Running) {
  const payload = await sdk.LimitOrder.cancelOrdersByOwner([
    {
      order_id: order.id,
      pay_coin_type: order.pay_coin_type,
      target_coin_type: order.target_coin_type,
    },
  ])
  const tx_result = await sdk.FullClient.executeTx(send_key_pair, payload, false)
}

Claim target coin

const order = await sdk.LimitOrder.getLimitOrder('0x24aaffb2f9785c110da3b670e0...')
if (order && order.status === LimitOrderStatus.Running) {
  const payload = await sdk.LimitOrder.claimTargetCoin({
    order_id: order.id,
    pay_coin_type: order.pay_coin_type,
    target_coin_type: order.target_coin_type,
  })
  const tx_result = await sdk.FullClient.executeTx(send_key_pair, payload, false)
}

Get the list of tokens that support limit orders

const token_list = await sdk.LimitOrder.getLimitOrderTokenList()

Get the list of limit order pools

const pool_list = await sdk.LimitOrder.getLimitOrderPoolList()

Get the limit order pool based on token pairs

const pool = await sdk.LimitOrder.getLimitOrderPool(
  '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
  '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN'
)

Get the indexer_id of limit order pool based on token pairs

const id = await sdk.LimitOrder.getPoolIndexerId(
  '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
  '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN'
)

Get the list of limit order by your wallet address

const order_list = await sdk.LimitOrder.getOwnerLimitOrderList('0x0..')

Get the limit order info by order id

const order = await sdk.LimitOrder.getLimitOrder('0x24aaffb2f9785c110da3b670e0f50e8a30...')

Get order operation log

const order = await sdk.LimitOrder.getLimitOrderLogs('0x24aaffb2f9785c110da3b670e0f50e8a30...')

Get the claim logs of the order

const order = await sdk.LimitOrder.getLimitOrderClaimLogs('0x24aaffb2f9785c110da3b670e0f50e8a30...')

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