on master help sign in
reticket: wrap try-catch around entire eth transfer logic

While we do want this to work, we really shouldn't scare the users with errors if it doesn't.

commitf63d396ef3fe16a1b901f4a33a2bf2651fcfe3da authorFang <git@fang.io> dateSat 1 Feb 2020, 20:12 (7 years ago) parent9d46b63
1 file changed+22−21
src/lib/reticket.js+22−21
src/lib/reticket.js+22−21
@@ -216,27 +216,28 @@ export async function reticketPointBetweenWallets({
216216 const gasLimit = GAS_LIMITS.SEND_ETH;
217217 const sendEthCost = gasPriceWeiBN.mul(toBN(gasLimit));
218218 if (transferEth && balance.gt(sendEthCost)) {
219− const value = balance.sub(sendEthCost);
220− const txn = {
221− to: toWallet.ownership.keys.address,
222− value: value,
223− };
224− const stx = await signTransaction({
225− wallet: fromWallet,
226− walletType: fromWalletType,
227− walletHdPath: fromWalletHdPath,
228− txn,
229− chainId,
230− networkType,
231− gasPrice: gasPriceGwei,
232− gasLimit,
233− nonce: inviteNonce,
234− });
235− // let stx = new Tx(tx);
236− // stx.sign(fromWallet.privateKey);
237− sendSignedTransaction(web3, stx).catch(err => {
238− console.log('error sending value tx, who cares', err);
239− });
219+ try {
220+ const value = balance.sub(sendEthCost);
221+ const txn = {
222+ to: toWallet.ownership.keys.address,
223+ value: value,
224+ };
225+ const stx = await signTransaction({
226+ wallet: fromWallet,
227+ walletType: fromWalletType,
228+ walletHdPath: fromWalletHdPath,
229+ txn,
230+ chainId,
231+ networkType,
232+ gasPrice: gasPriceGwei,
233+ gasLimit,
234+ nonce: inviteNonce,
235+ });
236+ sendSignedTransaction(web3, stx);
237+ } catch (err) {
238+ console.log('error sending value tx, safely ignored:');
239+ console.log(err);
240+ }
240241 }
241242
242243 progress(TRANSACTION_PROGRESS.DONE);