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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







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?

    5 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?

    5 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?

    5 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?

    5 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?

    5 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

這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()