diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-row.tsx b/apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-row.tsx index 4a2fc382ab1..c0ee572f44a 100644 --- a/apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-row.tsx +++ b/apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-row.tsx @@ -122,6 +122,9 @@ function pidToHref(pid: (typeof products)[number]["id"]) { case "rpc-edge": { return "https://portal.thirdweb.com/infrastructure/rpc-edge/overview"; } + case "insight": { + return "https://portal.thirdweb.com/insight"; + } } } diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/components/server/icons/InsightIcon.tsx b/apps/dashboard/src/app/(dashboard)/(chain)/components/server/icons/InsightIcon.tsx new file mode 100644 index 00000000000..9f15d001a74 --- /dev/null +++ b/apps/dashboard/src/app/(dashboard)/(chain)/components/server/icons/InsightIcon.tsx @@ -0,0 +1,53 @@ +export function InsightIcon(props: { className?: string }) { + return ( + + Insight + + + + + + + + + + + + ); +} diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/components/server/products.ts b/apps/dashboard/src/app/(dashboard)/(chain)/components/server/products.ts index 9f58b086474..48e91444d6f 100644 --- a/apps/dashboard/src/app/(dashboard)/(chain)/components/server/products.ts +++ b/apps/dashboard/src/app/(dashboard)/(chain)/components/server/products.ts @@ -2,6 +2,7 @@ import type { ChainSupportedService } from "../../types/chain"; import { ConnectSDKIcon } from "./icons/ConnectSDKIcon"; import { ContractIcon } from "./icons/ContractIcon"; import { EngineIcon } from "./icons/EngineIcon"; +import { InsightIcon } from "./icons/InsightIcon"; import { PayIcon } from "./icons/PayIcon"; import { RPCIcon } from "./icons/RPCIcon"; import { SmartAccountIcon } from "./icons/SmartAccountIcon"; @@ -49,6 +50,13 @@ export const products = [ description: "Point of sale solution for bridging, onramping & swapping", link: "https://portal.thirdweb.com/connect/pay/overview", }, + { + name: "Insight", + id: "insight", + icon: InsightIcon, + description: "Query, transform and analyze blockchain data", + link: "https://portal.thirdweb.com/insight", + }, ] satisfies Array<{ name: string; id: ChainSupportedService; diff --git a/apps/dashboard/src/app/(dashboard)/(chain)/types/chain.ts b/apps/dashboard/src/app/(dashboard)/(chain)/types/chain.ts index 3537e31e861..9aed8005efe 100644 --- a/apps/dashboard/src/app/(dashboard)/(chain)/types/chain.ts +++ b/apps/dashboard/src/app/(dashboard)/(chain)/types/chain.ts @@ -7,7 +7,8 @@ export type ChainSupportedService = | "account-abstraction" | "pay" | "rpc-edge" - | "chainsaw"; + | "chainsaw" + | "insight"; export type ChainService = { service: ChainSupportedService; diff --git a/apps/portal/public/og/icons/insight.svg b/apps/portal/public/og/icons/insight.svg new file mode 100644 index 00000000000..a48b5597729 --- /dev/null +++ b/apps/portal/public/og/icons/insight.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/portal/src/app/Header.tsx b/apps/portal/src/app/Header.tsx index 90662e4ecf3..b1d33a84f53 100644 --- a/apps/portal/src/app/Header.tsx +++ b/apps/portal/src/app/Header.tsx @@ -28,6 +28,10 @@ const links = [ name: "Contracts", href: "/contracts", }, + { + name: "Insight", + href: "/insight", + }, ]; const toolLinks = [ diff --git a/apps/portal/src/app/insight/blueprints/page.mdx b/apps/portal/src/app/insight/blueprints/page.mdx new file mode 100644 index 00000000000..88cfe0fd5ac --- /dev/null +++ b/apps/portal/src/app/insight/blueprints/page.mdx @@ -0,0 +1,134 @@ +import { createMetadata } from "@doc"; + +export const metadata = createMetadata({ + title: "Insight Blueprints | thirdweb Infrastructure", + description: + "Learn what are Insight Blueprints and how to use them", + image: { + title: "Insight", + icon: "insight", + }, +}); + +# Blueprints + +A blueprint is an API that provides access to on-chain data in a user-friendly format. There's no need for ABIs, decoding, RPC, or web3 knowledge to fetch blockchain data. Every chain exposes the default blueprints below + +## Events Blueprint + +Blockchain events offers developers a powerful way to track and analyze blockchain events emitted by smart contracts. This endpoint provides access to detailed event information, such as the address of the contract that generated the event, the transaction that triggered it, and when and where the event occurred on the blockchain. By offering data points like event topics, block numbers, and transaction hashes, developers can easily filter and search for specific event types, such as token transfers or contract executions. With precise timestamps and block references, the Events Blueprint ensures that developers have real-time access to critical on-chain activity, enabling them to build responsive, high-performance applications that can monitor, analyze, and react to blockchain events seamlessly. Whether working on DeFi, NFTs, or general dApps, this endpoint helps unlock the full potential of blockchain data in any project. + +### Blueprint details + +| Name | Description | Example | +| ----------- | ----------- | ----------- | +| Address | The `address` is the identifier of the smart contract or account that emitted the event. It tells you who or what generated the event. | If the event is related to an ERC-20 token transfer, the address would be the smart contract address of the token. For instance, if you’re tracking events for the USDT token, the address would be the contract address of USDT on Ethereum. | +| Chain ID | The `chain_id` is a unique identifier for the blockchain network where the event occurred. Different blockchain networks (e.g., Ethereum, Binance Smart Chain, Polygon) have their own unique chain IDs. | Ethereum’s mainnet has a chain_id of 1, while Binance Smart Chain has a chain_id of 56. This field ensures you know which network the event is coming from, which is crucial when interacting with multiple EVM chains. +| Data | The `data` field contains additional information specific to the event. In many cases, it’s the raw output of the smart contract event. | In an ERC-20 Transfer event, the data might include the number of tokens transferred in raw hexadecimal format. For instance, if 1000 USDT were transferred, this value would be encoded in the event’s data field. +| Log Index | The `log_index` is the order of the log (event) in the list of all events within the block. It helps you pinpoint exactly where this event is located in the block. | If multiple events occurred within the same block (e.g., multiple token transfers), the log_index tells you the sequence of this particular event. For example, it might be the 3rd event in the block. +| Topics | The `topics` array contains indexed parameters of the event, often used for filtering or categorizing events. The first topic contains the event signature (the function name), while the remaining topics contain indexed event arguments. | In an ERC-20 Transfer event, the first topic would be the hash of the event signature `Transfer(address,address,uint256)`. The second topic would be the sender’s address, and the third would be the receiver’s address. This allows filtering to track all Transfer events for a specific address. +| Transaction Hash | The `transaction_hash` is the unique identifier for the transaction that triggered the event. It helps you link the event to the specific transaction that caused it. | If you transfer 1 ETH to another wallet, the transaction hash might be 0x5c7b6f... which uniquely identifies that transaction. Using this hash, you can look up the transaction in any block explorer (e.g., Etherscan) to see all the details. +| Transaction Index | The `transaction_index` tells you the position of the transaction within the block. This helps you identify where in the block this particular transaction was placed relative to others. | If multiple transactions occurred within the same block (e.g., multiple token transfers), the transaction_index tells you the sequence of this particular transaction. For example, it might be the 3rd transaction in the block. | If a block contains 100 transactions, the transaction_index might indicate that this event was triggered by the 45th transaction in the block. This is useful for debugging or tracing the order of execution. +| Block Hash | A `block_hash` is the unique identifier of a block, generated after the block is confirmed. It’s like a tamper-proof record of all the transactions and events in that block. | If you wanted to verify that a particular transaction or event was part of a block, you could use the block hash to check its integrity. Think of it as a digital signature for the entire block, such as 0x91d… representing all transactions within that specific block. +| Block Number | The `block_number` indicates the position of the block in the blockchain. It tells you when (in terms of blockchain sequence) the event occurred. | Block number 12,345,678 on Ethereum might contain transactions from a particular moment, such as the transfer of 10 ETH between two accounts. You can think of block numbers like page numbers in a ledger. +| Block Timestamp | The `block_timestamp` is the exact time when the block was mined and added to the blockchain. | If block 12,345,678 was mined on July 1, 2023, at 12:30 PM UTC, the timestamp will reflect this exact moment. This helps you pinpoint when an event, such as a token transfer, actually happened in real time. + +## Transactions Blueprint + +Transaction data equips developers with the tools they need to interact with blockchain data efficiently and effectively. By providing clear, actionable insights into each transaction, the API helps streamline tasks like monitoring smart contract interactions, tracking asset transfers, and debugging. Developers can rely on this endpoint to access essential transaction details, enabling faster troubleshooting and more informed decision-making. Whether building DeFi platforms, dApps, or blockchain-based analytics tools, transaction data is the essence for all interactions with any chains. + +### Blueprint details + +| Name | Description | Example | +| ----------- | ----------- | ----------- | +| From Address | This is the address that initiated the transaction. It represents the sender who paid for the gas to execute the transaction. | If a user sends 1 ETH from their wallet, the `from_address` will be the sender’s Ethereum address, such as `0xabc123...`. +| To Address | This is the recipient of the transaction. It could be another wallet or a smart contract. | If sending ETH to a friend, their wallet address, like `0xdef456...`, would be the `to_address`. In the case of interacting with a DeFi platform, the address of the smart contract being called would be the `to_address`. +| Hash | The unique identifier (hash) of the transaction. This hash can be used to look up and verify the transaction on the blockchain. | A transaction might have a hash like `0x5c7b6f...`. You can use this hash to check the transaction status on a block explorer like Etherscan. +| Value | This is the amount of cryptocurrency (in wei) being transferred in the transaction. | If transferring 1 ETH, the `value` would be 1,000,000,000,000,000,000 wei (1 ETH = 10^18 wei). +| Gas | This is the maximum amount of gas units the sender is willing to pay for the transaction to be processed. It limits how much work the transaction can perform on the blockchain. | A simple ETH transfer might require 21,000 gas, while calling a complex smart contract function could require significantly more, such as 100,000 gas. +| Gas Price | The price per gas unit the sender is willing to pay, expressed in wei (the smallest unit of ETH). The total transaction cost is calculated as `gas` * `gas_price`. | If the `gas_price` is 100 gwei (1 gwei = 1 billion wei), the sender will pay `100 gwei * 21,000 gas` for a basic ETH transfer. +| Max Fee Per Gas | This is the maximum amount of gas fees (in wei) the sender is willing to pay for each gas unit. It was introduced in EIP-1559 to provide a cap on gas costs. | If `max_fee_per_gas` is set to 200 gwei, the sender is ensuring that they will never pay more than this for each gas unit, even during periods of high network congestion. +| Max Priority Fee Per Gas | This is the maximum additional fee the sender is willing to pay to incentivize miners to prioritize their transaction. Also introduced in EIP-1559. | A transaction might specify a `max_priority_fee_per_gas` of 2 gwei, which acts as a "tip" for miners to get their transaction included faster in a block. +| Data | The `data` field contains additional information required by a transaction, such as the input parameters for interacting with a smart contract. | In a call to a DeFi contract's `swap` function, the `data` field will include the encoded function call and arguments (e.g., token amount, recipient address). +| Nonce | The `nonce` is the number of transactions sent from the sender’s address. It ensures that transactions are processed in the correct order and prevents double-spending. | If the sender has sent 5 transactions before, the nonce will be 5. This helps in tracking the sequence of transactions and ensuring that each one is processed correctly. | If the `nonce` is 12, it means this is the 13th transaction (starting from 0) sent from the `from_address` +| Transaction Index | The position of the transaction within the block. It indicates the order in which the transaction was included relative to other transactions | If the `transaction_index` is 5, this was the 6th transaction included in the block. +| Transaction Type | The type of transaction, typically either legacy (type `0x0` ) or one of the newer types introduced in EIP-1559 (e.g., type `0x2` for transactions that use the new gas fee mechanism). | A `transaction_type` of `0x2` indicates the transaction follows the new EIP-1559 rules for gas fees. +| Access List | The `access_list` is an optional field introduced in EIP-2930 that specifies which addresses and storage slots the transaction intends to interact with. It’s used to optimize gas costs by pre-declaring the data access needed. | When a transaction interacts with a smart contract, the `access_list` may declare the contract address and storage slots the transaction intends to read from or write to. For example, interacting with a DeFi smart contract could include its contract address and the storage slots holding user balances. +| Chain ID | The `chain_id` identifies the blockchain network on which the transaction was conducted. It prevents replay attacks across different networks. | On Ethereum mainnet, the chain ID is `1`, while on Base Mainnet, the chain ID is `8453` . This field tells you which network the transaction belongs to. +| Block Hash | This is the unique identifier (or "fingerprint") of the block that includes this transaction. The hash ensures that the block hasn't been altered. | If the transaction is included in block `12,345,678`, the block's hash might look like `0xabc123...`, and this hash can be used to reference that particular block on the blockchain. +| Block Number | The `block_number` indicates the specific position of the block in the blockchain that contains the transaction. | If a transaction is included in block `12,345,678`, this number can be used to quickly locate the block and all the transactions it contains. +| Block Timestamp | This is the exact time when the block containing the transaction was mined and added to the blockchain. | If the transaction was confirmed on July 1, 2023, at 12:30 PM UTC, the block timestamp will reflect this moment. It's useful for analyzing when specific activities (like token transfers) occurred. +| r, s, v | These are the cryptographic components of the transaction signature. They prove that the transaction was signed by the private key associated with the sender's address. | The `r`, `s`, and `v` values are produced during the signing process and are necessary to verify the authenticity of the transaction on the blockchain. + + +## Tokens Blueprint + +Tokens on blockchain can be of different standards, but ones of the most widely used ones are: +- ERC-20 for fungible tokens +- ERC-721 and ERC-1155 for NFTs + +This blueprint provides access to such tokens’ balances information for a given owner address. + +### Blueprint details + +#### ERC-20 balances of an address + +```yaml +GET /v1/{clientId}/tokens/erc20/:ownerAddress +``` + +Path Parameters: +- `ownerAddress` *(required)*: The address of the owner of the tokens. +- `clientId` *(required)*: The thirdweb client ID of your project. + +Successful response schema: +```json +[ + { + "tokenAddress": "…", + "balance": "…" + } +] +``` + +#### ERC-721 tokens of an address + +```yaml +GET /v1/{clientId}/tokens/erc721/:ownerAddress +``` + +Path Parameters: +- `ownerAddress` *(required)*: The address of the owner of the tokens. +- `clientId` *(required)*: The thirdweb client ID of your project. + +Successful response schema: +```json +[ + { + "collectionAddress": "…", + "tokenId": "…", + "balance": "…" + } +] +``` + +#### ERC-1155 tokens of an address + +```yaml +GET /v1/{clientId}/tokens/erc1155/:ownerAddress +``` + +Path Parameters: +- `ownerAddress` *(required)*: The address of the owner of the tokens. +- `clientId` *(required)*: The thirdweb client ID of your project. + +Successful response schema: +```json +[ + { + "collectionAddress": "…", + "tokenId": "…", + "balance": "…" + } +] +``` diff --git a/apps/portal/src/app/insight/get-started/page.mdx b/apps/portal/src/app/insight/get-started/page.mdx new file mode 100644 index 00000000000..a252b3344df --- /dev/null +++ b/apps/portal/src/app/insight/get-started/page.mdx @@ -0,0 +1,135 @@ +import { createMetadata } from "@doc"; + +export const metadata = createMetadata({ + title: "Getting started with Insight | thirdweb Infrastructure", + description: + "Learn how to use thirdweb Insight to query blockchain events", + image: { + title: "Insight", + icon: "insight", + }, +}); + +# Get Started + +In this guide we will learn how to use the events blueprint in insight. + +## Pre-requisites + +- [Create a project](https://thirdweb.com/team) and navigate to the project settings to get a clientId +- Use insight API with the base URL below + +``` +https://.insight.thirdweb.com +``` + +## Basic Usage +```typescript +const getUsdtTransfers = async () => { + try { + const response = await fetch('https://1.insight.thirdweb.com/v1//events/0xdAC17F958D2ee523a2206206994597C13D831ec7/Transfer(address,address,uint256)?limit=5'); + const transfersInfo = await response.json(); + return transfersInfo + } catch (error) { + console.error('Error:', error); + } +}; +``` + +Once you execute the query above you will receive a result similar to this: + +```json +{ + "meta": { + "chain_id": 1, + "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "signature": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "page": 0, + "limit": 5, + "total_items": 5, + "total_pages": 0 + }, + "data": [ + { + "chain_id": 1, + "block_number": 14705663, + "block_hash": "0x8f7014ff29e3ea83ee03354bd968741d01b92d4c3ddf02bfa5121465b8240736", + "block_timestamp": 1651594686, + "transaction_hash": "0xf5009000b57b761900010bf7f365c12ce34438ac3afdef9778b46055c26353b3", + "transaction_index": 193, + "log_index": 278, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "data": "0x0000000000000000000000000000000000000000000000000000000005f5e100", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000b8418cdb539069e075b4c6c6675114879ffd441b", + "0x000000000000000000000000515ea78a0ff34aef46a5e323d759935e05de4827" + ] + }, + { + "chain_id": 1, + "block_number": 14705664, + "block_hash": "0x916d67589f2bc37600faf055309fd9f654d0c0030df35d31c04e22fef8d24ff2", + "block_timestamp": 1651594701, + "transaction_hash": "0x0999f86751fe5b8f2bc5446e38abf3f0e01ee1c7ff5ce6288abbea506ac3cebf", + "transaction_index": 41, + "log_index": 120, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "data": "0x0000000000000000000000000000000000000000000000000000000014dc9380", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000005041ed759dd4afc3a72b8192c143f72f4724081a", + "0x0000000000000000000000000f69fce36dc680512d836526fc1abb9cd6bdcdd4" + ] + }, + { + "chain_id": 1, + "block_number": 14705664, + "block_hash": "0x916d67589f2bc37600faf055309fd9f654d0c0030df35d31c04e22fef8d24ff2", + "block_timestamp": 1651594701, + "transaction_hash": "0x0f25b357155dca3186700e69a7586ee0153f1d7d75304a158aab9be210b31a56", + "transaction_index": 72, + "log_index": 133, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "data": "0x0000000000000000000000000000000000000000000000000000000643e6c140", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000007b29bee9cb744122edcd7e8223efcdf8d8d8e0a4", + "0x0000000000000000000000001724aabcef350d3f3433804e6167d4c4137aab01" + ] + }, + { + "chain_id": 1, + "block_number": 14705664, + "block_hash": "0x916d67589f2bc37600faf055309fd9f654d0c0030df35d31c04e22fef8d24ff2", + "block_timestamp": 1651594701, + "transaction_hash": "0x10da03bea7828722c92c86704522c7e1ce7dd2947d633ec6c1fb36680cb256e5", + "transaction_index": 145, + "log_index": 229, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "data": "0x00000000000000000000000000000000000000000000000000000000163d3a0d", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000056eddb7aa87536c09ccc2793473599fd21a8b17f", + "0x0000000000000000000000002b38e18192a442ed923addb4739e0a7724945d3c" + ] + }, + { + "chain_id": 1, + "block_number": 14705664, + "block_hash": "0x916d67589f2bc37600faf055309fd9f654d0c0030df35d31c04e22fef8d24ff2", + "block_timestamp": 1651594701, + "transaction_hash": "0x20967f489b5237c0c6ffcbf7afcd921303e0db9e49382f9dc37809874e674b8b", + "transaction_index": 188, + "log_index": 295, + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "data": "0x0000000000000000000000000000000000000000000000000000000011b9e2b6", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000003cd751e6b0078be393132286c442345e5dc49699", + "0x0000000000000000000000000e6eeff72188094c78b2478b693bbdbf9b13aaac" + ] + } + ] +} +``` diff --git a/apps/portal/src/app/insight/layout.tsx b/apps/portal/src/app/insight/layout.tsx new file mode 100644 index 00000000000..e51f6778d4b --- /dev/null +++ b/apps/portal/src/app/insight/layout.tsx @@ -0,0 +1,20 @@ +import { DocLayout } from "@/components/Layouts/DocLayout"; +import { createMetadata } from "@doc"; +import { sidebar } from "./sidebar"; + +export default async function Layout(props: { children: React.ReactNode }) { + return ( + + {props.children} + + ); +} + +export const metadata = createMetadata({ + title: "Insight", + description: "Query, transform and analyze blockchain data", + image: { + title: "Insight", + icon: "insight", + }, +}); diff --git a/apps/portal/src/app/insight/page.mdx b/apps/portal/src/app/insight/page.mdx new file mode 100644 index 00000000000..1036d25d60e --- /dev/null +++ b/apps/portal/src/app/insight/page.mdx @@ -0,0 +1,28 @@ +import { OpenSourceCard } from "@doc"; +import { createMetadata } from "@/components/Document"; + +export const metadata = createMetadata({ + title: "thirdweb Insight", + description: "Query, transform and analyze blockchain data", + image: { + title: "Insight", + icon: "insight", + }, +}); + +# Insight + +Insight is a powerful tool that lets you retrieve blockchain data from any EVM chain, enrich it with metadata, and transform it using custom logic. Whether you're building a gaming inventory system, tracking DeFi metrics, or analyzing NFT collections, Insight makes it easy to get the data you need with simple API calls. + +## Why use Insight? + +- It gives developers an easily understandable data API to query blockchain data. +- No need to index blockchains yourself or manage infrastructure and RPC costs. +- Transform and enrich data with custom Blueprints. +- Insight is open source. + + + +## Get in touch + +For dedicated support and feature requests, [contact Sales](https://thirdweb.com/contact-us). diff --git a/apps/portal/src/app/insight/sidebar.tsx b/apps/portal/src/app/insight/sidebar.tsx new file mode 100644 index 00000000000..01e50273872 --- /dev/null +++ b/apps/portal/src/app/insight/sidebar.tsx @@ -0,0 +1,29 @@ +import type { SideBar } from "@/components/Layouts/DocLayout"; + +const insightSlug = "/insight"; + +export const sidebar: SideBar = { + name: "Insight", + links: [ + { + name: "Overview", + href: "/insight", + }, + { + name: "Get Started", + href: `${insightSlug}/get-started`, + }, + { + name: "Blueprints", + href: `${insightSlug}/blueprints`, + }, + { + name: "Use cases", + href: `${insightSlug}/use-cases`, + }, + { + name: "API Reference", + href: "https://insight-api.thirdweb.com/reference", + }, + ], +}; diff --git a/apps/portal/src/app/insight/use-cases/page.mdx b/apps/portal/src/app/insight/use-cases/page.mdx new file mode 100644 index 00000000000..278a7812811 --- /dev/null +++ b/apps/portal/src/app/insight/use-cases/page.mdx @@ -0,0 +1,62 @@ +import { createMetadata } from "@doc"; + +export const metadata = createMetadata({ + title: "Insight Use Cases | thirdweb Infrastructure", + description: "Example use cases for thirdweb Insight", + image: { + title: "Insight", + icon: "insight", + }, +}); + +# Use Cases + +## Gaming + +### Show assets owned by players +In blockchain games, players often own digital assets such as in-game items or tokens. To display these assets, the events blueprint can track Transfer events of ERC-721 (NFT) or ERC-1155 tokens, allowing you to determine which assets belong to each player’s wallet. +- The Events blueprint can be used to fetch Transfer events where the player’s wallet is the recipient, showing all NFTs or in-game items acquired by the player. + +### Show users the tokens they earned +Some games reward players with tokens based on achievements or progress. Using the transactions blueprint, you can display these earned tokens by tracking transactions where the game’s smart contract sends tokens to the player’s wallet. +- Transactions Blueprint: Shows all transactions where the game contract transfers tokens to players. +- Events Blueprint: Filters Transfer events from the game’s contract to list all tokens awarded to players. + +## DeFi + +### Analyse Token Economics e.g. USDC 24h volume +Token economics, like daily trading volume, helps in understanding a token’s liquidity and market activity. By using the transactions blueprint users can get transactions involving USDC and then aggregating data based on timestamps, you can calculate 24-hour transaction volume. +- Transactions Blueprint: Retrieves all USDC transactions in the past 24 hours, enabling calculation of volume and other economic indicators. + +### Optimize protocol gas efficiency +DeFi protocols aim to minimize gas fees for users. Using the transactions blueprint allow users to analyze the gas consumption of different transactions, you can identify areas where gas optimization is possible by evaluating high-gas transactions or commonly used functions. +- Transactions Blueprint: Summarizes gas usage across transactions for specific functions, helping to analyze and optimize protocol functions for efficiency. + +### Analyse Token ownership +Understanding who holds a token (e.g., whales, retail investors) is crucial in DeFi to gauge community health and investment risk. The events blueprint helps track token transfer events, where users can analyze the distribution and concentration of token holders. +- Events Blueprint: Retrieves Transfer events to build a map of current token holders, showing distributions among wallets. + +## NFTs + +### Get all transfers of an NFT collection +To track the movement of an entire NFT collection, users can use the events blueprint to capture all Transfer events for that collection. This helps show ownership history or current trading volume for the collection. +- Events Blueprint: Queries Transfer events by contract address, returning each transfer for the NFT collection. + +### Get All NFTs owned by address +To show all NFTs owned by a user, users can use the events blueprint to fetch Transfer events where the specified address is the recipient. This shows a complete list of NFTs in their wallet. +- Events Blueprint: Retrieves Transfer events for each NFT contract where the wallet address is the recipient. + +## Wallets + +### Get all transactions performed by a wallet cross chain +Wallet activity often spans multiple chains. By using the transactions blueprint with the wallet address across different chain_ids, users can retrieve a cross-chain view of all transactions for that wallet. +- Transactions Blueprint: Filters transactions by wallet address and chain ID, providing a history of cross-chain transactions. + +### Get all ERC-20 tokens owned by a wallet +This allows users to see all ERC-20 tokens they own. By using the events blueprint to find Transfer events where the wallet address is the recipient, you can list each ERC-20 token held by that wallet. +- Events Blueprint: Tracks Transfer events of ERC-20 tokens to the wallet address, providing a list of token balances. + +### Detect wallet staking activity (e.g. AAVE) +To identify staking activity in AAVE or any DeFi protocol, users can use the events blueprint to watch for staking-related events, such as Deposit or Stake events on any protocol e.g. AAVE’s smart contracts. This helps monitor which wallets are actively staking assets. +- Events Blueprint: Filters by staking events on AAVE’s staking contracts for the wallet address, providing insights into wallet staking activity. + diff --git a/apps/portal/src/app/page.tsx b/apps/portal/src/app/page.tsx index 8a4a1fab7f0..35881551c31 100644 --- a/apps/portal/src/app/page.tsx +++ b/apps/portal/src/app/page.tsx @@ -14,6 +14,7 @@ import { DotNetIcon, EcosystemWalletsIcon, InfraEngineIcon, + InfraInsightIcon, PayIcon, ReactIcon, TypeScriptIcon, @@ -45,6 +46,7 @@ export default function Page() { + ); } @@ -360,6 +362,23 @@ function EngineSection() { ); } +function InsightSection() { + return ( +
+ +
+ + + +
+ ); +} + function SectionTitle(props: { title: string; id: string; diff --git a/apps/portal/src/components/Document/metadata.ts b/apps/portal/src/components/Document/metadata.ts index 5f6c1780723..38e329de43b 100644 --- a/apps/portal/src/components/Document/metadata.ts +++ b/apps/portal/src/components/Document/metadata.ts @@ -20,7 +20,8 @@ type DynamicImageOptions = { | "storage" | "changelog" | "dotnet" - | "unreal-engine"; + | "unreal-engine" + | "insight"; }; export type MetadataImageIcon = DynamicImageOptions["icon"]; diff --git a/apps/portal/src/icons/index.ts b/apps/portal/src/icons/index.ts index 099ef9a61c0..6bd16f5db15 100644 --- a/apps/portal/src/icons/index.ts +++ b/apps/portal/src/icons/index.ts @@ -17,6 +17,7 @@ export { ContractPublishIcon } from "./products/contracts/ContractPublishIcon"; export { InfraEngineIcon } from "./products/infra/InfraEngineIcon"; export { InfraRPCIcon } from "./products/infra/InfraRPCIcon"; export { InfraStorageIcon } from "./products/infra/InfraStorageIcon"; +export { InfraInsightIcon } from "./products/infra/InfraInsightIcon"; // // payments export { PaymentsNFTCheckoutIcon } from "./products/payments/PaymentsNFTCheckoutIcon"; export { PaymentsSponsoredIcon } from "./products/payments/PaymentsSponsoredIcon"; diff --git a/apps/portal/src/icons/products/infra/InfraInsightIcon.tsx b/apps/portal/src/icons/products/infra/InfraInsightIcon.tsx new file mode 100644 index 00000000000..e5f23ae7ac3 --- /dev/null +++ b/apps/portal/src/icons/products/infra/InfraInsightIcon.tsx @@ -0,0 +1,53 @@ +export function InfraInsightIcon(props: { className?: string }) { + return ( + + Insight + + + + + + + + + + + + ); +}