zerion
v1.0.2
Published
A TypeScript SDK for the Zerion API, providing access to rich web3 wallet data and analytics.
Downloads
1,250
Maintainers
Readme
🚀 Features
- Wallet Portfolio: Get comprehensive portfolio data including tokens, NFTs, and DeFi positions
- Wallet Charts: Historical balance charts with multiple time periods (hour, day, week, month, year, max)
- Profit & Loss (PnL): Detailed PnL analytics including realized/unrealized gains
- Transactions: Full transaction history with filtering and pagination
- NFT Support: NFT positions, collections, and portfolio data
- Fungibles: Search and retrieve fungible asset data with market information
- Chains: Access to all supported blockchain networks
- Swap: Get available swap offers and fungibles for bridge exchange
- Gas Prices: Real-time gas prices across supported networks
- TypeScript Support: Full type definitions for all API responses
🛠️ Installation
npm install zerion📖 Usage
Basic Example
import { ZerionAPI, createZerionClient } from 'zerion';
// Create client with API key
const client = new ZerionAPI({ apiKey: 'your-api-key' });
// Or use the factory function
const client = createZerionClient({ apiKey: 'your-api-key' });Get Wallet Portfolio
const portfolio = await client.getWalletPortfolio('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
console.log(portfolio);Get Wallet Positions
const positions = await client.listWalletPositions('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', {
positions: 'no_filter',
currency: 'usd',
});
console.log(positions);Get Wallet Transactions
const transactions = await client.listWalletTransactions('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', {
page: { size: 50 },
});
console.log(transactions);Get NFT Positions
const nftPositions = await client.listWalletNFTPositions('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', {
currency: 'usd',
});
console.log(nftPositions);Get Fungibles
const fungibles = await client.listFungibles({
searchQuery: 'bitcoin',
currency: 'usd',
});
console.log(fungibles);Get Chains
const chains = await client.listChains();
console.log(chains);Get Gas Prices
const gasPrices = await client.listGasPrices();
console.log(gasPrices);CLI Usage
# Initialize the CLI
npx zerion --api-key your-api-key
# Query a wallet
npx zerion --api-key your-api-key --address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045💻 Development
Setup
# Clone the repository
git clone https://github.com/romankurnovskii/zerion-sdk.git
# Install dependencies
npm installScripts
npm run build: Build for productionnpm run test: Run tests with Vitestnpm run test:watch: Run tests in watch modenpm run lint: Lint code with ESLintnpm run format: Format code with Prettiernpm run release: Create a release with Changesets
API Endpoints
The SDK provides access to the following Zerion API endpoints:
Wallets
getWalletChart- Get wallet's balance chartgetWalletPNL- Get wallet's PnLgetWalletPortfolio- Get wallet's portfoliolistWalletPositions- Get list of wallet's fungible positionslistWalletTransactions- Get list of wallet's transactionslistWalletNFTPositions- Get list of wallet's NFT positionslistWalletNFTCollections- Get list of NFT collections held by a walletgetWalletNFTPortfolio- Get wallet's NFT portfolio
Fungibles
listFungibles- Get list of fungible assetsgetFungibleById- Get fungible asset by IDgetFungibleChart- Get a chart for a fungible asset
Chains
listChains- Get list of all chainsgetChainById- Get chain by ID
Swap
getSwapFungibles- Get fungibles available for bridgegetSwapOffers- Get available swap offers
Gas
listGasPrices- Get list of all available gas prices
NFTs
listNFTs- Get list of NFTsgetNFTById- Get single NFT by ID
🤝 Contributing
Contributions are welcome! Please open an issue or submit a pull request.
📄 License
MIT © Roman Kurnovskii
