From f2ce18094547aaa96e79aaf803df6142d6c9c07b Mon Sep 17 00:00:00 2001 From: German Costilla Date: Tue, 16 Jul 2024 03:02:26 -0300 Subject: [PATCH] feat: using wallet_watchAsset to interact with Braavos --- .../components/ui_components/AddTokenModal.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/components/ui_components/AddTokenModal.tsx b/frontend/src/app/components/ui_components/AddTokenModal.tsx index 43a9290..5721d07 100644 --- a/frontend/src/app/components/ui_components/AddTokenModal.tsx +++ b/frontend/src/app/components/ui_components/AddTokenModal.tsx @@ -1,9 +1,7 @@ "use client"; import { useEffect, useState } from "react"; import GenericModal from "./GenericModal"; -import { WalletAccount } from "starknet"; import { useConnect } from "@starknet-react/core"; -const providerUrl = "https://starknet-sepolia.public.blastapi.io"; const AddTokenModal = ({ openAddTokenModal, @@ -22,13 +20,9 @@ const AddTokenModal = ({ function handleAddToken() { const fetchAddToken = async () => { try { - const myWalletAccount = new WalletAccount( - { nodeUrl: providerUrl }, - // @ts-ignore - connector?._wallet, - ); - - const resp = await myWalletAccount.watchAsset({ + // @ts-ignore + const walletProvider = connector?._wallet + const asset = { type: "ERC20", options: { address: tokenAddress, @@ -36,6 +30,11 @@ const AddTokenModal = ({ decimals, name, }, + }; + + const resp = await walletProvider.request({ + type: 'wallet_watchAsset', + params: asset, }); console.log(resp); } catch (err) {