From 7f74cca6b5b534c22cb413a719ede00883e9f714 Mon Sep 17 00:00:00 2001 From: manolodewiner Date: Mon, 17 Sep 2018 12:08:43 +0200 Subject: [PATCH] fix transfer tx --- _src/_guide/tutorial-token-launch.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/_src/_guide/tutorial-token-launch.md b/_src/_guide/tutorial-token-launch.md index fbf68a8..2b4b597 100644 --- a/_src/_guide/tutorial-token-launch.md +++ b/_src/_guide/tutorial-token-launch.md @@ -37,7 +37,7 @@ const nTokens = 10000 let tokensLeft const tokenCreator = new BigchainDB .Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0,32)) - +let createTxId function tokenLaunch() { // Construct a transaction payload const tx = BigchainDB.Transaction.makeCreateTransaction({ @@ -62,6 +62,7 @@ function tokenLaunch() { // Send the transaction off to BigchainDB conn.postTransactionCommit(txSigned) .then(res => { + createTxId = res.id tokensLeft = nTokens document.body.innerHTML ='

Transaction created

'; // txSigned.id corresponds to the asset id of the tokens @@ -91,12 +92,7 @@ function transferTokens() { // Search outputs of the transactions belonging the token creator // False argument to retrieve unspent outputs - conn.listOutputs(tokenCreator.publicKey, 'false') - .then((txs) => { - // Just one transaction available with outputs not being spent by - // tokenCreator. Therefore, txs[0] - return conn.getTransaction(txs[0].transaction_id) - }) + conn.getTransaction(createTxId) .then((txOutputs) => { // Create transfer transaction const createTranfer = BigchainDB.Transaction