Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap Wallet Address issue fixed #1377

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/components/PushSnap/PushSnapConfigureModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const PushSnapConfigureModal = () => {
},
},
});
console.log('res', res);
setToggleStatus(res);
})();
}, [toggleStatus]);
Expand All @@ -67,7 +66,6 @@ const PushSnapConfigureModal = () => {
}

const addWalletAddresses = async () => {
console.log('searchedUser', searchedUser);
const signatureResult = await getSignature(1);
if (signatureResult) {
if (searchedUser) {
Expand All @@ -81,7 +79,8 @@ const PushSnapConfigureModal = () => {
},
},
});
console.log('Added', searchedUser);
setSearchedUser('');
getWalletAddresses();
}
} else {
console.log('Signature Validation Failed');
Expand All @@ -107,6 +106,7 @@ const PushSnapConfigureModal = () => {

const removeWalletAddresses = async (walletSelected: string) => {
const signatureResult = await getSignature(2);
console.log("Ran",signatureResult)
if (signatureResult) {
if (walletSelected) {
await window.ethereum?.request({
Expand All @@ -119,6 +119,7 @@ const PushSnapConfigureModal = () => {
},
},
});
getWalletAddresses();
}
} else {
console.log('Signature Validation Failed');
Expand All @@ -133,7 +134,6 @@ const PushSnapConfigureModal = () => {
request: { method: 'pushproto_getaddresses' },
},
});
console.log('result', result);
setAddresses(result);
}

Expand All @@ -151,8 +151,6 @@ const PushSnapConfigureModal = () => {

return (
<Container >


<ItemVV2
alignItems="baseline"
margin="24px 0 0 0"
Expand Down Expand Up @@ -186,11 +184,11 @@ const PushSnapConfigureModal = () => {
{addresses?.map((wallet) => (
<AddressesSubContainer>
<SpanV2 fontSize='15px' fontWeight='500' color={walletSelected === wallet ? '#D53A94' : theme.default.color}>{shortenText(wallet, 8)}</SpanV2>
<MoreOptions onClick={() => handleWalletSelect(wallet)} color={theme.default.color} />
<MoreOptions onClick={() => handleWalletSelect(wallet)} color={theme.default.color} />

{walletSelected === wallet && <RemoveDiv >
<MinusCircle />
<SpanV2 fontSize='16px' fontWeight='400' color='#657795' onClick={() => removeWalletAddresses(walletSelected)}>Remove</SpanV2>
<SpanV2 fontSize='16px' cursor='pointer' fontWeight='400' color='#657795' onClick={() => removeWalletAddresses(walletSelected)}>Remove</SpanV2>
</RemoveDiv>
}
</AddressesSubContainer>
Expand Down Expand Up @@ -434,12 +432,14 @@ const AddressesSubContainer = styled(ItemHV2)`
const MoreOptions = styled(AiOutlineMore)`
width:24px;
height:24px;
cursor:pointer;
`

const RemoveDiv = styled(ItemHV2)`
border-radius: 12px;
border: 1px solid #BAC4D6;
background: #FFF;
cursor: pointer;
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.05);
padding: 8px 12px 8px 8px;
align-items: center;
Expand Down
11 changes: 5 additions & 6 deletions src/modules/snap/SnapModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ const SnapModule = () => {

const { account, provider } = useAccount();

const theme = useTheme();
const navigate = useNavigate();

useEffect(() => {
getInstalledSnaps();
getWalletAddresses();
}, [account, walletConnected]);
}, [account, walletConnected, snapInstalled]);

async function getInstalledSnaps() {
const installedSnaps = await window.ethereum.request({
Expand All @@ -65,10 +68,9 @@ const SnapModule = () => {
},
});

console.log(account);
console.log(walletConnected);
if (result.includes(account)) {
setAddedAddress(true);
setWalletConnected(true);
} else {
setAddedAddress(false);
}
Expand Down Expand Up @@ -142,9 +144,6 @@ const SnapModule = () => {
setSnapState(3);
showMetamaskPushSnap();
};

const theme = useTheme();
const navigate = useNavigate();
return (
<Container>
<AboutPushSnapModalComponent
Expand Down