Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LegacyTurtleCoind

A class interface that allows for easy interaction with Legacy TurtleCoind THIS OBJECT IS DEPRECATED AND SUBJECT TO REMOVAL WITH LITTLE NOTICE

Hierarchy

  • HTTPClient
    • LegacyTurtleCoind

Implements

  • ITurtleCoind

Index

Constructors

constructor

  • new LegacyTurtleCoind(host?: string, port?: number, timeout?: number, ssl?: boolean, userAgent?: string, keepAlive?: boolean, apiKey?: string, errorHandler?: (statusCode: number, error: IError) => Error): LegacyTurtleCoind
  • Parameters

    • host: string = '127.0.0.1'
    • port: number = 11898
    • timeout: number = 30000
    • ssl: boolean = false
    • userAgent: string = ...
    • keepAlive: boolean = true
    • Optional apiKey: string
    • Optional errorHandler: (statusCode: number, error: IError) => Error
        • (statusCode: number, error: IError): Error
        • Parameters

          • statusCode: number
          • error: IError

          Returns Error

    Returns LegacyTurtleCoind

Accessors

agent

  • get agent(): Agent | Agent
  • Returns Agent | Agent

headers

  • get headers(): Headers
  • Returns Headers

host

  • get host(): string
  • Returns string

keepAlive

  • get keepAlive(): boolean
  • Returns boolean

key

  • get key(): undefined | string
  • Returns undefined | string

port

  • get port(): number
  • Returns number

protocol

  • get protocol(): string
  • Returns string

ssl

  • get ssl(): boolean
  • Returns boolean

timeout

  • get timeout(): number
  • Returns number

userAgent

  • get userAgent(): string
  • Returns string

Methods

Private _blockHeaderByHash

  • _blockHeaderByHash(hash: string): Promise<IBlockHeader>
  • Retrieves the block header information by hash

    Parameters

    • hash: string

      the hash of the block to retrieve the header for

    Returns Promise<IBlockHeader>

Private _blockHeaderByHeight

  • _blockHeaderByHeight(height: number): Promise<IBlockHeader>
  • Retrieves the block header by the height

    Parameters

    • height: number

      the height of the block to retrieve the header for

    Returns Promise<IBlockHeader>

Private _blockShortHeaders

  • _blockShortHeaders(height: number): Promise<IBlockShortHeader[]>
  • Retrieves abbreviated block information for the last 31 blocks before the specified height (inclusive)

    Parameters

    • height: number

      the height of the block to retrieve

    Returns Promise<IBlockShortHeader[]>

Private _globalIndexesForRange

  • _globalIndexesForRange(startHeight: number, endHeight: number): Promise<IGlobalIndexesResponse[]>
  • Retrieves the global indexes for any transactions in the range [startHeight .. endHeight]. Generally, you only want the global index for a specific transaction, however, this reveals that you probably are the recipient of this transaction. By supplying a range of blocks, you can obfusticate which transaction you are enquiring about.

    Parameters

    • startHeight: number

      the height to begin returning indices from

    • endHeight: number

      the height to end returning indices from

    Returns Promise<IGlobalIndexesResponse[]>

Private _lastBlockHeader

  • _lastBlockHeader(): Promise<IBlockHeader>
  • Retrieves the last block header information

    Returns Promise<IBlockHeader>

Private _poolChanges

  • _poolChanges(tailBlockHash: string, knownTransactionHashes?: string[]): Promise<IPoolChanges>
  • Retrieves updates regarding the transaction mempool

    Parameters

    • tailBlockHash: string

      the last block hash that we know about

    • knownTransactionHashes: string[] = ...

      an array of the transaction hashes we last knew were in the mempool

    Returns Promise<IPoolChanges>

Private _randomOutputs

  • _randomOutputs(amounts: number[], mixin?: number): Promise<IRandomOutputsResponse>
  • Retrieves random outputs from the chain for mixing purposes during the creation of a new transaction

    Parameters

    • amounts: number[]

      an array of the amounts for which we need random outputs

    • mixin: number = 1

      the number of random outputs we need for each amount specified

    Returns Promise<IRandomOutputsResponse>

Private _rawBlocks

  • _rawBlocks(startHeight?: number, startTimestamp?: number, blockHashCheckpoints?: string[], skipCoinbaseTransactions?: boolean, blockCount?: number): Promise<IRawBlocksResponse>
  • Retrieves the raw hex representation of each block and the transactions in the blocks versus returning JSON or other encoded versions of the same.

    Retrieves up to 100 blocks. If block hash checkpoints are given, it will return beginning from the height of the first hash it finds, plus one. However, if startHeight or startTimestamp is given, and this value is higher than the block hash checkpoints, it will start returning from that height instead. The block hash checkpoints should be given with the highest block height hashes first. Typical usage: specify a start height/timestamp initially, and from then on, also provide the returned block hashes.

    Parameters

    • startHeight: number = 0

      the height to start returning blocks from

    • startTimestamp: number = 0

      the timestamp to start returning blocks from

    • blockHashCheckpoints: string[] = ...

      the block hash checkpoints

    • skipCoinbaseTransactions: boolean = false

      whether to skip returning blocks with only coinbase transactions

    • blockCount: number = 100

      the number of blocks to retrieve

    Returns Promise<IRawBlocksResponse>

