### Start Local Development Server Source: https://github.com/bitquery/graphql-docs/blob/main/README.md Starts a local development server for live preview. Changes are reflected without a server restart. ```bash yarn start ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/bitquery/graphql-docs/blob/main/README.md Installs project dependencies using Yarn. Run this command in the project root. ```bash yarn ``` -------------------------------- ### Install graphql-core Package Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Use-Cases/crypto-ml-price-prediction.md Installs the graphql-core package for working with GraphQL queries and responses, used for fetching data from the Bitquery API. ```python import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_squared_error pip install graphql-core ``` -------------------------------- ### Example Usage of Arguments Query Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/binance_smart_chain/arguments.md This example demonstrates how to query for 'PairCreated' smart contract events on the BNB Smart Chain and retrieve details about their arguments, ordered by block height. ```APIDOC ## Query Arguments ### Description Fetches information about arguments of smart contract calls and events on the BNB Smart Chain. ### Method POST ### Endpoint /graphql ### Query ```graphql { ethereum(network: bsc) { arguments( smartContractEvent: {is: "PairCreated"} options: {desc: "block.height", limit: 6} ) { block { height } argument { name type } } } } ``` ### Parameters #### Query Parameters - **network** (String, required) - Specifies the blockchain network (e.g., `bsc`). - **arguments** (Object, required) - Filters and selects arguments. - **smartContractEvent** (Object) - Filter by smart contract event. - **is** (String) - The name of the smart contract event. - **options** (Object) - Options for controlling the query results. - **desc** (String) - Field to sort results in descending order (e.g., `block.height`). - **limit** (Int) - Maximum number of results to return. ### Response #### Success Response (200) - **data.ethereum.arguments** (Array) - An array of argument objects. - **block.height** (Int) - The height of the block. - **argument.name** (String) - The name of the argument. - **argument.type** (String) - The data type of the argument. ### Response Example ```json { "data": { "ethereum": { "arguments": [ { "block": { "height": 12345678 }, "argument": { "name": "token0", "type": "address" } } ] } } } ``` ``` -------------------------------- ### Install and Import Libraries Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Use-Cases/multi-chain-portfolio-tracker.md Install Streamlit and Requests libraries using pip. Import them at the beginning of your Python script to use their functionalities. ```bash pip install streamlit requests ``` ```python import streamlit as st import requests ``` -------------------------------- ### Cosmos Coinpath Query Example Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/cosmos/coinpath.md This example demonstrates how to trace outbound fund flow from a specific Cosmos address, retrieving transaction details such as amounts in USD, block information, sender/receiver addresses, and transaction hashes. ```APIDOC ## Cosmos Coinpath Query ### Description Traces outbound fund flow from a Cosmos address, returning amounts in USD, block height and timestamps, sender/receiver addresses, and transaction hashes. ### Method POST ### Endpoint /query ### Parameters #### Query Parameters - **initialAddress** (String) - Required - The starting address for the fund flow trace. - **date** (Object) - Optional - Filters transactions by date. Supports operators like `after`. - **options** (Object) - Optional - Controls the ordering and limiting of results. Supports `desc` for ordering and `limit` for the number of results. ### Request Body ```json { "query": "query( $initialAddress: String!, $date: String, $limit: Int ) { cosmos { coinpath( initialAddress: { is: $initialAddress }, date: { after: $date }, options: { desc: \"block.timestamp.iso8601\", limit: $limit } ) { amount(in: USD) block { height timestamp { iso8601 } } currency { address name } receiver { address } sender { address } transaction { hash value } } } }", "variables": { "initialAddress": "cosmos1ypejmkpfqrqmv5w7cscq874xf8rlggq7w44rsw", "date": "2023-08-07", "limit": 10 } } ``` ### Response #### Success Response (200) - **amount** (Float) - The amount of currency transferred, specified in a given currency (e.g., USD). - **block** (Object) - Details about the block containing the transaction. - **height** (Int) - The block height. - **timestamp** (Object) - The timestamp of the block. - **iso8601** (String) - The timestamp in ISO 8601 format. - **currency** (Object) - Information about the currency involved in the transfer. - **address** (String) - The contract address of the currency. - **name** (String) - The name of the currency. - **receiver** (Object) - Information about the receiver of the transfer. - **address** (String) - The receiver's address. - **sender** (Object) - Information about the sender of the transfer. - **address** (String) - The sender's address. - **transaction** (Object) - Details about the transaction. - **hash** (String) - The transaction hash. - **value** (String) - The value of the transaction. #### Response Example ```json { "data": { "cosmos": { "coinpath": [ { "amount": 123.45, "block": { "height": 1234567, "timestamp": { "iso8601": "2023-08-07T10:00:00Z" } }, "currency": { "address": "ibc/27394FB092D2E4771100000000000000000000000000000000000000000000000", "name": "ATOM" }, "receiver": { "address": "cosmos1receiveraddress" }, "sender": { "address": "cosmos1senderaddress" }, "transaction": { "hash": "txhash12345", "value": "123450000000000000000" } } ] } } } ``` ``` -------------------------------- ### Count BNB Blocks Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/binance_smart_chain/blocks.md This example demonstrates how to get the total count of blocks on the BNB blockchain that meet specific criteria. ```APIDOC ## Count BNB Blocks ### Description Returns the aggregate count of blocks on the BNB blockchain. ### Method POST ### Endpoint /graphql ### Query ```graphql { ethereum (network: bsc){ blocks { count } } } ``` ### Response Example ```json { "data": { "ethereum": { "blocks": [ { "count": 34567890 } ] } } } ``` ``` -------------------------------- ### App.js Setup for TradingViewData Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Use-Cases/tradingview.md Sets up the main App component to render the TradingViewData component. This file imports the necessary component from './bitquery'. ```javascript import "./App.css"; import { TradingViewData } from "./bitquery"; function App() { return (
); } export default App; ``` -------------------------------- ### Get the Bitcoin Price on a Given Date Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Examples/bitcoin/Bitcoin-Input-and-Output API.mdx This query returns the price of Bitcoin on a specified date. The example uses '2016-01-01'. ```APIDOC ## Get the Bitcoin Price on a Given date ### Description This query returns price of the Bitcoin on a given date. ### Query ```graphql query MyQuery { bitcoin { outputs(date: {is: "2016-01-01"}) { value usd: value(in: USD) expression(get: "usd/value") } } } ``` ``` -------------------------------- ### Get Ethereum DEX Trades for WOJAK Versus WETH Currency Pair Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Examples/dexTrades/dex-trading-data-api.md Get trades for a specific token pair by combining `buyCurrency` and `quoteCurrency` filters. This example fetches WOJAK/WETH trades with derived USD prices via `expression`. ```APIDOC ## Get Ethereum DEX Trades for WOJAK Versus WETH Currency Pair ### Description Get trades for a specific token pair by combining `buyCurrency` and `quoteCurrency` filters. This example fetches [WOJAK](https://explorer.bitquery.io/ethereum/token/0x5026f006b85729a8b14553fae6af249ad16c9aab)/[WETH](https://explorer.bitquery.io/ethereum/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) trades with derived USD prices via `expression`. ### Query ```graphql { ethereum(network: ethereum) { dexTrades( options: { desc: ["block.height", "tradeIndex"], limit: 10, offset: 0 } date: { since: "2023-07-10", till: "2023-07-19" } buyCurrency: { is: "0x5026f006b85729a8b14553fae6af249ad16c9aab" } quoteCurrency: { is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" } ) { block { timestamp { time(format: "%Y-%m-%d %H:%M:%S") } height } tradeIndex protocol exchange { fullName address { address } } smartContract { address { address annotation } } baseAmount base_amount_usd: baseAmount(in: USD) baseCurrency { address symbol } quoteAmount quote_amount_usd: quoteAmount(in: USD) quotePrice priceInUSD: expression(get: "quote_amount_usd/baseAmount") quoteCurrency { address symbol } maker { address } taker { address } transaction { hash txFrom { address } } } } } ``` ``` -------------------------------- ### Generate PDF Documentation Source: https://github.com/bitquery/graphql-docs/blob/main/README.md Builds the website, serves it locally, and then generates a PDF from the specified URL. ```bash yarn build yarn serve npx docusaurus-print-pdf -u http://localhost:3000/docs/intro ``` -------------------------------- ### Get Uniswap Ethereum DEX Trades by Factory Contract Addresses Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Examples/dexTrades/dex-trading-data-api.md Get trades from a specific DEX using `exchangeAddress` (recommended) or `exchangeName`. This example queries all three Uniswap versions by passing V1, V2, and V3 factory addresses with `in: [...]`. ```APIDOC ## Get Uniswap Ethereum DEX Trades by Factory Contract Addresses Get trades from a specific DEX using `exchangeAddress` (recommended) or `exchangeName`. This example queries all three Uniswap versions by passing V1, V2, and V3 factory addresses with `in: [...]`. **Variations:** Replace factory addresses for SushiSwap, PancakeSwap, or any DEX. Use `exchangeName` alone for a quick lookup (less precise). Add `protocol` to also filter by protocol version. Switch `network` for other EVM chains. [Open this query in IDE](https://ide.bitquery.io/Trades-for-Uniswap) ```graphql { ethereum(network: ethereum) { dexTrades( options: { desc: ["block.height", "tradeIndex"], limit: 10, offset: 0 } date: { since: "2023-07-10", till: "2023-07-11" } exchangeName: { is: "Uniswap" } exchangeAddress: { in: [ "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f" "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95" "0x1f98431c8ad98523631ae4a59f267346ea31f984" ] } ) { block { timestamp { time(format: "%Y-%m-%d %H:%M:%S") } height } tradeIndex protocol exchange { fullName address { address } } smartContract { address { address annotation } } buyAmount buy_amount_usd: buyAmount(in: USD) buyCurrency { address symbol } sellAmount sell_amount_usd: sellAmount(in: USD) sellCurrency { address symbol } transaction { hash } } } } ``` ``` -------------------------------- ### Fetch Smart Contract Arguments Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/Polygon/arguments.md This example demonstrates how to query for arguments of a specific smart contract method on the Polygon network, filtering by date and smart contract address. ```APIDOC ## arguments ### Description Fetches information about arguments of smart contract calls and events. ### Method POST ### Endpoint /query ### Parameters #### Query Parameters - **network** (String) - Required - The blockchain network to query (e.g., matic). - **arguments** (Object) - Required - The arguments for the query. - **options** (Object) - Optional - Options for ordering, limiting, and constraining the results. - **desc** (String) - Optional - Field to sort in descending order (e.g., "block.timestamp.time"). - **limit** (Int) - Optional - Maximum number of results to return. - **offset** (Int) - Optional - Number of results to skip. - **date** (Object) - Optional - Filters by date. - **since** (String) - Optional - Start date for the filter (e.g., "2021-03-14"). - **smartContractMethod** (Object) - Optional - Filters by smart contract method. - **is** (String) - Optional - The name of the smart contract method (e.g., "performUpkeep"). - **smartContractAddress** (Object) - Optional - Filters by smart contract address. - **is** (String) - Optional - The address of the smart contract (e.g., "0x7b3ec232b08bd7b4b3305be0c044d907b2df960b"). ### Request Example ```json { "query": "{ ethereum(network: matic) { arguments( options: {desc: \"block.timestamp.time\", limit: 10, offset: 0} date: {since: \"2021-03-14\"} smartContractMethod: {is: \"performUpkeep\"} smartContractAddress: {is: \"0x7b3ec232b08bd7b4b3305be0c044d907b2df960b\"} ) { block { timestamp { time(format: \"%Y-%m-%d %H:%M:%S\") } height } transaction { hash } argument { name } value { value } } } }" } ``` ### Response #### Success Response (200) - **block** (Object) - Information about the block. - **timestamp** (Object) - Timestamp of the block. - **time** (String) - Formatted time of the block. - **height** (Int) - Height of the block. - **transaction** (Object) - Information about the transaction. - **hash** (String) - Hash of the transaction. - **argument** (Object) - Information about the argument. - **name** (String) - Name of the argument. - **value** (Object) - Information about the argument value. - **value** (String) - The value of the argument. #### Response Example ```json { "data": { "ethereum": { "arguments": [ { "block": { "timestamp": { "time": "2023-10-27 10:00:00" }, "height": 123456 }, "transaction": { "hash": "0xabc123..." }, "argument": { "name": "exampleArg" }, "value": { "value": "exampleValue" } } ] } } } ``` ``` -------------------------------- ### Get Historical XRP Ledger Transfers for a Ripple Address Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Examples/ripple/transfers.mdx This example retrieves the complete transfer history for a specific Ripple address within a given date range. ```APIDOC ## Get Historical XRP Ledger Transfers for a Ripple Address ### Description Retrieves all historical transfers associated with a specific Ripple address, including both sent and received transactions. ### Method POST ### Endpoint /query ### Parameters #### Query Parameters - **network** (RippleNetwork!) - The Ripple network to query. - **limit** (Int!) - The maximum number of results to return. - **offset** (Int!) - The number of results to skip. - **from** (ISO8601DateTime) - The start date for the query. - **till** (ISO8601DateTime) - The end date for the query. - **address** (String!) - The Ripple address to query transfers for. ### Request Example ```json { "query": "query ($network: RippleNetwork!, $limit: Int!, $offset: Int!, $from: ISO8601DateTime, $till: ISO8601DateTime, $address: String!) {\n ripple(network: $network) {\n transfers(\n options: {asc: \"timestamp.time\", limit: $limit, offset: $offset}\n date: {since: $from, till: $till}\n any: [{receiver: {is: $address}}, {sender: {is: $address}}]\n ) {\n timestamp {\n time\n }\n block\n direction\n amountFrom\n amount_from_usd: amountFrom(in: USD)\n amountTo\n amount_to_usd: amountTo(in: USD)\n currencyFrom {\n address\n name\n symbol\n tokenId\n tokenType\n decimals\n }\n currencyTo {\n address\n decimals\n name\n symbol\n tokenId\n tokenType\n }\n direction\n receiver {\n address\n annotation\n }\n sender {\n address\n annotation\n }\n }\n }\n}", "variables": { "limit": 10, "offset": 0, "address": "rs9ineLqrCzeAGS1bxsrW8x2n3bRJYAh3Q", "network": "ripple", "from": "2024-06-28", "till": "2024-07-05T23:59:59", "dateFormat": "%Y-%m-%d" } } ``` ### Response #### Success Response (200) - **timestamp** (object) - Timestamp of the transfer. - **block** (integer) - Block number of the transfer. - **direction** (string) - Direction of the transfer (SENT/RECEIVED). - **amountFrom** (string) - Amount transferred from. - **amount_from_usd** (string) - Amount transferred from in USD. - **amountTo** (string) - Amount transferred to. - **amount_to_usd** (string) - Amount transferred to in USD. - **currencyFrom** (object) - Details of the currency sent. - **currencyTo** (object) - Details of the currency received. - **receiver** (object) - Information about the receiver. - **sender** (object) - Information about the sender. #### Response Example ```json { "data": { "ripple": { "transfers": [ { "timestamp": { "time": "2024-07-01T10:00:00Z" }, "block": 123456, "direction": "SENT", "amountFrom": "100", "amount_from_usd": "120.50", "amountTo": "99.8", "amount_to_usd": "119.70", "currencyFrom": { "address": "r...", "name": "XRP", "symbol": "XRP", "tokenId": null, "tokenType": "XRP", "decimals": 6 }, "currencyTo": { "address": "r...", "decimals": 2, "name": "Yuan", "symbol": "CNY", "tokenId": null, "tokenType": "XRP" }, "receiver": { "address": "r...", "annotation": "Example Receiver" }, "sender": { "address": "rs9ineLqrCzeAGS1bxsrW8x2n3bRJYAh3Q", "annotation": "Example Sender" } } ] } } } ``` ``` -------------------------------- ### Fetch Address Details Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/tezos/address.md This example demonstrates how to fetch basic details for a specific Tezos address, including its address and available balance. ```APIDOC ## Fetch Address Details ### Description Retrieves information about a specific Tezos address, including its balance. ### Method query ### Endpoint /graphql ### Parameters #### Query Parameters - **tezos.address** (Object) - Required - Filter by address details. - **address** (Object) - Required - Filter by address. - **is** (String) - Required - The Tezos address to query. ### Request Example ```json { tezos { address(address: {is: "tz1Vkoqo2ZQsVXBniYJDfX6F2NMfH5RoEuGn"}) { address balance { available } } } } ``` ### Response #### Success Response (200) - **tezos.address** (Array) - List of addresses matching the query. - **address** (String) - The Tezos address. - **annotation** (String) - Any annotation associated with the address. - **balance** (Object) - The balance of the address. - **available** (String) - The available balance of the address. - **staking** (String) - The staking balance of the address. - **delegated** (String) - The delegated balance of the address. - **total** (String) - The total balance of the address. #### Response Example ```json { "data": { "tezos": { "address": [ { "address": "tz1Vkoqo2ZQsVXBniYJDfX6F2NMfH5RoEuGn", "annotation": null, "balance": { "available": "10000000000", "staking": "0", "delegated": "0", "total": "10000000000" } } ] } } } ``` ``` -------------------------------- ### Get XRP Ledger Transfers for a Currency on the Ripple Network Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Examples/ripple/transfers.mdx This example demonstrates how to retrieve all types of transfers for a specific currency (e.g., CNY) on the Ripple network within a given date range. ```APIDOC ## Get XRP Ledger Transfers for a Currency on the Ripple Network ### Description Retrieves all types of transfers for a specific currency on the Ripple network. ### Method POST ### Endpoint /query ### Parameters #### Query Parameters - **network** (RippleNetwork!) - The Ripple network to query. - **limit** (Int!) - The maximum number of results to return. - **offset** (Int!) - The number of results to skip. - **from** (ISO8601DateTime) - The start date for the query. - **till** (ISO8601DateTime) - The end date for the query. - **currency** (String!) - The currency symbol to filter transfers by. ### Request Example ```json { "query": "query ($network: RippleNetwork!, $limit: Int!, $offset: Int!, $from: ISO8601DateTime, $till: ISO8601DateTime, $currency: String!) {\n ripple(network: $network) {\n transfers(\n options: {desc: \"block\", limit: $limit, offset: $offset}\n date: {since: $from, till: $till}\n any: [{currencyToSymbol: {is: $currency}}, {currencyFromSymbol: {is: $currency}}]\n ) {\n timestamp {\n time\n }\n amountFrom\n amount_from_usd: amountFrom(in: USD)\n amountTo\n amount_to_usd: amountTo(in: USD)\n block\n currencyFrom {\n address\n name\n symbol\n tokenId\n tokenType\n decimals\n }\n currencyTo {\n address\n decimals\n name\n symbol\n tokenId\n tokenType\n }\n direction\n receiver {\n address\n annotation\n }\n sender {\n address\n annotation\n }\n }\n }\n}", "variables": { "limit": 10, "offset": 0, "currency": "CNY", "network": "ripple", "from": "2024-06-28", "till": "2024-07-05T23:59:59", "dateFormat": "%Y-%m-%d" } } ``` ### Response #### Success Response (200) - **timestamp** (object) - Timestamp of the transfer. - **amountFrom** (string) - Amount transferred from. - **amount_from_usd** (string) - Amount transferred from in USD. - **amountTo** (string) - Amount transferred to. - **amount_to_usd** (string) - Amount transferred to in USD. - **block** (integer) - Block number of the transfer. - **currencyFrom** (object) - Details of the currency sent. - **currencyTo** (object) - Details of the currency received. - **direction** (string) - Direction of the transfer. - **receiver** (object) - Information about the receiver. - **sender** (object) - Information about the sender. #### Response Example ```json { "data": { "ripple": { "transfers": [ { "timestamp": { "time": "2024-07-01T10:00:00Z" }, "amountFrom": "100", "amount_from_usd": "120.50", "amountTo": "99.8", "amount_to_usd": "119.70", "block": 123456, "currencyFrom": { "address": "r...", "name": "Yuan", "symbol": "CNY", "tokenId": null, "tokenType": "XRP", "decimals": 2 }, "currencyTo": { "address": "r...", "decimals": 2, "name": "XRP", "symbol": "XRP", "tokenId": null, "tokenType": "XRP" }, "direction": "OUT", "receiver": { "address": "r...", "annotation": "Example Receiver" }, "sender": { "address": "r...", "annotation": "Example Sender" } } ] } } } ``` ``` -------------------------------- ### Get Latest BNB Transactions Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/binance_smart_chain/transactions.md This example demonstrates how to query the 10 latest transactions from the BNB Smart Chain, including details like amount, block timestamp, currency, fees, gas, sender, and receiver. ```APIDOC ## Query BNB Transactions ### Description Retrieves a list of transactions from the BNB Smart Chain. ### Method POST ### Endpoint /graphql ### Request Body ```json { "query": "query { bsc { transactions( date: { after: \"2023-07-17T00:00:00Z\" }, options: { desc: \"block.timestamp.iso8601\", limit: 10 } ) { amount block { timestamp { iso8601 } } currency { address name symbol } feePayer feeRatio gas gasCurrency { address name symbol } gasPrice gasValue hash nonce sender { address annotation } to { address annotation } txType } } }" } ``` ### Response #### Success Response (200) Returns a list of transaction objects, each containing detailed information about the transaction. ```json { "data": { "bsc": { "transactions": [ { "amount": 0.001, "block": { "timestamp": { "iso8601": "2023-10-27T10:00:00Z" } }, "currency": { "address": "0x...", "name": "Binance Coin", "symbol": "BNB" }, "feePayer": "0xsender_address", "feeRatio": 10, "gas": 21000, "gasCurrency": { "address": "0x...", "name": "Binance Coin", "symbol": "BNB" }, "gasPrice": 5000000000, "gasValue": 10500000000000000, "hash": "0x...", "nonce": 1, "sender": { "address": "0xsender_address", "annotation": "Sender Account" }, "to": { "address": "0xreceiver_address", "annotation": "Receiver Account" }, "txType": "legacy" } ] } } } ``` ``` -------------------------------- ### Get Latest DEX Trades on BNB Smart Chain Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/binance_smart_chain/dextrades.md This example demonstrates how to query the 10 latest DEX trades on the BNB Smart Chain. It includes details about base and quote currencies, amounts, and transaction information. ```APIDOC ## GET /dexTrades ### Description Retrieves a list of DEX trades on the BNB Smart Chain. ### Method GET ### Endpoint /dexTrades ### Query Parameters - **date** (ISO8601 string) - Optional - Filter trades after a specific date. - **options** (object) - Optional - Options for limiting and ordering results. - **limit** (int) - Optional - The maximum number of trades to return. ### Request Example ```graphql query { ethereum(network: bsc) { dexTrades(date: {after: "2023-07-17T00:00:00Z"}, options: {limit: 10}) { baseCurrency { address name symbol } baseAmount(in: USD) buyAmount block { timestamp { iso8601 } } buyCurrency { address name symbol } exchange { fullName fullNameWithId address { address annotation } } quoteCurrency { address name symbol } quoteAmount(in: USD) sellAmount quotePrice sellCurrency { address name symbol } transaction { hash txFrom { address annotation } } } } } ``` ### Response #### Success Response (200) - **baseCurrency** (object) - Information about the base currency. - **baseAmount** (float) - The amount of the base currency in USD. - **buyAmount** (float) - The amount bought in the trade. - **block** (object) - Information about the block. - **buyCurrency** (object) - Information about the currency bought. - **exchange** (object) - Information about the exchange. - **quoteCurrency** (object) - Information about the quote currency. - **quoteAmount** (float) - The amount of the quote currency in USD. - **sellAmount** (float) - The amount sold in the trade. - **quotePrice** (float) - The price of the quote currency. - **sellCurrency** (object) - Information about the currency sold. - **transaction** (object) - Information about the transaction. #### Response Example ```json { "data": { "ethereum": { "dexTrades": [ { "baseCurrency": { "address": "0x1af3f3290853e55e6d1426f1591b5306f112dc30", "name": "BNB", "symbol": "BNB" }, "baseAmount": 100.50, "buyAmount": 0.25, "block": { "timestamp": { "iso8601": "2023-07-17T10:30:00Z" } }, "buyCurrency": { "address": "0xe9e7cea3dedca5984780bafc16d38004965bda70", "name": "Binance-Peg BUSD Token", "symbol": "BUSD" }, "exchange": { "fullName": "PancakeSwap", "fullNameWithId": "PancakeSwap V2", "address": { "address": "0x10ed43c718370f0f55abc85b31710d0979b12c9a", "annotation": "PancakeSwap" } }, "quoteCurrency": { "address": "0x1af3f3290853e55e6d1426f1591b5306f112dc30", "name": "BNB", "symbol": "BNB" }, "quoteAmount": 50.25, "sellAmount": 100.50, "quotePrice": 0.50, "sellCurrency": { "address": "0x1af3f3290853e55e6d1426f1591b5306f112dc30", "name": "BNB", "symbol": "BNB" }, "transaction": { "hash": "0xabc123def456ghi789jkl012mno345pqr678stu901vwx", "txFrom": { "address": "0x1234567890abcdef1234567890abcdef12345678", "annotation": "User Address" } } } ] } } } ``` ``` -------------------------------- ### Querying Smart Contract Calls Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/algorand/smartContractCalls.md This example demonstrates how to query smart contract calls on Algorand, filtering by date and smart contract address. ```APIDOC ## Querying Smart Contract Calls ### Description This query retrieves smart contract calls made to a specific contract address within a given date range. It demonstrates how to use the `smartContractCalls` field with filters like `date` and `smartContractAddress`. ### Method POST ### Endpoint /query ### Parameters #### Query Parameters - **date** (DateFilter) - Optional - Filter by date in range, list, or a single date. - **smartContractAddress** (String) - Required - Filter by the smart contract address being called. ### Request Example ```json { "query": "{\n algorand {\n smartContractCalls(\n date: {after: \"2023-08-05\"}\n smartContractAddress: {is: \"2TUBOBZ7CP7EZXFOWULEG5HE6WJ34TT7SBZ5AMHGR222O7RZNBK3I4BUMY\"}\n ) {\n count(uniq: txs)\n }\n }\n}" } ``` ### Response #### Success Response (200) - **data** (object) - The response object containing the query results. - **algorand** (object) - **smartContractCalls** (array) - **count** (integer) - The count of unique transactions matching the criteria. #### Response Example ```json { "data": { "algorand": { "smartContractCalls": [ { "count": 150 } ] } } } ``` ``` -------------------------------- ### Retrieve USDT Token Smart Contract Details Source: https://github.com/bitquery/graphql-docs/blob/main/docs/Schema/Polygon/address.md This example demonstrates how to query the Polygon API to get details about the USDT Token smart contract, including its attributes, contract type, protocol type, and currency information. ```APIDOC ## Query USDT Token Smart Contract Details ### Description Retrieves detailed information about the USDT Token smart contract on the Polygon network, including its attributes, contract type, protocol type, and currency specifics. ### Method POST ### Endpoint /graphql ### Query Parameters - **network** (string) - Required - The blockchain network to query, e.g., `matic`. - **address** (object) - Required - An object to filter addresses. Use `is` to specify a particular address. - **is** (string) - Required - The specific address to query. ### Request Body ```json { "query": "query {\n ethereum(network: matic) {\n address(address: {is: \"0xc2132D05D31c914a87C6611C10748AEb04B58e8F\"}) {\n smartContract {\n attributes {\n address {\n address\n annotation\n }\n name\n value\n type\n }\n contractType\n protocolType\n currency {\n decimals\n name\n symbol\n tokenType\n }\n }\n balance\n annotation\n address\n }\n }\n}" } ``` ### Response #### Success Response (200) - **data.ethereum.address[0].smartContract.attributes** (array) - Attributes of the smart contract. - **data.ethereum.address[0].smartContract.contractType** (string) - The type of the smart contract. - **data.ethereum.address[0].smartContract.protocolType** (string) - The protocol type of the smart contract. - **data.ethereum.address[0].smartContract.currency.decimals** (number) - The number of decimals for the token. - **data.ethereum.address[0].smartContract.currency.name** (string) - The name of the token. - **data.ethereum.address[0].smartContract.currency.symbol** (string) - The symbol of the token. - **data.ethereum.address[0].smartContract.currency.tokenType** (string) - The type of the token. - **data.ethereum.address[0].balance** (number) - The balance of the address. - **data.ethereum.address[0].annotation** (string) - The annotation of the address. - **data.ethereum.address[0].address** (string) - The address itself. #### Response Example ```json { "data": { "ethereum": { "address": [ { "smartContract": { "attributes": [ { "address": { "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", "annotation": "Tether USD" }, "name": "USDT", "value": "1000000", "type": "erc20" } ], "contractType": "token", "protocolType": "erc20", "currency": { "decimals": 6, "name": "Tether USD", "symbol": "USDT", "tokenType": "erc20" } }, "balance": 1000000, "annotation": "Tether USD", "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" } ] } } } ``` ```