1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 01:36:56 +01:00

older versions readme explanation

This commit is contained in:
manolodewiner 2017-12-20 11:32:34 +01:00
parent e745b5948d
commit 2348a49965
2 changed files with 31 additions and 3 deletions

View File

@ -16,7 +16,7 @@
| ----------------- |------------------------------|
| `0.10` | `0.1.x` |
| `1.0.0` | `0.3.x` |
| `>= 1.3.0` | `>= 3.1.x` |
| `>= 1.3.0` | `3.x.x` |
## Breaking changes
Version 3.2 of BigchainDB JavaScript Driver introduces a new way of creating transfer transactions. Check [older versions](https://docs.bigchaindb.com/projects/js-driver/en/latest/readme.html#features)

View File

@ -34,13 +34,13 @@ Compatibility Matrix
+-----------------------+----------------------------------+
| ``1.0`` | ``0.3.x`` |
+-----------------------+----------------------------------+
| ``1.3`` | ``3.1.x`` |
| ``1.3`` | ``3.x.x`` |
+-----------------------+----------------------------------+
Older versions
--------------------
For versions below 3.2, the transfer transaction is like this:
For versions below 3.2, a transfer transaction looked like:
.. code-block:: js
@ -52,3 +52,31 @@ For versions below 3.2, the transfer transaction is like this:
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, keypair.privateKey)
In order to upgrade and do it compatible with the new driver version, this transaction should be now:
.. code-block:: js
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated, output_index: 0 }],
[aliceOutput],
metaData
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, keypair.privateKey)
The upgrade allows to create transfer transaction spending outputs that belong to different transactions.
So for instance is now possible to create a transfer transaction spending two outputs from two different create transactions:
.. code-block:: js
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated1, output_index: 0 }, { tx: txCreated2, output_index: 0 }],
[aliceOutput],
metaData
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, keypair.privateKey)