NYYU Logo
APIWithdraw

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

Mutation Schema
Submit crypto withdrawal request
cryptoWithdrawRequest(
  amount: Float!,
  sourceToken: String!,
  network: String!,
  des: String!,
  code: String!
): CryptoWithdraw

Parameters

📋
Required Parameters
All fields are mandatory
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

CryptoWithdraw Object
Withdrawal request details
type CryptoWithdraw {
  id: Int!
  userId: Int!
  amount: Float!
  sourceToken: String!
  network: String!
  des: String!
  status: Int!
  createdAt: Float
  updatedAt: Float
  deniedReason: String
}
Transaction Info
id - Unique request ID
userId - Requesting user ID
amount - Withdrawal amount
sourceToken - Crypto type
Status Tracking
status - 0: Pending, 1: Approved, 2: Denied
createdAt - Request timestamp
updatedAt - Last update
deniedReason - Reason if denied

Example Mutation

💻Withdraw 1.5 BTC to External Wallet
mutation {
  cryptoWithdrawRequest(
    amount: 1.5,
    sourceToken: "BTC",
    network: "Bitcoin",
    des: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    code: "123456"
  ) {
    id
    userId
    amount
    sourceToken
    network
    des
    status
    createdAt
    updatedAt
  }
}
Example Response
{
  "data": {
    "cryptoWithdrawRequest": {
      "id": 12345,
      "userId": 789,
      "amount": 1.5,
      "sourceToken": "BTC",
      "network": "Bitcoin",
      "des": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
      "status": 0,
      "createdAt": 1699564800000,
      "updatedAt": 1699564800000
    }
  }
}

Additional Examples

🔷Withdraw USDT on ERC20 Network
mutation {
  cryptoWithdrawRequest(
    amount: 500.0,
    sourceToken: "USDT",
    network: "ERC20",
    des: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    code: "789012"
  ) {
    id
    status
    amount
    sourceToken
    network
  }
}
🟡Withdraw BNB on BEP20 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

Common Network-Token Pairs
Ethereum Network (ERC20)
• ETH (Ether)
• USDT (Tether)
• USDC (USD Coin)
• NYYU (Platform Token)
• DAI, LINK, UNI, etc.
Binance Smart Chain (BEP20)
• BNB (Binance Coin)
• BUSD (Binance USD)
• USDT (Tether BEP20)
• CAKE (PancakeSwap)
Bitcoin Network
• BTC (Bitcoin)
Native Bitcoin blockchain
TRON Network (TRC20)
• TRX (Tron)
• USDT (Tether TRC20)
• BTT, JST, etc.

Security Features

🔒Security Measures
📧
Email Verification Required

Must provide valid verification code from generateWithdraw

👨‍💼
Admin Approval Process

All withdrawals manually reviewed and approved by administrators with 2FA

🔍
Address Validation

Destination addresses validated for correct format and network compatibility

💰
Balance Verification

System verifies sufficient wallet balance before creating withdrawal request

Best Practices

Double-Check Destination Address

Always verify the destination wallet address is correct. Crypto transactions are irreversible!

Match Network to Token

Ensure the network parameter matches the token type (e.g., USDT on ERC20 vs TRC20)

Verify Sufficient Balance

Check wallet balance before requesting withdrawal to avoid failed requests

Account for Network Fees

Consider blockchain network fees which may be deducted from withdrawal amount

⚠️
Test with Small Amounts First

For new addresses, consider testing with a small amount before large withdrawals

⚠️
Important Reminder
Always double-check wallet addresses and networks. Cryptocurrency transactions are irreversible once processed!