Private _sendRawTransaction

  • _sendRawTransaction(transaction: string): Promise<ISendRawTransactionResponse>
  • Submits a raw transaction to the daemon for processing relaying to the network

    Parameters

    • transaction: string

      the hex representation of the transaction

    Returns Promise<ISendRawTransactionResponse>

Private _transaction

  • _transaction(hash: string): Promise<ITransactionResponse>
  • Retrieves a single transaction's information

    Parameters

    • hash: string

      the hash of the transaction to retrieve

    Returns Promise<ITransactionResponse>

Private _transactionPool

  • _transactionPool(): Promise<ITransactionSummary[]>
  • Retrieves summary information of the transactions currently in the mempool

    Returns Promise<ITransactionSummary[]>

Private _transactionStatus

  • _transactionStatus(transactionHashes: string[]): Promise<ITransactionStatusResponse>
  • Retrieves the status of the transaction hashes provided

    Parameters

    • transactionHashes: string[]

      an array of transaction hashes to check

    Returns Promise<ITransactionStatusResponse>

Private _walletSyncData

  • _walletSyncData(startHeight?: number, startTimestamp?: number, blockHashCheckpoints?: string[], skipCoinbaseTransactions?: boolean, blockCount?: number): Promise<IWalletSyncData>
  • The only the data necessary for wallet syncing purposes

    Retrieves up to 100 blocks. If block hash checkpoints are given, it will return beginning from the height of the first hash it finds, plus one. However, if startHeight or startTimestamp is given, and this value is higher than the block hash checkpoints, it will start returning from that height instead. The block hash checkpoints should be given with the highest block height hashes first. Typical usage: specify a start height/timestamp initially, and from then on, also provide the returned block hashes.

    Parameters

    • startHeight: number = 0

      the height to start returning blocks from

    • startTimestamp: number = 0

      the timestamp to start returning blocks from

    • blockHashCheckpoints: string[] = ...

      the block hash checkpoints

    • skipCoinbaseTransactions: boolean = false

      whether to skip returning blocks with only coinbase transactions

    • blockCount: number = 100

      the number of blocks to request

    Returns Promise<IWalletSyncData>

block

  • block(block: string | number): Promise<IBlock>
  • Retrieves the block information for the specified block Requires the daemon to have the explorer enabled

    Parameters

    • block: string | number

      the block height or hash

    Returns Promise<IBlock>

blockCount

  • blockCount(): Promise<number>
  • Retrieves the number of blocks the node has in its chain

    Returns Promise<number>

blockHeaders

  • blockHeaders(height: number): Promise<IBlock[]>
  • Retrieves the block information for the last 30 blocks up to the current height Requires the daemon to have the explorer enabled

    Parameters

    • height: number

      the height to stop at

    Returns Promise<IBlock[]>

blockTemplate

  • blockTemplate(address: string, reserveSize?: number): Promise<IBlockTemplate>
  • Retrieves a mining block template using the specified address and reserve size

    Parameters

    • address: string

      the wallet address that will receive the coinbase outputs

    • reserveSize: number = 8

      the amount of data to reserve in the miner transaction

    Returns Promise<IBlockTemplate>

Protected delete

  • delete(endpoint: string): Promise<void>
  • Parameters

    • endpoint: string

    Returns Promise<void>

fee

  • fee(): Promise<IFee>
  • Retrieves the node fee information

    Returns Promise<IFee>

Protected get

  • get(endpoint: string): Promise<any>
  • Parameters

    • endpoint: string

    Returns Promise<any>

height

  • height(): Promise<IHeight>
  • Retrieves the node height information

    Returns Promise<IHeight>

indexes

  • indexes(startHeight: number, endHeight: number): Promise<ITransactionIndexes[]>
  • Retrieves the global indexes for all transactions contained within the blocks heights specified (non-inclusive)

    Parameters

    • startHeight: number

      the starting block height

    • endHeight: number

      the ending block height

    Returns Promise<ITransactionIndexes[]>

info

  • info(): Promise<IInfo>
  • Retrieves the node information

    Returns Promise<IInfo>

