Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/transaction-pay-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Read Relay provider fees directly from response ([#7098](https://github.com/MetaMask/core/pull/7098))

## [4.0.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ const QUOTE_REQUEST_MOCK: QuoteRequest = {

const QUOTE_MOCK = {
details: {
currencyIn: {
amountUsd: '2.34',
},
currencyOut: {
amountFormatted: '1.0',
amountUsd: '1.23',
Expand All @@ -51,8 +48,8 @@ const QUOTE_MOCK = {
timeEstimate: 300,
},
fees: {
gas: {
amountUsd: '3.45',
relayer: {
amountUsd: '1.11',
},
},
steps: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ function normalizeQuote(
fullRequest: PayStrategyGetQuotesRequest,
): TransactionPayQuote<RelayQuote> {
const { messenger, transaction } = fullRequest;
const { details } = quote;
const { currencyIn, currencyOut } = details;
const { details, fees } = quote;

const { usdToFiatRate } = getFiatRates(messenger, request);

Expand All @@ -175,7 +174,7 @@ function normalizeQuote(
);

const provider = getFiatValueFromUsd(
new BigNumber(currencyIn.amountUsd).minus(currencyOut.amountUsd),
new BigNumber(fees.relayer.amountUsd),
usdToFiatRate,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import type { Hex } from '@metamask/utils';

export type RelayQuote = {
details: {
currencyIn: {
amountUsd: string;
};
currencyOut: {
amountFormatted: string;
amountUsd: string;
Expand All @@ -16,7 +13,7 @@ export type RelayQuote = {
timeEstimate: number;
};
fees: {
gas: {
relayer: {
amountUsd: string;
};
};
Expand Down
Loading