Skip to content

Interest Protocol Pools

Fetch pools for versions 0 to 126000.

Code

Rust
use futures::StreamExt;
use std::{collections::HashSet, sync::Arc};
use pangea_client::{
    core::types::ChainId, query::Bound,
    ClientBuilder, Format, WsProvider,
    provider::MoveProvider, requests::interest::GetPoolsRequest, 
};
 
#[tokio::main]
async fn main() {
    dotenvy::dotenv_override().ok();
 
    let client = match ClientBuilder::default()
        .endpoint("movement.app.pangea.foundation")
        .build::<WsProvider>()
        .await
    {
        Ok(client) => Arc::new(client),
        Err(e) => {
            eprintln!("Client failed to initialize:\n{e}");
            return;
        }
    };
 
    {
        let request = GetPoolsRequest { 
            chains: HashSet::from([ChainId::MOVEMENT]), 
            from_block: Bound::Exact(0), 
            to_block: Bound::Exact(126000), 
            ..Default::default() 
        }; 
        let stream = match client 
            .get_move_interest_v1_pools_by_format(request, Format::JsonStream, false) 
            .await
        {
            Ok(stream) => stream,
            Err(e) => {
                eprintln!("Request failed\n{e}");
                return;
            }
        };
 
        futures::pin_mut!(stream);
 
        while let Some(chunk) = stream.next().await {
            let chunk = String::from_utf8(chunk.unwrap()).unwrap();
            println!("{chunk}");
        }
    }
}

Response

{
  {
    "block_number": 125509,
    "transaction_hash": "0x75b098c3cb55a24ccc11768d0bb546ec56bcb006d5e9fd1ec4f86603569ca141",
    "log_index": 5,
    "address": "0x13418bb00810eca160f77aa03e134d6d62b0859653f9236ccc6293acf1a6513d",
    "timestamp": 1741595395062842,
    "pool_address": "0x34f0d9084319bbee03059449b1ee52d47512781052dabba55a9acf766bae3599",
    "token0_address": "0x000000000000000000000000000000000000000000000000000000000000000a",
    "token0_decimals": 8,
    "token0_name": "Move Coin",
    "token0_symbol": "MOVE",
    "token1_address": "0x3e4b7a9dda4dfe0807fc52999cb4823a00af352eed9fdf6bb5377306a6089c05",
    "token1_decimals": 8,
    "token1_name": "Galactic Movement",
    "token1_symbol": "GM"
  }
}

Query parameters

  • chains: Filters the data by chain.
  • from_block: Filters the data by a starting version. As Move chains use a per-transaction versioned database, we use version interchangably with block_number and omit blocks altogether.
  • to_block: Filters the data by an ending version. As Move chains use a per-transaction versioned database, we use version interchangably with block_number and omit blocks altogether.
  • pool_address__in: Filters the data by a list of pool_address.
  • token0_address__in: Filters the data by a list of token0_address.
  • token1_address__in: Filters the data by a list of token1_address.
  • tokens_address__in: Filters the data by a list of both token0_address and token1_address.