on master help sign in
disable tank for metamask users

Currently, we need a signed transaction to use the gas tank, because the gas tank demands a signed transaction, both to determine the sender address, and to send the transaction directly post-funding, as a theft-deterence mechanism. As metamask does not support signing a transaction without broadcasting it, we disable the gas tank for metamask users.

commit884e2944c95f3275bef2c123d4ba21f4ac1737ce authorLiam Fitzgerald <liam@urizen.co> dateTue 14 Jan 2020, 14:56 (7 years ago) parent10c3c29
4 files changed+11
src/lib/reticket.js+1 src/lib/tank.js+7 src/lib/useEthereumTransaction.js+1 src/views/Invite/InviteEmail.js+2
src/lib/reticket.js+1
@@ -189,6 +189,7 @@ export async function reticketPointBetweenWallets({
189189 web3,
190190 point,
191191 fromWallet.address,
192+ fromWalletType,
192193 totalCost,
193194 txPairs.map(p => p.raw),
194195 askForFunding,
src/lib/tank.js+7
@@ -3,6 +3,7 @@
33import retry from 'async-retry';
44import { toBN } from 'web3-utils';
55import { RETRY_OPTIONS, waitForTransactionConfirm } from './txn';
6+import { WALLET_TYPES } from 'lib/wallet';
67
78//NOTE if accessing this in a localhost configuration fails with "CORS request
89// did not succeed", you might need to visit localhost:3001 or whatever
@@ -49,6 +50,7 @@ const ensureFundsFor = async (
4950 web3,
5051 point,
5152 address,
53+ walletType,
5254 cost,
5355 signedTxs,
5456 askForFunding,
@@ -66,6 +68,11 @@ const ensureFundsFor = async (
6668 return false;
6769 }
6870
71+ if (walletType === WALLET_TYPES.METAMASK) {
72+ console.log('tank: disabling for metamask login');
73+
74+ return false;
75+ }
6976 try {
7077 // TODO: if we can't always (easily) provide a point, and the
7178 // fundTransactions call is gonna fail anyway, should we maybe
src/lib/useEthereumTransaction.js+1
@@ -157,6 +157,7 @@ export default function useEthereumTransaction(
157157 _web3,
158158 pointCursor.value,
159159 _wallet.address,
160+ walletType,
160161 cost,
161162 rawTxs,
162163 (address, minBalance, balance) =>
src/views/Invite/InviteEmail.js+2
@@ -316,6 +316,7 @@ export default function InviteEmail() {
316316 _web3,
317317 point,
318318 _wallet.address,
319+ walletType,
319320 toWei(totalCost.toString(), 'gwei'),
320321 names.map(name => invites[name].rawTx),
321322 (address, minBalance, balance) =>
@@ -384,6 +385,7 @@ export default function InviteEmail() {
384385 }, [
385386 web3,
386387 wallet,
388+ walletType,
387389 gasPrice,
388390 point,
389391 clearReceipts,