Skip to content

adamant-api / api / AdamantApi

Class: AdamantApi ​

Defined in: src/api/index.ts:547

Resilient client for the public ADAMANT Node HTTP API.

The client inherits node health checks and failover from the internal NodeManager and returns structured API results instead of exposing raw Axios errors.

Extends ​

  • NodeManager

Constructors ​

Constructor ​

ts
new AdamantApi(options): AdamantApi;

Defined in: src/api/index.ts:553

Parameters ​

ParameterType
optionsAdamantApiOptions

Returns ​

AdamantApi

Overrides ​

NodeManager.constructor

Properties ​

hasCompatibleNode ​

ts
protected hasCompatibleNode: boolean = true;

Defined in: src/helpers/healthCheck.ts:208

Inherited from ​

NodeManager.hasCompatibleNode


logger ​

ts
protected logger: Logger;

Defined in: src/helpers/healthCheck.ts:207

Inherited from ​

NodeManager.logger


maxRetries ​

ts
maxRetries: number;

Defined in: src/api/index.ts:548


node ​

ts
node: string;

Defined in: src/helpers/healthCheck.ts:204

Inherited from ​

NodeManager.node


options ​

ts
options: NodeManagerOptions;

Defined in: src/helpers/healthCheck.ts:202

Inherited from ​

NodeManager.options


socket? ​

ts
socket?: WebSocketClient;

Defined in: src/helpers/healthCheck.ts:205

Inherited from ​

NodeManager.socket

Accessors ​

isReady ​

Get Signature ​

ts
get isReady(): boolean;

Defined in: src/helpers/healthCheck.ts:238

Whether the manager has completed initial readiness (either a usable node was selected during startup health checks, or checkHealthAtStartup is false).

Returns ​

boolean

Inherited from ​

NodeManager.isReady

Methods ​

checkNode() ​

ts
checkNode(node): Promise<
  | AdamantApiResult<GetNodeStatusResponseDto>
  | {
  rateLimited?: boolean;
  success: false;
}>;

Defined in: src/helpers/healthCheck.ts:833

Parameters ​

ParameterType
nodestring

Returns ​

Promise< | AdamantApiResult<GetNodeStatusResponseDto> | { rateLimited?: boolean; success: false; }>

Inherited from ​

NodeManager.checkNode


checkNodes() ​

ts
checkNodes(): Promise<ActiveNode[]>;

Defined in: src/helpers/healthCheck.ts:866

Returns ​

Promise<ActiveNode[]>

Inherited from ​

NodeManager.checkNodes


chooseNode() ​

ts
chooseNode(
   activeNodes, 
   forceChangeActiveNode?, 
   failedNode?
): Promise<boolean>;

Defined in: src/helpers/healthCheck.ts:516

Parameters ​

ParameterType
activeNodesActiveNode[]
forceChangeActiveNode?boolean
failedNode?string

Returns ​

Promise<boolean>

Inherited from ​

NodeManager.chooseNode


createAccount() ​

ts
createAccount(publicKey): Promise<
  | {
  errorMessage: string;
  success: boolean;
}
  | Omit<CreateNewAccountResponseDto, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:821

Initializes an account from a public key without transmitting a secret.

Parameters ​

ParameterType
publicKeystring

Returns ​

Promise< | { errorMessage: string; success: boolean; } | Omit<CreateNewAccountResponseDto, "success"> & { success: true; }>


get() ​

ts
get<T>(endpoint, params?): Promise<AdamantApiResult<T>>;

Defined in: src/api/index.ts:758

Makes GET request to ADAMANT network.

endpoint should be in 'accounts/getPublicKey' format, excluding '/api/'.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
endpointstring
params?unknown

Returns ​

Promise<AdamantApiResult<T>>


getAccountBalance() ​

ts
getAccountBalance(address): Promise<AdamantApiResult<GetAccountBalanceResponseDto>>;

Defined in: src/api/index.ts:1215

Get account balance

Parameters ​

ParameterType
addressstring

Returns ​

Promise<AdamantApiResult<GetAccountBalanceResponseDto>>


getAccountInfo() ​

ts
getAccountInfo(options): Promise<AdamantApiResult<GetAccountInfoResponseDto>>;

Defined in: src/api/index.ts:1206

Get account information by ADAMANT address or Public Key

Parameters ​

