I want to send a promise as input to another function in java script [duplicate]












0
















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • What is an unhandled promise rejection?

    4 answers




async function accounts  ()  {
accountA = await server.loadAccount(Apub);
accountB = await server.loadAccount(Bpub);
escrow = await server.loadAccount(escrow);
}
let transaction = new Stellar.TransactionBuilder(accounts().then(() => escrow))
.addOperation(Stellar.Operation.setOptions(thresholds))
.addOperation(Stellar.Operation.setOptions(extraSignerA))
.addOperation(Stellar.Operation.setOptions(extraSignerB))
.build()

transaction.sign(cescrowprivate);
}


1) i have written a async function which gives me the total details of individual account



2) i want to send the escrow as input to the TranscationBuilder How to pass



3) i don't want to write inside same block i want accounts in one block and transaction on another block



4) i can keep everything under TranscationBuilder but the problem is it has to run first TransactionBuilder and proceed with the remaining steps



5) I am getting unhanded promise rejection as error










share|improve this question















marked as duplicate by Neil Lunn javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 7:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

    – Neil Lunn
    Nov 24 '18 at 7:45


















0
















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • What is an unhandled promise rejection?

    4 answers




async function accounts  ()  {
accountA = await server.loadAccount(Apub);
accountB = await server.loadAccount(Bpub);
escrow = await server.loadAccount(escrow);
}
let transaction = new Stellar.TransactionBuilder(accounts().then(() => escrow))
.addOperation(Stellar.Operation.setOptions(thresholds))
.addOperation(Stellar.Operation.setOptions(extraSignerA))
.addOperation(Stellar.Operation.setOptions(extraSignerB))
.build()

transaction.sign(cescrowprivate);
}


1) i have written a async function which gives me the total details of individual account



2) i want to send the escrow as input to the TranscationBuilder How to pass



3) i don't want to write inside same block i want accounts in one block and transaction on another block



4) i can keep everything under TranscationBuilder but the problem is it has to run first TransactionBuilder and proceed with the remaining steps



5) I am getting unhanded promise rejection as error










share|improve this question















marked as duplicate by Neil Lunn javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 7:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

    – Neil Lunn
    Nov 24 '18 at 7:45
















0












0








0









This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • What is an unhandled promise rejection?

    4 answers




async function accounts  ()  {
accountA = await server.loadAccount(Apub);
accountB = await server.loadAccount(Bpub);
escrow = await server.loadAccount(escrow);
}
let transaction = new Stellar.TransactionBuilder(accounts().then(() => escrow))
.addOperation(Stellar.Operation.setOptions(thresholds))
.addOperation(Stellar.Operation.setOptions(extraSignerA))
.addOperation(Stellar.Operation.setOptions(extraSignerB))
.build()

transaction.sign(cescrowprivate);
}


1) i have written a async function which gives me the total details of individual account



2) i want to send the escrow as input to the TranscationBuilder How to pass



3) i don't want to write inside same block i want accounts in one block and transaction on another block



4) i can keep everything under TranscationBuilder but the problem is it has to run first TransactionBuilder and proceed with the remaining steps



5) I am getting unhanded promise rejection as error










share|improve this question

















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • What is an unhandled promise rejection?

    4 answers




async function accounts  ()  {
accountA = await server.loadAccount(Apub);
accountB = await server.loadAccount(Bpub);
escrow = await server.loadAccount(escrow);
}
let transaction = new Stellar.TransactionBuilder(accounts().then(() => escrow))
.addOperation(Stellar.Operation.setOptions(thresholds))
.addOperation(Stellar.Operation.setOptions(extraSignerA))
.addOperation(Stellar.Operation.setOptions(extraSignerB))
.build()

transaction.sign(cescrowprivate);
}


1) i have written a async function which gives me the total details of individual account



2) i want to send the escrow as input to the TranscationBuilder How to pass



3) i don't want to write inside same block i want accounts in one block and transaction on another block



4) i can keep everything under TranscationBuilder but the problem is it has to run first TransactionBuilder and proceed with the remaining steps



5) I am getting unhanded promise rejection as error





This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • What is an unhandled promise rejection?

    4 answers








javascript node.js transactions stellar.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 7:40







Venkatesh Muthyla

















asked Nov 24 '18 at 7:20









Venkatesh MuthylaVenkatesh Muthyla

417




417




marked as duplicate by Neil Lunn javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 7:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Neil Lunn javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 7:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

    – Neil Lunn
    Nov 24 '18 at 7:45





















  • function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

    – Neil Lunn
    Nov 24 '18 at 7:45



















function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

– Neil Lunn
Nov 24 '18 at 7:45







function accounts() does not return anything. So you can't then() on nothing. And since Stellar.TransactionBuilder() "appears" to not be asynchronous, then you probably want await accounts(), after you fix the function to actually return something that is.

– Neil Lunn
Nov 24 '18 at 7:45














0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks