cryptofoundry

Contact cryptofoundry

Tell us what you want to build or automate.

adamant-api-jsclient

ADAMANT API JS Client v2.2.0

This release of the ADAMANT API JS Client introduces a set of validator utility functions that are now exported from the package. These utilities allow developers to validate passphrases, ADAMANT addresses, public keys, vote targets, delegate names, and chat messages programmatically, enabling safer runtime checks in TypeScript projects.

The exported functions include type guards for passphrases, addresses, public keys, and delegate names, as well as helpers for converting ADM amounts to satoshis and validating message payloads. Each validator returns a type-narrowed result where applicable.

function isPassphrase(passphrase: unknown): passphrase is string;
function isAdmAddress(address: unknown): address is AdamantAddress;
function isAdmPublicKey(publicKey: unknown): publicKey is string;
function isAdmVoteForPublicKey(publicKey: unknown): publicKey is string;
function isAdmVoteForAddress(address: unknown): boolean;
function isAdmVoteForDelegateName(delegateName: unknown): delegateName is string;
function validateMessage(
  message: string,
  messageType: MessageType = MessageType.Chat
): { success: false, error: string } | { success: true };
function isDelegateName(name: unknown): name is string;
function admToSats(amount: number): number;