### Install GoldRush CLI Source: https://goldrush.dev/docs/changelog/20260225-goldrush-cli-terminal-first-blockchain-data-for-humans-and-agents Run this command to install the GoldRush CLI tool. This is the primary way to get started with the CLI. ```bash npx @covalenthq/goldrush-cli ``` -------------------------------- ### Complete Pipeline Configuration Example Source: https://goldrush.dev/docs/goldrush-pipeline-api/configuration This example demonstrates a full pipeline configuration, including project details, topic, destination (PostgreSQL), ABI parsing for contract addresses, a SQL transformation for swap events, and unbounded execution mode starting from the earliest block. ```yaml project: "analytics-prod" topic: "base.mainnet.ref.block.logs" destination: type: "postgres" url: "postgresql://db.example.com:5432/analytics" user: "${PG_USER}" password: "${PG_PASSWORD}" batch_size: 1000 abi: path: "/etc/pipeline-api/uniswap-v3.json" contract_addresses: - "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45" unmatched: "skip" transforms: evt_swap: > SELECT block_number, tx_hash, contract_address, sender, recipient, amount0, amount1 FROM evt_swap WHERE contract_address = '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45' execution: mode: "unbounded" start_from: "earliest" ``` -------------------------------- ### Example SDK Usage: Get Token Balances Source: https://goldrush.dev/docs/chains/axie-ronin This example shows how to retrieve token balances for a wallet address on the Axie Ronin mainnet using the GoldRush TypeScript SDK. ```APIDOC ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "axie-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` ``` -------------------------------- ### Example API Call: Get Token Balances Source: https://goldrush.dev/docs/chains/axie-ronin This example demonstrates how to fetch token balances for a given wallet address on the Axie Ronin mainnet using a cURL request. ```APIDOC ## GET /v1/axie-mainnet/address/{wallet_address}/balances_v2/ ### Description Fetches token balances for a specific wallet address on the Axie Ronin mainnet. ### Method GET ### Endpoint `/v1/axie-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key. ### Request Example ```bash curl -X GET "https://api.covalenthq.com/v1/axie-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/?key=API_KEY" ``` ``` -------------------------------- ### Example API Call - Get Token Balances Source: https://goldrush.dev/docs/chains/megaeth This example demonstrates how to fetch token balances for a given wallet address on the MegaETH mainnet using the GoldRush Foundational API. ```APIDOC ## GET /v1/megaeth-mainnet/address/{address}/balances_v2/ ### Description Fetches token balances for a specific wallet address. ### Method GET ### Endpoint /v1/megaeth-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/ ### Parameters #### Query Parameters - **key** (string) - Required - Your GoldRush API key. ### Request Example ``` curl -X GET "https://api.covalenthq.com/v1/megaeth-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/?key=API_KEY" ``` ### Response #### Success Response (200) - **data** (object) - Contains the token balance information. - **items** (array) - List of token balances. - **contract_name** (string) - The name of the token contract. - **contract_ticker_symbol** (string) - The ticker symbol of the token. - **balance** (string) - The balance of the token. - **quote_rate** (number) - The current price of the token. - **quote** (number) - The total value of the token balance in USD. #### Response Example ```json { "data": { "items": [ { "contract_name": "Tether USD", "contract_ticker_symbol": "USDT", "balance": "100000000000000000000", "quote_rate": 1.0005, "quote": 100.05 } ] } } ``` ``` -------------------------------- ### Make Your First Request Source: https://goldrush.dev/docs/skills/goldrush-x402/references/overview This example demonstrates how to initialize the x402 client, set up a payment-wrapped fetch function, and make a request to an API endpoint. The client automatically handles the payment flow. ```APIDOC ## 4. Make your first request ```typescript theme={null} import { x402Client } from "@x402/core/client"; import { ExactEvmScheme } from "@x402/evm"; import { wrapFetchWithPayment } from "@x402/fetch"; import { privateKeyToAccount } from "viem/accounts"; const client = new x402Client().register("eip155:84532", new ExactEvmScheme(privateKeyToAccount(process.env.WALLET_PRIVATE_KEY)) ); const paidFetch = wrapFetchWithPayment(fetch, client); const response = await paidFetch( "https://x402.goldrush.dev/v1/eth-mainnet/address/aave.eth/balances_v2/" ); const balances = await response.json(); console.log(JSON.stringify({ headers: Object.fromEntries(response.headers.entries()), body: balances, }, null, 2)); ``` The x402 client handles the full payment flow: if a request gets a `402`, it reads the payment instructions, signs a transaction, and retries. From your code's perspective, it's just a GET request. ``` -------------------------------- ### Get Solana Mainnet Token Balances (TypeScript SDK) Source: https://goldrush.dev/docs/chains/solana This TypeScript SDK example demonstrates how to retrieve token balances for a wallet address on the Solana mainnet. Ensure you have the @covalenthq/client-sdk installed and replace API_KEY with your key. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "solana-mainnet", walletAddress: "4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY" }); ``` -------------------------------- ### Install x402 Client Libraries Source: https://goldrush.dev/docs/skills/goldrush-x402/SKILL Install the necessary x402 client libraries using npm. These libraries facilitate interaction with the x402 protocol for blockchain data access. ```bash npm install @x402/core @x402/evm @x402/fetch ``` -------------------------------- ### Get Token Balances for Wallet Address (Mainnet) Source: https://goldrush.dev/docs/chains/moonriver This TypeScript SDK example demonstrates how to retrieve token balances for a given wallet address on the Moonriver mainnet. Ensure you have the @covalenthq/client-sdk installed and replace API_KEY with your key. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "moonbeam-moonriver", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Get Bitcoin Mainnet Balances via TypeScript SDK Source: https://goldrush.dev/docs/chains/bitcoin This TypeScript SDK example demonstrates how to retrieve token balances for a Bitcoin mainnet wallet address. Ensure you have the @covalenthq/client-sdk installed and replace API_KEY with your key. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "btc-mainnet", walletAddress: "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo" }); ``` -------------------------------- ### Wallet Activity Stream Subscription Example Source: https://goldrush.dev/docs/api-reference/streaming-api/subscriptions/wallet-activity-stream This example demonstrates how to subscribe to wallet activity events. It shows the structure of the subscription request and the expected response format for event data. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": [ "logs", { "address": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000d2216ed62a5c84f285a051839e808902fe8fc90b", "0x000000000000000000000000286f3add5dd41ba6e208f9f9a68533107fd0d0fa" ], "topics": [ "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", "0x000000000000000000000000198ef79f1f515f02dfe9e3115ed9fc07183f02fc", "0x000000000000000000000000198ef79f1f515f02dfe9e3115ed9fc07183f02fc" ] } ] } ``` -------------------------------- ### Get Token Balances for Address using TypeScript SDK (Mainnet) Source: https://goldrush.dev/docs/chains/redstone This TypeScript SDK example demonstrates how to retrieve token balances for a wallet address on Redstone mainnet. Ensure you have the client-sdk installed and replace API_KEY with your key. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "redstone-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Quick Start with TypeScript Client SDK Source: https://goldrush.dev/docs/skills/goldrush-foundational-api/SKILL Demonstrates how to install and use the GoldRush Client SDK for TypeScript to fetch token balances for a wallet address. This is the recommended approach for development. ```APIDOC ## Quick Start **IMPORTANT:** Always prioritize using the official available GoldRush Client SDK best suited for your development ecosystem: * [TypeScript Client SDK](https://www.npmjs.com/package/@covalenthq/client-sdk) ```typescript theme={null} import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("YOUR_API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress( "eth-mainnet", "demo.eth" ); if (!resp.error) { console.log(resp.data.items); } else { console.error(resp.error_message); } ``` **Install:** `npm install @covalenthq/client-sdk` ``` -------------------------------- ### Get Token Balances for Wallet Address (TypeScript SDK) Source: https://goldrush.dev/docs/chains/cronos-zkevm This TypeScript SDK example demonstrates how to retrieve token balances for a wallet address on Cronos zkEVM mainnet. Ensure you have the @covalenthq/client-sdk installed and replace API_KEY with your key. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "cronos-zkevm-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Install x402 Client using yarn Source: https://goldrush.dev/docs/skills/goldrush-x402/references/overview Install the necessary x402 client packages using yarn. This includes the core client, EVM support, and fetch wrapper. ```bash yarn add @x402/core @x402/evm @x402/fetch ``` -------------------------------- ### Install x402 client dependencies Source: https://goldrush.dev/docs/goldrush-x402/quickstart Install the necessary @x402 packages for your project using either npm or yarn. ```bash npm install @x402/core @x402/evm @x402/fetch ``` ```bash yarn add @x402/core @x402/evm @x402/fetch ``` -------------------------------- ### Get ADI Chain Mainnet Token Balances (TypeScript SDK) Source: https://goldrush.dev/docs/chains/adi-chain This TypeScript SDK example demonstrates how to retrieve token balances for a wallet address on the ADI Chain mainnet. Ensure you have the @covalenthq/client-sdk installed and replace API_KEY. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "adi-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Get ADI Chain Testnet Token Balances (TypeScript SDK) Source: https://goldrush.dev/docs/chains/adi-chain This TypeScript SDK example shows how to fetch token balances for a wallet address on the ADI Chain testnet. Make sure to install @covalenthq/client-sdk and replace API_KEY. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "adi-testnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Install x402 Client Source: https://goldrush.dev/docs/skills/goldrush-x402/references/overview Install the necessary x402 client packages using npm or yarn. ```APIDOC ## 3. Install the x402 client ```bash npm theme={null} npm install @x402/core @x402/evm @x402/fetch ``` ```bash yarn theme={null} yarn add @x402/core @x402/evm @x402/fetch ``` ``` -------------------------------- ### Get Moonbeam Token Balances using GoldRush SDK (Mainnet) Source: https://goldrush.dev/docs/chains/moonbeam This TypeScript example demonstrates how to retrieve token balances for a wallet address on Moonbeam mainnet using the GoldRush client SDK. Ensure you have the SDK installed and your API key is configured. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "moonbeam-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### SDK Usage Example (Mainnet) Source: https://goldrush.dev/docs/chains/solana Example of how to use the GoldRush SDK to fetch token balances for a wallet address on Solana mainnet. ```APIDOC ## SDK Usage ### Description This example demonstrates how to use the GoldRush SDK to retrieve token balances for a specified wallet address on the Solana mainnet. ### Code Example ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "solana-mainnet", walletAddress: "4ZJhPQAgUseCsWhKvJLTmmRRUV74fdoTpQLNfKoekbPY" }); ``` ### Parameters - **API_KEY**: Your unique GoldRush API key. - **chainName**: The name of the blockchain network (e.g., "solana-mainnet"). - **walletAddress**: The Solana wallet address for which to fetch balances. ``` -------------------------------- ### Get Token Balances for HyperEVM Mainnet using GoldRush SDK Source: https://goldrush.dev/docs/chains/hyperevm This TypeScript example demonstrates how to retrieve token balances for a wallet address on HyperEVM mainnet using the GoldRush client SDK. Ensure you have the SDK installed and your API key is configured. ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "hyperevm-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` -------------------------------- ### Wallet Setup Source: https://goldrush.dev/docs/skills/goldrush-x402/references/overview To make payments, you need a wallet with testnet USDC on Base Sepolia. Use the wallet's private key to sign x402 payments. Ensure you handle your private key securely. ```APIDOC ## 2. Set up a wallet You need a wallet with testnet USDC on Base Sepolia. You'll use the wallet's private key to sign x402 payments. > **Warning:** Never commit your private key to source control. Use environment variables or a secrets manager. ```bash theme={null} export WALLET_PRIVATE_KEY="your-base-sepolia-private-key" ``` ``` -------------------------------- ### Get Block Heights using GoldRush SDK Source: https://goldrush.dev/docs/api-reference/foundational-api/utility/get-block-heights Example of how to use the GoldRush SDK to get block heights for a specified chain and wallet address. ```APIDOC ## Get Block Heights ### Description Retrieves block heights for a given chain and wallet address. ### Method POST ### Endpoint `/v1/block-heights` ### Parameters #### Query Parameters - **chain_name** (string) - Required - The name of the blockchain chain. - **wallet_address** (string) - Required - The wallet address to query. ### Request Example ```json { "chain_name": "eth-mainnet", "wallet_address": "0x..." } ``` ### Response #### Success Response (200) - **data** (object) - Contains block height information. - **items** (array) - List of block height objects. - **block_height** (integer) - The block height. - **block_timestamp** (string) - The timestamp of the block. #### Response Example ```json { "data": { "items": [ { "block_height": 18000000, "block_timestamp": "2023-10-27T10:00:00Z" } ] } } ``` ``` -------------------------------- ### Example Streaming Subscription Source: https://goldrush.dev/docs/chains/hypercore This example demonstrates how to subscribe to wallet transactions on the Hypercore chain using the TypeScript SDK. It shows how to query for various event types like HypercoreDelegationEvent, HypercoreDepositEvent, HypercoreFillTransaction, HypercoreFundingEvent, and HypercoreLedgerEvent. ```APIDOC ## Example Streaming Subscription ### Description This example demonstrates how to subscribe to wallet transactions on the Hypercore chain using the TypeScript SDK. It shows how to query for various event types like HypercoreDelegationEvent, HypercoreDepositEvent, HypercoreFillTransaction, HypercoreFundingEvent, and HypercoreLedgerEvent. ### Method `subscription` ### Endpoint `walletTxs` ### Parameters #### Query Parameters - **wallet_addresses** (string[]) - Required - The wallet addresses to track. - **chain_name** (string) - Required - The name of the chain, e.g., `HYPERCORE_MAINNET`. ### Request Example ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("YOUR_API_KEY"); const SUBSCRIPTION_QUERY = ` subscription { walletTxs( wallet_addresses: ["0xecb63caa47c7c4e77f60f1ce858cf28dc2b82b00"] chain_name: HYPERCORE_MAINNET ) { decoded_details { ... on ErrorDetails { message } ... on HypercoreDelegationEvent { hash time is_undelegate amount validator } ... on HypercoreDepositEvent { hash time amount } ... on HypercoreFillTransaction { liquidation { market_price method liquidated_user } twap_id builder_fee side cloid closed_pnl fee fee_token oid dir start_position tid size price builder time crossed hash coin } ... on HypercoreFundingEvent { hash time szi funding_amount coin funding_rate } ... on HypercoreLedgerEvent { delta { ... on LedgerSubAccountTransfer { destination usdc user } ... on LedgerWithdraw { fee usdc nonce } ... on LedgerLiquidation { liquidated_ntl_pos account_value liquidated_positions { szi coin } leverage_type } ... on LedgerSpotTransfer { amount usdc_value native_token_fee fee destination fee_token nonce user token } ... on LedgerVaultLeaderCommission { usdc vault } ... on LedgerSend { amount usdc_value destination_dex native_token_fee fee destination fee_token nonce user source_dex token } ... on LedgerVaultDeposit { usdc user vault } ... on LedgerInternalTransfer { fee destination usdc user } ... on LedgerAccountClassTransfer { amount token } ... on LedgerAccountActivationGas { amount token } ... on LedgerVaultCreate { fee usdc vault } ... on LedgerBorrowLend { amount interest_amount operation token } ... on LedgerRewardsClaim { amount } ... on LedgerDeposit { usdc } ... on LedgerPerpDexClassTransfer { amount dex to_perp token } ... on LedgerCStakingTransfer { amount is_deposit token } ... on LedgerSpotGenesis { amount token } ... on LedgerDeployGasAuction { amount token } ... on LedgerVaultDistribution { usdc vault } ... on LedgerVaultWithdraw { requested_usd commission basis closing_cost user vault } } hash ledger_type time } } value chain_name successful } } `; client.subscribe(SUBSCRIPTION_QUERY).subscribe({ next: (data) => { console.log(data); }, error: (err) => console.error(err), }); ``` ### Response #### Success Response (200) - **value** (object) - The subscription data. - **chain_name** (string) - The name of the chain. - **successful** (boolean) - Indicates if the subscription was successful. ``` -------------------------------- ### Example API Calls (Mainnet) Source: https://goldrush.dev/docs/chains/cronos-zkevm Example cURL command to fetch token balances for a given address on Cronos zkEVM mainnet. ```APIDOC ## Example API Calls (Mainnet) ```bash Chain Name (Mainnet) theme={null} curl -X GET "https://api.covalenthq.com/v1/cronos-zkevm-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/?key=API_KEY" ``` ``` -------------------------------- ### Get Paginated Transactions for Address (v3) Source: https://goldrush.dev/docs/api-reference/foundational-api/transactions/get-paginated-transactions-for-address-v3 This endpoint returns paginated transactions, starting with the earliest transactions on page 0. For the most recent transactions, refer to the 'Get recent transactions for address (v3)' endpoint. ```APIDOC ## Get paginated transactions for address (v3) ### Description Commonly used to fetch the transactions involving an address including the decoded log events in a paginated fashion. ### Method GET ### Endpoint /v3/address/{address}/transactions ### Query Parameters - **block-height** (integer) - Optional - The block height to retrieve transactions up to. If not specified, transactions will be retrieved up to the latest block. - **from-block** (integer) - Optional - The block height to retrieve transactions from. If not specified, transactions will be retrieved from the earliest block. - **to-block** (integer) - Optional - The block height to retrieve transactions up to. If not specified, transactions will be retrieved up to the latest block. - **page-number** (integer) - Optional - The page number to retrieve. Defaults to 0. - **page-size** (integer) - Optional - The number of items to return per page. Defaults to 25. - **no-logs** (boolean) - Optional - If true, log events will not be returned. Defaults to false. ### Response #### Success Response (200) - **data** (object) - Contains the paginated transaction data. - **items** (array) - An array of transaction objects. - **block_height** (integer) - The block height of the transaction. - **block_timestamp** (string) - The timestamp of the block. - **transaction_hash** (string) - The hash of the transaction. - **from_address** (string) - The sender address. - **to_address** (string) - The receiver address. - **value** (string) - The value transferred in the transaction. - **log_events** (array) - An array of log events associated with the transaction. #### Response Example ```json { "data": { "items": [ { "block_height": 1234567, "block_timestamp": "2023-01-01T10:00:00Z", "transaction_hash": "0xabc123...", "from_address": "0xsender...", "to_address": "0xreceiver...", "value": "1000000000000000000", "log_events": [ { "decoded": { "name": "Transfer", "params": [ { "name": "from", "type": "address", "value": "0xsender..." }, { "name": "to", "type": "address", "value": "0xreceiver..." }, { "name": "value", "type": "uint256", "value": "1000000000000000000" } ] }, "event_signature": "0xddf252ad1..." } ] } ] } } ``` ``` -------------------------------- ### Initialize Lightweight Charts Source: https://goldrush.dev/docs/api-reference/streaming-api/queries/ohlcv-pairs-query Sets up the Lightweight Charts library, including its configuration for dark/light themes, grid lines, time scale, and price formatting. This snippet is essential for rendering the chart component. ```javascript const LightweightCharts = window.LightweightCharts; if (!LightweightCharts) return; const container = containerRef.current; const dark = isDarkTheme(); const chart = LightweightCharts.createChart(container, { layout: { background: { type: "solid", color: dark ? "rgba(15, 23, 42, 0)" : "rgba(255, 255, 255, 0)" }, textColor: dark ? "#e5e7eb" : "#0f172a" }, grid: { vertLines: { color: dark ? "rgba(100, 116, 139, 0.25)" : "rgba(148, 163, 184, 0.12)" }, horzLines: { color: dark ? "rgba(100, 116, 139, 0.25)" : "rgba(148, 163, 184, 0.12)" } }, timeScale: { timeVisible: true, secondsVisible: true, borderColor: "rgba(148, 163, 184, 0.12)" }, rightPriceScale: { borderVisible: true, borderColor: "rgba(148, 163, 184, 0.12)" }, leftPriceScale: { visible: false, borderColor: "rgba(148, 163, 184, 0.12)" }, localization: { priceFormatter: formatPrice }, width: container.clientWidth, height: container.clientHeight }); ``` -------------------------------- ### Get NFTs for Address Source: https://goldrush.dev/docs/api-reference/foundational-api/nft/get-nfts-for-address This example demonstrates how to fetch NFTs for a given wallet address using the GoldRush SDK. ```APIDOC ## GET /nft/v1/get-nfts-for-address ### Description Retrieves a list of NFTs owned by a specific wallet address on a given blockchain. ### Method GET ### Endpoint `/nft/v1/get-nfts-for-address` ### Query Parameters - **chainName** (string) - Required - The name of the blockchain network (e.g., 'eth-mainnet', 'matic-mainnet'). - **walletAddress** (string) - Required - The wallet address to query for NFTs. ### Request Example ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const ApiServices = async () => { const client = new GoldRushClient("YOUR_API_KEY"); const resp = await client.NftService.getNftsForAddress({chainName: "chainName", walletAddress: "walletAddress"}); console.log(resp.data); }; ApiServices(); ``` ### Response #### Success Response (200) - **data** (object) - Contains the list of NFTs and related information. - **items** (array) - List of NFT objects. - **nft_data** (object) - NFT specific data. - **external_data** (object) - External data associated with the NFT. - **image** (string) - URL of the NFT image. - **name** (string) - Name of the NFT. - **description** (string) - Description of the NFT. - **attributes** (array) - Array of NFT attributes. - **token_id** (string) - The unique token ID of the NFT. - **contract_name** (string) - The name of the NFT contract. - **contract_ticker_symbol** (string) - The ticker symbol of the NFT contract. - **contract_address** (string) - The address of the NFT contract. - **owner_address** (string) - The address of the NFT owner. - **chain_name** (string) - The name of the blockchain. - **asset_url** (string) - URL of the asset. - **thumbnail** (object) - Thumbnail information. - **url** (string) - URL of the thumbnail. - **hash** (string) - Hash of the thumbnail. - **asset_properties** (object) - Properties of the asset. - **asset_width** (integer) - The width of the asset. - **asset_height** (integer) - The height of the asset. - **dominant_color** (string) - The dominant color of the asset. - **asset_cached** (boolean) - Indicates if the asset data is cached. - **image_cached** (boolean) - Indicates if the image data is cached. #### Response Example ```json { "data": { "items": [ { "nft_data": { "external_data": { "image": "https://example.com/image.png", "name": "Example NFT", "description": "This is an example NFT.", "attributes": [ { "trait_type": "Color", "value": "Blue" } ] }, "token_id": "12345", "contract_name": "Example Contract", "contract_ticker_symbol": "EXC", "contract_address": "0xabc123", "owner_address": "0xdef456", "chain_name": "eth-mainnet" }, "asset_url": "https://example.com/asset.glb", "thumbnail": { "url": "https://example.com/thumbnail.png", "hash": "base64encodedhash" }, "asset_properties": { "asset_width": 100, "asset_height": 100, "dominant_color": "#FFFFFF" }, "asset_cached": true, "image_cached": true } ] } } ``` ``` -------------------------------- ### Install Dependencies Source: https://goldrush.dev/docs/CLAUDE Installs all project dependencies using Yarn. This command should be run after cloning the repository or when dependency changes occur. ```bash yarn install ``` -------------------------------- ### Get Recent Transactions for Address Source: https://goldrush.dev/docs/api-reference/foundational-api/transactions/get-recent-transactions-for-address-v3 This example demonstrates how to use the GoldRushClient to fetch recent transactions for a given address. ```APIDOC ## Get Recent Transactions for Address V3 ### Description Retrieves a list of recent transactions for a specified blockchain address. ### Method POST ### Endpoint /v3/transactions/address/{chainName}/{walletAddress} ### Parameters #### Path Parameters - **chainName** (string) - Required - The name of the blockchain network. - **walletAddress** (string) - Required - The blockchain address to query. ### Request Body (No request body is specified for this operation in the provided text.) ### Response #### Success Response (200) - **data** (array) - An array of transaction objects. #### Response Example ```json { "data": [ { "hash": "0x...", "from": "0x...", "to": "0x...", "value": "1000000000000000000", "timestamp": 1678886400 } ] } ``` ``` -------------------------------- ### Address Validation Example Source: https://goldrush.dev/docs/skills/goldrush-foundational-api/references/workflows Ensures the provided wallet address starts with '0x' and consists of 40 hexadecimal characters. ```text Valid: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 ``` -------------------------------- ### Subscribe to Wallet Transactions (EVM Chains & Solana) Source: https://goldrush.dev/docs/api-reference/streaming-api/subscriptions/wallet-activity-stream This example shows how to subscribe to wallet transactions for EVM chains and Solana. You can provide multiple wallet addresses to monitor. ```APIDOC ## Subscription to Wallet Transactions (EVM Chains & Solana) ### Description Subscribe to the `walletTxs` endpoint to receive events for specified wallet addresses across EVM chains and Solana. ### Method Subscription ### Endpoint `walletTxs` ### Parameters #### Query Parameters - **wallet_addresses** (String[]) - Required - A list of wallet addresses to subscribe to. ### Response #### Success Response - **walletTxs** - An object containing transaction details. The structure of `decoded_details` will vary based on the specific event type and chain. ### Request Example ```graphql subscription { walletTxs( wallet_addresses: [ "0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc" "0x4200000000000000000000000000000000000006" ] ) } ``` ``` -------------------------------- ### TypeScript SDK (Mainnet) Source: https://goldrush.dev/docs/chains/canto Example of how to use the GoldRush SDK to get token balances for a wallet address on Canto mainnet. ```APIDOC ## TypeScript SDK (Mainnet) ### Description Example of how to use the GoldRush SDK to get token balances for a wallet address on Canto mainnet. ### Code ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "canto-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` ``` -------------------------------- ### Get Token Balances (Mainnet) Source: https://goldrush.dev/docs/chains/avalanche-c-chain Example of fetching token balances for a wallet address on Avalanche C-Chain mainnet using curl. ```APIDOC ## Get Token Balances (Mainnet) ### Method GET ### Endpoint https://api.covalenthq.com/v1/avalanche-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/ ### Query Parameters - **key** (string) - Required - Your API key ``` -------------------------------- ### Response Headers Example Source: https://goldrush.dev/docs/skills/goldrush-x402/references/overview Example response headers indicating pricing model, base price, cache status, and rate limit remaining. ```text X-Pricing-Model: fixed X-Base-Price: 0.000001 X-Cache: MISS X-RateLimit-Remaining: 97 ``` -------------------------------- ### Get Token Balances (Mainnet - cURL) Source: https://goldrush.dev/docs/chains/base Example cURL command to retrieve token balances for a given wallet address on the Base Mainnet. ```APIDOC ## Get Token Balances (Mainnet - cURL) ### Description Retrieves token balances for a specified wallet address on the Base Mainnet. ### Method GET ### Endpoint https://api.covalenthq.com/v1/base-mainnet/address/{wallet_address}/balances_v2/ ### Parameters #### Query Parameters - **key** (string) - Required - Your Covalent API key. ### Request Example ```bash curl -X GET "https://api.covalenthq.com/v1/base-mainnet/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balances_v2/?key=API_KEY" ``` ``` -------------------------------- ### Example Streaming Subscription Source: https://goldrush.dev/docs/chains/harmony This example demonstrates how to subscribe to wallet transactions on the Harmony mainnet using both GraphQL subscriptions and the TypeScript SDK. ```APIDOC ## Example Streaming Subscription This example demonstrates how to subscribe to wallet transactions on the Harmony mainnet using both GraphQL subscriptions and the TypeScript SDK. ### GraphQL Subscription ```graphql subscription { walletTxs( chain_name: HARMONY_MAINNET, wallet_addresses: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"] ) { block_signed_at block_height tx_hash tx_offset successful decoded_type } } ``` ### TypeScript SDK ```typescript import { GoldRushClient, StreamingChain } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); client.StreamingService.subscribeToWalletTxs( { chain_name: StreamingChain.HARMONY_MAINNET, wallet_addresses: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"], }, { next: (data) => console.log("Received data:", data), error: (error) => console.error("Error:", error), complete: () => console.log("Stream completed"), } ); ``` Connect via WebSocket at `wss://streaming.goldrushdata.com/graphql` with your API key in the connection parameters. See the [Streaming API Quickstart](/goldrush-streaming-api/quickstart) for full setup details. ``` -------------------------------- ### TypeScript SDK Usage (Mainnet) Source: https://goldrush.dev/docs/chains/arbitrum Example of how to get token balances for a wallet address on Arbitrum Mainnet using the GoldRush TypeScript SDK. ```APIDOC ## TypeScript SDK Usage (Mainnet) ### Description This snippet demonstrates how to initialize the GoldRushClient and retrieve token balances for a given wallet address on the Arbitrum mainnet. ### Method `client.BalanceService.getTokenBalancesForWalletAddress` ### Parameters - `chainName` (string): The name of the chain, e.g., "arbitrum-mainnet". - `walletAddress` (string): The wallet address to query. ### Request Example ```typescript import { GoldRushClient } from "@covalenthq/client-sdk"; const client = new GoldRushClient("API_KEY"); const resp = await client.BalanceService.getTokenBalancesForWalletAddress({ chainName: "arbitrum-mainnet", walletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }); ``` ```