Skip to content

Commit

Permalink
add-token-method
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorginaShall committed Jan 8, 2025
1 parent 01939fd commit 537bab1
Showing 1 changed file with 4 additions and 52 deletions.
56 changes: 4 additions & 52 deletions src/components/stakingPoolDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,45 +81,9 @@ const StakingPoolDetailsView: React.FC<
stakingPoolData.definition.tokenDecimals
);

//method 1

const { data: walletClient } = useWalletClient();

const { walletAddress } = WalletConnector.useContainer();

const handleClick1 = async () => {
if (walletAddress && walletClient) {
try {
console.log(walletClient);
const result = await walletClient.watchAsset({
type: 'ERC20',
options: {
address: stakingPoolData.definition.tokenAddress,
symbol: stakingPoolData.definition.tokenSymbol,
decimals: stakingPoolData.definition.tokenDecimals,
},
});

if (result) {
console.log('Asset watched successfully!');
}
else {
console.error('Failed to watch asset.');
}
}
catch (error) {
console.error('Error watching asset:', error);
}
}
else console.log('not wallet client');
};

//method 1 end

//method 2

const { watchAsset } = useWatchAsset();
const handleClick2 = () =>

const handleClickAaddToken = () =>
watchAsset(
{
type: 'ERC20',
Expand All @@ -139,10 +103,6 @@ const StakingPoolDetailsView: React.FC<
}
);

//

//method 2 end

return (
<div
className="relative overflow-y-auto max-h-[calc(90vh-10vh)] sm:max-h-[calc(90vh-15vh)]
Expand All @@ -159,18 +119,10 @@ const StakingPoolDetailsView: React.FC<
</div>
<div>
<Button
onClick={handleClick1}
className="btn-primary-gradient-aqua-lg lg:btn-primary-gradient-aqua"
>
M1
</Button>
</div>
<div>
<Button
onClick={handleClick2}
onClick={handleClickAaddToken}
className="btn-primary-gradient-aqua-lg lg:btn-primary-gradient-aqua"
>
M2
+
</Button>
</div>
</div>
Expand Down

0 comments on commit 537bab1

Please sign in to comment.