supportedProtocols function returns a list of protocols (AMMs) that are supported by Fibrous on a specific chain.
Function Signature
/**
* Returns supported protocols.
* @param chainId Chain ID.
* @returns Mapping of AMM name -> protocol identifier.
*/
supportedProtocols(chainId: number): Promise<Record<string, ProtocolId>>;
Example Usage
import { Router as FibrousRouter } from "fibrous-router-sdk";
const router = new FibrousRouter({
apiVersion: "v2",
});
const chains = await router.refreshSupportedChains();
const chainId = chains.find(chain => chain.chain_name == "hyperevm")?.chain_id;
if (!chainId) {
throw new Error("Chain not supported");
}
const protocols = await router.supportedProtocols(chainId);
Parameters
| Parameter | Type | Description |
|---|---|---|
| chainId | number | The chain ID to get supported protocols for (e.g., 8453 for Base, 4114 for Citrea) |
Response
Returns a Promise that resolves to a Record mapping protocol names to their IDs. The response includes:type ProtocolId = {
id: number; // Protocol unique identifier
name: string; // Protocol name
logoURI?: string; // Optional protocol logo URL
};
Example Response
[
{
"protocol": 1,
"amm_name": "hyperSwapV2",
"display_name": "HyperSwap V2",
"image_url": null,
"type": "v2"
},
{
"protocol": 2,
"amm_name": "hyperSwapV2Stable",
"display_name": "HyperSwap V2 Stable",
"image_url": null,
"type": "stable"
},
{
"protocol": 3,
"amm_name": "hyperSwapV3",
"display_name": "HyperSwap V3",
"image_url": null,
"type": "v3"
},
{
"protocol": 4,
"amm_name": "kittenSwapV2",
"display_name": "KittenSwap V2",
"image_url": null,
"type": "v2"
},
{
"protocol": 5,
"amm_name": "kittenSwapV2Stable",
"display_name": "KittenSwap V2 Stable",
"image_url": null,
"type": "stable"
},
{
"protocol": 6,
"amm_name": "kittenSwapV3",
"display_name": "KittenSwap V3",
"image_url": null,
"type": "v3"
},
{
"protocol": 7,
"amm_name": "laminarV2",
"display_name": "Laminar V2",
"image_url": null,
"type": "v2"
},
{
"protocol": 8,
"amm_name": "laminarV3",
"display_name": "Laminar V3",
"image_url": null,
"type": "v3"
},
{
"protocol": 9,
"amm_name": "ramsesV3",
"display_name": "Ramses V3",
"image_url": null,
"type": "v3"
},
{
"protocol": 10,
"amm_name": "projectX",
"display_name": "Project X",
"image_url": null,
"type": "v3"
}
...
]