Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Swap with unapproved token #10088

Merged
merged 2 commits into from
Jun 24, 2024
Merged
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
12 changes: 7 additions & 5 deletions app/components/UI/Swaps/QuotesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ function SwapsQuotesView({

try {
resetTransaction();
const { transactionMeta } = await addTransaction(
const { transactionMeta, result } = await addTransaction(
tommasini marked this conversation as resolved.
Show resolved Hide resolved
{
...selectedQuote.trade,
...getTransactionPropertiesFromGasEstimates(
Expand All @@ -929,6 +929,8 @@ function SwapsQuotesView({
},
);

await result;

updateSwapsTransactions(
transactionMeta,
approvalTransactionMetaId,
Expand Down Expand Up @@ -965,7 +967,7 @@ function SwapsQuotesView({
) => {
try {
resetTransaction();
const { transactionMeta } = await addTransaction(
const { transactionMeta, result } = await addTransaction(
{
...approvalTransaction,
...getTransactionPropertiesFromGasEstimates(
Expand All @@ -979,6 +981,7 @@ function SwapsQuotesView({
},
);

await result;
setRecipient(selectedAddress);

approvalTransactionMetaId = transactionMeta.id;
Expand Down Expand Up @@ -1041,9 +1044,8 @@ function SwapsQuotesView({
const newSwapsTransactions =
TransactionController.state.swapsTransactions || {};
let approvalTransactionMetaId;

if (approvalTransaction) {
handleApprovaltransaction(
await handleApprovaltransaction(
tommasini marked this conversation as resolved.
Show resolved Hide resolved
TransactionController,
newSwapsTransactions,
approvalTransactionMetaId,
Expand All @@ -1060,7 +1062,7 @@ function SwapsQuotesView({
!shouldUseSmartTransaction ||
(shouldUseSmartTransaction && !approvalTransaction)
) {
handleSwapTransaction(
await handleSwapTransaction(
TransactionController,
newSwapsTransactions,
approvalTransactionMetaId,
Expand Down
Loading