Skip to content

Commit 30db801

Browse files
committed
fix: return receipt after waiting
1 parent ca29e71 commit 30db801

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎cli/lib/nf3.mjs

+3-5
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,17 @@ class Nf3 {
185185
const signed = await this.web3.eth.accounts.signTransaction(tx, this.ethereumSigningKey);
186186
// rather than waiting until we have a receipt, wait until we have enough confirmation blocks
187187
// then return the receipt.
188-
let mined; // indicates receipt is mined
189-
const confirmationPromise = new Promise(resolve => {
188+
// TODO does this still work if there is a chain reorg or do we have to handle that?
189+
return new Promise(resolve => {
190190
this.web3.eth
191191
.sendSignedTransaction(signed.rawTransaction)
192192
.on('confirmation', (number, receipt) => {
193193
console.log(`Confirmed ${number} ${receipt.transactionHash}`);
194194
if (number === 12) resolve(receipt);
195195
});
196196
});
197-
await confirmationPromise;
198-
return mined;
199197
}
200-
// TODO a wait for confirmations to the wallet functionality
198+
// TODO add wait for confirmations to the wallet functionality
201199
return this.web3.eth.sendTransaction(tx);
202200
}
203201

0 commit comments

Comments
 (0)