Skip to main content

Fetching Maximum Pool Capacity

The getMaxPoolCap method retrieves the maximum capacity of the pool, i.e., the upper limit on the amount of funds that can be held in the pool.

Usage

import kohin from "./kohinInstance";

const maxPoolCap = await kohin.getMaxPoolCap();

if (maxPoolCap.success) {
console.log("Max Pool Capacity:", maxPoolCap.maxPoolCap);
} else {
console.error("Error fetching max pool capacity:", maxPoolCap.error);
}

Return Value

The getMaxPoolCap method returns an object with the following structure:

{
success: boolean; // Indicates if the operation was successful
error?: string; // Error message if the operation failed
maxPoolCap?: number; // The maximum pool capacity value
}

Error Handling

Here's how you can handle errors while fetching the maximum pool capacity:

try {
const res = await kohin.getMaxPoolCap();

if (res.success) {
console.log("Max Pool Capacity:", res.maxPoolCap);
} else {
console.error("Error fetching max pool capacity:", res.error);
}
} catch (error: any) {
console.error("Unexpected error while fetching max pool capacity:", error);
}

Example Response

Success Response:

{
"success": true,
"maxPoolCap": 100000
}

Error Response:

{
"success": false,
"error": "Unable to fetch max pool capacity."
}