on master help sign in
tx: return receipts from tx awaiting functions
80516b9Fang
src/lib/txn.js+3−3
@@ -164,7 +164,7 @@ const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
164 return Promise.all(
164 return Promise.all(
165 stxs.map(async tx => {
165 stxs.map(async tx => {
166 const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
166 const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
167− await waitForTransactionConfirm(web3, txHash);
167+ return await waitForTransactionConfirm(web3, txHash);
168 })
168 })
169 );
169 );
170};
170};
@@ -172,9 +172,9 @@ const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
172const sendAndAwaitAllSerial = (web3, stxs, doubtNonceError) => {
172const sendAndAwaitAllSerial = (web3, stxs, doubtNonceError) => {
173 return stxs.reduce(
173 return stxs.reduce(
174 (promise, stx) =>
174 (promise, stx) =>
175− promise.then(async () => {
175+ promise.then(async (receipts = []) => {
176 const txHash = await sendSignedTransaction(web3, stx, doubtNonceError);
176 const txHash = await sendSignedTransaction(web3, stx, doubtNonceError);
177− await waitForTransactionConfirm(web3, txHash);
177+ return [...receipts, await waitForTransactionConfirm(web3, txHash)];
178 }),
178 }),
179 Promise.resolve()
179 Promise.resolve()
180 );
180 );