pos checks if wallet address is not found
This commit is contained in:
parent
c8350fd1ab
commit
aee92b1f3b
|
@ -5,6 +5,8 @@ import { emptyAddress } from '../utils';
|
||||||
import { recoverTypedSignature } from 'eth-sig-util';
|
import { recoverTypedSignature } from 'eth-sig-util';
|
||||||
import ethUtil from 'ethereumjs-util';
|
import ethUtil from 'ethereumjs-util';
|
||||||
|
|
||||||
|
const addressZero = "0x0000000000000000000000000000000000000000";
|
||||||
|
|
||||||
export const NEW_WALLET = 'NEW_WALLET';
|
export const NEW_WALLET = 'NEW_WALLET';
|
||||||
export const newWallet = () => ({
|
export const newWallet = () => ({
|
||||||
type: NEW_WALLET,
|
type: NEW_WALLET,
|
||||||
|
@ -215,12 +217,13 @@ export const sendPaymentRequest = (walletContract, message, sig) => {
|
||||||
try {
|
try {
|
||||||
dispatch(requestingPayment())
|
dispatch(requestingPayment())
|
||||||
const requestPayment = await walletContract.methods.requestPayment(message, sig);
|
const requestPayment = await walletContract.methods.requestPayment(message, sig);
|
||||||
const estimatedGas = await requestPayment.estimateGas();
|
const gas = await requestPayment.estimateGas();
|
||||||
const receipt = await requestPayment.send({
|
const receipt = await requestPayment.send({
|
||||||
gas: estimatedGas
|
gas: gas
|
||||||
});
|
});
|
||||||
dispatch(paymentRequested())
|
dispatch(paymentRequested())
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
alert(err)
|
||||||
console.error("ERROR: ", err)
|
console.error("ERROR: ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,11 +276,18 @@ export const findWallet = (keycardAddress, message, sig) => {
|
||||||
dispatch(findingWallet());
|
dispatch(findingWallet());
|
||||||
KeycardWalletFactory.methods.keycardsWallets(keycardAddress).call()
|
KeycardWalletFactory.methods.keycardsWallets(keycardAddress).call()
|
||||||
.then((address) => {
|
.then((address) => {
|
||||||
//FIXME: if 0x00, the wallet was not found
|
//FIXME: if 0x00, display error
|
||||||
|
if (address === addressZero) {
|
||||||
|
alert("wallet not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
dispatch(walletFound(address))
|
dispatch(walletFound(address))
|
||||||
dispatch(loadWallet(address, message, sig))
|
dispatch(loadWallet(address, message, sig))
|
||||||
})
|
})
|
||||||
.catch((err) => dispatch(web3Error(err)))
|
.catch((err) => {
|
||||||
|
dispatch(web3Error(err))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue