Create and execute withdrawal requests. Supports both Bitcoin (multi-address) and Ethereum (single-address) networks.
Methods
create()
Create a withdrawal request.
Signature:
create(
request: CreateWithdrawRequest,
requestOptions?: RequestOptions
): Promise<WithdrawResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|
request.network | 'BTC' | 'tBTC' | 'ETH' | 'tETH' | Yes | Blockchain network |
request.from | string[] | Yes | Array of source addresses |
request.to | string | Yes | Recipient address |
request.amount | string | Yes | Amount to withdraw |
request.clientShare | string | Yes | Client share for signing |
Example - Bitcoin (Multi-address):
const withdrawal = await client.withdrawals.create({
network: 'BTC',
from: [
'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
],
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
amount: '0.001',
clientShare: 'your-client-share'
});
console.log('Withdrawal ID:', withdrawal.data.id);
console.log('Status:', withdrawal.data.status);
Example - Ethereum (Single-address):
const withdrawal = await client.withdrawals.create({
network: 'ETH',
from: [
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
],
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '0.1',
clientShare: 'your-client-share'
});
console.log('Transaction Hash:', withdrawal.data.hash);
Network Differences: Bitcoin supports multi-address withdrawals (withdraw from multiple addresses in one transaction), while Ethereum only supports single-address withdrawals.