ParameterType
optionsAddressOrPublicKeyObject

Returns ​

Promise<AdamantApiResult<GetAccountInfoResponseDto>>


getBlock() ​

ts
getBlock(id): Promise<AdamantApiResult<GetBlockInfoResponseDto>>;

Defined in: src/api/index.ts:1234

Get block information by ID

Parameters ​

ParameterType
idstring

Returns ​

Promise<AdamantApiResult<GetBlockInfoResponseDto>>


getBlocks() ​

ts
getBlocks(options?): Promise<AdamantApiResult<GetBlocksResponseDto>>;

Defined in: src/api/index.ts:1241

Get list of blocks

Parameters ​

ParameterType
options?GetBlocksOptions

Returns ​

Promise<AdamantApiResult<GetBlocksResponseDto>>


getBroadhash() ​

ts
getBroadhash(): Promise<AdamantApiResult<GetBroadhashResponseDto>>;

Defined in: src/api/index.ts:1438

Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.

Returns ​

Promise<AdamantApiResult<GetBroadhashResponseDto>>


getChatMessages() ​

ts
getChatMessages(
   address1, 
   address2, 
   query?
): Promise<
  | {
  errorMessage: string;
  success: false;
}
  | Omit<GetChatMessagesResponseDto, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:1267

Get messages between two accounts

Parameters ​

ParameterType
address1string
address2string
query?TransactionQuery<ChatroomsOptions>

Returns ​

Promise< | { errorMessage: string; success: false; } | Omit<GetChatMessagesResponseDto, "success"> & { success: true; }>


getChats() ​

ts
getChats(address, options?): Promise<
  | {
  errorMessage: string;
  success: false;
}
  | Omit<GetChatRoomsResponseDto, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:1248

Get list of Chats

Parameters ​

ParameterType
addressstring
options?TransactionQuery<ChatroomsOptions>

Returns ​

Promise< | { errorMessage: string; success: false; } | Omit<GetChatRoomsResponseDto, "success"> & { success: true; }>


getChatTransactions() ​

ts
getChatTransactions(options?): Promise<
  | {
  errorMessage: string;
  success: false;
}
  | Omit<GetChatTransactionsResponseDto, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:1288

Gets chat transactions through the legacy /api/chats/get endpoint.

Parameters ​

ParameterType
options?TransactionQuery<ChatTransactionsOptions>

Returns ​

Promise< | { errorMessage: string; success: false; } | Omit<GetChatTransactionsResponseDto, "success"> & { success: true; }>

Deprecated ​

Use getChats or getChatMessages instead.


getDelegate() ​

ts
getDelegate(options): Promise<AdamantApiResult<GetDelegateResponseDto>>;

Defined in: src/api/index.ts:1319

Gets delegate info by username, publicKey, or address.

The delegate includes forged, the lifetime sum of block fees and rewards as a base-10 integer string in base units.

Parameters ​

ParameterType
optionsDelegateLookupOptions

Returns ​

Promise<AdamantApiResult<GetDelegateResponseDto>>


getDelegates() ​

ts
getDelegates(options?): Promise<AdamantApiResult<GetDelegatesResponseDto>>;

Defined in: src/api/index.ts:1309

Retrieves registered ADAMANT delegates.

Each delegate includes forged, the lifetime sum of block fees and rewards as a base-10 integer string in base units.

Parameters ​

ParameterType
options?GetDelegatesOptions

Returns ​

Promise<AdamantApiResult<GetDelegatesResponseDto>>


getDelegatesCount() ​

ts
getDelegatesCount(): Promise<AdamantApiResult<GetDelegatesCountResponseDto>>;

Defined in: src/api/index.ts:1341

Get total count of delegates

Returns ​

Promise<AdamantApiResult<GetDelegatesCountResponseDto>>


getDelegateStats() ​

ts
getDelegateStats(generatorPublicKey, options?): Promise<AdamantApiResult<GetDelegateStatsResponseDto>>;

Defined in: src/api/index.ts:1349

Gets forging activity for a delegate, optionally within an inclusive Unix timestamp interval.

Parameters ​

ParameterType
generatorPublicKeystring
options?GetDelegateStatsOptions

Returns ​

Promise<AdamantApiResult<GetDelegateStatsResponseDto>>


getEpoch() ​

ts
getEpoch(): Promise<AdamantApiResult<GetEpochResponseDto>>;

