Skip to main content

Fetching Withdrawal Timing

The getWithdrawAfter method retrieves the timing information for when a withdrawal can be made after a specific deposit. This allows you to know the earliest time when funds can be withdrawn.

Usage

import kohin from "./kohinInstance";

const withdrawalTiming = await kohin.getWithdrawAfter({ depositId: 12345 });

if (withdrawalTiming.success) {
console.log("Withdrawal Timing:", withdrawalTiming.withdrawAfter);
} else {
console.error("Error fetching withdrawal timing:", withdrawalTiming.error);
}

Return Value

The getWithdrawAfter method returns an object with the following structure:

{
success: boolean; // Indicates if the operation was successful
error?: string; // Error message if the operation failed
withdrawAfter?: string; // The time after which withdrawal is allowed
}

Error Handling

Here's how you can handle errors while fetching the withdrawal timing:

try {
const res = await kohin.getWithdrawAfter({ depositId: 12345 });

if (res.success) {
console.log("Withdrawal Timing:", res.withdrawAfter);
} else {
console.error("Error fetching withdrawal timing:", res.error);
}
} catch (error: any) {
console.error("Unexpected error while fetching withdrawal timing:", error);
}

Example Response

Success Response:

{
"success": true,
"withdrawAfter": "2025-01-15T12:00:00Z"
}

Error Response:

{
"success": false,
"error": "Unable to fetch withdrawal timing."
}