@@ -45,6 +45,9 @@ export class TransactionRequestExtended extends TransactionRequest {
4545export class TransactionDtoMapper {
4646 // BuyCrypto
4747 static mapBuyCryptoTransaction ( buyCrypto : BuyCryptoExtended ) : TransactionDto {
48+ const inputAsset = isAsset ( buyCrypto . inputAssetEntity ) ? buyCrypto . inputAssetEntity : null ;
49+ const outputAsset = buyCrypto . outputAsset ;
50+
4851 const dto : TransactionDto = {
4952 id : buyCrypto . transaction . id ,
5053 uid : buyCrypto . transaction . uid ,
@@ -54,14 +57,18 @@ export class TransactionDtoMapper {
5457 inputAmount : Util . roundReadable ( buyCrypto . inputAmount , amountType ( buyCrypto . inputAssetEntity ) ) ,
5558 inputAsset : buyCrypto . inputAssetEntity . name ,
5659 inputAssetId : buyCrypto . inputAssetEntity . id ,
60+ inputChainId : inputAsset ?. chainId ?? null ,
5761 inputBlockchain : buyCrypto . cryptoInput ?. asset . blockchain ,
62+ inputEvmChainId : inputAsset ?. evmChainId ?? null ,
5863 inputPaymentMethod : buyCrypto . paymentMethodIn ,
5964 ...( buyCrypto . outputAmount ? buyCrypto . exchangeRate : null ) ,
6065 outputAmount :
6166 buyCrypto . outputAmount != null ? Util . roundReadable ( buyCrypto . outputAmount , AmountType . ASSET ) : null ,
6267 outputAsset : buyCrypto . outputAsset ?. name ,
6368 outputAssetId : buyCrypto . outputAsset ?. id ,
69+ outputChainId : outputAsset ?. chainId ?? null ,
6470 outputBlockchain : buyCrypto . outputAsset ?. blockchain ,
71+ outputEvmChainId : outputAsset ?. evmChainId ?? null ,
6572 outputPaymentMethod : CryptoPaymentMethod . CRYPTO ,
6673 priceSteps : buyCrypto . priceStepsObject ,
6774 feeAmount : buyCrypto . totalFeeAmount
@@ -76,6 +83,7 @@ export class TransactionDtoMapper {
7683 inputTxUrl : buyCrypto ?. cryptoInput
7784 ? txExplorerUrl ( buyCrypto . cryptoInput . asset . blockchain , buyCrypto . cryptoInput . inTxId )
7885 : null ,
86+ depositAddress : buyCrypto . cryptoInput ?. address ?. address ?? null ,
7987 outputTxId : buyCrypto . txId ,
8088 outputTxUrl : buyCrypto . txId ? txExplorerUrl ( buyCrypto . outputAsset ?. blockchain , buyCrypto . txId ) : null ,
8189 outputDate : buyCrypto . outputDate ,
@@ -122,6 +130,8 @@ export class TransactionDtoMapper {
122130
123131 // BuyFiat
124132 static mapBuyFiatTransaction ( buyFiat : BuyFiatExtended ) : TransactionDto {
133+ const inputAsset = isAsset ( buyFiat . inputAssetEntity ) ? buyFiat . inputAssetEntity : null ;
134+
125135 const dto : TransactionDto = {
126136 id : buyFiat . transaction . id ,
127137 uid : buyFiat . transaction . uid ,
@@ -131,13 +141,17 @@ export class TransactionDtoMapper {
131141 inputAmount : Util . roundReadable ( buyFiat . inputAmount , amountType ( buyFiat . inputAssetEntity ) ) ,
132142 inputAsset : buyFiat . inputAssetEntity . name ,
133143 inputAssetId : buyFiat . inputAssetEntity . id ,
144+ inputChainId : inputAsset ?. chainId ?? null ,
134145 inputBlockchain : buyFiat . cryptoInput ?. asset . blockchain ,
146+ inputEvmChainId : inputAsset ?. evmChainId ?? null ,
135147 inputPaymentMethod : CryptoPaymentMethod . CRYPTO ,
136148 ...( buyFiat . outputAmount ? buyFiat . exchangeRate : null ) ,
137149 outputAmount : buyFiat . outputAmount != null ? Util . roundReadable ( buyFiat . outputAmount , AmountType . FIAT ) : null ,
138150 outputAsset : buyFiat . outputAsset ?. name ,
139151 outputAssetId : buyFiat . outputAsset ?. id ,
152+ outputChainId : null ,
140153 outputBlockchain : null ,
154+ outputEvmChainId : null ,
141155 outputPaymentMethod : FiatPaymentMethod . BANK ,
142156 outputDate : buyFiat . outputDate ,
143157 priceSteps : buyFiat . priceStepsObject ,
@@ -153,6 +167,7 @@ export class TransactionDtoMapper {
153167 inputTxUrl : buyFiat ?. cryptoInput
154168 ? txExplorerUrl ( buyFiat . cryptoInput . asset . blockchain , buyFiat . cryptoInput . inTxId )
155169 : null ,
170+ depositAddress : buyFiat . cryptoInput ?. address ?. address ?? null ,
156171 outputTxId : buyFiat . bankTx ?. remittanceInfo ?? null ,
157172 outputTxUrl : null ,
158173 chargebackAmount : buyFiat . chargebackAmount ,
@@ -186,6 +201,8 @@ export class TransactionDtoMapper {
186201 // Waiting TxRequest
187202 static mapTxRequestTransaction ( txRequest : TransactionRequestExtended ) : TransactionDto {
188203 const fees = TransactionDtoMapper . mapFees ( txRequest ) ;
204+ const sourceAsset = isAsset ( txRequest . sourceAssetEntity ) ? txRequest . sourceAssetEntity : null ;
205+ const targetAsset = isAsset ( txRequest . targetAssetEntity ) ? txRequest . targetAssetEntity : null ;
189206
190207 const dto : TransactionDto = {
191208 id : null ,
@@ -195,19 +212,24 @@ export class TransactionDtoMapper {
195212 inputAmount : Util . roundReadable ( txRequest . amount , amountType ( txRequest . sourceAssetEntity ) ) ,
196213 inputAsset : txRequest . sourceAssetEntity . name ,
197214 inputAssetId : txRequest . sourceAssetEntity . id ,
198- inputBlockchain : isAsset ( txRequest . sourceAssetEntity ) ? txRequest . sourceAssetEntity . blockchain : null ,
215+ inputChainId : sourceAsset ?. chainId ?? null ,
216+ inputBlockchain : sourceAsset ?. blockchain ?? null ,
217+ inputEvmChainId : sourceAsset ?. evmChainId ?? null ,
199218 inputPaymentMethod : txRequest . sourcePaymentMethod ,
200219 outputAmount : null ,
201220 outputAsset : txRequest . targetAssetEntity ?. name ,
202221 outputAssetId : txRequest . targetAssetEntity ?. id ,
203- outputBlockchain : isAsset ( txRequest . targetAssetEntity ) ? txRequest . targetAssetEntity ?. blockchain : null ,
222+ outputChainId : targetAsset ?. chainId ?? null ,
223+ outputBlockchain : targetAsset ?. blockchain ?? null ,
224+ outputEvmChainId : targetAsset ?. evmChainId ?? null ,
204225 outputPaymentMethod : txRequest . targetPaymentMethod ,
205226 priceSteps : null ,
206227 feeAmount : fees ?. total ,
207228 feeAsset : fees ?. total ? txRequest . sourceAssetEntity . name : null ,
208229 fees,
209230 inputTxId : null ,
210231 inputTxUrl : null ,
232+ depositAddress : null ,
211233 outputTxId : null ,
212234 outputTxUrl : null ,
213235 outputDate : null ,
@@ -247,7 +269,9 @@ export class TransactionDtoMapper {
247269 inputAmount : null ,
248270 inputAsset : null ,
249271 inputAssetId : null ,
272+ inputChainId : null ,
250273 inputBlockchain : null ,
274+ inputEvmChainId : null ,
251275 inputPaymentMethod : null ,
252276 exchangeRate : null ,
253277 rate : null ,
@@ -257,7 +281,9 @@ export class TransactionDtoMapper {
257281 : null ,
258282 outputAsset : refReward . outputAsset . name ,
259283 outputAssetId : refReward . outputAsset ?. id ,
284+ outputChainId : refReward . outputAsset ?. chainId ?? null ,
260285 outputBlockchain : refReward . targetBlockchain ,
286+ outputEvmChainId : refReward . outputAsset ?. evmChainId ?? null ,
261287 outputPaymentMethod : CryptoPaymentMethod . CRYPTO ,
262288 outputDate : refReward . outputDate ,
263289 priceSteps : null ,
@@ -266,6 +292,7 @@ export class TransactionDtoMapper {
266292 fees : null ,
267293 inputTxId : null ,
268294 inputTxUrl : null ,
295+ depositAddress : null ,
269296 outputTxId : refReward . txId ,
270297 outputTxUrl : refReward . txId ? txExplorerUrl ( refReward . targetBlockchain , refReward . txId ) : null ,
271298 chargebackAmount : undefined ,
0 commit comments