import axios from 'axios';
import crypto from "crypto"
const apiKey = 'b20c...b54a';
const merchantCode = 'e3aa...ba9a';
const secreteKey = 'c81a...44ed';
const amount = '100'
const token = 'USDT';
const walletAddress = '0xFB0F...2cAc';
const timestamp = Date.now();
const signature = crypto.createHmac("sha256",secreteKey).update(`${apiKey}${merchantCode}${timestamp}${amount}${token}${walletAddress}`).digest("hex");
const response = await axios.post('https://chainhub-devapi.bitycle.com/v1/webservice/withdraw',{
amount: amount,
description:"Widthraw fund from account description",
token: token,
walletAddress: walletAddress,
chain:"Amoy",
},{
headers:{
'x-api-key': apiKey,
'x-timestamp': timestamp,
'x-signature': signature
}
});
console.log("response: " ,response);
import requests
import hmac
import hashlib
import time
# API credentials
merchant_code = 'e3aa...ba9a'
api_key = 'b20c...b54a'
secret_key = 'c81a...44ed'
# Request parameters
amount = '200'
token = 'USDT'
wallet_address = '0xFB0F...2cAc'
timestamp = str(int(time.time() * 1000)) # Convert current time to milliseconds
# Creating the signature
message = f"{api_key}{merchant_code}{timestamp}{amount}{token}{wallet_address}"
signature = hmac.new(secret_key.encode(), message.encode(), hashlib.sha256).hexdigest()
# Sending the POST request
response = requests.post('https://chainhub-devapi.bitycle.com/v1/webservice/withdraw', json={
'amount': amount,
'description': "Withdraw fund from account description",
'token': token,
'walletAddress': wallet_address,
'chain': "BSC",
}, headers={
'x-api-key': api_key,
'x-timestamp': timestamp,
'x-signature': signature
})
# Output the response
print("Response: ", response.json())curl --location --request POST 'https://chainhub.bitycle.com/v1/webservice/withdraw' \
--header 'x-api-key: apiKey' \
--header 'x-timestamp: timestamp' \
--header 'x-signature: signature' \
--header 'Content-Type: application/json' \
--data-raw '{
amount: "100",
description: "Widthraw fund user 1302.",
token: "USDT",
walletAddress: "0x0ad32...45a6",
chain: "BSC"
}'{
message: "Withdraw request registered successfully",
data: {
withdrawId: 20
}
}