on master help sign in
Clean up needless Promise cruft
commitccb7118c167b37e5b20dd2968fa0a29528b5b77e authorFang <git@fang.io> dateTue 16 Jul 2019, 18:07 (7 years ago) parent1caf845
1 file changed+6−8
src/lib/txn.js+6−8
src/lib/txn.js+6−8
@@ -172,14 +172,12 @@ const waitForTransactionConfirm = (web3, txHash) => {
172172 }, RETRY_OPTIONS);
173173};
174174
175−const sendAndAwaitAll = async (web3, stxs, doubtNonceError) => {
176− await Promise.all(
177− stxs.map(tx => {
178− return new Promise(async (resolve, reject) => {
179− const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
180− await waitForTransactionConfirm(web3, txHash);
181− resolve();
182− });
175+// returns a Promise that resolves when all stxs have been sent & confirmed
176+const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
177+ return Promise.all(
178+ stxs.map(async tx => {
179+ const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
180+ await waitForTransactionConfirm(web3, txHash);
183181 })
184182 );
185183};