Skip to content
Open
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
38 changes: 38 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,34 @@ function App() {
SHOW_BACKGROUND: false,
});

const addTokenToWallet= () => {
const tokenDecimals = 0;
const tokenImage = 'https://www.conreco.com.ar/abuelas-plaza-mayo/output-nft/hidden.png';

try {
window.ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: CONFIG.CONTRACT_ADDRESS, // The address that the token is at.
symbol: CONFIG.SYMBOL, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage, // A string url of the token logo
}
}
}).then(() => {
console.log('Thanks for your interest!');
}).catch(() => {
console.log('Your loss!');
});


} catch (error) {
console.log(error);
}
}

const claimNFTs = () => {
let cost = CONFIG.WEI_COST;
let gasLimit = CONFIG.GAS_LIMIT;
Expand Down Expand Up @@ -273,6 +301,16 @@ function App() {
Excluding gas fees.
</s.TextDescription>
<s.SpacerSmall />
<StyledButton
onClick={(e) => {
e.preventDefault();
dispatch(addTokenToWallet);
getData();
}}
>
Add to Metamask
</StyledButton>
<s.SpacerSmall />
{blockchain.account === "" ||
blockchain.smartContract === null ? (
<s.Container ai={"center"} jc={"center"}>
Expand Down