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.1.0 | runtime |
bech32Environment{
"local_name": "bech32",
"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 |
valibotEnvironment{
"local_name": "valibot",
"alias": false,
"peer_metadata": null
} | ^1.2.0 | runtime |
keccak256Environment{
"local_name": "keccak256",
"alias": false,
"peer_metadata": null
} | ^1.0.6 | runtime |
pluralizeEnvironment{
"local_name": "pluralize",
"alias": false,
"peer_metadata": null
} | ^8.0.0 | runtime |
tweetnaclEnvironment{
"local_name": "tweetnacl",
"alias": false,
"peer_metadata": null
} | ^1.0.3 | runtime |
@mysten/bcsEnvironment{
"local_name": "@mysten/bcs",
"alias": false,
"peer_metadata": null
} | 1.6.3 | runtime |
@mysten/suiEnvironment{
"local_name": "@mysten/sui",
"alias": false,
"peer_metadata": null
} | 1.35.0 | 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.3.0 | runtime |
@noble/curvesEnvironment{
"local_name": "@noble/curves",
"alias": false,
"peer_metadata": null
} | ^1.4.2 | runtime |
@noble/hashesEnvironment{
"local_name": "@noble/hashes",
"alias": false,
"peer_metadata": null
} | ^1.4.0 | runtime |
@suchipi/femverEnvironment{
"local_name": "@suchipi/femver",
"alias": false,
"peer_metadata": null
} | ^1.0.0 | runtime |
@types/pluralizeEnvironment{
"local_name": "@types/pluralize",
"alias": false,
"peer_metadata": null
} | ^0.0.33 | runtime |
ts-retry-promiseEnvironment{
"local_name": "ts-retry-promise",
"alias": false,
"peer_metadata": null
} | ^0.7.1 | runtime |
jestEnvironment{
"local_name": "jest",
"alias": false,
"peer_metadata": null
} | ^29.7.0 | development |
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
} | ^9.0.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.27.9 | development |
prettierEnvironment{
"local_name": "prettier",
"alias": false,
"peer_metadata": null
} | 3.3.3 | development |
@types/tmpEnvironment{
"local_name": "@types/tmp",
"alias": false,
"peer_metadata": null
} | ^0.2.5 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.2.2 | development |
@types/jestEnvironment{
"local_name": "@types/jest",
"alias": false,
"peer_metadata": null
} | ^29.5.14 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^20.8.7 | development |
lint-stagedEnvironment{
"local_name": "lint-staged",
"alias": false,
"peer_metadata": null
} | ^15.0.2 | 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
} | ^18.0.0 | development |
@commitlint/prompt-cliEnvironment{
"local_name": "@commitlint/prompt-cli",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | development |
eslint-config-prettierEnvironment{
"local_name": "eslint-config-prettier",
"alias": false,
"peer_metadata": null
} | ^9.1.0 | development |
eslint-plugin-prettierEnvironment{
"local_name": "eslint-plugin-prettier",
"alias": false,
"peer_metadata": null
} | ^5.0.1 | development |
@typescript-eslint/parserEnvironment{
"local_name": "@typescript-eslint/parser",
"alias": false,
"peer_metadata": null
} | ^6.8.0 | development |
@commitlint/config-conventionalEnvironment{
"local_name": "@commitlint/config-conventional",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | development |
@typescript-eslint/eslint-pluginEnvironment{
"local_name": "@typescript-eslint/eslint-plugin",
"alias": false,
"peer_metadata": null
} | ^6.8.0 | development |
Source distribution
{
"shasum": "72f80833d2652382cb4b4f3866cd9410e89419a3",
"tarball": "https://registry.npmjs.org/@0xobelisk/sui-client/-/sui-client-1.2.0-pre.121.tgz",
"fileCount": 66,
"integrity": "sha512-AF1gIHSWSADNN7TiucPtAPstlb1N7zJ6OXCy3E/L64sseOtPHWV9zAnXGZWTMPV+gXwZliQJ6nceqTxOoqCE+w==",
"signatures": [
{
"sig": "MEUCIDYGToV+GvEit48VWM50iF2zKCUr53rM5Pg6HMX5TlQxAiEAiOgcn+ZSjL1UhrotoTcENLnBTrKXrjuoaKjy/lwxIPI=",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"attestations": {
"url": "https://registry.npmjs.org/-/npm/v1/attestations/@0xobelisk%2fsui-client@1.2.0-pre.121",
"provenance": {
"predicateType": "https://slsa.dev/provenance/v1"
}
},
"unpackedSize": 920387
}Observed since 21 Oct, 09:22 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:cfdff4e2de1bdec397fe227cf2bc1ce92b34a095ee2f7481b32a73249981d7c2