MCPcopy Create free account
hub / github.com/ccxt/ccxt / withdraw

Method withdraw

ts/src/cryptocom.ts:1988–2025  ·  view source on GitHub ↗

* @method * @name cryptocom#withdraw * @description make a withdrawal * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal * @param {string} code unified currency code * @param {float} amount the amount to withdraw * @param {s

(code: string, amount: number, address: string, tag: Str = undefined, params = {})

Source from the content-addressed store, hash-verified

1986 * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
1987 */
1988 async withdraw (code: string, amount: number, address: string, tag: Str = undefined, params = {}): Promise<Transaction> {
1989 [ tag, params ] = this.handleWithdrawTagAndParams (tag, params);
1990 await this.loadMarkets ();
1991 const currency = this.safeCurrency (code); // for instance, USDC is not inferred from markets but it's still available
1992 const request: Dict = {
1993 'currency': currency['id'],
1994 'amount': amount,
1995 'address': address,
1996 };
1997 if (tag !== undefined) {
1998 request['address_tag'] = tag;
1999 }
2000 let networkCode: Str = undefined;
2001 [ networkCode, params ] = this.handleNetworkCodeAndParams (params);
2002 const networkId = this.networkCodeToId ((networkCode as string), code);
2003 if (networkId !== undefined) {
2004 request['network_id'] = networkId;
2005 }
2006 const response = await this.v1PrivatePostPrivateCreateWithdrawal (this.extend (request, params));
2007 //
2008 // {
2009 // "id":-1,
2010 // "method":"private/create-withdrawal",
2011 // "code":0,
2012 // "result": {
2013 // "id": 2220,
2014 // "amount": 1,
2015 // "fee": 0.0004,
2016 // "symbol": "BTC",
2017 // "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBf",
2018 // "client_wid": "my_withdrawal_002",
2019 // "create_time":1607063412000
2020 // }
2021 // }
2022 //
2023 const result = this.safeDict (response, 'result');
2024 return this.parseTransaction (result as Dict, currency);
2025 }
2026
2027 /**
2028 * @method

Callers

nothing calls this directly

Calls 9

parseTransactionMethod · 0.95
loadMarketsMethod · 0.45
safeCurrencyMethod · 0.45
networkCodeToIdMethod · 0.45
extendMethod · 0.45
safeDictMethod · 0.45

Tested by

no test coverage detected