on master help sign in
reticket: wrap try-catch around entire eth transfer logic
f63d396Fang
src/lib/reticket.js+22−21
@@ -216,27 +216,28 @@ export async function reticketPointBetweenWallets({
216 const gasLimit = GAS_LIMITS.SEND_ETH;
216 const gasLimit = GAS_LIMITS.SEND_ETH;
217 const sendEthCost = gasPriceWeiBN.mul(toBN(gasLimit));
217 const sendEthCost = gasPriceWeiBN.mul(toBN(gasLimit));
218 if (transferEth && balance.gt(sendEthCost)) {
218 if (transferEth && balance.gt(sendEthCost)) {
219+ try {
219− const value = balance.sub(sendEthCost);
220+ const value = balance.sub(sendEthCost);
220− const txn = {
221+ const txn = {
221− to: toWallet.ownership.keys.address,
222+ to: toWallet.ownership.keys.address,
222− value: value,
223+ value: value,
223− };
224+ };
224− const stx = await signTransaction({
225+ const stx = await signTransaction({
225− wallet: fromWallet,
226+ wallet: fromWallet,
226− walletType: fromWalletType,
227+ walletType: fromWalletType,
227− walletHdPath: fromWalletHdPath,
228+ walletHdPath: fromWalletHdPath,
228− txn,
229+ txn,
229− chainId,
230+ chainId,
230− networkType,
231+ networkType,
231− gasPrice: gasPriceGwei,
232+ gasPrice: gasPriceGwei,
232− gasLimit,
233+ gasLimit,
233− nonce: inviteNonce,
234+ nonce: inviteNonce,
234− });
235+ });
235− // let stx = new Tx(tx);
236− // stx.sign(fromWallet.privateKey);
237− sendSignedTransaction(web3, stx).catch(err => {
236+ sendSignedTransaction(web3, stx);
237+ } catch (err) {
238− console.log('error sending value tx, who cares', err);
238+ console.log('error sending value tx, safely ignored:');
239+ console.log(err);
239− });
240+ }
240 }
241 }
241
242
242 progress(TRANSACTION_PROGRESS.DONE);
243 progress(TRANSACTION_PROGRESS.DONE);