Skip to content

fastnear/transfers-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Transfers API

Endpoint

POST https://transfers.main.fastnear.com/v0/transfers

Parameters

Parameter Type Required Default Description
account_id string - NEAR account ID to query
resume_token string null Pagination token from previous response
from_timestamp_ms integer null Start of time range (ms) inclusive
to_timestamp_ms integer null End of time range (ms)
limit integer 1000 Number of transfers to return (1 to 1000)
desc boolean false Sort descending (newest first) when true

Examples

Basic Query

Fetch transfers for an account with default settings (ascending order):

curl -X POST https://transfers.main.fastnear.com/v0/transfers \
  -H "Content-Type: application/json" \
  -d '{"account_id": "intents.near"}'

With Limit and Descending Order

Fetch the 10 most recent transfers:

curl -X POST https://transfers.main.fastnear.com/v0/transfers \
  -H "Content-Type: application/json" \
  -d '{"account_id": "intents.near", "limit": 10, "desc": true}'

Pagination with Resume Token

Continue fetching from where the previous request left off:

curl -X POST https://transfers.main.fastnear.com/v0/transfers \
  -H "Content-Type: application/json" \
  -d '{"account_id": "intents.near", "limit": 10, "desc": true, "resume_token": "7594641293647473196415950063"}'

Filter by Time Range

Fetch transfers within a specific time window (timestamps in milliseconds):

curl -X POST https://transfers.main.fastnear.com/v0/transfers \
  -H "Content-Type: application/json" \
  -d '{"account_id": "intents.near", "from_timestamp_ms": 1768265220000, "to_timestamp_ms": 1768265226000}'

Combined: Resume Token with Time Filter

Paginate through transfers within a time range:

curl -X POST https://transfers.main.fastnear.com/v0/transfers \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "intents.near",
    "resume_token": "7594641293647473196415950063",
    "from_timestamp_ms": 1768265200000,
    "to_timestamp_ms": 1768265300000,
    "limit": 5,
    "desc": true
  }'

Reference Schema

Account-centric Transfers table:

CREATE TABLE account_transfers
(
    block_height           UInt64 COMMENT 'Block height',
    block_timestamp        DateTime64(9, 'UTC') COMMENT 'Block timestamp in nanoseconds using UTC',
    transaction_id         Nullable(String) COMMENT 'Transaction hash. Sometimes our indexer is missing the transaction hash.',
    receipt_id             String COMMENT 'Receipt hash',
    action_index           Nullable(UInt16) COMMENT 'Index of the actions within the receipt. Empty for event based (where action index is unknown)',
    log_index              Nullable(UInt16) COMMENT 'Index of the log within the receipt. Empty for action based transfers.',
    transfer_index         UInt32 COMMENT 'The unique index of the transfer within the block',
    signer_id              String COMMENT 'The account ID of the transaction signer',
    predecessor_id         String COMMENT 'The account ID of the receipt predecessor',
    receipt_account_id     String COMMENT 'The account ID of where the receipt is executed',
    account_id             String COMMENT 'The account ID involved in a transfer (either sender or receiver)',
    other_account_id       Nullable(String) COMMENT 'The account ID on the other side of the transfer, or empty for mints or burns',
    asset_id               String COMMENT 'The asset ID (e.g., "near" for NEAR transfers, or the token contract account ID for fungible token transfers)',
    asset_type             LowCardinality(String) COMMENT 'The asset type: "Near" for native token transfers, "Ft" for fungible token transfers',
    amount                 Int128 COMMENT 'The amount transferred in token units (e.g. yoctoNEAR). Positive for incoming transfers, negative for outgoing transfers. The value will be capped to Int128 range.',
    method_name            Nullable(String) COMMENT 'The method name that triggered the transfer (e.g., "ft_transfer", "ft_transfer_call", etc.)',
    transfer_type          LowCardinality(String) COMMENT 'The type of transfer: NEAR native token or Fungible Token (FT)',
    human_amount           Nullable(Float64) COMMENT 'The amount transferred after applying the token decimals, if available',
    usd_amount             Nullable(Float64) COMMENT 'The USD value of the transfer at the time of the block, if available',
    start_of_block_balance Nullable(UInt128) COMMENT 'The sender account balance at the start of the block in token units',
    end_of_block_balance   Nullable(UInt128) COMMENT 'The sender account balance at the end of the block in token units',

    INDEX block_height_minmax_idx block_height TYPE minmax GRANULARITY 1,
    INDEX block_timestamp_minmax_idx block_timestamp TYPE minmax GRANULARITY 1,
    INDEX receipt_account_id_bloom_index receipt_account_id TYPE bloom_filter() GRANULARITY 1,
    INDEX asset_id_bloom_index asset_id TYPE bloom_filter() GRANULARITY 1,
    INDEX other_account_id_bloom_index other_account_id TYPE bloom_filter() GRANULARITY 1
) ENGINE = ReplacingMergeTree
      PRIMARY KEY (account_id, block_timestamp)
      ORDER BY (account_id, block_timestamp, transfer_index);

About

API server for transfers history

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages