I want to send a promise as input to another function in java script [duplicate]
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
javascript node.js transactions stellar.js
marked as duplicate by Neil Lunn
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.
add a comment |
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
javascript node.js transactions stellar.js
marked as duplicate by Neil Lunn
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 notreturn
anything. So you can'tthen()
on nothing. And sinceStellar.TransactionBuilder()
"appears" to not be asynchronous, then you probably wantawait accounts()
, after you fix the function to actually return something that is.
– Neil Lunn
Nov 24 '18 at 7:45
add a comment |
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
javascript node.js transactions stellar.js
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
javascript node.js transactions stellar.js
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
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
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 notreturn
anything. So you can'tthen()
on nothing. And sinceStellar.TransactionBuilder()
"appears" to not be asynchronous, then you probably wantawait accounts()
, after you fix the function to actually return something that is.
– Neil Lunn
Nov 24 '18 at 7:45
add a comment |
function accounts()
does notreturn
anything. So you can'tthen()
on nothing. And sinceStellar.TransactionBuilder()
"appears" to not be asynchronous, then you probably wantawait 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
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
function accounts()
does notreturn
anything. So you can'tthen()
on nothing. And sinceStellar.TransactionBuilder()
"appears" to not be asynchronous, then you probably wantawait accounts()
, after you fix the function to actually return something that is.– Neil Lunn
Nov 24 '18 at 7:45