1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 01:36:55 +01:00

postTransaction updated

This commit is contained in:
manolodewiner 2018-04-06 14:05:11 +02:00
parent 1586f6ae29
commit d26f66e7c1
4 changed files with 10 additions and 22 deletions

View File

@ -78,8 +78,7 @@ let makeTransaction = BigchainDB.Transaction.makeCreateTransaction({
const txSigned = BigchainDB.Transaction.signTransaction(makeTransaction, creator.privateKey)
// Send the transaction to BigchainDB
conn.postTransaction(txSigned)
.then(() => conn.pollStatusAndFetchTransaction(txSigned.id))
conn.postTransactionCommit(txSigned)
.then(res => {
document.body.innerHTML +='<h3>Transaction created</h3>';
document.body.innerHTML +=txSigned.id
@ -127,8 +126,7 @@ function createPR() {
createTranfer.inputs[0].fulfillment = fulfillmentUri
// Post the transaction to BigchainDB
conn.postTransaction(createTranfer)
.then(() => conn.pollStatusAndFetchTransaction(createTranfer.id))
conn.postTransactionCommit(createTranfer)
.then(res => {
document.body.innerHTML +='<h3>Transaction created</h3>';
document.body.innerHTML +=createTranfer.id
@ -184,8 +182,7 @@ let createTranfer = BigchainDB.Transaction.makeTransferTransaction(
const transferToProduction = BigchainDB.Transaction.signTransaction(createTranfer, QAperson.privateKey)
// Send the transaction to BigchainDB
conn.postTransaction(transferToProduction)
.then(() => conn.pollStatusAndFetchTransaction(transferToProduction.id))
conn.postTransactionCommit(transferToProduction)
.then(res => {
document.body.innerHTML ='<h3>Transfer transaction created</h3>';
document.body.innerHTML +=transferToProduction.id
@ -230,8 +227,7 @@ let fulfillment = BigchainDB.Transaction.makeThresholdCondition(threshold, [fulf
const fulfillmentUri = fulfillment.serializeUri()
transferApprove.inputs[0].fulfillment = fulfillmentUri
conn.postTransaction(transferApprove)
.then(() => conn.pollStatusAndFetchTransaction(transferApprove.id))
conn.postTransactionCommit(transferApprove)
.then(res => {
document.body.innerHTML ='<h3>Transfer transaction created</h3>';
document.body.innerHTML +=transferApprove.id

View File

@ -85,9 +85,7 @@ function createPaint() {
alice.privateKey)
// Send the transaction off to BigchainDB
conn.postTransaction(txSigned)
// Check the status of the transaction
.then(() => conn.pollStatusAndFetchTransaction(txSigned.id))
conn.postTransactionCommit(txSigned)
.then(res => {
document.body.innerHTML += '<h3>Transaction created</h3>';
document.body.innerHTML += txSigned.id
@ -134,10 +132,8 @@ function transferOwnership(txCreatedID, newOwner) {
// Sign with the key of the owner of the painting (Alice)
const signedTransfer = BigchainDB.Transaction
.signTransaction(createTranfer, alice.privateKey)
return conn.postTransaction(signedTransfer)
return conn.postTransactionCommit(signedTransfer)
})
.then((signedTransfer) => conn
.pollStatusAndFetchTransaction(signedTransfer.id))
.then(res => {
document.body.innerHTML += '<h3>Transfer Transaction created</h3>'
document.body.innerHTML += res.id

View File

@ -83,8 +83,7 @@ async function createNewAsset(keypair, asset, metadata) {
const txSigned = BigchainDB.Transaction.signTransaction(transaction,
keypair.privateKey)
let tx
await conn.postTransaction(txSigned)
.then(() => conn.pollStatusAndFetchTransaction(txSigned.id))
await conn.postTransactionCommit(txSigned)
.then(retrievedTx => {
tx = retrievedTx
})

View File

@ -60,8 +60,7 @@ function tokenLaunch() {
.signTransaction(tx, tokenCreator.privateKey)
// Send the transaction off to BigchainDB
conn.postTransaction(txSigned)
.then(() => conn.pollStatusAndFetchTransaction(txSigned.id))
conn.postTransactionCommit(txSigned)
.then(res => {
tokensLeft = nTokens
document.body.innerHTML ='<h3>Transaction created</h3>';
@ -128,10 +127,8 @@ function transferTokens() {
const signedTransfer = BigchainDB.Transaction
.signTransaction(createTranfer, tokenCreator.privateKey)
return conn.postTransaction(signedTransfer)
return conn.postTransactionCommit(signedTransfer)
})
.then((signedTransfer) => conn
.pollStatusAndFetchTransaction(signedTransfer.id))
.then(res => {
// Update tokensLeft
tokensLeft -= amountToSend
@ -175,7 +172,7 @@ function combineTokens(transaction1, outputIndex1, transaction2, outputIndex2,
const signedTransfer = BigchainDB.Transaction
.signTransaction(combineTranfer, newUser.privateKey)
return conn.postTransaction(signedTransfer)
return conn.postTransactionCommit(signedTransfer)
}
```