Defined in: src/api/index.ts:1445

Returns time when blockchain epoch starts. Value 2017-09-02T17:00:00.000Z is for mainnet.

Returns ​

Promise<AdamantApiResult<GetEpochResponseDto>>


getFee() ​

ts
getFee(): Promise<AdamantApiResult<GetTokenTransferFeeResponseDto>>;

Defined in: src/api/index.ts:1460

Returns current fee value for type 0 (token transfer) transactions. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

Returns ​

Promise<AdamantApiResult<GetTokenTransferFeeResponseDto>>


getFees() ​

ts
getFees(): Promise<AdamantApiResult<GetTransactionTypesFeesResponseDto>>;

Defined in: src/api/index.ts:1467

Returns current fee values for different transaction types

Returns ​

Promise<AdamantApiResult<GetTransactionTypesFeesResponseDto>>


getHeight() ​

ts
getHeight(): Promise<AdamantApiResult<GetHeightResponseDto>>;

Defined in: src/api/index.ts:1452

Returns current node's blockchain height

Returns ​

Promise<AdamantApiResult<GetHeightResponseDto>>


getKVS() ​

ts
getKVS(options?, requestOptions?): Promise<
  | {
  errorMessage: string;
  success: false;
}
  | Omit<GetKVSResponseDto, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:1524

Fetches ADAMANT KVS transactions from /api/states/get.

Pass {method: 'POST'} when large keyIds or senderIds filters would exceed URL length limits.

Parameters ​

ParameterType
options?TransactionQuery<KVSOptions>
requestOptions?GetKVSRequestOptions

Returns ​

Promise< | { errorMessage: string; success: false; } | Omit<GetKVSResponseDto, "success"> & { success: true; }>


getLoadingStatus() ​

ts
getLoadingStatus(): Promise<AdamantApiResult<GetLoadingStatusResponseDto>>;

Defined in: src/api/index.ts:1410

Gets loading status

Returns ​

Promise<AdamantApiResult<GetLoadingStatusResponseDto>>


getMilestone() ​

ts
getMilestone(): Promise<AdamantApiResult<GetMilestoneResponseDto>>;

Defined in: src/api/index.ts:1481

Return current slot height, which determines reward a delegate will get for forging a block.

Returns ​

Promise<AdamantApiResult<GetMilestoneResponseDto>>


getNethash() ​

ts
getNethash(): Promise<AdamantApiResult<GetNethashResponseDto>>;

Defined in: src/api/index.ts:1474

The nethash describes e.g. the Mainnet or the Testnet, that the node is connecting to.

Returns ​

Promise<AdamantApiResult<GetNethashResponseDto>>


getNextForgers() ​

ts
getNextForgers(limit?): Promise<AdamantApiResult<GetNextForgersResponseDto>>;

Defined in: src/api/index.ts:1369

Returns a next-block snapshot of upcoming forger public keys.

The node builds the entire result from the delegate schedule for currentBlock + 1, including at round boundaries. Request a new snapshot after another block is accepted.

Parameters ​

ParameterTypeDescription
limit?numberNumber of public keys to retrieve, from 1 to 101. Defaults to 10.

Returns ​

Promise<AdamantApiResult<GetNextForgersResponseDto>>


getNodeStatus() ​

ts
getNodeStatus(): Promise<AdamantApiResult<GetNodeStatusResponseDto>>;

Defined in: src/api/index.ts:1514

Returns ADAMANT blockchain network and Node information in a single request, including the effective consensus activation heights and complete block reward milestone schedule.

Returns ​

Promise<AdamantApiResult<GetNodeStatusResponseDto>>


getNodeVersion() ​

ts
getNodeVersion(): Promise<AdamantApiResult<GetNodeVersionResponseDto>>;

Defined in: src/api/index.ts:1431

Gets node's software information

Returns ​

Promise<AdamantApiResult<GetNodeVersionResponseDto>>


getPeer() ​

ts
getPeer(ip, port): Promise<AdamantApiResult<GetPeerInfoResponseDto>>;

Defined in: src/api/index.ts:1403

Finds a peer known to the active node.

Parameters ​

ParameterType
ipstring
portnumber

Returns ​

Promise<AdamantApiResult<GetPeerInfoResponseDto>>


getPeers() ​

ts
getPeers(options?): Promise<AdamantApiResult<GetPeersResponseDto>>;

