1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-12-27 23:27:50 +01:00

removed redundant getTransaction func calls

This commit is contained in:
Manan Patel 2018-07-06 16:51:10 +02:00
parent fadc1bd567
commit 28bcc02f30
3 changed files with 4 additions and 8 deletions

View File

@ -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 ======== //

View File

@ -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

View File

@ -35,7 +35,6 @@ function createTx(assetdata) {
const txCreateSigned = driver.Transaction.signTransaction(txCreate, alice.privateKey)
return conn.postTransactionCommit(txCreateSigned)
.then(() => conn.getTransaction(txCreateSigned.id))
}