Skip to content

Commit

Permalink
Merge pull request #16129 from samgermain/bitfinex-parse-transaction
Browse files Browse the repository at this point in the history
bitfinex parseTransaction unification
  • Loading branch information
kroitor committed Dec 20, 2022
2 parents ca95b08 + 92b6b7a commit 7290565
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions js/bitfinex.js
Expand Up @@ -1496,34 +1496,31 @@ module.exports = class bitfinex extends Exchange {
// }
//
const timestamp = this.safeTimestamp (transaction, 'timestamp_created');
const updated = this.safeTimestamp (transaction, 'timestamp');
const currencyId = this.safeString (transaction, 'currency');
const code = this.safeCurrencyCode (currencyId, currency);
const type = this.safeStringLower (transaction, 'type'); // DEPOSIT or WITHDRAWAL
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
let feeCost = this.safeString (transaction, 'fee');
if (feeCost !== undefined) {
feeCost = Precise.stringAbs (feeCost);
}
const tag = this.safeString (transaction, 'description');
return {
'info': transaction,
'id': this.safeString2 (transaction, 'id', 'withdrawal_id'),
'txid': this.safeString (transaction, 'txid'),
'type': this.safeStringLower (transaction, 'type'), // DEPOSIT or WITHDRAWAL,
'currency': code,
'network': undefined,
'amount': this.safeNumber (transaction, 'amount'),
'status': this.parseTransactionStatus (this.safeString (transaction, 'status')),
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'network': undefined,
'address': this.safeString (transaction, 'address'), // todo: this is actually the tag for XRP transfers (the address is missing)
'addressTo': undefined,
'addressFrom': undefined,
'tag': tag,
'tagTo': undefined,
'addressTo': undefined,
'tag': this.safeString (transaction, 'description'),
'tagFrom': undefined,
'type': type,
'amount': this.safeNumber (transaction, 'amount'),
'currency': code,
'status': status,
'updated': updated,
'tagTo': undefined,
'updated': this.safeTimestamp (transaction, 'timestamp'),
'comment': undefined,
'fee': {
'currency': code,
'cost': this.parseNumber (feeCost),
Expand Down

0 comments on commit 7290565

Please sign in to comment.