Defined in: src/api/index.ts:1398

Gets list of connected peer nodes

Parameters ​

ParameterType
options?GetPeersOptions

Returns ​

Promise<AdamantApiResult<GetPeersResponseDto>>


getPingStatus() ​

ts
getPingStatus(): Promise<AdamantApiResult<GetPingStatusResponseDto>>;

Defined in: src/api/index.ts:1424

Checks if the connected node is alive

Returns ​

Promise<AdamantApiResult<GetPingStatusResponseDto>>


getPublicKey() ​

ts
getPublicKey(address): Promise<string>;

Defined in: src/api/index.ts:778

Gets an account's Ed25519 public key and verifies locally that it is well-formed and derives address before caching or returning it.

Returns an empty string when the key cannot be retrieved or fails verification.

Parameters ​

ParameterType
address`U${string}`

Returns ​

Promise<string>


getQueuedTransaction() ​

ts
getQueuedTransaction(id): Promise<AdamantApiResult<GetQueuedTransactionsResponseDto>>;

Defined in: src/api/index.ts:1596

Get queued transaction by ID

Parameters ​

ParameterType
idstring

Returns ​

Promise<AdamantApiResult<GetQueuedTransactionsResponseDto>>


getQueuedTransactions() ​

ts
getQueuedTransactions(options?): Promise<AdamantApiResult<GetQueuedTransactionsResponseDto>>;

Defined in: src/api/index.ts:1586

Get queued transactions count

Parameters ​

ParameterType
options?PooledTransactionsOptions

Returns ​

Promise<AdamantApiResult<GetQueuedTransactionsResponseDto>>


getReward() ​

ts
getReward(): Promise<AdamantApiResult<GetRewardResponseDto>>;

Defined in: src/api/index.ts:1489

Returns reward — the reward a delegate will get for forging a block. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Depends on the slot height.

Returns ​

Promise<AdamantApiResult<GetRewardResponseDto>>


getStatus() ​

ts
getStatus(): Promise<AdamantApiResult<GetNetworkInfoResponseDto>>;

Defined in: src/api/index.ts:1505

Returns blockchain network information in a single request, including the latest cumulative consensusCodeName active at the current height.

Returns ​

Promise<AdamantApiResult<GetNetworkInfoResponseDto>>


getSupply() ​

ts
getSupply(): Promise<AdamantApiResult<GetTokensTotalSupplyResponseDto>>;

Defined in: src/api/index.ts:1497

Returns total current supply of ADM tokens in network. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Total supply increases with every new forged block.

Returns ​

Promise<AdamantApiResult<GetTokensTotalSupplyResponseDto>>


getSyncStatus() ​

ts
getSyncStatus(): Promise<AdamantApiResult<GetSyncStatusResponseDto>>;

Defined in: src/api/index.ts:1417

Gets information on node's sync process with other peers

Returns ​

Promise<AdamantApiResult<GetSyncStatusResponseDto>>


getTopAccounts() ​

ts
getTopAccounts(options?): Promise<AdamantApiResult<GetTopAccountsResponseDto>>;

Defined in: src/api/index.ts:1227

Gets non-zero-balance accounts ordered by balance descending.

ADAMANT Node v0.10.2 and newer return pagination metadata and support an optional delegate-status filter.

Parameters ​

ParameterType
options?GetTopAccountsOptions

Returns ​

Promise<AdamantApiResult<GetTopAccountsResponseDto>>


getTransaction() ​

ts
getTransaction(id, options?): Promise<AdamantApiResult<GetTransactionByIdResponseDto>>;

Defined in: src/api/index.ts:1566

Get transaction by ID

Parameters ​

ParameterType
idstring
options?TransactionQuery<TransactionsOptions>

Returns ​

Promise<AdamantApiResult<GetTransactionByIdResponseDto>>


getTransactions() ​

ts
getTransactions(options?): Promise<AdamantApiResult<GetTransactionsResponseDto>>;

Defined in: src/api/index.ts:1551

Returns list of transactions

Parameters ​

ParameterType
options?TransactionQuery<TransactionsOptions>

Returns ​

Promise<AdamantApiResult<GetTransactionsResponseDto>>


getTransactionsCount() ​

ts
getTransactionsCount(): Promise<AdamantApiResult<GetTransactionsCountResponseDto>>;

