1import { safeFromWei } from './lib';
4 MISSING_WEB3: 'no web3 object found',
5 MISSING_WALLET: 'no wallet found',
6 MISSING_TXN: 'no transaction found',
7 MISSING_CONTRACTS: 'no contracts found',
8 MISSING_KEYSTORE: 'no keystore text found',
9 MISSING_MNEMONIC: 'no authentication mnemonic found',
10 MISSING_URBIT_WALLET: 'no urbit wallet found',
11 MISSING_POINT: 'no point found',
12 MISSING_POINT_DETAILS: 'no details of point found',
13 INVALID_ROUTE: 'invalid route',
14 INVALID_NETWORK_TYPE: 'invalid network type',
15 INVALID_WALLET_TYPE: 'invalid wallet type',
18const renderTxnError = (web3, msg) => {
19 const txnCost = (web3, msg) => {
20 const costWei = msg.match(/upfront cost is: ([0-9]+)/);
21 const costEth = safeFromWei(costWei[1], 'ether');
22 return parseFloat(costEth).toFixed(4);
25 const acctBalance = (web3, msg) => {
26 const balWei = msg.match(/sender's account only has: ([0-9]+)/);
27 const balEth = safeFromWei(balWei[1], 'ether');
28 return parseFloat(balEth).toFixed(4);
31 return msg.includes("doesn't have enough funds")
32 ? "The account doesn't have enough Ether. " +
33 `The up-front transaction cost is ${txnCost(web3, msg)} ETH, but the ` +
34 `account only holds ${acctBalance(web3, msg)} ETH.`
35 : 'You may want to verify that the account that has signed the ' +
36 'transaction holds sufficient Ether to pay for the gas, and ' +
37 "also that you haven't set the gas limit for the transaction " +
41export { BRIDGE_ERROR, renderTxnError };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list