on master help sign in
tx: return receipts from tx awaiting functions

Values in it, like the gas use, will come in handy.

commit80516b9121f65ec6e9b9e836a641a9b4351db049 authorFang <git@fang.io> dateTue 8 Sep 2020, 23:33 (6 years ago) parent82b00c2
1 file changed+3−3
src/lib/txn.js+3−3
src/lib/txn.js+3−3
@@ -164,7 +164,7 @@ const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
164164 return Promise.all(
165165 stxs.map(async tx => {
166166 const txHash = await sendSignedTransaction(web3, tx, doubtNonceError);
167− await waitForTransactionConfirm(web3, txHash);
167+ return await waitForTransactionConfirm(web3, txHash);
168168 })
169169 );
170170};
@@ -172,9 +172,9 @@ const sendAndAwaitAll = (web3, stxs, doubtNonceError) => {
172172const sendAndAwaitAllSerial = (web3, stxs, doubtNonceError) => {
173173 return stxs.reduce(
174174 (promise, stx) =>
175− promise.then(async () => {
175+ promise.then(async (receipts = []) => {
176176 const txHash = await sendSignedTransaction(web3, stx, doubtNonceError);
177− await waitForTransactionConfirm(web3, txHash);
177+ return [...receipts, await waitForTransactionConfirm(web3, txHash)];
178178 }),
179179 Promise.resolve()
180180 );