Supercharged thirdweb SDK with Insight: Faster, More Reliable Blockchain Queries

Joaquim Verges

We're excited to announce a major enhancement to the thirdweb TypeScript SDK that will significantly improve the developer experience when building blockchain applications. With release 5.95.0, we've supercharged the SDK by integrating it with Insight - our in-house indexer - replacing traditional RPC calls for fetching contract state, events, balances, NFT metadata, and more.

The Power of Insight

Until now, the thirdweb SDK has relied primarily on RPC calls to fetch on-chain data. While functional, this approach sometimes faced limitations in terms of speed, reliability, and functionality. By integrating Insight directly into our SDK, we've addressed these challenges head-on, offering:

  • Significantly faster queries for contract events, balances, and NFTs
  • Enhanced reliability with reduced dependency on mutli roundtrip RPC calls
  • Cross-chain functionality that lets you query data across multiple blockchains in a single call
  • Advanced filtering capabilities for more precise data retrieval

What's New in the SDK

New capabilities in the Connect UI components

The Connect UI modal now uses Insight to give your users a full wallet experience directly in your websites:

  • Shows all ERC20 token balances
  • Show all NFTs
  • Shows past transactions of the connected wallet
0:00
/0:11

You can now view all your tokens and NFTs in the connect modal

Supercharged Existing Functions

Your favorite thirdweb functions have been turbocharged with Insight integration:

  • getContractEvents
  • getOwnedNFTs
  • getNFTs
  • getNFT

These functions now automatically leverage our indexer on supported chains, with a graceful fallback to traditional RPC calls when needed.

If you're already using those functions in your app, no changes needed on your end, you'll just get the improved functionality out of the box.

If for any reason you need to turn off that behavior, you can pass useIndexer: false to always use RPC.

New Insight Namespace

We've added a dedicated Insight namespace with powerful new functions:

  • Insight.getOwnedTokens() - Get ERC20 tokens owned by an address across multiple chains
  • Insight.getOwnedNFTs() - Get NFTs (ERC721 and ERC1155) owned by an address
  • Insight.getNFTs() - Get NFTs (ERC721 and ERC1155) for a given contract
  • Insight.getNFT() - Get NFTs metadata for a given contract and tokenId
  • Insight.getTransactions() - Get all transactions for a given wallet address
  • Insight.getContractEvents() - Query indexed events with advanced filtering options

You can import those with import { Insight } from "thirdweb"

New Standalone Package: @thirdweb-dev/insight


For developers who need direct access to our indexer API, we've released a standalone package: @thirdweb-dev/insight. This lightweight API wrapper provides:

  • Typed functions, request bodies, and responses
  • Always stays in sync with the Insight API
  • Perfect for backend applications requiring optimized blockchain data access, without the rest of the SDK

Hands-on Examples

For the existing functions, you will get the improved functionality out of the box without any changes. If you want to use the new multichain capabilities directly, here's some examples using the new Insight namespace:

Get ERC20 Tokens Across Multiple Chains

import { Insight } from "thirdweb";
const tokens = await Insight.getOwnedTokens({
client,
ownerAddress,
chains: [base, polygon, arbitrum],
});

With just a few lines of code, you can now retrieve all ERC20 tokens owned by an address across Base, Polygon, and Arbitrum networks simultaneously!

Fetch Owned NFTs

import { Insight } from "thirdweb";
const nfts = await Insight.getOwnedNFTs({
client,
ownerAddress,
chains: [sepolia],
});

Get Transaction History

import { Insight } from "thirdweb";
const transactions = await Insight.getTransactions({
client,
walletAddress,
chains: [sepolia],
});

Query Indexed Contract Events

import { Insight } from "thirdweb";
const events = await Insight.getContractEvents({
client,
chains: [sepolia],
contractAddress: "0x...",
event: transferEvent(),
decodeLogs: true,
});

Using the Standalone Insight Package

For developers who want low level access to the Insight API with type-safe functions, here's how to use the standalone @thirdweb-dev/insight package:

Configuration

import { configure } from "@thirdweb-dev/insight";
// Call this once at the startup of your application
configure({
clientId: "<YOUR_CLIENT_ID>",
});

Example Usage

import { getV1Events } from "@thirdweb-dev/insight";
const events = await getV1Events({
query: {
chain: [1, 137],
filter_address: "0x1234567890123456789012345678901234567890",
},
});

These functions will map one to one with the Insight OpenAPI spec and will stay in sync as the service changes.

Getting Started

These new features are available now in thirdweb SDK v5.95.0 and the new @thirdweb-dev/insight v1.0.0 package.

To get started:

npm install thirdweb@latest
# Or if you need the standalone package
npm install @thirdweb-dev/insight

Looking for dotnet/unity? It's already out, head over to the dotnet documentation to learn more.

What's Next?

This Insight integration is just the beginning. We're continuously working to enhance the thirdweb developer experience with more powerful indexing capabilities, additional cross-chain functionality, and deeper integration with our developer tools ecosystem.

Stay tuned for more updates, and as always, happy building!


For more detailed documentation on these new features, visit portal.thirdweb.com.