Skip to content
martiliones edited this page Jun 12, 2023 · 1 revision

Adamant: Node

adamantApi.getBroadhash()

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

  • Type

    interface AdamantApi {
      getBroadhash(): Promise<GetBroadhashResponseDto>;
    }
    
    interface GetBroadhashResponseDto {
      broadhash: string;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getEpoch()

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

  • Type

    interface AdamantApi {
      getEpoch(): Promise<GetEpochResponseDto>;
    }
    
    interface GetEpochResponseDto {
      epoch: string;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getFee()

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

  • Type

    interface AdamantApi {
      getFee(): Promise<GetTokenTransferFeeResponseDto>;
    }
    
    interface GetTokenTransferFeeResponseDto {
      fee: number;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getFees()

Returns current fee values for different transaction types

  • Type

    interface AdamantApi {
      getFees(): Promise<GetTransactionTypesFeesResponseDto>;
    }
    
    interface GetTransactionTypesFeesResponseDto {
      fees: TransactionTypesFeesDto;
      nodeTimestamp: number;
      success: boolean;
    }
    
    interface TransactionTypesFeesDto {
      avatar_upload: number;
      chat_message: number;
      delegate: number;
      old_chat_message: number;
      profile_update: number;
      send: number;
      state_store: number;
      vote: number;
    }

adamantApi.getHeight()

Returns current node's blockchain height

  • Type

    interface AdamantApi {
      getHeight(): Promise<GetHeightResponseDto>;
    }
    
    interface GetHeightResponseDto {
      height: number;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getLoadingStatus()

gets loading status

  • Type

    interface AdamantApi {
      getLoadingStatus(): Promise<GetLoadingStatusResponseDto>;
    }
    
    interface GetLoadingStatusResponseDto {
      blocksCount: number;
      loaded: boolean;
      nodeTimestamp: number;
      now: number;
      success: boolean;
    }

adamantApi.getMilestone()

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

  • Type

    interface AdamantApi {
      getMilestone(): Promise<GetMilestoneResponseDto>;
    }
    
    interface GetMilestoneResponseDto {
      milestone: number;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getNethash()

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

  • Type

    interface AdamantApi {
      getNethash(): Promise<GetNethashResponseDto>;
    }
    
    interface GetNethashResponseDto {
      nethash: string;
      nodeTimestamp: number;
      success: boolean;
    }

adamantApi.getNodeStatus()

Returns both ADAMANT blockchain network information and Node information in a single request.

  • Type

    interface AdamantApi {
      getNodeStatus(): Promise<GetNodeStatusResponseDto>;
    }
    
    interface GetNodeStatusResponseDto {
      network: NetworkStatus;
      nodeTimestamp: number;
      success: boolean;
      version: NodeVersion;
      wsClient: WsClient;
    }
    
    interface NetworkStatus {
      broadhash: string;
      epoch: string;
      fee: number;
      height: number;
      milestone: number;
      nethash: string;
      reward: number;
      supply: number;
    }
    
    interface NodeVersion {
      build: string;
      commit: string;
      version: string;
    }
    
    interface WsClient {
      enabled: boolean;
      port: number;
    }

adamantApi.getNodeVersion()

gets node's software information

  • Type

    interface AdamantApi {
      getNodeVersion(): Promise<GetNodeVersionResponseDto>;
    }
    
    type GetNodeVersionResponseDto = {
      nodeTimestamp: number;
      success: boolean;
    } & NodeVersion;
    
    interface NodeVersion {
      build: string;
      commit: string;
      version: string;
    }

adamantApi.getPeers()

gets list of connected peer nodes

  • Type

    interface AdamantApi {
      getPeers(): Promise<GetPeersResponseDto>;
    }
    
    interface GetPeersResponseDto {
      nodeTimestamp: number;
      peers: PeerDto[];
      success: boolean;
    }
    
    interface PeerDto {
      broadhash: string;
      clock: string;
      height: number;
      ip: string;
      nonce: string;
      os: string;
      port: string;
      state: number;
      updated: number;
      version: string;
    }

adamantApi.getPingStatus()

checks whenever the node is alive

  • Type

    interface AdamantApi {
      getPingStatus(): Promise<GetPingStatusResponseDto>;
    }
    
    interface GetPingStatusResponseDto {
      success: boolean;
    }

adamantApi.getReward()

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.

  • Type

    interface AdamantApi {
      getReward(): Promise<GetRewardResponseDto>;
    }
    
    interface GetRewardResponseDto {
      nodeTimestamp: number;
      reward: number;
      success: boolean;
    }

adamantApi.getStatus()

Returns blockchain network information in a single request

  • Type

    interface AdamantApi {
      getStatus(): Promise<GetNetworkInfoResponseDto>;
    }
    
    type GetNetworkInfoResponseDto = {
      nodeTimestamp: number;
      success: boolean;
    } & NetworkStatus;
    
    interface NetworkStatus {
      broadhash: string;
      epoch: string;
      fee: number;
      height: number;
      milestone: number;
      nethash: string;
      reward: number;
      supply: number;
    }

adamantApi.getSupply()

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.

  • Type

    interface AdamantApi {
      getSupply(): Promise<GetTokensTotalSupplyResponseDto>;
    }
    
    interface GetTokensTotalSupplyResponseDto {
      nodeTimestamp: number;
      success: boolean;
      supply: number;
    }

adamantApi.getSyncStatus()

gets information on node's sync process with other peers

  • Type

    interface AdamantApi {
      getSyncStatus(): Promise<GetSyncStatusResponseDto>;
    }
    
    interface GetSyncStatusResponseDto {
      blocks: number;
      broadhash: string;
      consensus: number;
      height: number;
      nodeTimestamp: number;
      success: boolean;
      syncing: boolean;
    }

adamantApi.getTransactions()

Returns list of transactions

  • Type

    interface AdamantApi {
      getTransactions(
        options?: TransactionQuery<TransactionsOptions>
      ): Promise<GetTransactionsResponseDto>;
    }
    
    interface TransactionsOptions {
      blockId?: number;
      fromHeight?: number;
      inId?: string;
      limit?: number;
      maxAmount?: number;
      minAmount?: number;
      offset?: number;
      orderBy?: string;
      recipientId?: string;
      recipientIds?: string[];
      recipientPublicKey?: string;
      recipientPublicKeys?: string[];
      returnAsset?: 1 | 0;
      senderId?: string;
      senderIds?: string[];
      senderPublicKey?: string;
      senderPublicKeys?: string[];
      toHeight?: number;
      type?: number;
      types?: number[];
    }
    
    interface GetTransactionsResponseDto {
      count: string;
      nodeTimestamp: number;
      success: boolean;
      transactions: (
        | VoteForDelegateTransaction
        | never
        | never
        | ChatMessageTransaction
        | TokenTransferTransaction
      )[];
    }
    
    type TokenTransferTransaction = {
      asset: TokenTransferAsset;
      type: number;
    } & BaseTransaction;
    
    type ChatMessageTransaction = {
      asset: ChatMessageAsset;
      type: number;
    } & BaseTransaction;
    
    type VoteForDelegateTransaction = {
      asset: VoteForDelegateAsset;
      type: number;
      votes: { added?: string[]; deleted?: string[] };
    } & BaseTransaction;
    
    interface BaseTransaction {
      amount: number;
      asset: object;
      blockId: string;
      block_timestamp: number;
      confirmations: number;
      fee: number;
      height: number;
      id: string;
      recipientId: string;
      recipientPublicKey: string;
      senderId: string;
      senderPublicKey: string;
      signature: string;
      signatures: string[];
      timestamp: number;
      type: number;
    }
    
    type TokenTransferAsset = object;
    
    interface ChatMessageAsset {
      chat: { message?: string; own_message?: string; type?: number };
    }
    
    interface VoteForDelegateAsset {
      votes?: string[];
    }
  • References

    TransactionQuery

Clone this wiki locally