← Retour au fil
Helius lance les filtres de comptes token pour gTFA sur Solana
Helius16 janv., 22h · il y a 5 mois

Helius lance les filtres de comptes token pour gTFA sur Solana

Sur Solana, récupérer l'historique complet d'un wallet nécessitait jusqu'à plus de 100 appels RPC : un seul suffit désormais.

Helius enrichit sa méthode RPC getTransactionsForAddress (gTFA) avec un nouveau filtre tokenAccounts. Sur Solana, les tokens ne sont pas détenus directement par le wallet mais via des Associated Token Accounts (ATA). Avant, les développeurs devait interroger chaque ATA individuellement pour reconstituer l'historique, un processus lent, coûteux et inefficace.

Le filtre tokenAccounts permet désormais de récupérer l'historique complet d'un wallet en un seul appel RPC. Trois options disponibles : none (par défaut), balanceChanged (recommandé) et all. Cette fonctionnalité est disponible immédiatement et cible particulièrement les wallets, trackers de portfolio, outils fiscaux et dashboards analytiques.

Solana

Détails

Source
Helius
Publication
16 janv. à 22h37

Contenu source (brut)

<p>Last October we <a href="https://www.helius.dev/blog/introducing-gettransactionsforaddress"><span style="text-decoration: underline">released getTransactionsForAddress</span></a>, a new Solana RPC call for querying historical data that combines <code>getSignaturesForAddress</code> and <code>getTransaction</code> into one method.</p><p>Today, we&#39;re excited to announce <code>getTransactionsForAddress</code> (gTFA) can now query a wallet’s token transfer history with a single RPC call. </p><p>The new <a href="https://www.helius.dev/docs/rpc/gettransactionsforaddress#associated-token-accounts"><code>tokenAccounts</code> feature</a> allows users to <strong>include transactions for the wallet’s associated token accounts</strong>—previously omitted from gTFA and its predecessor, <code>getSignaturesForAddress</code>.</p><p>Before, developers were forced to query <code>getTokenAccountsByOwner</code> and then <code>getSignaturesForAddress</code> for every token account. </p><p>This was slow and expensive, often requiring 100s of extra RPC calls.</p><p>Now, it only takes a single call to <code>getTransactionsForAddress</code> with <code>tokenAccounts</code>.</p><h2>The Problem</h2><p>On Solana, your wallet doesn&#39;t actually hold tokens directly. </p><p>Instead, your wallet <em>owns</em> Associated Token Accounts (ATAs), and those token accounts hold your tokens. </p><p>For example, when someone sends you USDC, it goes to your USDC token account instead of your main wallet address.</p><p>This creates a major headache when querying wallet transaction history:</p><p>When you call <code>getSignaturesForAddress</code> on a wallet, you <em>only</em> get transactions that directly reference that wallet address. </p><p>Token transfers that interact with your token accounts—but don&#39;t mention your wallet—simply don&#39;t show up.</p><h2>The Workaround</h2><p>Before today, developers had to implement a tedious workaround:</p><ol class="list-number"><li value=1>Call <code>getTokenAccountsByOwner</code> to get token accounts for a wallet</li><li value=2>Call <code>getSignaturesForAddress</code> for the wallet itself</li><li value=3>Call <code>getSignaturesForAddress</code> for <em>every single token account</em></li><li value=4>Merge all results together</li><li value=5>Deduplicate (many transactions touch multiple accounts)</li><li value=6>Sort chronologically</li></ol><p>This approach is problematic for several reasons:</p><h3>1. Performance is slow</h3><p>A wallet with 50 token accounts requires 51+ RPC calls just to build a complete history. Professional traders, heavy DeFi users, or recreational memecoin traders can have hundreds of token accounts.</p><h3>2. Pagination is inefficient</h3><p>Want the 20 most recent transactions? You can&#39;t just fetch 20 from each source and merge—you need to fetch <em>everything</em>, dedupe, sort, and only then take the first 20 transactions. </p><p>There&#39;s no way to efficiently paginate without over-fetching.</p><h3>3. RPC costs add up</h3><p>Each RPC call has overhead. Multiplying that overhead by 100+ calls per user request gets expensive fast, especially at scale.</p><h2>The Solution</h2><p>With the new <code>tokenAccounts</code> filter, you can get a complete wallet history in a single RPC request:</p><pre><code>{ "jsonrpc": "2.0", "id": "helius-example", "method": "getTransactionsForAddress", "params": [ "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY", { "filters": { "tokenAccounts": "all" }, "sortOrder": "asc", "limit": 100 } ] }</code></pre><p>That&#39;s it. One call. Complete history.</p><h3>Filtering Options</h3><p>The <code>tokenAccounts</code> filter provides three options: <code>none</code>, <code>balanceChanged</code>, and <code>all</code>.</p><h4>none (default)</h4><p>When the <code>tokenAccounts</code> filter is set to <code>none</code>, transactions must reference the wallet address.</p><h4>balanceChanged (recommended)</h4><p>When <code>balanceChanged</code> is applied, transactions reference the wallet address, or modify the balance of a token account owned by the wallet.</p><h4>all</h4><p>Setting <code>tokenAccounts</code> to <code>all</code> requires that transactions reference the address of the wallet or a token account owned by the wallet.</p><h2>Use Cases</h2><p>This new feature is essential for:</p><ul class="list-bullet"><li value=1><strong>Wallets</strong> showing complete transaction history</li><li value=2><strong>Portfolio trackers</strong> that need every token movement</li><li value=3><strong>Tax software</strong> calculating gains/losses across all tokens</li><li value=4><strong>Analytics dashboards</strong> displaying user activity</li></ul><h2>Get Started</h2><p>The <code>tokenAccounts</code> feature is available now. </p><p>Simply add <code>tokenAccounts: balanceChanged</code> (or <code>all</code>) to your filters object and you&#39;re set!</p><p>Not using <code>getTransactionsForAddress</code> yet? </p><p>Check out our <a href="https://www.helius.dev/docs/rpc/gettransactionsforaddress#associated-token-accounts"><span style="text-decoration: underline">docs</span></a> and <a href="https://www.helius.dev/docs/sdks"><span style="text-decoration: underline">SDKs</span></a> to learn more and to get started.</p>