Skip to content

Add requireApproval option to addTransaction method option bag#1580

Merged
OGPoyraz merged 7 commits intomainfrom
961-support-adding-transactions-without-approval-in-the-core-transaction-controller
Aug 17, 2023
Merged

Add requireApproval option to addTransaction method option bag#1580
OGPoyraz merged 7 commits intomainfrom
961-support-adding-transactions-without-approval-in-the-core-transaction-controller

Conversation

@OGPoyraz
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz commented Aug 14, 2023

Explanation

This PR aims to add requireApproval option to addTransaction method options in order to either force or skip creating approval for transactions.

As seen in the PR requireApproval default value will be true to keep the same behavior as before, and set explicitly to false in order to skip approval.

Changelog

@metamask/transaction-controller

  • ADDED: Adds requireApproval option to addTransaction method options.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@OGPoyraz OGPoyraz requested a review from a team as a code owner August 14, 2023 12:56
@OGPoyraz OGPoyraz changed the title [Draft] Add requireApproval option to addTransaction method option bag Add requireApproval option to addTransaction method option bag Aug 14, 2023
@OGPoyraz OGPoyraz force-pushed the 961-support-adding-transactions-without-approval-in-the-core-transaction-controller branch from 4e872ff to a33c64c Compare August 14, 2023 13:42
Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three suggestions.

@OGPoyraz OGPoyraz force-pushed the 961-support-adding-transactions-without-approval-in-the-core-transaction-controller branch from 8e49362 to 5409a31 Compare August 15, 2023 07:17
{
deviceConfirmedOn,
origin,
requireApproval = true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than default here, can we leave it without a default and pass it to processApproval as possibly undefined and then have a single explicit requireApproval !== false before requesting the approval to ensure the only way to disable is with an explicit false.

Currently you could pass anything that is falsy like null or 0 and it would disable the approval.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good spot Matthew, committed the suggested way.

@OGPoyraz OGPoyraz force-pushed the 961-support-adding-transactions-without-approval-in-the-core-transaction-controller branch from b18b748 to f7b006d Compare August 16, 2023 09:46
@OGPoyraz OGPoyraz merged commit 0cb49fd into main Aug 17, 2023
@OGPoyraz OGPoyraz deleted the 961-support-adding-transactions-without-approval-in-the-core-transaction-controller branch August 17, 2023 07:47
@matthewwalsh0 matthewwalsh0 mentioned this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants