Skip to content

Commit

Permalink
Merge branch 'develop' into jl/bump-queued-request-controller-fix-con…
Browse files Browse the repository at this point in the history
…firmation-popup-focus
  • Loading branch information
jiexi authored Jun 25, 2024
2 parents f96d58e + 7add8ac commit 718dd6f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/scripts/lib/transaction/smart-transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ describe('submitSmartTransactionHook', () => {
expect(result).toEqual({ transactionHash: undefined });
});

it('falls back to regular transaction submit if the transaction type is "swapApproval"', async () => {
const request: SubmitSmartTransactionRequestMocked = createRequest();
request.transactionMeta.type = TransactionType.swapApproval;
const result = await submitSmartTransactionHook(request);
expect(result).toEqual({ transactionHash: undefined });
});

it('falls back to regular transaction submit if /getFees throws an error', async () => {
const request: SubmitSmartTransactionRequestMocked = createRequest();
jest
Expand Down
8 changes: 6 additions & 2 deletions app/scripts/lib/transaction/smart-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ class SmartTransactionHook {
}

async submit() {
const isUnsupportedTransactionTypeForSmartTransaction =
this.#transactionMeta?.type === TransactionType.swapAndSend;
const isUnsupportedTransactionTypeForSmartTransaction = this
.#transactionMeta?.type
? [TransactionType.swapAndSend, TransactionType.swapApproval].includes(
this.#transactionMeta.type,
)
: false;

// Will cause TransactionController to publish to the RPC provider as normal.
const useRegularTransactionSubmit = { transactionHash: undefined };
Expand Down
1 change: 1 addition & 0 deletions ui/ducks/send/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -3017,6 +3017,7 @@ export function signTransaction(history) {
{ ...bestQuote.approvalNeeded, amount: '0x0' },
{
requireApproval: false,
// TODO: create new type for swap+send approvals; works as stopgap bc swaps doesn't use this type for STXs in `submitSmartTransactionHook` (via `TransactionController`)
type: TransactionType.swapApproval,
swaps: {
hasApproveTx: true,
Expand Down

0 comments on commit 718dd6f

Please sign in to comment.