Skip to content

Commit

Permalink
Merge pull request #11930 from phips28/patch-24
Browse files Browse the repository at this point in the history
Gate.io: fix GateCode redemption
  • Loading branch information
kroitor committed Feb 11, 2022
2 parents f932cb7 + 8e6b9d2 commit 2de2b32
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions js/gateio.js
Expand Up @@ -2108,7 +2108,6 @@ module.exports = class gateio extends Exchange {

parseTransactionType (type) {
const types = {
'b': 'deposit', // GateCode redemption
'd': 'deposit',
'w': 'withdrawal',
};
Expand All @@ -2133,12 +2132,16 @@ module.exports = class gateio extends Exchange {
// withdrawals
const id = this.safeString (transaction, 'id');
let type = undefined;
if (id !== undefined) {
let amount = this.safeString (transaction, 'amount');
if (id[0] === 'b') {
// GateCode handling
type = Precise.stringGt (amount, '0') ? 'deposit' : 'withdrawal';
amount = Precise.stringAbs (amount);
} else if (id !== undefined) {
type = this.parseTransactionType (id[0]);
}
const currencyId = this.safeString (transaction, 'currency');
const code = this.safeCurrencyCode (currencyId);
const amount = this.safeNumber (transaction, 'amount');
const txid = this.safeString (transaction, 'txid');
const rawStatus = this.safeString (transaction, 'status');
const status = this.parseTransactionStatus (rawStatus);
Expand All @@ -2154,7 +2157,7 @@ module.exports = class gateio extends Exchange {
'id': id,
'txid': txid,
'currency': code,
'amount': amount,
'amount': this.parseNumber (amount),
'network': undefined,
'address': address,
'addressTo': undefined,
Expand Down

0 comments on commit 2de2b32

Please sign in to comment.