Skip to content

Commit 176b475

Browse files
committed
fix: resolve TypeScript build errors
- Revert to inline asset type conversion to avoid type conflicts - Maintain the same functionality without extracted method - Fixes CI/CD build pipeline failure
1 parent b3e775d commit 176b475

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

packages/xchain-mayachain-amm/src/mayachain-amm.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -465,17 +465,6 @@ export class MayachainAMM {
465465
})
466466
}
467467

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-
}
479468

480469
/**
481470
* Estimate adding trade amount to account
@@ -526,7 +515,10 @@ export class MayachainAMM {
526515
if (!quote.allowed) throw Error(`Can not add to trade account. ${quote.errors.join(' ')}`)
527516

528517
// 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+
}
530522
const transactionAmount = new CryptoAmount(quote.value.baseAmount, underlyingAsset)
531523

532524
return MayachainAction.makeAction({
@@ -584,7 +576,10 @@ export class MayachainAMM {
584576
if (!quote.allowed) throw Error(`Can not withdraw from trade account. ${quote.errors.join(' ')}`)
585577

586578
// 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+
}
588583
const transactionAmount = new CryptoAmount(quote.value.baseAmount, underlyingAsset)
589584

590585
return MayachainAction.makeAction({

0 commit comments

Comments
 (0)