| name | alchemy-core-workflow-a |
| description | Build a complete wallet portfolio tracker using Alchemy Enhanced APIs.
Use when implementing token balance dashboards, NFT galleries,
transaction history views, or wallet analytics applications.
Trigger: "alchemy wallet tracker", "alchemy portfolio", "alchemy token dashboard",
"alchemy transaction history", "build dApp with alchemy".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","blockchain","web3","alchemy","defi","portfolio"] |
| compatibility | Designed for Claude Code |
Alchemy Core Workflow A — Wallet Portfolio Tracker
Overview
Primary workflow: build a wallet portfolio tracker using Alchemy's Enhanced APIs. Combines getTokenBalances, getNftsForOwner, getAssetTransfers, and token metadata to create a complete wallet view across ERC-20, ERC-721, and ERC-1155 assets.
Prerequisites
- Completed
alchemy-install-auth setup
alchemy-sdk installed
- Understanding of Ethereum address format and token standards
Instructions
Step 1: Portfolio Data Fetcher
import { Alchemy, Network, AssetTransfersCategory } from 'alchemy-sdk';
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
interface TokenHolding {
contractAddress: string;
symbol: string;
name: string;
balance: number;
decimals: number;
}
interface NftHolding {
contractAddress: string;
collectionName: string;
tokenId: string;
name: string;
imageUrl: | ;
}
{
: ;
: ;
: [];
: [];
: [];
: ;
}
(): <> {
[ethBalance, tokenBalances, nftResponse, transfers] = .([
alchemy..(address),
alchemy..(address),
alchemy..(address, { : }),
alchemy..({
: address,
: [
.,
.,
.,
],
: ,
: ,
}),
]);
: [] = [];
( tb tokenBalances.) {
(tb. && tb. !== ) {
metadata = alchemy..(tb.);
balance = (tb., ) / .(, metadata. || );
(balance > ) {
tokens.({
: tb.,
: metadata. || ,
: metadata. || ,
balance,
: metadata. || ,
});
}
}
}
: [] = nftResponse..( ({
: nft..,
: nft.. || ,
: nft.,
: nft. || ,
: nft.?. || ,
}));
{
address,
: ((ethBalance.()) / ).(),
: tokens.( b. - a.),
nfts,
: transfers.,
: ().(),
};
}
{ fetchPortfolio, };