History REST Endpoints

Query transaction history for AMM operations including swaps, mints, burns, and wraps.

get-pool-swap-history

Get swap transaction history for a specific pool.

Endpoint: POST /get-pool-swap-history

Parameters:

  • poolId (object) - Pool ID with block and tx fields
  • count (number, optional) - Limit results (default: 50)
  • offset (number, optional) - Pagination offset
POST /v4/api/get-pool-swap-history
Get swap history for a specific pool.
Click "Run" to execute the request...

get-token-swap-history

Get swap history for a specific token across all pools.

Endpoint: POST /get-token-swap-history

Parameters:

  • alkaneId (object) - Token ID with block and tx fields
  • count (number, optional) - Limit results (default: 50)
POST /v4/api/get-token-swap-history
Get all swaps involving a specific token.
Click "Run" to execute the request...

get-pool-mint-history

Get liquidity add (mint) history for a pool.

Endpoint: POST /get-pool-mint-history

Parameters:

  • poolId (object) - Pool ID with block and tx fields
  • count (number, optional) - Limit results
POST /v4/api/get-pool-mint-history
Get mint (add liquidity) history for a pool.
Click "Run" to execute the request...

get-pool-burn-history

Get liquidity remove (burn) history for a pool.

Endpoint: POST /get-pool-burn-history

Parameters:

  • poolId (object) - Pool ID with block and tx fields
  • count (number, optional) - Limit results
POST /v4/api/get-pool-burn-history
Get burn (remove liquidity) history for a pool.
Click "Run" to execute the request...

get-pool-creation-history

Get pool creation history.

Endpoint: POST /get-pool-creation-history

Parameters:

  • factoryId (object) - Factory ID with block and tx fields
  • count (number, optional) - Limit results
POST /v4/api/get-pool-creation-history
Get history of pool creations.
Click "Run" to execute the request...

get-all-wrap-history

Get all BTC wrap transactions.

Endpoint: POST /get-all-wrap-history

Parameters:

  • count (number, optional) - Limit results
POST /v4/api/get-all-wrap-history
Get all wrap (BTC to wrapped BTC) transactions.
Click "Run" to execute the request...

get-all-unwrap-history

Get all BTC unwrap transactions.

Endpoint: POST /get-all-unwrap-history

Parameters:

  • count (number, optional) - Limit results
POST /v4/api/get-all-unwrap-history
Get all unwrap (wrapped BTC to BTC) transactions.
Click "Run" to execute the request...

get-address-wrap-history

Get wrap history for a specific address.

Endpoint: POST /get-address-wrap-history

Parameters:

  • address (string) - Bitcoin address
  • count (number, optional) - Limit results
POST /v4/api/get-address-wrap-history
Get wrap history for a specific address.
Click "Run" to execute the request...

get-total-unwrap-amount

Get the total amount of BTC that has been unwrapped.

Endpoint: POST /get-total-unwrap-amount

POST /v4/api/get-total-unwrap-amount
Get the total unwrapped BTC amount.
Click "Run" to execute the request...

get-all-amm-tx-history

Get all AMM transactions (swaps, mints, burns, etc.).

Endpoint: POST /get-all-amm-tx-history

Parameters:

  • count (number, optional) - Limit results
  • transactionType (string, optional) - Filter by type: swap, mint, burn, creation, wrap, unwrap
POST /v4/api/get-all-amm-tx-history
Get all AMM transactions across the platform.
Click "Run" to execute the request...

get-all-address-amm-tx-history

Get all AMM transactions for a specific address.

Endpoint: POST /get-all-address-amm-tx-history

Parameters:

  • address (string) - Bitcoin address
  • count (number, optional) - Limit results
  • transactionType (string, optional) - Filter by type
POST /v4/api/get-all-address-amm-tx-history
Get all AMM transactions for a specific address.
Click "Run" to execute the request...

JavaScript Example

class HistoryClient {
  constructor(apiKey, network = 'mainnet') {
    this.baseUrl = `https://${network}.subfrost.io/v4/api`;
    this.apiKey = apiKey;
  }

  async post(endpoint, body) {
    const response = await fetch(`${this.baseUrl}${endpoint}`, {
      method: 'POST',
      headers: { 
        'Content-Type': 'application/json',
        'x-subfrost-api-key': this.apiKey
      },
      body: JSON.stringify(body)
    });
    return (await response.json()).data;
  }

  async getPoolSwaps(poolBlock, poolTx, limit = 50) {
    return this.post('/get-pool-swap-history', { 
      poolId: { block: String(poolBlock), tx: String(poolTx) },
      count: limit
    });
  }

  async getAddressHistory(address, limit = 100) {
    return this.post('/get-all-address-amm-tx-history', { 
      address, 
      count: limit 
    });
  }

  async getTotalUnwrapped() {
    return this.post('/get-total-unwrap-amount', {});
  }
}

// Usage
const history = new HistoryClient('your-api-key');

const { swaps } = await history.getPoolSwaps(4, 1, 20);
console.log(`Last 20 swaps:`, swaps);

const { transactions } = await history.getAddressHistory('bc1p...', 100);
console.log(`User transactions:`, transactions);