@@ -29,9 +29,10 @@ import {
30} from 'lib/txn';
30} from 'lib/txn';
31import * as tank from 'lib/tank';
31import * as tank from 'lib/tank';
32+import { useSuggestedGasPrice } from 'lib/useSuggestedGasPrice';
32import useArray from 'lib/useArray';
33import useArray from 'lib/useArray';
33import { buildEmailInputConfig } from 'lib/useInputs';
34import { buildEmailInputConfig } from 'lib/useInputs';
34−import { MIN_PLANET, GAS_LIMITS, DEFAULT_GAS_PRICE_GWEI } from 'lib/constants';
35+import { MIN_PLANET, GAS_LIMITS } from 'lib/constants';
35import * as need from 'lib/need';
36import * as need from 'lib/need';
36import * as wg from 'lib/walletgen';
37import * as wg from 'lib/walletgen';
37import useSetState from 'lib/useSetState';
38import useSetState from 'lib/useSetState';
@@ -42,10 +43,6 @@ import LoadableButton from 'components/LoadableButton';
42import Highlighted from 'components/Highlighted';
43import Highlighted from 'components/Highlighted';
44const GAS_LIMIT = GAS_LIMITS.GIFT_PLANET;
45const GAS_LIMIT = GAS_LIMITS.GIFT_PLANET;
45−const INVITE_COST = toWei(
46− (DEFAULT_GAS_PRICE_GWEI * GAS_LIMIT).toString(),
49const HAS_RECEIVED_TEXT = 'This email has already received an invite.';
46const HAS_RECEIVED_TEXT = 'This email has already received an invite.';
51const STATUS = {
48const STATUS = {
@@ -100,6 +97,7 @@ export default function InviteEmail() {
100 const { pointCursor } = usePointCursor();
97 const { pointCursor } = usePointCursor();
101 const point = need.point(pointCursor);
98 const point = need.point(pointCursor);
102 const { getHasReceived, syncHasReceivedForEmail, sendMail } = useMailer();
99 const { getHasReceived, syncHasReceivedForEmail, sendMail } = useMailer();
100+ const { gasPrice } = useSuggestedGasPrice(networkType);
104 const { availableInvites } = getInvites(point);
102 const { availableInvites } = getInvites(point);
105 const maxInvitesToSend = availableInvites.matchWith({
103 const maxInvitesToSend = availableInvites.matchWith({
@@ -257,7 +255,7 @@ export default function InviteEmail() {
257 networkType,
255 networkType,
258 // TODO: ^ make a useTransactionSigner to encapsulate this logic
256 // TODO: ^ make a useTransactionSigner to encapsulate this logic
259 txn: inviteTx,
257 txn: inviteTx,
260− gasPrice: DEFAULT_GAS_PRICE_GWEI.toString(),
258+ gasPrice: gasPrice.toString(),
261 gasLimit: GAS_LIMIT.toString(),
259 gasLimit: GAS_LIMIT.toString(),
262 nonce: nonce + i,
260 nonce: nonce + i,
@@ -283,6 +281,7 @@ export default function InviteEmail() {
284 contracts,
282 contracts,
@@ -308,7 +307,7 @@ export default function InviteEmail() {
310 _wallet.address,
309 _wallet.address,
311− INVITE_COST * inputs.length,
310+ toWei((gasPrice * GAS_LIMIT * inputs.length).toString(), 'gwei'),
312 inputs.map(input => invites[input.name].rawTx),
311 inputs.map(input => invites[input.name].rawTx),
313 (address, minBalance, balance) =>
312 (address, minBalance, balance) =>
314 setNeedFunds({ address, minBalance, balance }),
313 setNeedFunds({ address, minBalance, balance }),
@@ -377,6 +376,7 @@ export default function InviteEmail() {
381 addReceipt,
381 addReceipt,
382 clearReceipts,
382 clearReceipts,