NYYU Logo
APIWithdraw

Confirm Crypto Withdrawal Request

Admin approval or denial of cryptocurrency withdrawal requests with 2FA

Confirm Crypto Withdrawal Request

Approve or deny cryptocurrency withdrawal requests with 2FA verification

ADMIN Only

Overview

The confirmCryptoWithdraw mutation allows administrators to approve or deny cryptocurrency withdrawal requests. This operation requires 2FA SMS verification for security.

Admin-Only Operation

This mutation is accessible only to users with ADMIN privileges and requires a valid 2FA SMS code.

GraphQL Schema

Mutation Schema
Approve or deny crypto withdrawal
confirmCryptoWithdraw(
  id: Int!,
  status: Int!,
  deniedReason: String,
  code: String!
): Int

Parameters

📋
Parameters
idInt! Required

The unique ID of the cryptocurrency withdrawal request to confirm

statusInt! Required

Action to take on the withdrawal request

1: Approve withdrawal

2: Deny withdrawal

deniedReasonString Optional

Reason for denial (required if status is 2)

Examples: "Insufficient verification", "Suspicious activity", "Invalid wallet address"

codeString! Required

Admin 2FA verification code received via SMS from sendWithdrawConfirmCode

Return Value

📊
Integer Response
Updated status value
Return Type: Int

Returns an integer indicating the updated status of the withdrawal request (1 for approved, 2 for denied).

Example Mutations

Approve Crypto Withdrawal
mutation {
  confirmCryptoWithdraw(
    id: 123,
    status: 1,
    code: "654321"
  )
}
Response
{
  "data": {
    "confirmCryptoWithdraw": 1
  }
}
Deny Crypto Withdrawal with Reason
mutation {
  confirmCryptoWithdraw(
    id: 124,
    status: 2,
    deniedReason: "Wallet address does not match verification records",
    code: "654321"
  )
}
Response
{
  "data": {
    "confirmCryptoWithdraw": 2
  }
}

Implementation Example

async function reviewCryptoWithdrawal(
  requestId: number,
  approve: boolean,
  denialReason?: string
) {
  try {
    // Step 1: Request 2FA code
    const codeRequest = await client.request(gql`
      mutation {
        sendWithdrawConfirmCode
      }
    `);

    if (!codeRequest.sendWithdrawConfirmCode) {
      throw new Error('Failed to send 2FA code');
    }

    console.log('✅ 2FA code sent to admin phone');

    // Step 2: Get 2FA code from admin
    const twoFactorCode = await promptAdminFor2FACode();

    // Step 3: Confirm withdrawal
    const result = await client.request(gql`
      mutation ConfirmCrypto(
        $id: Int!,
        $status: Int!,
        $deniedReason: String,
        $code: String!
      ) {
        confirmCryptoWithdraw(
          id: $id,
          status: $status,
          deniedReason: $deniedReason,
          code: $code
        )
      }
    `, {
      id: requestId,
      status: approve ? 1 : 2,
      deniedReason: approve ? null : denialReason,
      code: twoFactorCode
    });

    if (approve) {
      console.log('✅ Crypto withdrawal approved');
      // Trigger blockchain transaction
      await processBlockchainWithdrawal(requestId);
    } else {
      console.log('❌ Crypto withdrawal denied');
    }

    return result.confirmCryptoWithdraw;

  } catch (error) {
    console.error('Withdrawal confirmation failed:', error);
    throw error;
  }
}

Admin Workflow

Complete Admin Review Process
1
Review Withdrawal Request
Check withdrawal details, user verification status, and wallet address validity
2
Request 2FA Code
Call sendWithdrawConfirmCode to receive SMS verification
3
Make Decision
Approve (status: 1) or deny (status: 2) with reason if denying
4
Confirm with 2FA
Submit decision with 2FA code using confirmCryptoWithdraw
5
Process Blockchain Transaction
If approved, initiate blockchain transfer to user's destination wallet

Security Features

🔒Security Measures
📱
2FA SMS Required

All approvals/denials require valid 2FA SMS verification code

👨‍💼
Admin-Only Access

Only users with ADMIN role can confirm withdrawal requests

📝
Mandatory Denial Reason

When denying, must provide clear reason for user transparency

📊
Audit Trail

All approvals/denials logged with timestamp and admin identity

Best Practices

Verify Wallet Address Format

Check that destination wallet address is valid for the specified network

Check User Verification Status

Ensure user has completed required KYC/verification for withdrawal amount

Provide Clear Denial Reasons

When denying, give specific actionable reasons so users can resolve issues

Process Promptly

Review and process withdrawal requests quickly to maintain good user experience

🔐
Critical Security Operation
Always verify wallet addresses and user details before approving crypto withdrawals - blockchain transactions are irreversible!