1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-12-29 08:07:51 +01:00
js-bigchaindb-driver/API.md
2017-09-22 10:15:02 +02:00

9.9 KiB

Table of Contents

Ed25519Keypair

Parameters

  • secret number? A seed that will be used as a key derivation function

Properties

makeEd25519Condition

Parameters

  • publicKey string base58 encoded Ed25519 public key for the recipient of the Transaction
  • json boolean If true returns a json object otherwise a crypto-condition type (optional, default true)

Returns object Ed25519 Condition (that will need to wrapped in an Output)

makeSha256Condition

Parameters

  • preimage string Preimage to be hashed and wrapped in a crypto-condition
  • json boolean If true returns a json object otherwise a crypto-condition type (optional, default true)

Returns object Preimage-Sha256 Condition (that will need to wrapped in an Output)

makeThresholdCondition

Parameters

  • threshold number
  • subconditions Array (optional, default [])
  • json boolean If true returns a json object otherwise a crypto-condition type (optional, default true)

Returns object Sha256 Threshold Condition (that will need to wrapped in an Output)

makeCreateTransaction

Parameters

  • asset object Created asset's data
  • metadata object Metadata for the Transaction
  • outputs Array<object> Array of Output objects to add to the Transaction. Think of these as the recipients of the asset after the transaction. For CREATE Transactions, this should usually just be a list of Outputs wrapping Ed25519 Conditions generated from the issuers' public keys (so that the issuers are the recipients of the created asset).
  • issuers ...Array<string> Public key of one or more issuers to the asset being created by this Transaction. Note: Each of the private keys corresponding to the given public keys MUST be used later (and in the same order) when signing the Transaction (signTransaction()).

Returns object Unsigned transaction -- make sure to call signTransaction() on it before sending it off!

makeOutput

Parameters

  • condition object Condition (e.g. a Ed25519 Condition from makeEd25519Condition())
  • amount number Amount of the output (optional, default 1)

Returns object An Output usable in a Transaction

makeTransferTransaction

Parameters

  • unspentTransaction object Previous Transaction you have control over (i.e. can fulfill its Output Condition)
  • metadata object Metadata for the Transaction
  • outputs Array<object> Array of Output objects to add to the Transaction. Think of these as the recipients of the asset after the transaction. For TRANSFER Transactions, this should usually just be a list of Outputs wrapping Ed25519 Conditions generated from the public keys of the recipients.
  • fulfilledOutputs ...number Indices of the Outputs in unspentTransaction that this Transaction fulfills. Note that the public keys listed in the fulfilled Outputs must be used (and in the same order) to sign the Transaction (signTransaction()).

Returns object Unsigned transaction -- make sure to call signTransaction() on it before sending it off!

serializeTransactionIntoCanonicalString

Parameters

  • transaction
  • null object (transaction)

Returns string a canonically serialized Transaction

signTransaction

Parameters

  • transaction object Transaction to sign. transaction is not modified.
  • privateKeys ...string Private keys associated with the issuers of the transaction. Looped through to iteratively sign any Input Fulfillments found in the transaction.

Returns object The signed version of transaction.

ccJsonLoad

Parameters

Returns cc.Condition Ed25519 Condition (that will need to wrapped in an Output)

ccJsonify

Parameters

  • fulfillment cc.Fulfillment base58 encoded Ed25519 public key for the recipient of the Transaction

Returns object Ed25519 Condition (that will need to wrapped in an Output)

getBlock

Parameters

  • blockId

getStatus

Parameters

  • tx_id

getTransaction

Parameters

  • txId

listBlocks

Parameters

  • $0 Object
    • $0.tx_id
    • $0.status
  • tx_id
  • status

listOutputs

Parameters

  • $0 Object
    • $0.public_key
    • $0.unspent
  • onlyJsonResponse
  • public_key
  • unspent

listTransactions

Parameters

  • $0 Object
    • $0.asset_id
    • $0.operation
  • asset_id
  • operation

listVotes

Parameters

  • block_id

pollStatusAndFetchTransaction

Parameters

  • tx_id

Returns Promise

postTransaction

Parameters

  • transaction