mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 01:36:56 +01:00
Merge pull request #27 from bigchaindb/feature/readmeupdates
Code example updates
This commit is contained in:
commit
6ccc9848c5
@ -45,7 +45,7 @@ You'll probably need a babel here and a bundler there. Alternatively, use one of
|
||||
```js
|
||||
import * as driver from 'bigchaindb-driver'
|
||||
|
||||
// http(s)://<bigchaindb-API-url>/ (e.g. http://localhost:9984/api/v1/)
|
||||
// BigchainDB server instance or IPDB (e.g. https://test.ipdb.io/api/v1/)
|
||||
const API_PATH = 'http://localhost:9984/api/v1/'
|
||||
|
||||
// Create a new user with a public-private key pair
|
||||
@ -65,7 +65,7 @@ const tx = driver.Transaction.makeCreateTransaction(
|
||||
driver.Transaction.makeEd25519Condition(alice.publicKey))
|
||||
],
|
||||
alice.publicKey
|
||||
);
|
||||
)
|
||||
|
||||
// Optional: You've got everything you need, except for an asset
|
||||
// and metadata. Maybe define them here, any JSON-serializable object
|
||||
@ -78,7 +78,7 @@ const tx = driver.Transaction.makeCreateTransaction(
|
||||
const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey)
|
||||
|
||||
// Send the transaction off to BigchainDB
|
||||
let conn = new driver.Connection(PATH, { 'Content-Type': 'application/json' })
|
||||
let conn = new driver.Connection(API_PATH, { 'Content-Type': 'application/json' })
|
||||
|
||||
conn.postTransaction(txSigned)
|
||||
.then(() => conn.getStatus(txSigned.id))
|
||||
|
Loading…
Reference in New Issue
Block a user