Conversation
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
FiatStrategy and getQuotes functionalityFiatStrategy and getQuotes functionality
FiatStrategy and getQuotes functionalityFiatStrategy and getQuotes functionality
|
@SocketSecurity ignore npm/@metamask/ramps-controller@12.0.0 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| amount: adjustedAmount, | ||
| paymentMethods: [selectedPaymentMethodId], | ||
| walletAddress, | ||
| }); |
There was a problem hiding this comment.
Missing assetId in ramps getQuotes call
High Severity
The RampsController:getQuotes call is missing the assetId parameter. The fiatAsset object (derived from deriveFiatAssetForFiatPayment) contains a caipAssetId field that was clearly intended to be passed as assetId, but it's never included in the call. The RampsController.getQuotes method validates that assetId is present and throws "assetId is required." if neither the parameter nor this.state.tokens.selected?.assetId is available. This causes the fiat quote flow to either silently fail (caught by try-catch, returning []) or use an unrelated asset from ramps controller state.


Explanation
This PR introduces
FiatStrategy:TransactionPayStrategy.Fiatand registersFiatStrategyin strategy resolution.MMPAY_FIAT_ASSET_ID_BY_TX_TYPE).fiat-quotes.tswith relay-first estimation:fiatPayment.amountFiat+ selected payment methodstrategy: fiatquotefees.provider= relay provider/swap feefees.fiatProvider= ramps provider/network feefees.metaMask= MM fee (100 bps overamountFiat + adjustedAmountFiat)metamaskPay.bridgeFeeFiatwhen fiat provider fee exists.References
Checklist
Note
Medium Risk
Adds a new
Fiatpayment strategy that combines Relay fee estimation with Ramps quote retrieval and introduces a new fee bucket (fees.fiatProvider), which can affect totals and transaction metadata calculations.Overview
Adds a new MM Pay
FiatStrategyand wiring (TransactionPayStrategy.Fiat) to generate quotes by first estimating fees via Relay, then requesting Ramps quotes using an adjusted fiat amount (user amount + estimated relay fees), returning a single combined quote.Introduces
TransactionPayFiatAsset+ tx-type-to-fiat-asset mapping, addsRampsController:getQuotesto messengerAllowedActions, and updates fee/totals plumbing to support a separatefees.fiatProviderbucket (including aggregating it into totals andmetamaskPay.bridgeFeeFiat).Includes new unit tests for the fiat quote flow/utilities and adds
@metamask/ramps-controllerdependency/build references; fiatexecuteis currently a placeholder returning no tx hash.Written by Cursor Bugbot for commit ee58873. This will update automatically on new commits. Configure here.