Defined in: src/api/index.ts:1579

Get confirmed, unconfirmed and queued transactions count

Returns ​

Promise<AdamantApiResult<GetTransactionsCountResponseDto>>


getUnconfirmedTransaction() ​

ts
getUnconfirmedTransaction(id): Promise<AdamantApiResult<GetUnconfirmedTransactionByIdResponseDto>>;

Defined in: src/api/index.ts:1616

Get unconfirmed transaction by ID

Parameters ​

ParameterType
idstring

Returns ​

Promise<AdamantApiResult<GetUnconfirmedTransactionByIdResponseDto>>


getUnconfirmedTransactions() ​

ts
getUnconfirmedTransactions(options?): Promise<AdamantApiResult<GetUnconfirmedTransactionsResponseDto>>;

Defined in: src/api/index.ts:1606

Get unconfirmed transactions

Parameters ​

ParameterType
options?PooledTransactionsOptions

Returns ​

Promise<AdamantApiResult<GetUnconfirmedTransactionsResponseDto>>


getVoteData() ​

ts
getVoteData(address): Promise<AdamantApiResult<GetAccountVotesResponseDto>>;

Defined in: src/api/index.ts:1389

Gets current votes of specific ADAMANT account

Parameters ​

ParameterTypeDescription
addressstringaddress of the account to get votes

Returns ​

Promise<AdamantApiResult<GetAccountVotesResponseDto>>


getVoters() ​

ts
getVoters(publicKey): Promise<AdamantApiResult<GetVotersResponseDto>>;

Defined in: src/api/index.ts:1380

Gets list of delegate's voters

Parameters ​

ParameterTypeDescription
publicKeystringrepresenting delegate's publicKey

Returns ​

Promise<AdamantApiResult<GetVotersResponseDto>>


initSocket() ​

ts
initSocket(options): void;

Defined in: src/helpers/healthCheck.ts:285

Parameters ​

ParameterType
options| WsOptions | WebSocketClient

Returns ​

void

Inherited from ​

NodeManager.initSocket


markNodeRateLimited() ​

ts
protected markNodeRateLimited(node, cooldownMs): void;

Defined in: src/helpers/healthCheck.ts:350

Records a temporary HTTP 429 cooldown for node so health checks and failovers prefer other synced nodes until the node's window resets.

Parameters ​

ParameterType
nodestring
cooldownMsnumber

Returns ​

void

Inherited from ​

NodeManager.markNodeRateLimited


newDelegate() ​

ts
newDelegate(passphrase, username): Promise<
  | {
  errorMessage: string;
  success: boolean;
}
  | Omit<unknown, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:834

Register new delegate within given username

Parameters ​

ParameterTypeDescription
passphrasestring-
usernamestringThe new delegate's username

Returns ​

Promise< | { errorMessage: string; success: boolean; } | Omit<unknown, "success"> & { success: true; }>


onReady() ​

ts
onReady(callback): void;

Defined in: src/helpers/healthCheck.ts:276

Runs callback once a usable node has been selected.

With startup health checks enabled, a usable node has answered /api/node/status, satisfies minVersion, and is neither still loading nor syncing. The callback does not run when that check selects no such node. A later health check runs it after one becomes available.

With startup health checks disabled, selection is skipped and the callback runs immediately. An already ready manager runs the callback immediately.

Parameters ​

ParameterType
callback() => void

Returns ​

void

Inherited from ​

NodeManager.onReady


post() ​

ts
post<T>(endpoint, options): Promise<AdamantApiResult<T>>;

Defined in: src/api/index.ts:767

Makes POST request to ADAMANT network.

endpoint should be in 'accounts/getPublicKey' format, excluding '/api/'.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
endpointstring
optionsunknown

Returns ​

Promise<AdamantApiResult<T>>


searchDelegates() ​

ts
searchDelegates(q, options?): Promise<AdamantApiResult<SearchDelegateResponseDto>>;

Defined in: src/api/index.ts:1331

Searches delegates by partial or full username.

Search results include voter and registration details, but unlike the delegate list and single-delegate endpoints they do not include forged.

Parameters ​

ParameterTypeDescription
qstringA username fragment from 1 to 20 characters.
options?SearchDelegatesOptions-

Returns ​

Promise<AdamantApiResult<SearchDelegateResponseDto>>


sendMessage() ​

