mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 09:46:58 +01:00
Merge pull request #219 from innoprenuer/master
removed redundant getTransaction func calls
This commit is contained in:
commit
ea4f9e4464
@ -42,12 +42,12 @@ async function basicUsage() {
|
||||
driver.Transaction.signTransaction(txCreateAliceSimple, alice.privateKey)
|
||||
|
||||
|
||||
// ======== Post Transaction and Fetch Result ======== //
|
||||
await conn.postTransactionCommit(txCreateAliceSimpleSigned)
|
||||
await conn.getTransaction(txCreateAliceSimpleSigned.id)
|
||||
// ======== POST CREATE Transaction ======== //
|
||||
const createdTx = await conn.postTransactionCommit(txCreateAliceSimpleSigned)
|
||||
|
||||
// ======== POST TRANSFER Transaction ======== //
|
||||
const txTransferBob = driver.Transaction.makeTransferTransaction(
|
||||
[{ tx: txCreateAliceSimpleSigned, output_index: 0 }],
|
||||
[{ tx: createdTx, output_index: 0 }],
|
||||
[driver.Transaction.makeOutput(driver.Transaction.makeEd25519Condition(bob.publicKey))],
|
||||
{ price: '100 euro' }
|
||||
)
|
||||
@ -55,7 +55,6 @@ async function basicUsage() {
|
||||
const txTransferBobSigned = driver.Transaction.signTransaction(txTransferBob, alice.privateKey)
|
||||
|
||||
await conn.postTransactionCommit(txTransferBobSigned)
|
||||
await conn.getTransaction(txTransferBobSigned.id)
|
||||
|
||||
|
||||
// ======== Querying Assets ======== //
|
||||
|
@ -38,7 +38,6 @@ const txCreateAliceSimpleSigned =
|
||||
|
||||
// ======== Post Transaction and Fetch Result ======== //
|
||||
conn.postTransactionCommit(txCreateAliceSimpleSigned)
|
||||
.then(() => conn.getTransaction(txCreateAliceSimpleSigned.id))
|
||||
// ======== Transfer Bicycle to Bob ======== //
|
||||
.then((fetchedTx) => {
|
||||
const txTransferBob = driver.Transaction.makeTransferTransaction(
|
||||
@ -52,7 +51,6 @@ conn.postTransactionCommit(txCreateAliceSimpleSigned)
|
||||
|
||||
return conn.postTransactionCommit(txTransferBobSigned)
|
||||
})
|
||||
.then(res => conn.getTransaction(res.id))
|
||||
.then(tx => {
|
||||
console.log('Is Bob the owner?', tx.outputs[0].public_keys[0] === bob.publicKey) // eslint-disable-line no-console
|
||||
console.log('Was Alice the previous owner?', tx.inputs[0].owners_before[0] === alice.publicKey) // eslint-disable-line no-console
|
||||
|
@ -35,7 +35,6 @@ function createTx(assetdata) {
|
||||
|
||||
const txCreateSigned = driver.Transaction.signTransaction(txCreate, alice.privateKey)
|
||||
return conn.postTransactionCommit(txCreateSigned)
|
||||
.then(() => conn.getTransaction(txCreateSigned.id))
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user