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 withblockandtxfieldscount(number, optional) - Limit results (default: 50)offset(number, optional) - Pagination offset
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 withblockandtxfieldscount(number, optional) - Limit results (default: 50)
get-pool-mint-history
Get liquidity add (mint) history for a pool.
Endpoint: POST /get-pool-mint-history
Parameters:
poolId(object) - Pool ID withblockandtxfieldscount(number, optional) - Limit results
get-pool-burn-history
Get liquidity remove (burn) history for a pool.
Endpoint: POST /get-pool-burn-history
Parameters:
poolId(object) - Pool ID withblockandtxfieldscount(number, optional) - Limit results
get-pool-creation-history
Get pool creation history.
Endpoint: POST /get-pool-creation-history
Parameters:
factoryId(object) - Factory ID withblockandtxfieldscount(number, optional) - Limit results
get-all-wrap-history
Get all BTC wrap transactions.
Endpoint: POST /get-all-wrap-history
Parameters:
count(number, optional) - Limit results
get-all-unwrap-history
Get all BTC unwrap transactions.
Endpoint: POST /get-all-unwrap-history
Parameters:
count(number, optional) - Limit results
get-address-wrap-history
Get wrap history for a specific address.
Endpoint: POST /get-address-wrap-history
Parameters:
address(string) - Bitcoin addresscount(number, optional) - Limit results
get-total-unwrap-amount
Get the total amount of BTC that has been unwrapped.
Endpoint: POST /get-total-unwrap-amount
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 resultstransactionType(string, optional) - Filter by type: swap, mint, burn, creation, wrap, unwrap
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 addresscount(number, optional) - Limit resultstransactionType(string, optional) - Filter by type
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);