ts
sendMessage(
   passphrase, 
   addressOrPublicKey, 
   message, 
   type?, 
   amount?, 
   isAmountInADM?
): Promise<
  | {
  errorMessage: string;
  success: boolean;
}
  | Omit<unknown, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:864

Encrypts a message, creates a Message transaction, signs it, and broadcasts it to the ADAMANT network.

Accepts either a recipient ADM address or a full 32-byte hex Ed25519 public key. When resolving a recipient address, the SDK verifies that the public key is well-formed and locally derives the recipient address before encrypting or broadcasting.

Parameters ​

ParameterTypeDefault value
passphrasestringundefined
addressOrPublicKeystringundefined
messagestringundefined
type?MessageTypeMessageType.Chat
amount?numberundefined
isAmountInADM?booleanundefined

Returns ​

Promise< | { errorMessage: string; success: boolean; } | Omit<unknown, "success"> & { success: true; }>


sendTokens() ​

ts
sendTokens(
   passphrase, 
   addressOrPublicKey, 
   amount, 
   isAmountInADM?
): 
  | {
  errorMessage: string;
  success: boolean;
}
| Promise<AdamantApiResult<unknown>>;

Defined in: src/api/index.ts:969

Send tokens to an account

Parameters ​

ParameterTypeDefault value
passphrasestringundefined
addressOrPublicKeystringundefined
amountnumberundefined
isAmountInADM?booleantrue

Returns ​

| { errorMessage: string; success: boolean; } | Promise<AdamantApiResult<unknown>>


sendTransaction() ​

ts
sendTransaction(request): Promise<AdamantApiResult<RegisterTransactionResponseDto>>;

Defined in: src/api/index.ts:1559

Broadcasts an already-created and signed transaction.

Parameters ​

ParameterType
requestRegisterTransactionRequestBody

Returns ​

Promise<AdamantApiResult<RegisterTransactionResponseDto>>


setKVS() ​

ts
setKVS(request): Promise<AdamantApiResult<SetKVSResponseDto>>;

Defined in: src/api/index.ts:1544

Broadcasts an already-created and signed KVS transaction.

Parameters ​

ParameterType
requestSetKVSRequestBody

Returns ​

Promise<AdamantApiResult<SetKVSResponseDto>>


switchNodeFromCache() ​

ts
protected switchNodeFromCache(failedNode): boolean;

Defined in: src/helpers/healthCheck.ts:368

Switches to another already-verified synced, non-rate-limited node from the latest health sweep without issuing new /api/node/status requests.

Parameters ​

ParameterType
failedNodestring

Returns ​

boolean

Inherited from ​

NodeManager.switchNodeFromCache


updateNodes() ​

ts
updateNodes(isPlannedUpdate?, failedNode?): Promise<void>;

Defined in: src/helpers/healthCheck.ts:405

Parameters ​

ParameterTypeDefault value
isPlannedUpdate?booleanfalse
failedNode?stringundefined

Returns ​

Promise<void>

Inherited from ​

NodeManager.updateNodes


voteForDelegate() ​

ts
voteForDelegate(passphrase, votes): Promise<
  | {
  errorMessage: string;
  success: boolean;
}
  | Omit<unknown, "success"> & {
  success: true;
}>;

Defined in: src/api/index.ts:1045

Vote for specific delegates.

Address-based votes verify locally that the delegate's public key derives the voted ADM address before caching or signing. Username-based votes verify that the node's {address, publicKey} response is self-consistent (publicKey derives address), which does not prove that the username belongs to that delegate.

Parameters ​

ParameterTypeDescription
passphrasestringAccount's passphrase
votesstring[]Array with public keys, ADM addresses, or delegate names. For upvote, add leading +. For downvote, add leading -.

Returns ​

Promise< | { errorMessage: string; success: boolean; } | Omit<unknown, "success"> & { success: true; }>

Example ​

voteForDelegate(
  'apple banana cherry date elderberry fig grape hazelnut iris juniper kiwi lemon',
  [
    '+b3d0c0b99f64d0960324089eb678e90d8bcbb3dd8c73ee748e026f8b9a5b5468',
    '-9ef1f6212ae871716cfa2d04e3dc5339e8fe75f89818be21ee1d75004983e2a8',
    '+system',
    '-U16615166477939602094'
  ]
)

Released under the GPL-3.0 License.