1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-01 07:55:21 +01:00
js-bigchaindb-driver/docs/upgrade-guides/0.3.0.md
2018-08-10 12:49:26 +02:00

3.4 KiB

Updating js-bigchaindb-driver from v0.1.x to v0.3.0

The latest version of js-bigchaindb-driver contains breaking changes to its external API. In this document, we enumerate all changes to allow you to make upgrades efficiently.

Note that upgrading the js-bigchaindb-driver to v0.3.0 was done to enable functionality included in the latest (v1.0) BigchainDB release. A full list of BigchainDB v1.0's breaking changes can be found here. Note that v1.0 contains breaking changes to its core data models.

This document will just go into the very specific breaking changes affecting the JavaScript driver.

Breaking changes to js-bigchaindb-driver's APIs

Output amount is now a string

// old
export default function makeOutput(condition, amount = 1) {}

// new
export default function makeOutput(condition, amount = '1') {}

Update to Crypto-Conditions version 2

All conditions or fulfillments passed manually to the driver now need to comply with ILP's Crypto-Condition version 2 specification. For more information, see the updated specification or checkout the latest reference implementation of Crypto-Conditions in JavaScript.

Several Connection methods now require positional arguments

Connection.listBlocks
// old
new Connection(PATH).listBlocks({ tx_id, status })

// new
new Connection(PATH).listBlocks(transactionId, status)
Connection.listOutputs
// old
new Connection(PATH).listOutputs({ public_key, unspent })

// new
new Connection(PATH).listOutputs(publicKey, spent)

NOTE: The unspent flag has been inversed. This is inline with breaking changes to BigchainDB v1.0.

Connection.listTransactions
// old
new Connection(PATH).listTransactions({ asset_id, operation })

// new
new Connection(PATH).listTransactions(assetId, operation)

Newly added endpoints

Connection.searchAsset
// new
new Connection(PATH).searchAssets(search)

A querying interface to text-search all assets in BigchainDB. For more documentation, see BigchainDB's HTTP API.

Newly available bundles and CDN hosting

The driver is now bundled automatically each time we publish it to npm.com. We now ship packages for commonjs, commonjs2, amd, umd, window and node.js. Thanks to unpkg.com, we're also able to provide all these packages on a CDN. A link to all the bundles can be found here.

A few notes:

  • Adjust version number in link as appropriate
  • only include bigchaindb-driver.*.min.js, but now everything bundle.*. This is a known issue.