Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
feat: Ability to add network fee on top of withdrawal (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
akwodkiewicz committed Oct 12, 2020
1 parent 193ce2e commit bdfd30a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/withdraw/WithdrawAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface CryptoWithdrawal {
}

interface CryptoWithdrawalRequest {
add_network_fee_to_total?: boolean;
amount: number;
crypto_address: string;
currency: string;
Expand All @@ -30,16 +31,24 @@ export class WithdrawAPI {
* @param currency - The type of currency
* @param cryptoAddress - A crypto address of the recipient
* @param destinationTag - A destination tag for currencies that support one
* @param addNetworkFeeToTotal - A boolean flag to add the network fee on top of the amount.
* If this is blank, it will default to deducting the network fee from the amount.
* @see https://docs.pro.coinbase.com/#crypto
*/
async postCryptoWithdrawal(
amount: number,
currency: string,
cryptoAddress: string,
destinationTag?: string
destinationTag?: string,
addNetworkFeeToTotal?: boolean
): Promise<CryptoWithdrawal> {
const resource = WithdrawAPI.URL.WITHDRAWALS.CRYPTO;
const withdrawal: CryptoWithdrawalRequest = {amount, crypto_address: cryptoAddress, currency};
const withdrawal: CryptoWithdrawalRequest = {
add_network_fee_to_total: addNetworkFeeToTotal,
amount,
crypto_address: cryptoAddress,
currency,
};
if (destinationTag) {
withdrawal.destination_tag = destinationTag;
} else {
Expand Down

0 comments on commit bdfd30a

Please sign in to comment.