File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -202,19 +202,22 @@ export function processMoonpayTx(rawTx: unknown): StandardTx {
202
202
const tx : MoonpayTx = asMoonpayTx ( rawTx )
203
203
const isoDate = tx . createdAt . toISOString ( )
204
204
const timestamp = tx . createdAt . getTime ( )
205
+
206
+ const direction = tx . baseCurrency . type === 'fiat' ? 'buy' : 'sell'
207
+
205
208
const standardTx : StandardTx = {
206
209
status : 'complete' ,
207
210
orderId : tx . id ,
208
211
209
212
countryCode : tx . country ,
210
- depositTxid : undefined ,
213
+ depositTxid : direction === 'sell' ? tx . cryptoTransactionId : undefined ,
211
214
depositAddress : undefined ,
212
215
depositCurrency : tx . baseCurrency . code . toUpperCase ( ) ,
213
216
depositAmount : tx . baseCurrencyAmount ,
214
- direction : 'buy' ,
217
+ direction,
215
218
exchangeType : 'fiat' ,
216
219
paymentType : getFiatPaymentType ( tx ) ,
217
- payoutTxid : tx . cryptoTransactionId ,
220
+ payoutTxid : direction === 'buy' ? tx . cryptoTransactionId : undefined ,
218
221
payoutAddress : tx . walletAddress ,
219
222
payoutCurrency : tx . currency . code . toUpperCase ( ) ,
220
223
payoutAmount : tx . quoteCurrencyAmount ,
You can’t perform that action at this time.
0 commit comments