@@ -465,17 +465,6 @@ export class MayachainAMM {
465
465
} )
466
466
}
467
467
468
- /**
469
- * Convert trade asset to underlying asset type for transactions
470
- * @param {Asset } asset The asset to convert
471
- * @returns {Asset } The asset with converted type
472
- */
473
- private convertToUnderlyingAsset ( asset : Asset ) : Asset {
474
- return {
475
- ...asset ,
476
- type : asset . type === AssetType . TRADE ? AssetType . NATIVE : asset . type ,
477
- }
478
- }
479
468
480
469
/**
481
470
* Estimate adding trade amount to account
@@ -526,7 +515,10 @@ export class MayachainAMM {
526
515
if ( ! quote . allowed ) throw Error ( `Can not add to trade account. ${ quote . errors . join ( ' ' ) } ` )
527
516
528
517
// Convert trade asset to underlying asset for the transaction
529
- const underlyingAsset = this . convertToUnderlyingAsset ( quote . value . asset )
518
+ const underlyingAsset = {
519
+ ...quote . value . asset ,
520
+ type : quote . value . asset . type === AssetType . TRADE ? AssetType . NATIVE : quote . value . asset . type ,
521
+ }
530
522
const transactionAmount = new CryptoAmount ( quote . value . baseAmount , underlyingAsset )
531
523
532
524
return MayachainAction . makeAction ( {
@@ -584,7 +576,10 @@ export class MayachainAMM {
584
576
if ( ! quote . allowed ) throw Error ( `Can not withdraw from trade account. ${ quote . errors . join ( ' ' ) } ` )
585
577
586
578
// Convert trade asset to underlying asset for the transaction
587
- const underlyingAsset = this . convertToUnderlyingAsset ( quote . value . asset )
579
+ const underlyingAsset = {
580
+ ...quote . value . asset ,
581
+ type : quote . value . asset . type === AssetType . TRADE ? AssetType . NATIVE : quote . value . asset . type ,
582
+ }
588
583
const transactionAmount = new CryptoAmount ( quote . value . baseAmount , underlyingAsset )
589
584
590
585
return MayachainAction . makeAction ( {
0 commit comments