Skip to main content

Utilities

The @kynesyslabs/demosdk/utils subpath exposes small pure-function helpers used across the SDK. They are all framework-free and safe to import in browser or Node code.

Sleep

sleep(ms) returns a Promise<void> that resolves after the given number of milliseconds.

Address validation

validateEd25519Address(address) returns true when address matches /^0x[0-9a-f]{64}$/i — a 0x prefix followed by exactly 64 hex characters (case-insensitive). Use it to fail fast on malformed input before constructing transactions.

Uint8Array ↔ Base64

serializeUint8Array(u8) returns a Base64 string. deserializeUint8Array(base64) returns the original Uint8Array. Useful when carrying binary payloads through JSON (e.g. wire formats that require string fields).

Data manipulation

The dataManipulation namespace bundles object-to-hex and forge-buffer helpers used by the wire serializers:
Prefer the WebSDK-level helpers (Demos.signMessage, denomination.demToOs, etc.) for everyday use. Reach for utils only when you need raw byte/hex manipulation that the higher-level surface doesn’t cover.