Skip to content

Commit

Permalink
Merge pull request ccxt#17928 from sc0Vu/bitget-use-withdraw-v2
Browse files Browse the repository at this point in the history
bitget: update transfer / withdraw to v2 api
  • Loading branch information
kroitor authored May 16, 2023
2 parents e880b59 + b267b4e commit a415951
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ts/src/bitget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ export default class bitget extends Exchange {
* @method
* @name bitget#withdraw
* @description make a withdrawal
* @see https://bitgetlimited.github.io/apidoc/en/spot/#withdraw-v2
* @param {string} code unified currency code
* @param {float} amount the amount to withdraw
* @param {string} address the address to withdraw to
Expand All @@ -1395,22 +1396,24 @@ export default class bitget extends Exchange {
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
*/
this.checkAddress (address);
const chain = this.safeString (params, 'chain');
const chain = this.safeString2 (params, 'chain', 'network');
params = this.omit (params, [ 'network' ]);
if (chain === undefined) {
throw new ArgumentsRequired (this.id + ' withdraw() requires a chain parameter');
}
await this.loadMarkets ();
const currency = this.currency (code);
const networkId = this.networkCodeToId (chain);
const request = {
'coin': currency['code'],
'address': address,
'chain': chain,
'chain': networkId,
'amount': amount,
};
if (tag !== undefined) {
request['tag'] = tag;
}
const response = await this.privateSpotPostWalletWithdrawal (this.extend (request, params));
const response = await this.privateSpotPostWalletWithdrawalV2 (this.extend (request, params));
//
// {
// "code": "00000",
Expand Down Expand Up @@ -4259,7 +4262,7 @@ export default class bitget extends Exchange {
/**
* @method
* @name bitget#transfer
* @see https://bitgetlimited.github.io/apidoc/en/spot/#transfer
* @see https://bitgetlimited.github.io/apidoc/en/spot/#transfer-v2
* @description transfer currency internally between wallets on the same account
* @param {string} code unified currency code
* @param {float} amount amount to transfer
Expand Down Expand Up @@ -4287,7 +4290,7 @@ export default class bitget extends Exchange {
'amount': amount,
'coin': currency['info']['coinName'],
};
const response = await this.privateSpotPostWalletTransfer (this.extend (request, params));
const response = await this.privateSpotPostWalletTransferV2 (this.extend (request, params));
//
// {
// "code": "00000",
Expand Down

0 comments on commit a415951

Please sign in to comment.