# You can get the endpoint once you have completed deploying a subgraph onto Alchemy# Please check your Alchemy Dashboard to retrieve the endpointEND_POINT=YOUR_ENDPOINT
Create a script to query from the Alchemy Subgraph:
import { getAccountBalance, getAllowance } from"./query";asyncfunctionmain() {constaccount="0x31003C2D5685c7D28D7174c3255307Eb9a0f3015"; // Replace with your actual addressconstinfo=awaitgetAccountBalance(account.toLowerCase());console.log("Account Info: ", info);constspender="0x87a7A0223D6F96B3DECaAf3666d5c550b36fEfEe"; // Replace with your actual addressconstapprovals=awaitgetAllowance(account.toLowerCase(),spender.toLowerCase() );console.log("Approvals: ", approvals);}main().then(() =>process.exit(0)).catch((error) => {console.error(error);process.exit(1); });
Run the test:
cd..&&npxts-nodesrc/main.ts
After running, you should see output similar to the following: