Skip to content

Commit

Permalink
fix: [CM-638] Include quote basis Points on smartCheckout response (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesgodi committed May 17, 2024
1 parent 35f22b2 commit 4189db9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ describe('swapRoute', () => {
type: FeeType.SWAP_FEE,
amount: BigNumber.from(3),
formattedAmount: utils.formatUnits(BigNumber.from(3), 18),
basisPoints: 0,
token: {
decimals: 18,
name: 'IMX',
Expand Down Expand Up @@ -404,6 +405,7 @@ describe('swapRoute', () => {
type: FeeType.SWAP_FEE,
amount: BigNumber.from(3),
formattedAmount: utils.formatUnits(BigNumber.from(3), 18),
basisPoints: 0,
token: {
decimals: 18,
name: 'IMX',
Expand Down Expand Up @@ -546,6 +548,7 @@ describe('swapRoute', () => {
type: FeeType.SWAP_FEE,
amount: BigNumber.from(3),
formattedAmount: utils.formatUnits(BigNumber.from(3), 18),
basisPoints: 0,
token: {
decimals: 18,
name: 'IMX',
Expand Down Expand Up @@ -599,6 +602,7 @@ describe('swapRoute', () => {
type: FeeType.SWAP_FEE,
amount: BigNumber.from(3),
formattedAmount: utils.formatUnits(BigNumber.from(3), 18),
basisPoints: 0,
token: {
decimals: 18,
name: 'IMX',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CheckoutConfiguration, getL2ChainId } from '../../../config';
import {
AvailableRoutingOptions,
ChainId,
Fee as SwapFee,
FeeType,
FundingStepType,
GetBalanceResult,
Expand Down Expand Up @@ -51,12 +52,13 @@ const constructFees = (
};
}

const fees = [];
const fees: SwapFee[] = [];
for (const swapFee of swapFees) {
fees.push({
type: FeeType.SWAP_FEE,
amount: swapFee.amount.value,
formattedAmount: utils.formatUnits(swapFee.amount.value, swapFee.amount.token.decimals),
basisPoints: swapFee.basisPoints,
token: {
name: swapFee.amount.token.name ?? '',
symbol: swapFee.amount.token.symbol ?? '',
Expand Down
2 changes: 2 additions & 0 deletions packages/checkout/sdk/src/types/smartCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ export type Fee = {
formattedAmount: string;
/** The token info for the fee */
token?: TokenInfo;
/** The basis points for the secondary fee */
basisPoints?: number;
};

/**
Expand Down

0 comments on commit 4189db9

Please sign in to comment.