diff --git a/examples/src/basic-usage-async-await.js b/examples/src/basic-usage-async-await.js index e07aee8..9414985 100644 --- a/examples/src/basic-usage-async-await.js +++ b/examples/src/basic-usage-async-await.js @@ -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 ======== // diff --git a/examples/src/basic-usage.js b/examples/src/basic-usage.js index bf0c451..fe66e28 100644 --- a/examples/src/basic-usage.js +++ b/examples/src/basic-usage.js @@ -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 diff --git a/examples/src/query-assets.js b/examples/src/query-assets.js index cb5a2a8..c4829e0 100644 --- a/examples/src/query-assets.js +++ b/examples/src/query-assets.js @@ -35,7 +35,6 @@ function createTx(assetdata) { const txCreateSigned = driver.Transaction.signTransaction(txCreate, alice.privateKey) return conn.postTransactionCommit(txCreateSigned) - .then(() => conn.getTransaction(txCreateSigned.id)) }