lastBlock

  • lastBlock(): Promise<IBlock>
  • Retrieves the block information for the last block available

    Returns Promise<IBlock>

peers

  • peers(): Promise<IPeers>
  • Retrieves the node peer information

    Returns Promise<IPeers>

Protected post

  • post(endpoint: string, body?: any): Promise<any>
  • Parameters

    • endpoint: string
    • Optional body: any

    Returns Promise<any>

Protected put

  • put(endpoint: string, body?: any): Promise<any>
  • Parameters

    • endpoint: string
    • Optional body: any

    Returns Promise<any>

randomIndexes

  • randomIndexes(amounts: number[], count: number): Promise<IRandomOutput[]>
  • Retrieves random global indexes typically used for mixing operations for the specified amounts and for the number requested (if available)

    Parameters

    • amounts: number[]

      an array of amounts for which we need random global indexes

    • count: number

      the number of global indexes to return for each amount

    Returns Promise<IRandomOutput[]>

rawBlock

  • rawBlock(block: string | number): Promise<IRawBlock>
  • Retrieves the RawBlock information from the node for the specified block Requires the daemon to have the explorer enabled

    Parameters

    • block: string | number

      the block height or hash

    Returns Promise<IRawBlock>

rawSync

  • rawSync(checkpoints?: string[], height?: number, timestamp?: number, skipCoinbaseTransactions?: boolean, count?: number): Promise<IRawSync>
  • Retrieves the RawBlocks & RawTransactions for syncing a wallet (or other utility) against the node

    Parameters

    • checkpoints: string[] = ...

      a list of block hashes that we know about in descending height order

    • height: number = 0

      the height to start syncing from

    • timestamp: number = 0

      the timestamp to start syncing from

    • skipCoinbaseTransactions: boolean = false

      whether we should skip blocks that only include coinbase transactions

    • count: number = 100

      the number of blocks to return

    Returns Promise<IRawSync>

rawTransaction

  • rawTransaction(hash: string): Promise<string>
  • Retrieves the RawTransaction from the node for the specified transaction Requires the daemon to have the explorer enabled

    Parameters

    • hash: string

      the transaction hash

    Returns Promise<string>

rawTransactionPool

  • rawTransactionPool(): Promise<string[]>
  • Retrieves the RawTransactions currently in the memory pool Requires the daemon to have the explorer enabled

    Returns Promise<string[]>

Protected rpcPost

  • rpcPost(method: string, params?: any): Promise<any>
  • Parameters

    • method: string
    • Optional params: any

    Returns Promise<any>

submitBlock

  • submitBlock(block: string): Promise<string>
  • Submits a block to the node for processing

    Parameters

    • block: string

      the hex representation of the block

    Returns Promise<string>

submitTransaction

  • submitTransaction(transaction: string): Promise<string>
  • Submits a transaction to the node for processing

    Parameters

    • transaction: string

      the hex representation of the transaction

    Returns Promise<string>

sync

  • sync(checkpoints?: string[], height?: number, timestamp?: number, skipCoinbaseTransactions?: boolean, count?: number): Promise<ISync>
  • Retrieves the information necessary for syncing a wallet (or other utility) against the node

    Parameters

    • checkpoints: string[] = ...

      a list of block hashes that we know about in descending height order

    • height: number = 0

      the height to start syncing from

    • timestamp: number = 0

      the timestamp to start syncing from

    • skipCoinbaseTransactions: boolean = false

      whether we should skip blocks that only include coinbase transactions

    • count: number = 100

      the number of blocks to return

    Returns Promise<ISync>

transaction

  • transaction(hash: string): Promise<ITransaction>
  • Retrieves the transaction information for the specified transaction Requires the daemon to have the explorer enabled

    Parameters

    • hash: string

      the transaction hash

    Returns Promise<ITransaction>

transactionPool

  • transactionPool(): Promise<TransactionSummary[]>
  • Retrieves the transaction summary information for the transactions currently Requires the daemon to have the explorer enabled in the memory pool

    Returns Promise<TransactionSummary[]>

transactionPoolChanges

  • transactionPoolChanges(lastKnownBlock: string, transactions?: string[]): Promise<ITransactionPoolDelta>
  • Gets the transaction memory pool changes given the last known block hash and the transactions we last knew to be in the memory pool

    Parameters

    • lastKnownBlock: string

      the last known block hash

    • transactions: string[] = ...

      an array of transaction hashes we last saw in the memory pool

    Returns Promise<ITransactionPoolDelta>

transactionsStatus

  • transactionsStatus(transactions: string[]): Promise<ITransactionsStatus>
  • Retrieves information on where the specified transactions are located

    Parameters

    • transactions: string[]

      an array of transaction hashes

    Returns Promise<ITransactionsStatus>

Generated using TypeDoc