Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed Jan 7, 2025
1 parent 45d364f commit f52be39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const TransactionSummary = ({swapForm}: {swapForm: SwapContext}) => {
const strings = useStrings()
const {styles} = useStyles()
const {wallet} = useSelectedWallet()
const {wantedPrice, orderType} = swapForm
const {orderType} = swapForm

const tokenInInfo = swapForm.tokenInfos.get(swapForm.tokenInInput.tokenId ?? '.unknown')
const tokenOutInfo = swapForm.tokenInfos.get(swapForm.tokenOutInput.tokenId ?? '.unknown')
Expand All @@ -31,7 +31,7 @@ export const TransactionSummary = ({swapForm}: {swapForm: SwapContext}) => {
}
const amountOut = {
info: tokenOutInfo,
quantity: BigInt((Number(swapForm.createTx?.totalInput) ?? 0) * 10 ** tokenOutInfo.decimals),
quantity: BigInt((Number(swapForm.createTx?.totalOutputWithoutSlippage) ?? 0) * 10 ** tokenOutInfo.decimals),
}

const priceImpactRisk = getPriceImpactRisk(Number(swapForm.createTx?.splits[0].priceImpact))
Expand All @@ -41,7 +41,7 @@ export const TransactionSummary = ({swapForm}: {swapForm: SwapContext}) => {
const tokenToSellName = tokenInInfo.ticker ?? tokenInInfo.name
const tokenToBuyName = tokenOutInfo.ticker ?? tokenOutInfo.name

const priceInfoValue = `${wantedPrice} ${tokenToSellName}/${tokenToBuyName}`
const priceInfoValue = `${swapForm.createTx?.netPrice} ${tokenToSellName}/${tokenToBuyName}`
const minAdaInfoValue = `${swapForm.createTx?.deposits} ${wallet.portfolioPrimaryTokenInfo.ticker}`
const totalFee = `${swapForm.createTx?.totalFee} ${wallet.portfolioPrimaryTokenInfo.ticker}`
const minReceivedInfoValue = `${swapForm.createTx?.totalOutput} ${tokenToBuyName}`
Expand Down
12 changes: 6 additions & 6 deletions packages/swap/src/adapters/api/muesliswap/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export const transformersMaker = ({
numbers_have_decimals: true,
}),
response: ({
// buy_token_decimals,
// sell_token_decimals,
buy_token_decimals,
sell_token_decimals,
net_price,
splits,
total_batcher_fee,
Expand All @@ -188,7 +188,7 @@ export const transformersMaker = ({
totalFee: Number(total_lvl_attached),
totalInput: Number(total_input),
totalOutput: Number(total_output),
netPrice: net_price,
netPrice: net_price * 10 ** (sell_token_decimals - buy_token_decimals),
totalOutputWithoutSlippage: Number(total_output_without_slippage),
splits: splits.map(transformSplit),
}),
Expand Down Expand Up @@ -216,8 +216,8 @@ export const transformersMaker = ({
}),
response: ({
quote: {
// buy_token_decimals,
// sell_token_decimals,
buy_token_decimals,
sell_token_decimals,
net_price,
splits,
total_batcher_fee,
Expand All @@ -238,7 +238,7 @@ export const transformersMaker = ({
totalFee: Number(total_lvl_attached),
totalInput: Number(total_input),
totalOutput: Number(total_output),
netPrice: net_price,
netPrice: net_price * 10 ** (sell_token_decimals - buy_token_decimals),
totalOutputWithoutSlippage: Number(total_output_without_slippage),
splits: splits.map(transformSplit),
}),
Expand Down

0 comments on commit f52be39

Please sign in to comment.