Skip to main content

Fetching Minimum Deposit

The getMinDeposit method retrieves the minimum deposit amount required for a given action or contract. This is useful for determining the lowest deposit users need to make.

Usage

import kohin from "./kohinInstance";

const minDeposit = await kohin.getMinDeposit();

if (minDeposit.success) {
console.log("Minimum Deposit:", minDeposit.minDeposit);
} else {
console.error("Error fetching minimum deposit:", minDeposit.error);
}

Return Value

The getMinDeposit method returns an object with the following structure:

{
success: boolean; // Indicates if the operation was successful
error?: string; // Error message if the operation failed
minDeposit?: number; // The minimum deposit value
}

Error Handling

Here's how you can handle errors while fetching the minimum deposit:

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

if (res.success) {
console.log("Minimum Deposit:", res.minDeposit);
} else {
console.error("Error fetching minimum deposit:", res.error);
}
} catch (error: any) {
console.error("Unexpected error while fetching minimum deposit:", error);
}

Example Response

Success Response:

{
"success": true,
"minDeposit": 1
}

Error Response:

{
"success": true,
"minDeposit": 1
}