Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DarkcoinClient

Client instance for doing RPC calls on Dashd

Hierarchy

  • DarkcoinClient

Index

Constructors

constructor

Properties

config

config: DashdConfig

defaultObjectRevision

defaultObjectRevision: string = "1"

defaultParentHash

defaultParentHash: string = "0"

Methods

abandonTransaction

  • abandonTransaction(txId: string): Promise<CallResult<null>>
  • Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.

    Parameters

    • txId: string

    Returns Promise<CallResult<null>>

callRPCMethod

  • callRPCMethod<T>(method: string, params: ReadonlyArray<any>, callId?: number): Promise<CallResult<T>>
  • This methods allows to call any of the RPC methods provided by dashd directly. Call it with 'help' for the full list of commands.

    Type parameters

    • T

    Parameters

    • method: string

      name of the method to call, e.g getblockhash

    • params: ReadonlyArray<any>

      params of the method, e.g. height for getblockhash

    • Optional callId: number

      id to associate with call

    Returns Promise<CallResult<T>>

dumpWallet

  • dumpWallet(filename: string): Promise<CallResult<null>>
  • creates or overwrites a file with all wallet keys in a human-readable format.

    Parameters

    • filename: string

      The file in which the wallet dump will be placed. May be prefaced by an absolute file path. An existing file with that name will be overwritten

    Returns Promise<CallResult<null>>

estimateFee

  • estimateFee(blocks: number): Promise<CallResult<number>>
  • Estimates the transaction fee per kilobyte that needs to be paid for a transaction to begin confirmation within a certain number of blocks.

    Parameters

    • blocks: number

      The maximum number of blocks a transaction should have to wait before it is predicted to be included in a block. Has to be between 1 and 25 blocks

    Returns Promise<CallResult<number>>

estimateSmartFee

  • Estimates the transaction fee per kilobyte that needs to be paid for a transaction to begin confirmation within a certain number of blocks and returns the number of blocks for which the estimate is valid.

    Parameters

    • blocks: number

      The maximum number of blocks a transaction should have to wait before it is predicted to be included in a block. Has to be between 1 and 25 blocks

    Returns Promise<CallResult<FeeEstimation>>

Private filterUndefined

  • filterUndefined<T>(originalArgs: IArguments, params: ReadonlyArray<T>): Promise<ReadonlyArray<T>>
  • Build the parameter list by removing optional arguments

    Type parameters

    • T

    Parameters

    • originalArgs: IArguments

      original argument list

    • params: ReadonlyArray<T>

    Returns Promise<ReadonlyArray<T>>

getAddressBalance

getGovernanceInfo

getMiningInfo

getNetworkInfo

getNewAddress

getUnconfirmedBalance

  • getUnconfirmedBalance(): Promise<CallResult<number>>

getWalletInfo

gobjectCurrentVotes

gobjectList

  • Returns key/value pairs for all current GObjects with the key. Will include both funding gobjects and trigger gobjects, Make sure to parse them and pull out the ones you want.

    Returns Promise<CallResult<GObjectList>>

gobjectPrepare

  • gobjectPrepare(creationTime: number, gobjectData: string): Promise<CallResult<string>>
  • The gobject prepare RPC prepares a governance object by signing and creating a collateral transaction.

    Parameters

    • creationTime: number

      Creation time as a unix timestamp

    • gobjectData: string

      Object data (JSON object with governance details)

    Returns Promise<CallResult<string>>

    Transaction id for the collateral transaction

gobjectSubmit

  • gobjectSubmit(creationTime: number, gobjectData: string, txId: string): Promise<CallResult<string>>
  • The gobject submit RPC submits a governance object to network (objects must first be prepared via gobject prepare).

    Parameters

    • creationTime: number

      Creation time as a unix timestamp (I think it needs to match the timestamp used in gobjectPrepare)

    • gobjectData: string

      Object data (JSON object with governance details)

    • txId: string

      Collateral transaction ID

    Returns Promise<CallResult<string>>

    The resulting governance object hash

importWallet

  • importWallet(filename: string): Promise<CallResult<null>>
  • imports private keys from a file in wallet dump file format (see the dumpwallet RPC). These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the block chain for transactions affecting the newly-added keys, which may take several minutes.

    Parameters

    • filename: string

      The file to import. The path is relative to Dash Core’s working directory

    Returns Promise<CallResult<null>>

