Crypto Withdrawal Request
Withdraw cryptocurrency to external wallet addresses with secure verification
Crypto Withdrawal Request
Withdraw cryptocurrency assets to external wallet addresses via blockchain networks
USER Operation
Overview
The cryptoWithdrawRequest mutation allows users to request cryptocurrency withdrawals from their NYYU wallets to external blockchain addresses. This sends a withdrawal request to admins for processing and verification.
Admin Approval Required
This mutation creates a withdrawal request that must be approved by an administrator. It does not immediately transfer funds.
GraphQL Schema
cryptoWithdrawRequest(
  amount: Float!,
  sourceToken: String!,
  network: String!,
  des: String!,
  code: String!
): CryptoWithdrawParameters
amountFloat!The amount of cryptocurrency to withdraw from your wallet
sourceTokenString!The cryptocurrency type to withdraw
Examples: "BTC", "ETH", "USDT", "BNB", "NYYU"
networkString!The blockchain network for the transaction
Examples: "ERC20", "BEP20", "TRC20", "Polygon", "Bitcoin"
desString!Destination wallet address to receive the funds
Example: "0x1234567890abcdef1234567890abcdef12345678"
codeString!Email verification code from generateWithdraw mutation
Example: "123456"
Return Value
type CryptoWithdraw {
  id: Int!
  userId: Int!
  amount: Float!
  sourceToken: String!
  network: String!
  des: String!
  status: Int!
  createdAt: Float
  updatedAt: Float
  deniedReason: String
}id - Unique request IDuserId - Requesting user IDamount - Withdrawal amountsourceToken - Crypto typestatus - 0: Pending, 1: Approved, 2: DeniedcreatedAt - Request timestampupdatedAt - Last updatedeniedReason - Reason if deniedExample Mutation
mutation {
  cryptoWithdrawRequest(
    amount: 1.5,
    sourceToken: "BTC",
    network: "Bitcoin",
    des: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    code: "123456"
  ) {
    id
    userId
    amount
    sourceToken
    network
    des
    status
    createdAt
    updatedAt
  }
}{
  "data": {
    "cryptoWithdrawRequest": {
      "id": 12345,
      "userId": 789,
      "amount": 1.5,
      "sourceToken": "BTC",
      "network": "Bitcoin",
      "des": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
      "status": 0,
      "createdAt": 1699564800000,
      "updatedAt": 1699564800000
    }
  }
}Additional Examples
mutation {
  cryptoWithdrawRequest(
    amount: 500.0,
    sourceToken: "USDT",
    network: "ERC20",
    des: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    code: "789012"
  ) {
    id
    status
    amount
    sourceToken
    network
  }
}mutation {
  cryptoWithdrawRequest(
    amount: 10.0,
    sourceToken: "BNB",
    network: "BEP20",
    des: "0x8894E0a0c962CB723c1976a4421c95949bE2D4E3",
    code: "345678"
  ) {
    id
    status
    createdAt
  }
}Implementation Example
import { gql } from 'graphql-request';
async function withdrawCrypto(
  amount: number,
  sourceToken: string,
  network: string,
  destinationAddress: string
) {
  try {
    // Step 1: Generate verification code
    const codeResult = await client.request(gql`
      mutation {
        generateWithdraw
      }
    `);
    if (codeResult.generateWithdraw !== 'Success') {
      throw new Error('Failed to generate verification code');
    }
    // Step 2: Get code from user input
    const verificationCode = await promptUserForCode();
    // Step 3: Submit withdrawal request
    const withdrawal = await client.request(gql`
      mutation WithdrawCrypto(
        $amount: Float!,
        $sourceToken: String!,
        $network: String!,
        $des: String!,
        $code: String!
      ) {
        cryptoWithdrawRequest(
          amount: $amount,
          sourceToken: $sourceToken,
          network: $network,
          des: $des,
          code: $code
        ) {
          id
          amount
          sourceToken
          network
          des
          status
          createdAt
        }
      }
    `, {
      amount,
      sourceToken,
      network,
      des: destinationAddress,
      code: verificationCode
    });
    console.log('✅ Withdrawal request submitted:', withdrawal.cryptoWithdrawRequest.id);
    console.log('Status: Pending admin approval');
    return withdrawal.cryptoWithdrawRequest;
  } catch (error) {
    console.error('❌ Withdrawal failed:', error);
    throw error;
  }
}
// Usage
withdrawCrypto(1.5, 'BTC', 'Bitcoin', 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh');Network & Token Compatibility
Security Features
Must provide valid verification code from generateWithdraw
All withdrawals manually reviewed and approved by administrators with 2FA
Destination addresses validated for correct format and network compatibility
System verifies sufficient wallet balance before creating withdrawal request
Best Practices
Always verify the destination wallet address is correct. Crypto transactions are irreversible!
Ensure the network parameter matches the token type (e.g., USDT on ERC20 vs TRC20)
Check wallet balance before requesting withdrawal to avoid failed requests
Consider blockchain network fees which may be deducted from withdrawal amount
For new addresses, consider testing with a small amount before large withdrawals
Related Operations
Generate Withdraw Code
Generate verification code required for withdrawal
Confirm Crypto Withdrawal
Admin operation to approve/deny withdrawal (ADMIN)
Change Show Status
Hide or show withdrawal in transaction history
Withdrawal Overview
Complete withdrawal API documentation