diff --git a/src/WalletManagement/ImportPrivateKey.js b/src/WalletManagement/ImportPrivateKey.js
index a9077bdd..83d4e14e 100644
--- a/src/WalletManagement/ImportPrivateKey.js
+++ b/src/WalletManagement/ImportPrivateKey.js
@@ -39,7 +39,7 @@ const ImportPrivateKey = () => {
return;
}, []);
- const save = async e => {
+ const save = async (e) => {
e.preventDefault();
try {
@@ -50,7 +50,7 @@ const ImportPrivateKey = () => {
}
};
- const confirm = e => {
+ const confirm = (e) => {
e.preventDefault();
setConfirming(true);
};
@@ -107,7 +107,7 @@ const ImportPrivateKey = () => {
className="mr-3 mb-2"
id="privateKey"
name="privateKey"
- onChange={e => setPrivateKey(e.target.value)}
+ onChange={(e) => setPrivateKey(e.target.value)}
value={privateKey}
style={{ width: 350 }}
/>
diff --git a/src/Withdraw.js b/src/Withdraw.js
index 021c93a9..3288304e 100644
--- a/src/Withdraw.js
+++ b/src/Withdraw.js
@@ -12,7 +12,7 @@ import {
Label,
Modal,
ModalHeader,
- ModalBody
+ ModalBody,
} from "reactstrap";
import { Error, toEth, toWei, txLink } from "utils";
import { isAddress } from "ethereum-address";
@@ -29,7 +29,7 @@ const Withdraw = ({ open, setOpen }) => {
const [{ balance, blockchain, symbol }] = useStore();
- const onSubmit = async e => {
+ const onSubmit = async (e) => {
e.preventDefault();
let txid;
try {
@@ -65,7 +65,7 @@ const Withdraw = ({ open, setOpen }) => {
setTxid(null);
};
- const withdrawAll = e => {
+ const withdrawAll = (e) => {
e.preventDefault();
setAmount(balanceEth);
@@ -98,7 +98,7 @@ const Withdraw = ({ open, setOpen }) => {
) : (
@@ -124,7 +124,7 @@ const Withdraw = ({ open, setOpen }) => {
type="text"
name="address"
placeholder={t("recipientAddress")}
- onChange={e => setAddress(e.target.value)}
+ onChange={(e) => setAddress(e.target.value)}
value={address}
valid={addressValid}
invalid={!!(address && !addressValid)}
@@ -145,7 +145,7 @@ const Withdraw = ({ open, setOpen }) => {
label={t("to")}
name="amount"
placeholder={0}
- onChange={e => setAmount(e.target.value)}
+ onChange={(e) => setAmount(e.target.value)}
value={amount}
valid={amountValid}
invalid={!!(amount && !amountValid)}
@@ -155,7 +155,7 @@ const Withdraw = ({ open, setOpen }) => {
style={{
background: "#F8F9FA",
fontSize: 14,
- color: "#888"
+ color: "#888",
}}
>
{symbol}
@@ -175,7 +175,7 @@ const Withdraw = ({ open, setOpen }) => {
display: "flex",
margin: -20,
marginTop: 0,
- padding: 10
+ padding: 10,
}}
/>
diff --git a/src/WithdrawAll.js b/src/WithdrawAll.js
index ddac26f4..11371b4e 100644
--- a/src/WithdrawAll.js
+++ b/src/WithdrawAll.js
@@ -9,7 +9,7 @@ import {
Label,
Modal,
ModalHeader,
- ModalBody
+ ModalBody,
} from "reactstrap";
import { Error, txLink, toEth } from "utils";
import { post, useStore } from "store";
@@ -26,7 +26,7 @@ const WithdrawAll = ({ open, setOpen }) => {
const [{ balance, status }] = useStore();
const { eth, dai } = status;
- const onSubmit = async e => {
+ const onSubmit = async (e) => {
e.preventDefault();
try {
const txid = await post(`/withdraw_all/${address}`);
@@ -63,7 +63,7 @@ const WithdrawAll = ({ open, setOpen }) => {
@@ -88,7 +88,7 @@ const WithdrawAll = ({ open, setOpen }) => {
type="text"
name="address"
placeholder={t("recipientAddress")}
- onChange={e => setAddress(e.target.value)}
+ onChange={(e) => setAddress(e.target.value)}
value={address}
valid={addressValid}
invalid={!!(address && !addressValid)}
diff --git a/src/hooks/useWifiSettings.js b/src/hooks/useWifiSettings.js
index 6bc9a24a..ece039c7 100644
--- a/src/hooks/useWifiSettings.js
+++ b/src/hooks/useWifiSettings.js
@@ -32,7 +32,7 @@ const useWifiSettings = () => {
const security = [];
await Promise.all(
- wifiSettings.map(async setting => {
+ wifiSettings.map(async (setting) => {
let radio = setting.device.sectionName;
channels[radio] = [];
try {
@@ -51,7 +51,7 @@ const useWifiSettings = () => {
);
await Promise.all(
- wifiSettings.map(async setting => {
+ wifiSettings.map(async (setting) => {
let radio = setting.device.sectionName;
security[radio] = [];
try {
diff --git a/src/i18n.js b/src/i18n.js
index ccc9f069..ce1e6961 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -11,19 +11,19 @@ i18n
resources: {
en: { translations: require("./locales/en/translations.json") },
es: { translations: require("./locales/es/translations.json") },
- fr: { translations: require("./locales/fr/translations.json") }
+ fr: { translations: require("./locales/fr/translations.json") },
},
ns: ["translations"],
defaultNS: "translations",
interpolation: {
- escapeValue: false
+ escapeValue: false,
},
react: {
- wait: true
- }
+ wait: true,
+ },
});
export default i18n;
diff --git a/src/icons.js b/src/icons.js
index b2eb5965..4fb3c470 100644
--- a/src/icons.js
+++ b/src/icons.js
@@ -13,7 +13,7 @@ import {
faRoute,
faSignal,
faSitemap,
- faSync
+ faSync,
} from "@fortawesome/free-solid-svg-icons";
library.add(faBan);
diff --git a/src/index.js b/src/index.js
index 91ee1ee8..adb57be1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -16,9 +16,10 @@ ReactDOM.render(
document.getElementById("root")
);
-window.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
- navigator.userAgent
-);
+window.isMobile =
+ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
+ navigator.userAgent
+ );
if (window.isMobile) {
let tag = document.createElement("script");
diff --git a/src/locales/en/translations.json b/src/locales/en/translations.json
index b4533312..cd4bdd5e 100644
--- a/src/locales/en/translations.json
+++ b/src/locales/en/translations.json
@@ -406,4 +406,4 @@
"bandwidthLimitSaved": "Changes Saved",
"bandwidthLimitTitle": "Your bandwidth limit",
"setYourBandwidth": "Your Althea network provides the fastest service possible at any given time. To control costs you may wish to limit this. For more details and advice on how to use this option contact your local operator or call at"
-}
\ No newline at end of file
+}
diff --git a/src/locales/es/translations.json b/src/locales/es/translations.json
index e1e8b85c..ca331905 100644
--- a/src/locales/es/translations.json
+++ b/src/locales/es/translations.json
@@ -382,4 +382,4 @@
"organizerFeeContent": " {{maybeDollarSymbol}}{{readableDAOPrice}} {{symbol_or_star}}/Mes",
"bandwidthPriceContent": " {{maybeDollarSymbol}}{{readableExitPrice}} {{symbol_or_star}}/GB",
"pricesCopy": "Estas son las tarifas que paga actualmente su enrutador; las determinan otros miembros de su red y su organizador de red."
-}
\ No newline at end of file
+}
diff --git a/src/media.js b/src/media.js
index 4a96ad04..40aaf17e 100644
--- a/src/media.js
+++ b/src/media.js
@@ -2,12 +2,12 @@ import { css } from "styled-components";
const lower = {
desktop: 768,
- mobile: 0
+ mobile: 0,
};
const upper = {
desktop: 99999,
- mobile: 768
+ mobile: 768,
};
const media = Object.keys(lower).reduce((acc, device) => {
diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js
index aa60902f..4dc120bb 100644
--- a/src/registerServiceWorker.js
+++ b/src/registerServiceWorker.js
@@ -55,7 +55,7 @@ export default function register() {
function registerValidSW(swUrl) {
navigator.serviceWorker
.register(swUrl)
- .then(registration => {
+ .then((registration) => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
installingWorker.onstatechange = () => {
@@ -76,7 +76,7 @@ function registerValidSW(swUrl) {
};
};
})
- .catch(error => {
+ .catch((error) => {
console.error("Error during service worker registration:", error);
});
}
@@ -84,14 +84,14 @@ function registerValidSW(swUrl) {
function checkValidServiceWorker(swUrl) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
- .then(response => {
+ .then((response) => {
// Ensure service worker exists, and that we really are getting a JS file.
if (
response.status === 404 ||
response.headers.get("content-type").indexOf("javascript") === -1
) {
// No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then(registration => {
+ navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
window.location.reload(true);
});
@@ -110,7 +110,7 @@ function checkValidServiceWorker(swUrl) {
export function unregister() {
if ("serviceWorker" in navigator) {
- navigator.serviceWorker.ready.then(registration => {
+ navigator.serviceWorker.ready.then((registration) => {
registration.unregister();
});
}
diff --git a/src/store/actions.js b/src/store/actions.js
index b0fe62d4..4cdfd242 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -5,7 +5,7 @@ import { toEth } from "utils";
const symbols = {
Ethereum: "ETH",
Rinkeby: "tETH",
- Xdai: "Dai"
+ Xdai: "Dai",
};
export default (state, action) => {
@@ -14,7 +14,7 @@ export default (state, action) => {
const actions = {
blockchain: ({ blockchain }) => ({
blockchain,
- symbol: symbols[blockchain]
+ symbol: symbols[blockchain],
}),
channels: ({ channels }) => ({ channels }),
security: ({ security }) => ({ security }),
@@ -26,7 +26,7 @@ export default (state, action) => {
? a.plus(BigNumber(b.paymentDetails.debt.toString()))
: a;
}, BigNumber("0")),
- debts
+ debts,
};
}
@@ -42,15 +42,15 @@ export default (state, action) => {
state.resetting &&
exits
.filter(
- e =>
+ (e) =>
e.exitSettings.state === "Pending" ||
e.exitSettings.state === "GotInfo"
)
- .map(e => resetting.includes(e.nickname)).length;
+ .map((e) => resetting.includes(e.nickname)).length;
if (resetOccurred) resetting = [];
- const selectedExit = exits.find(exit => {
+ const selectedExit = exits.find((exit) => {
return (
exit.isSelected &&
exit.exitSettings.state === "Registered" &&
@@ -90,8 +90,8 @@ export default (state, action) => {
localFee,
lowBalance,
ritaVersion,
- version
- }
+ version,
+ },
}) => {
let lastVersion = state.lastVersion;
if (version) {
@@ -117,7 +117,7 @@ export default (state, action) => {
waiting:
!version || state.portChange || state.firmwareUpgrading
? state.waiting
- : 0
+ : 0,
};
},
level: ({ level }) => ({ level }),
@@ -125,37 +125,38 @@ export default (state, action) => {
keepWaiting: () => ({
portChange: state.portChange && state.waiting >= 1,
wifiChange: state.wifiChange && state.waiting >= 1,
- waiting: Math.max(state.waiting - 1, 0)
+ waiting: Math.max(state.waiting - 1, 0),
}),
interfaces: ({ interfaces }) => ({
interfaces: Object.keys(interfaces)
/*eslint no-sequences: 0*/
- .reduce((a, b) => ((a[b] = interfaces[b]), a), {})
+ .reduce((a, b) => ((a[b] = interfaces[b]), a), {}),
}),
neighbors: ({ neighbors }) => {
return {
neighbors: neighbors
- .filter(n => {
+ .filter((n) => {
return !state.exits.find(
- e =>
+ (e) =>
e.exitSettings &&
e.exitSettings.wgPublicKey ===
n.id.wgPublicKey.replace(/"/g, "")
);
})
- .map(n => {
+ .map((n) => {
n.debt = state.debts.find(
- d => d.identity.wgPublicKey === n.id.wgPublicKey.replace(/"/g, "")
+ (d) =>
+ d.identity.wgPublicKey === n.id.wgPublicKey.replace(/"/g, "")
);
return n;
- })
+ }),
};
},
initialized: ({ initialized }) => ({ initialized }),
nickname: ({ nickname }) => ({ nickname }),
exitWg: ({ exitWg }) => ({ exitWg }),
reset: ({ nickname }) => ({
- resetting: [...state.resetting, nickname]
+ resetting: [...state.resetting, nickname],
}),
lightClientAP: ({ lightClientAP }) => ({ lightClientAP }),
meshAP: ({ meshAP }) => ({ meshAP }),
@@ -217,7 +218,7 @@ export default (state, action) => {
minEth,
requiredEth,
reserve,
- dest
+ dest,
};
return { status, withdrawChainSymbol: symbols[status.withdrawChain] };
@@ -230,7 +231,7 @@ export default (state, action) => {
wgPublicKey: ({ wgPublicKey }) => ({ wgPublicKey }),
wifiChange: () => ({ wifiChange: true }),
wifiSettings: ({ wifiSettings }) => ({ wifiSettings }),
- withdrawSuccess: ({ txid }) => ({ txid })
+ withdrawSuccess: ({ txid }) => ({ txid }),
};
if (actions[type]) return { ...state, ...actions[type]({ ...data }) };
diff --git a/src/store/fetch.js b/src/store/fetch.js
index 881623ca..028283b3 100644
--- a/src/store/fetch.js
+++ b/src/store/fetch.js
@@ -50,8 +50,8 @@ export async function post(url, data, camel = true) {
body: JSON.stringify(data),
headers: {
Accept: "application/json",
- "Content-Type": "application/json"
- }
+ "Content-Type": "application/json",
+ },
});
if (!res.ok) return new Error((await res.json()).error);
diff --git a/src/store/index.js b/src/store/index.js
index 9553a441..cd328ed7 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -4,7 +4,7 @@ import React, {
useContext,
useEffect,
useState,
- useReducer
+ useReducer,
} from "react";
import actions from "./actions";
@@ -61,7 +61,7 @@ const state = {
wgPublicKey: null,
wifiChange: null,
wifiSettings: null,
- withdrawChainSymbol: null
+ withdrawChainSymbol: null,
};
let { protocol, hostname } = window.location;
@@ -129,13 +129,13 @@ export async function post(url, data, camel = true) {
let headers = {
Accept: "application/json",
Authorization,
- "Content-Type": "application/json"
+ "Content-Type": "application/json",
};
const res = await fetch(base + url, {
method: "POST",
body: JSON.stringify(data),
- headers
+ headers,
});
if (!res.ok) throw new Error(res.status);
diff --git a/src/ui/index.js b/src/ui/index.js
index 459e0fc6..63d8e91e 100644
--- a/src/ui/index.js
+++ b/src/ui/index.js
@@ -5,14 +5,14 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import media from "media";
export const Left = styled.div.attrs({
- className: "d-flex flex-column justify-content-between pr-lg-4 col-md-6 pl-0"
+ className: "d-flex flex-column justify-content-between pr-lg-4 col-md-6 pl-0",
})`
${media.mobile`border-bottom: 1px solid #dadada; padding-bottom: 20px; margin-bottom: 20px`};
${media.desktop`border-right: 1px solid #dadada;`};
`;
export const Right = styled.div.attrs({
- className: "pl-md-4 mt-3 mt-md-0 col-md-6 d-flex"
+ className: "pl-md-4 mt-3 mt-md-0 col-md-6 d-flex",
})``;
export const Card = ({ children }) => (
diff --git a/src/utils/AltheaUI.js b/src/utils/AltheaUI.js
index 08d6389f..13773c50 100644
--- a/src/utils/AltheaUI.js
+++ b/src/utils/AltheaUI.js
@@ -5,14 +5,14 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import media from "media";
export const Left = styled.div.attrs({
- className: "d-flex flex-column justify-content-between pr-lg-4 col-md-6"
+ className: "d-flex flex-column justify-content-between pr-lg-4 col-md-6",
})`
${media.mobile`border-bottom: 1px solid #dadada; padding-bottom: 20px; margin-bottom: 20px`};
${media.desktop`border-right: 1px solid #dadada;`};
`;
export const Right = styled.div.attrs({
- className: "pl-4 col-md-6 d-flex"
+ className: "pl-4 col-md-6 d-flex",
})``;
export const Card = ({ children }) => (
diff --git a/src/utils/Confirm.js b/src/utils/Confirm.js
index f90f108f..0eb172b6 100644
--- a/src/utils/Confirm.js
+++ b/src/utils/Confirm.js
@@ -6,7 +6,7 @@ import {
Modal,
ModalBody,
ModalFooter,
- ModalHeader
+ ModalHeader,
} from "reactstrap";
const Confirm = ({ open, cancel, confirm, message }) => {
diff --git a/src/utils/Flags.js b/src/utils/Flags.js
index c24f2baa..63f1d953 100644
--- a/src/utils/Flags.js
+++ b/src/utils/Flags.js
@@ -250,7 +250,7 @@ const flagMap = {
YT: () =>
,
ZA: () =>
,
ZM: () =>
,
- ZW: () =>
+ ZW: () =>
,
};
export default flagMap;
diff --git a/src/utils/NoConnection.js b/src/utils/NoConnection.js
index 5f9ad1f3..ddd92720 100644
--- a/src/utils/NoConnection.js
+++ b/src/utils/NoConnection.js
@@ -14,8 +14,8 @@ const NoConnection = () => {
portChange,
waiting,
wifiChange,
- version
- }
+ version,
+ },
] = useStore();
if (!authenticated) return null;
diff --git a/src/utils/SystemWarning.js b/src/utils/SystemWarning.js
index b7182b85..ee916993 100644
--- a/src/utils/SystemWarning.js
+++ b/src/utils/SystemWarning.js
@@ -5,9 +5,8 @@ import { BigNumber } from "bignumber.js";
const SystemWarning = () => {
const [t] = useTranslation();
- const [
- { balance, closeThreshold, debt, lowBalance, selectedExit }
- ] = useStore();
+ const [{ balance, closeThreshold, debt, lowBalance, selectedExit }] =
+ useStore();
if (!(lowBalance && debt)) return null;
return (
diff --git a/src/utils/groupUsage.js b/src/utils/groupUsage.js
index 5f450134..6aa6f000 100644
--- a/src/utils/groupUsage.js
+++ b/src/utils/groupUsage.js
@@ -22,9 +22,9 @@ const groupData = (
) => {
let data = {};
- let indices = usage.map(h => h.index);
+ let indices = usage.map((h) => h.index);
- indices.map(index => {
+ indices.map((index) => {
const date = new Date(index * msPerHr);
let i;
@@ -54,14 +54,14 @@ const groupData = (
if (!data[i]) data[i] = { up: 0, down: 0, cost: 0, service: 0 };
- let c = usage.find(c => c.index === index);
+ let c = usage.find((c) => c.index === index);
if (payments && payments.length) {
- let p = payments.find(p => p.index === index);
+ let p = payments.find((p) => p.index === index);
if (p) {
if (client) {
data[i].service += p.payments
- .filter(p => p.to.meshIp === "::1")
+ .filter((p) => p.to.meshIp === "::1")
.reduce((a, b) => a + parseInt(b.amount), 0);
}
@@ -76,20 +76,20 @@ const groupData = (
if (client) {
data[i].cost += p.payments
.filter(
- p =>
+ (p) =>
p.from.ethAddress.toLowerCase() ===
our_info.address.toLowerCase()
)
- .filter(p => !(p.to.meshIp === "::1"))
+ .filter((p) => !(p.to.meshIp === "::1"))
.reduce((a, b) => a + parseInt(b.amount), 0);
} else {
data[i].cost += p.payments
.filter(
- p =>
+ (p) =>
p.to.ethAddress.toLowerCase() ===
our_info.address.toLowerCase()
)
- .filter(p => !(p.to.meshIp === "::1"))
+ .filter((p) => !(p.to.meshIp === "::1"))
.reduce((a, b) => a + parseInt(b.amount), 0);
}
}
@@ -116,7 +116,7 @@ const groupData = (
return c;
});
- const start = hour => {
+ const start = (hour) => {
let date = new Date(hour * msPerHr);
switch (period) {
@@ -130,7 +130,7 @@ const groupData = (
}
};
- const end = hour => {
+ const end = (hour) => {
let date = new Date(hour * msPerHr);
switch (period) {
@@ -150,7 +150,7 @@ const groupData = (
const rows = Object.keys(data)
.reverse()
.slice((page - 1) * limit, page * limit)
- .map(d => ({
+ .map((d) => ({
index: d,
period: `${start(d)} - ${end(d)}`,
usage:
@@ -159,7 +159,7 @@ const groupData = (
.toFixed(4) + "GB",
bandwidthCost: `${toEth(data[d].cost, 4)} ${symbol}`,
serviceCost: `${toEth(data[d].service, 4)} ${symbol}`,
- totalCost: `${toEth(data[d].cost + data[d].service, 4)} ${symbol}`
+ totalCost: `${toEth(data[d].cost + data[d].service, 4)} ${symbol}`,
}));
return [rows, data];
diff --git a/src/utils/index.js b/src/utils/index.js
index 35e8e350..ee2a97d8 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -12,17 +12,13 @@ const weiPerEth = BigNumber("1000000000000000000");
const toEth = (n, i = 4) => {
if (!n && n !== 0) return null;
- return BigNumber(n.toString())
- .div(weiPerEth)
- .toFixed(i);
+ return BigNumber(n.toString()).div(weiPerEth).toFixed(i);
};
-const toWei = n => {
+const toWei = (n) => {
if (!n && n !== 0) return null;
- return BigNumber(n.toString())
- .times(weiPerEth)
- .toString();
+ return BigNumber(n.toString()).times(weiPerEth).toString();
};
const txLink = (blockchain, txid) => {
@@ -43,8 +39,8 @@ const txLink = (blockchain, txid) => {
return link;
};
-const sleep = milliseconds => {
- return new Promise(resolve => setTimeout(resolve, milliseconds));
+const sleep = (milliseconds) => {
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
};
export {
@@ -58,5 +54,5 @@ export {
txLink,
sleep,
groupUsage,
- Warning
+ Warning,
};