Skip to content

Commit

Permalink
Gate.io: fix GateCode redemption
Browse files Browse the repository at this point in the history
GateCode redemption can be a deposit or a withdrawal.
  • Loading branch information
phips28 committed Feb 11, 2022
1 parent f932cb7 commit fbe6d9c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 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 @@ -2131,14 +2130,21 @@ module.exports = class gateio extends Exchange {
// }
//
// withdrawals
const amount = this.safeNumber (transaction, 'amount');
const id = this.safeString (transaction, 'id');
let type = undefined;
if (id !== undefined) {
if (id[0] === 'b') {
// GateCode redemption
if (amount > 0) {
type = 'deposit'
} else {
type = 'withdrawal'
}
} 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 Down

0 comments on commit fbe6d9c

Please sign in to comment.