on master help sign in
Clean up needless Promise cruft
ccb7118Fang
src/lib/txn.js+6−8
@@ -172,14 +172,12 @@ const waitForTransactionConfirm = (web3, txHash) => {
172 }, RETRY_OPTIONS);
172 }, RETRY_OPTIONS);
173};
173};
174
174
175+// returns a Promise that resolves when all stxs have been sent & confirmed
175−const sendAndAwaitAll = async (web3, stxs, doubtNonceError) => {
176+const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
176− await Promise.all(
177+ return Promise.all(
177− stxs.map(tx => {
178+ stxs.map(async tx => {
178− return new Promise(async (resolve, reject) => {
179− const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
179+ const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
180− await waitForTransactionConfirm(web3, txHash);
180+ await waitForTransactionConfirm(web3, txHash);
181− resolve();
182− });
183 })
181 })
184 );
182 );
185};
183};