listSinceBlock

  • listSinceBlock(headerHash?: string, targetConfirmations?: number, includeWatchOnly?: boolean): Promise<CallResult<ReadonlyArray<Transaction>>>
  • Get all transactions in blocks since block [blockhash], or all transactions if omitted

    Parameters

    • Optional headerHash: string

      The hash of a block header encoded as hex in RPC byte order. All transactions affecting the wallet which are not in that block or any earlier block will be returned, including unconfirmed transactions. Default is the hash of the genesis block, so all transactions affecting the wallet are returned by default

    • Optional targetConfirmations: number

      Sets the lastblock field of the results to the header hash of a block with this many confirmations. This does not affect which transactions are returned. Default is 1, so the hash of the most recent block on the local best block chain is returned

    • Optional includeWatchOnly: boolean

      If set to true, include watch-only addresses in details and calculations as if they were regular addresses belonging to the wallet. If set to false (the default), treat watch-only addresses as if they didn’t belong to this wallet

    Returns Promise<CallResult<ReadonlyArray<Transaction>>>

listTransactions

  • listTransactions(count?: number, skip?: number, includeWatchOnly?: boolean): Promise<CallResult<ReadonlyArray<Transaction>>>
  • Returns the most recent transactions that affect the wallet.

    Parameters

    • Optional count: number

      The number of transactions to return. default 10

    • Optional skip: number

      The number of transactions to return. default 0

    • Optional includeWatchOnly: boolean

      Include transactions to watch-only addresses (see 'importaddress'). default false

    Returns Promise<CallResult<ReadonlyArray<Transaction>>>

lockUnspent

  • Updates list of temporarily unspendable outputs. Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs. T If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked. A locked transaction output will not be chosen by automatic coin selection, when spending dashs. Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list is always cleared (by virtue of process exit) when a node stops or fails. Also see the listunspent call

    Parameters

    • unlock: boolean

      Whether to unlock (true) or lock (false) the specified transactions

    • inputs: ReadonlyArray<TransactionOutput>

      list of transaction outputs

    Returns Promise<CallResult<boolean>>

masternodeList

removePrunedFunds

  • removePrunedFunds(txId: string): Promise<CallResult<null>>
  • Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.

    Parameters

    • txId: string

      The hex-encoded id of the transaction you are removing

    Returns Promise<CallResult<null>>

sendToAddress

  • sendToAddress(dest: string, amount: number, comment?: string, commentTo?: string, subtractFeeFromAmount?: boolean, useIS?: boolean, usePS?: boolean): Promise<CallResult<string>>
  • Send an amount to a given address.

    Parameters

    • dest: string

      A P2PKH or P2SH address to which the dash should be sent

    • amount: number

      The amount to spent in dash

    • Optional comment: string

      A locally-stored (not broadcast) comment assigned to this transaction. Default is no comment

    • Optional commentTo: string

      A locally-stored (not broadcast) comment assigned to this transaction. Meant to be used for describing who the payment was sent to. Default is no comment

    • Optional subtractFeeFromAmount: boolean

      The fee will be deducted from the amount being sent. The recipient will receive less dash than you enter in the amount field. Default is false

    • Optional useIS: boolean

      If set to true, send this transaction as InstantSend (default: false).

    • Optional usePS: boolean

      If set to true, use anonymized funds only (default: false).

    Returns Promise<CallResult<string>>

    transaction id.

setTxFee

  • setTxFee(amount: number): Promise<CallResult<boolean>>
  • Set the transaction fee per kB. Overwrites the paytxfee parameter.

    Parameters

    • amount: number

      The transaction fee in DASH/kB

    Returns Promise<CallResult<boolean>>

signMessage

  • signMessage(address: string, message: string): Promise<CallResult<string>>
  • Sign a message with the private key of an address

    Parameters

    • address: string

      The dash address to use for the private key.

    • message: string

      The message to create a signature of.

    Returns Promise<CallResult<string>>

    The signature of the message encoded in base 64

verifyMessage

  • verifyMessage(address: string, signature: string, message: string): Promise<CallResult<string>>

Static convertDashToDuffs

  • convertDashToDuffs(value: number): number
  • Convert value from DASH to Duff (multiply by 10 ^ 8)

    Parameters

    • value: number

    Returns number

Generated using TypeDoc