@@ -34,7 +34,8 @@ import {
3434 hexify,
3535} from 'lib/txn';
3636import * as tank from 'lib/tank';
37−import { MIN_PLANET, GAS_LIMITS, DEFAULT_GAS_PRICE_GWEI } from 'lib/constants';
37+import { MIN_PLANET, GAS_LIMITS } from 'lib/constants';
38+import { useSuggestedGasPrice } from 'lib/useSuggestedGasPrice';
3839import * as need from 'lib/need';
3940import * as wg from 'lib/walletgen';
4041import useSetState from 'lib/useSetState';
@@ -59,10 +60,6 @@ import FormError from 'form/FormError';
5960const INITIAL_VALUES = { emails: [''] };
6061
6162const GAS_LIMIT = GAS_LIMITS.GIFT_PLANET;
62−const INVITE_COST = toWei(
63− (DEFAULT_GAS_PRICE_GWEI * GAS_LIMIT).toString(),
64− 'gwei'
65−);
6663const HAS_RECEIVED_TEXT = 'This email has already received an invite.';
6764
6865const STATUS = {
@@ -106,6 +103,7 @@ export default function InviteEmail() {
106103 const { pointCursor } = usePointCursor();
107104 const point = need.point(pointCursor);
108105 const { getHasReceived, sendMail } = useMailer();
106+ const { gasPrice } = useSuggestedGasPrice(networkType);
109107
110108 const cachedEmails = useRef([]);
111109
@@ -245,7 +243,7 @@ export default function InviteEmail() {
245243 nonce: nonce + i,
246244 // TODO: ^ make a useTransactionSigner to encapsulate this logic
247245 txn: inviteTx,
248− gasPrice: DEFAULT_GAS_PRICE_GWEI.toString(),
246+ gasPrice: gasPrice.toString(),
249247 gasLimit: GAS_LIMIT.toString(),
250248 });
251249
@@ -278,6 +276,7 @@ export default function InviteEmail() {
278276 walletType,
279277 walletHdPath,
280278 networkType,
279+ gasPrice,
281280 addInvite,
282281 ]
283282 );
@@ -295,7 +294,7 @@ export default function InviteEmail() {
295294 _web3,
296295 point,
297296 _wallet.address,
298− INVITE_COST * emails.length,
297+ toWei((gasPrice * GAS_LIMIT * emails.length).toString(), 'gwei'),
299298 emails.map(email => invites[email].rawTx),
300299 (address, minBalance, balance) =>
301300 setNeedFunds({ address, minBalance, balance }),
@@ -361,7 +360,16 @@ export default function InviteEmail() {
361360 if (errorString !== '') {
362361 throw new Error(errorString);
363362 }
364− }, [web3, addReceipt, clearReceipts, invites, point, wallet, sendMail]);
363+ }, [
364+ web3,
365+ wallet,
366+ point,
367+ gasPrice,
368+ clearReceipts,
369+ invites,
370+ addReceipt,
371+ sendMail,
372+ ]);
365373
366374 const onSubmit = useCallback(
367375 async values => {