From 4da3a1e69e67d7025ad5c0f1582648945c1a5de1 Mon Sep 17 00:00:00 2001 From: mixplore <9848598+mixplore@users.noreply.github.com> Date: Thu, 27 Nov 2025 11:44:22 +0200 Subject: [PATCH] fix: use nxm premium from quote when payment asset is nxm --- src/quote/Quote.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/quote/Quote.ts b/src/quote/Quote.ts index a7618057..bb91efd1 100644 --- a/src/quote/Quote.ts +++ b/src/quote/Quote.ts @@ -203,8 +203,10 @@ export class Quote extends NexusSDKBase { // Get quote using helper method const { quote } = await this.getQuote(quoteParams); + const premium = paymentAssetEnum === PaymentAsset.NXM ? quote.premiumInNXM : quote.premiumInAsset; + const maxPremiumInAsset = this.calculatePremiumWithCommissionAndSlippage( - BigInt(quote.premiumInAsset), + BigInt(premium), commissionRatio || BUY_COVER_COMMISSION_RATIO_BY_PRODUCT_TYPE[productType], slippageValue, ); @@ -233,7 +235,7 @@ export class Quote extends NexusSDKBase { amount, period: period * 60 * 60 * 24, // seconds maxPremiumInAsset: maxPremiumInAsset.toString(), - paymentAsset: coverAssetEnum, + paymentAsset: paymentAssetEnum, commissionRatio: commissionRatio || BUY_COVER_COMMISSION_RATIO_BY_PRODUCT_TYPE[productType], commissionDestination: commissionDestination || BUY_COVER_COMMISSION_DESTINATION_BY_PRODUCT_TYPE[productType],