Pools & AMM REST Endpoints
Query and interact with alkanes AMM liquidity pools.
get-pools
List all liquidity pools for a factory.
Endpoint: POST /get-pools
Parameters:
factoryId(object) - Factory ID withblockandtxfields
POST /v4/api/get-pools
List all pools for the specified factory.
Click "Run" to execute the request...
get-all-pools-details
Get detailed information for all pools.
Endpoint: POST /get-all-pools-details
Parameters:
factoryId(object) - Factory ID withblockandtxfields
POST /v4/api/get-all-pools-details
Get details for all pools including reserves and token info.
Click "Run" to execute the request...
get-pool-details
Get detailed information about a specific pool.
Endpoint: POST /get-pool-details
Parameters:
factoryId(object) - Factory ID withblockandtxfieldspoolId(object) - Pool ID withblockandtxfields
POST /v4/api/get-pool-details
Get details for a specific pool.
Click "Run" to execute the request...
get-all-token-pairs
Get all available token pairs.
Endpoint: POST /get-all-token-pairs
Parameters:
factoryId(object) - Factory ID withblockandtxfields
POST /v4/api/get-all-token-pairs
Get all token pairs available in the factory.
Click "Run" to execute the request...
get-token-pairs
Get pairs containing a specific token.
Endpoint: POST /get-token-pairs
Parameters:
factoryId(object) - Factory ID withblockandtxfieldsalkaneId(object) - Token ID withblockandtxfields
POST /v4/api/get-token-pairs
Get all pairs that include the specified token.
Click "Run" to execute the request...
address-positions
Get liquidity positions for an address.
Endpoint: POST /address-positions
Parameters:
factoryId(object) - Factory ID withblockandtxfieldsaddress(string) - Bitcoin address
POST /v4/api/address-positions
Get all liquidity positions for an address.
Click "Run" to execute the request...
JavaScript Example
class AMMClient {
constructor(apiKey, network = 'mainnet') {
this.baseUrl = `https://${network}.subfrost.io/v4/api`;
this.apiKey = apiKey;
this.factoryId = { block: "4", tx: "65522" };
}
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 getAllPools() {
return this.post('/get-all-pools-details', {
factoryId: this.factoryId
});
}
async getPoolDetails(poolBlock, poolTx) {
return this.post('/get-pool-details', {
factoryId: this.factoryId,
poolId: { block: String(poolBlock), tx: String(poolTx) }
});
}
async getPositions(address) {
return this.post('/address-positions', {
factoryId: this.factoryId,
address
});
}
}
// Usage
const amm = new AMMClient('your-api-key');
const { pools } = await amm.getAllPools();
console.log(`Found ${pools.length} pools`);
const positions = await amm.getPositions('bc1p...');
console.log('LP positions:', positions);