Observed since 21 Oct, 09:22 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xobelisk/sui-client
Tookit for interacting with move eps framework
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.
Before using the SDK, make sure you have:
packageId after deploymentFirst, 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
There are two ways to initialize the Dubhe client:
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
});
import metadata from './metadata.json';
const dubhe = new Dubhe({
networkType: network,
packageId: packageId,
metadata: metadata,
secretKey: privkey
});
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);
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);
The SDK provides a view() method to decode BCS-encoded return values from contract queries.
// 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);
⚠️ Important Note:
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);
To query objects owned by a specific address:
const owner = '0xfa99b5b0463fcfb7d0203c701a76da5eda21a96190eb1368ab36a437cc89195e';
const ownedObjects = await dubhe.getOwnedObjects(owner);
For more information or support, please visit our GitHub repository or join our community channels.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
tmpEnvironment{
"local_name": "tmp",
"alias": false,
"peer_metadata": null
} | ^0.2.1 | runtime |
huskyEnvironment{
"local_name": "husky",
"alias": false,
"peer_metadata": null
} | ^8.0.3 | runtime |
assertEnvironment{
"local_name": "assert",
"alias": false,
"peer_metadata": null
} | ^2.0.0 | runtime |
colortsEnvironment{
"local_name": "colorts",
"alias": false,
"peer_metadata": null
} | ^0.1.63 | runtime |
processEnvironment{
"local_name": "process",
"alias": false,
"peer_metadata": null
} | ^0.11.10 | runtime |
keccak256Environment{
"local_name": "keccak256",
"alias": false,
"peer_metadata": null
} | ^1.0.6 | runtime |
@mysten/bcsEnvironment{
"local_name": "@mysten/bcs",
"alias": false,
"peer_metadata": null
} | ^0.7.3 | runtime |
superstructEnvironment{
"local_name": "superstruct",
"alias": false,
"peer_metadata": null
} | ^1.0.3 | runtime |
@scure/bip39Environment{
"local_name": "@scure/bip39",
"alias": false,
"peer_metadata": null
} | ^1.2.1 | runtime |
@mysten/sui.jsEnvironment{
"local_name": "@mysten/sui.js",
"alias": false,
"peer_metadata": null
} | ^0.41.0 | runtime |
ts-retry-promiseEnvironment{
"local_name": "ts-retry-promise",
"alias": false,
"peer_metadata": null
} | ^0.7.0 | runtime |
tsupEnvironment{
"local_name": "tsup",
"alias": false,
"peer_metadata": null
} | ^7.1.0 | development |
dotenvEnvironment{
"local_name": "dotenv",
"alias": false,
"peer_metadata": null
} | ^16.3.1 | development |
eslintEnvironment{
"local_name": "eslint",
"alias": false,
"peer_metadata": null
} | ^8.43.0 | development |
ts-nodeEnvironment{
"local_name": "ts-node",
"alias": false,
"peer_metadata": null
} | ^10.9.1 | development |
typedocEnvironment{
"local_name": "typedoc",
"alias": false,
"peer_metadata": null
} | ^0.24.8 | development |
prettierEnvironment{
"local_name": "prettier",
"alias": false,
"peer_metadata": null
} | ^2.8.8 | development |
@types/tmpEnvironment{
"local_name": "@types/tmp",
"alias": false,
"peer_metadata": null
} | ^0.2.3 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.0.4 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^20.5.0 | development |
lint-stagedEnvironment{
"local_name": "lint-staged",
"alias": false,
"peer_metadata": null
} | ^13.2.3 | development |
tsconfig-pathsEnvironment{
"local_name": "tsconfig-paths",
"alias": false,
"peer_metadata": null
} | ^4.2.0 | development |
@commitlint/cliEnvironment{
"local_name": "@commitlint/cli",
"alias": false,
"peer_metadata": null
} | ^17.6.6 | development |
@commitlint/prompt-cliEnvironment{
"local_name": "@commitlint/prompt-cli",
"alias": false,
"peer_metadata": null
} | ^17.6.6 | development |
eslint-config-prettierEnvironment{
"local_name": "eslint-config-prettier",
"alias": false,
"peer_metadata": null
} | ^8.8.0 | development |
eslint-plugin-prettierEnvironment{
"local_name": "eslint-plugin-prettier",
"alias": false,
"peer_metadata": null
} | ^4.2.1 | development |
@typescript-eslint/parserEnvironment{
"local_name": "@typescript-eslint/parser",
"alias": false,
"peer_metadata": null
} | ^5.60.1 | development |
@commitlint/config-conventionalEnvironment{
"local_name": "@commitlint/config-conventional",
"alias": false,
"peer_metadata": null
} | ^17.6.6 | development |
@typescript-eslint/eslint-pluginEnvironment{
"local_name": "@typescript-eslint/eslint-plugin",
"alias": false,
"peer_metadata": null
} | ^5.60.1 | development |
@mysten/sui.jsEnvironment{
"local_name": "@mysten/sui.js",
"alias": false,
"peer_metadata": null
} | ^0.41.0 | peer |
Source distribution
{
"shasum": "64d508c6de1f66eefda392bb729e04029dc18104",
"tarball": "https://registry.npmjs.org/@0xobelisk/sui-client/-/sui-client-0.5.3.tgz",
"fileCount": 48,
"integrity": "sha512-u8W12imwEI+3y6U8pVEYXqsUMzueG6TTnftl7JpaRUpMcDMfPDDIGAF3YeB/Gs61ciCbmBYaYJxK3kytEyLP2g==",
"signatures": [
{
"sig": "MEUCIQDhMLjTv31pXoqQ8SucHVnxmoEfoFX+a1eBU4oo4wJqJAIgLUprLGQsLopeZCEbQSWxNGjWOKTJ4t7kItp4nh7aVwo=",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 501235
}Observed since 21 Oct, 09:22 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:42adefc98029dfca905f72b0d1e42d0dcc0b052d0d35493a926274b0a457acd0