From 9023d061dd37a1b4148d01601ed9862127e86f9a Mon Sep 17 00:00:00 2001 From: manolodewiner Date: Tue, 3 Apr 2018 10:43:25 +0200 Subject: [PATCH 1/4] include BigchainDB2.0 in README --- README.md | 1 + docs/source/readme.rst | 94 +++++++++++++++++++++--------------------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 285ee2f3..f7d6ea8d 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ | `0.10` | `0.1.x` | | `1.0.0` | `0.3.x` | | `>= 1.3.0` | `3.x.x` | +| `>= 2.0.0` | `4.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) diff --git a/docs/source/readme.rst b/docs/source/readme.rst index 97278cd2..4c1906aa 100644 --- a/docs/source/readme.rst +++ b/docs/source/readme.rst @@ -44,70 +44,68 @@ Compatibility Matrix Older versions -------------------- -#### Versions 4.x.x +**Version 4.x.x** + As part of the changes in the BigchainDB 2.0 server, some endpoint were + modified. In order to be consistent with them, the JS driver does not have + anymore the `pollStatusAndFetchTransaction()` method as there are three + different ways of posting a transaction. + - `async` using the `postTransaction`: the response will return immediately and not wait to see if the transaction is valid. + - `sync` using the `postTransactionSync`: the response will return after the transaction is validated. + - `commit` using the `postTransactionCommit`: the response will return after the transaction is committed to a block. + By default in the docs we will use the `postTransactionCommit` as is way of + being sure that the transaction is validated and commited to a block, so + there will not be any issue if you try to transfer the asset immediately. -As part of the changes in the BigchainDB 2.0 server, some endpoint were -modified. In order to be consistent with them, the JS driver does not have -anymore the `pollStatusAndFetchTransaction()` method as there are three -different ways of posting a transaction. -- `async` using the `postTransaction`: the response will return immediately and not wait to see if the transaction is valid. -- `sync` using the `postTransactionSync`: the response will return after the transaction is validated. -- `commit` using the `postTransactionCommit`: the response will return after the transaction is committed to a block. -By default in the docs we will use the `postTransactionCommit` as is way of -being sure that the transaction is validated and commited to a block, so -there will not be any issue if you try to transfer the asset immediately. +**Version 3.2.x** + For versions below 3.2, a transfer transaction looked like: -#### Versions 3.2.x + .. code-block:: js -For versions below 3.2, a transfer transaction looked like: + const createTranfer = BigchainDB.Transaction.makeTransferTransaction( + txCreated, + metadata, [BigchainDB.Transaction.makeOutput( + BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], + 0 + ) -.. code-block:: js - - const createTranfer = BigchainDB.Transaction.makeTransferTransaction( - txCreated, - metadata, [BigchainDB.Transaction.makeOutput( - BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], - 0 - ) - - const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, - keypair.privateKey) + 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: + In order to upgrade and do it compatible with the new driver version, this + transaction should be now: -.. code-block:: js + .. code-block:: js - const createTranfer = BigchainDB.Transaction.makeTransferTransaction( - [{ tx: txCreated, output_index: 0 }], - [BigchainDB.Transaction.makeOutput( - BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], - metaData - ) + const createTranfer = BigchainDB.Transaction.makeTransferTransaction( + [{ tx: txCreated, output_index: 0 }], + [BigchainDB.Transaction.makeOutput( + BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], + metaData + ) - const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, - keypair.privateKey) + 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: + 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 + .. code-block:: js - const createTranfer = BigchainDB.Transaction.makeTransferTransaction( - [{ tx: txCreated1, output_index: 0 }, - { tx: txCreated2, output_index: 0}], - [BigchainDB.Transaction.makeOutput( - BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], - metaData - ) + const createTranfer = BigchainDB.Transaction.makeTransferTransaction( + [{ tx: txCreated1, output_index: 0 }, + { tx: txCreated2, output_index: 0}], + [BigchainDB.Transaction.makeOutput( + BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))], + metaData + ) - const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, - keypair.privateKey) + const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer, + keypair.privateKey) From 107c8b0d6e28e5aa627d860c14fe4f80f85878d3 Mon Sep 17 00:00:00 2001 From: manolodewiner Date: Tue, 3 Apr 2018 10:47:00 +0200 Subject: [PATCH 2/4] version 4.0 added to breaking changes --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f7d6ea8d..495af1f1 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ | `>= 2.0.0` | `4.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) + +- **Version 4.0** of BigchainDB JavaScript Driver makes the driver compatible with BigchainDB 2.0. There are new functions for posting transactions. Check [older versions](https://docs.bigchaindb.com/projects/js-driver/en/latest/readme.html#features) +- **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) ## Contents From e2da49751c0314322505936abafd3add402339d4 Mon Sep 17 00:00:00 2001 From: manolodewiner Date: Wed, 4 Apr 2018 10:27:23 +0200 Subject: [PATCH 3/4] postTransaction --> postTransactionCommit in README --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 495af1f1..079d8a44 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,10 @@ ## Breaking changes -- **Version 4.0** of BigchainDB JavaScript Driver makes the driver compatible with BigchainDB 2.0. There are new functions for posting transactions. Check [older versions](https://docs.bigchaindb.com/projects/js-driver/en/latest/readme.html#features) +- **Version 4.0** of BigchainDB JavaScript Driver makes the driver compatible with BigchainDB 2.0. There are new functions for sending off transactions along with other changes. Check [older versions](https://docs.bigchaindb.com/projects/js-driver/en/latest/readme.html#features) - **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) + ## Contents * [Installation and Usage with package managers (npm/yarn)](#installation-and-usage-with-package-managers-npmyarn) @@ -74,8 +75,7 @@ const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey) // Send the transaction off to BigchainDB const conn = new driver.Connection(API_PATH) -conn.postTransaction(txSigned) - .then(() => conn.pollStatusAndFetchTransaction(txSigned.id)) +conn.postTransactionCommit(txSigned) .then(retrievedTx => console.log('Transaction', retrievedTx.id, 'successfully posted.')) ``` @@ -88,7 +88,7 @@ conn.postTransaction(txSigned) BigchainDB boilerplate - +