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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@0xobelisk/sui-client

v1.2.0-pre.93

Published

Tookit for interacting with move eps framework

Readme

Dubhe Client SDK

Dubhe is a client-agnostic SDK that supports various platforms including browsers, Node.js, and the COCOS game engine. It provides a simple interface to interact with your Sui Move contracts.

Getting Started

Prerequisites

Before using the SDK, make sure you have:

  1. Created and deployed your contract using the Dubhe CLI
  2. Obtained the packageId after deployment

Data Model Setup

First, define your contract's configuration using DubheConfig:

import { DubheConfig } from '@0xobelisk/sui-common';

export const dubheConfig = {
  name: 'counter',
  description: 'counter',
  systems: ['counter'],
  schemas: {
    counter: {
      structure: {
        value: 'StorageValue<u32>'
      }
    }
  }
} as DubheConfig;

Generate the contract code using CLI:

dubhe schemagen --config-path dubhe.config.ts

Initializing the Client

There are two ways to initialize the Dubhe client:

  1. Using dynamic metadata loading:
import { loadMetadata, Dubhe, NetworkType } from '@0xobelisk/sui-client';

const network = 'devnet' as NetworkType;
const packageId = 'YOUR_PACKAGE_ID';

const metadata = await loadMetadata(network, packageId);
const dubhe = new Dubhe({
  networkType: network,
  packageId: packageId,
  metadata: metadata,
  secretKey: privkey
});
  1. Using pre-saved metadata (recommended for better performance):
import metadata from './metadata.json';

const dubhe = new Dubhe({
  networkType: network,
  packageId: packageId,
  metadata: metadata,
  secretKey: privkey
});

Executing Transactions

To call contract methods:

import { Transaction } from '@0xobelisk/sui-client';

// Create transaction
const tx = new Transaction();
const params = [
  /* your parameters */
];

// Execute transaction
const response = await dubhe.tx.counter_system.inc(tx, params);

// For wallet integration
await dubhe.tx.counter_system.inc(tx, params, undefined, true);
const response = await dubhe.signAndSendTxn(tx);

Querying Data

To query contract state:

const tx = new Transaction();
const params = [
  /* your parameters */
];
const result = await dubhe.query.counter_system.get(tx, params);

// For BCS encoded results
const decodedData = dubhe.view(result);

BCS Data Decoding

The SDK provides a view() method to decode BCS-encoded return values from contract queries.

Supported Types

  • Basic types (u8, u16, u32, u64, u128, u256)
  • Boolean
  • String
  • Vector
  • Struct
  • Option
  • Custom objects

Example with Complex Types

// Example contract return type
struct GameState {
    score: u64,
    player_name: String,
    is_active: bool,
    items: vector<Item>
}

// Query and decode
const tx = new Transaction();
const result = await dubhe.query.game_system.get_state(tx, params);
const decodedState = dubhe.view(result);

Known Limitations

⚠️ Important Note:

  1. The current implementation cannot automatically decode enum types due to limitations in Sui metadata.
  2. Some complex nested structures might require additional handling.

Entity Key Generation

Dubhe provides three methods for generating entity keys:

// From object ID
const objectKey = await dubhe.entity_key_from_object(objectId);

// From string data
const bytesKey = await dubhe.entity_key_from_bytes('hello');

// From number
const numberKey = await dubhe.entity_key_from_u256(123);

Query Owned Objects

To query objects owned by a specific address:

const owner = '0xfa99b5b0463fcfb7d0203c701a76da5eda21a96190eb1368ab36a437cc89195e';
const ownedObjects = await dubhe.getOwnedObjects(owner);

Best Practices

  1. Use pre-saved metadata for better performance in production
  2. Implement proper error handling for BCS decoding
  3. Consider the limitations of enum type handling when designing your contract return types

Support

For more information or support, please visit our GitHub repository or join our community channels.