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

Method parseTransaction

ts/src/woo.ts:2766–2822  ·  view source on GitHub ↗
(transaction: Dict, currency: Currency = undefined)

Source from the content-addressed store, hash-verified

2764 }
2765
2766 parseTransaction (transaction: Dict, currency: Currency = undefined): Transaction {
2767 //
2768 // {
2769 // "createdTime": "1734964440.523",
2770 // "updatedTime": "1734964614.081",
2771 // "id": "24122314340000585",
2772 // "externalId": "241223143600621",
2773 // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2774 // "token": "ARB_USDCNATIVE",
2775 // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2776 // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2777 // "extra": "",
2778 // "type": "BALANCE",
2779 // "tokenSide": "WITHDRAW",
2780 // "amount": "10.00000000",
2781 // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2782 // "feeToken": "USDC",
2783 // "feeAmount": "2",
2784 // "status": "COMPLETED",
2785 // "confirmingThreshold": null,
2786 // "confirmedNumber": null
2787 // }
2788 //
2789 const networkizedCode = this.safeString (transaction, 'token');
2790 const currencyDefined = this.getCurrencyFromChaincode (networkizedCode, currency);
2791 const code = currencyDefined['code'];
2792 let movementDirection = this.safeStringLowerN (transaction, [ 'token_side', 'tokenSide', 'type' ]);
2793 if (movementDirection === 'withdraw') {
2794 movementDirection = 'withdrawal';
2795 }
2796 const fee = this.parseTokenAndFeeTemp (transaction, [ 'fee_token', 'feeToken' ], [ 'fee_amount', 'feeAmount' ]);
2797 const addressTo = this.safeStringN (transaction, [ 'target_address', 'targetAddress', 'addressTo' ]);
2798 const addressFrom = this.safeString2 (transaction, 'source_address', 'sourceAddress');
2799 const timestamp = this.safeTimestampN (transaction, [ 'created_time', 'createdTime' ], this.safeInteger (transaction, 'timestamp'));
2800 return {
2801 'info': transaction,
2802 'id': this.safeStringN (transaction, [ 'id', 'withdraw_id', 'withdrawId' ]),
2803 'txid': this.safeString2 (transaction, 'tx_id', 'txId'),
2804 'timestamp': timestamp,
2805 'datetime': this.iso8601 (timestamp),
2806 'address': undefined,
2807 'addressFrom': addressFrom,
2808 'addressTo': addressTo,
2809 'tag': this.safeString2 (transaction, 'extra', 'tag'),
2810 'tagFrom': undefined,
2811 'tagTo': undefined,
2812 'type': movementDirection,
2813 'amount': this.safeNumber (transaction, 'amount'),
2814 'currency': code,
2815 'status': this.parseTransactionStatus (this.safeString (transaction, 'status')),
2816 'updated': this.safeTimestamp2 (transaction, 'updated_time', 'updatedTime'),
2817 'comment': undefined,
2818 'internal': undefined,
2819 'fee': fee,
2820 'network': this.networkIdToCode (this.safeString (transaction, 'network'), code),
2821 } as Transaction;
2822 }
2823

Callers 1

withdrawMethod · 0.95

Calls 13

parseTokenAndFeeTempMethod · 0.95
safeStringMethod · 0.45
safeStringLowerNMethod · 0.45
safeStringNMethod · 0.45
safeString2Method · 0.45
safeTimestampNMethod · 0.45
safeIntegerMethod · 0.45
iso8601Method · 0.45
safeNumberMethod · 0.45
safeTimestamp2Method · 0.45

Tested by

no test coverage detected