diff --git a/examples/connect/src/App.tsx b/examples/connect/src/App.tsx index c940d3a7..a494e711 100644 --- a/examples/connect/src/App.tsx +++ b/examples/connect/src/App.tsx @@ -3,14 +3,12 @@ import { Button, ConnectButton, formatAmount, - getContractAddress, useTreasure, } from "@treasure-dev/tdk-react"; import { formatEther, parseEther } from "viem"; export const App = () => { - const { tdk, chainId, user } = useTreasure(); - const magicAddress = getContractAddress(chainId, "MAGIC"); + const { tdk, user, contractAddresses } = useTreasure(); const handleMintMagic = async (amount: number) => { if (!user?.smartAccountAddress) { @@ -20,7 +18,7 @@ export const App = () => { try { await tdk.transaction.create( { - address: magicAddress, + address: contractAddresses.MAGIC, abi: [ { inputs: [ diff --git a/examples/harvester/.env.example b/examples/harvester/.env.example index 7251c898..2e1c6251 100644 --- a/examples/harvester/.env.example +++ b/examples/harvester/.env.example @@ -1,5 +1,4 @@ VITE_TDK_API_URL=http://localhost:8080 -VITE_TDK_CHAIN_ID=421614 -VITE_TDK_LOGIN_DOMAIN=http://localhost:5173 -VITE_TDK_LOGIN_REDIRECT_URI=http://localhost:5174 +VITE_TDK_CLIENT_ID= +VITE_TDK_BACKEND_WALLET= VITE_WALLETCONNECT_PROJECT_ID= diff --git a/examples/harvester/src/App.tsx b/examples/harvester/src/App.tsx index 47fc35cf..06788588 100644 --- a/examples/harvester/src/App.tsx +++ b/examples/harvester/src/App.tsx @@ -16,12 +16,13 @@ import { useAccount, useChainId, useReadContracts } from "wagmi"; const MAGIC_AMOUNT = parseEther("1000"); export const App = () => { - const { address, tdk } = useTreasure(); + const { tdk, user } = useTreasure(); const { address: eoaAddress = zeroAddress, isConnected: isEOAConnected } = useAccount(); const chainId = useChainId(); const contractAddresses = useContractAddresses(); - const smartAccountAddress = (address ?? zeroAddress) as AddressString; + const smartAccountAddress = (user?.smartAccountAddress ?? + zeroAddress) as AddressString; const { data: { @@ -38,7 +39,7 @@ export const App = () => { refetch: refetchHarvesterData, } = useHarvester({ chainId, - contract: "HarvesterEmerion", + contract: "HarvesterEmberwing", userAddress: eoaAddress, }); @@ -61,7 +62,7 @@ export const App = () => { }, ], query: { - enabled: !!address, + enabled: !!user?.smartAccountAddress, select: (data) => ({ eoaMagic: data[0].result ?? 0n, eoaPermits: data[1].result ?? 0n, @@ -142,14 +143,15 @@ export const App = () => {

TDK Harvester Example

- +
- {address ? ( + {user?.smartAccountAddress ? ( <>

- Smart Account: {address} + Smart Account:{" "} + {user.smartAccountAddress}

  • {formatEther(smartAccountMagic)} MAGIC balance
  • diff --git a/examples/harvester/src/main.tsx b/examples/harvester/src/main.tsx index 98e2a32b..73e71b19 100644 --- a/examples/harvester/src/main.tsx +++ b/examples/harvester/src/main.tsx @@ -26,12 +26,17 @@ ReactDOM.createRoot(document.getElementById("root")!).render(