Skip to content

Conversation

@dan437
Copy link
Collaborator

@dan437 dan437 commented Feb 1, 2024

Description

This PR does 2 things:

  • Adds support for more transactions
  • Emits events, so it's easier to understand what's going on with a transaction status

Testing

  • Make a build with this PR, include it in the MM extension and make sure Smart Swaps still work

@dan437 dan437 requested a review from a team February 1, 2024 12:41
@socket-security
Copy link

socket-security bot commented Feb 1, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/events@3.3.0 None 0 82.8 kB goto-bus-stop

View full report↗︎

Copy link
Contributor

@infiniteflower infiniteflower left a comment

Choose a reason for hiding this comment

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

Just had some small comments

@infiniteflower infiniteflower self-requested a review February 2, 2024 21:22
infiniteflower
infiniteflower previously approved these changes Feb 2, 2024
Copy link
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.

Hello, I suspect there are plans here for events, but I've seen similar events in TransactionController as those you're adding here, so I'm curious how we intend to use them? Thanks.


Object.entries(data).forEach(([uuid, stxStatus]) => {
const transactionHash = stxStatus?.minedHash;
this.eventEmitter.emit(`${uuid}:status`, stxStatus);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where will this event be used if eventEmitter is private?

Copy link
Collaborator Author

@dan437 dan437 Feb 5, 2024

Choose a reason for hiding this comment

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

The extension is able to use it. It's an easy way to see what is going on with an STX status in Console. @matthewwalsh0 actually wrote most of the code in this PR and I suppose he added the events module usage into the TransactionController, so he might elaborate on intended use a bit more.

More about the events node module here: https://www.npmjs.com/package/events


private trackMetaMetricsEvent: any;

private eventEmitter: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we give this property a type? Perhaps:

Suggested change
private eventEmitter: any;
private eventEmitter: EventEmitter;

@dan437 dan437 merged commit d280879 into main Feb 5, 2024
@dan437 dan437 deleted the non-swaps-stx-support branch February 5, 2024 14:55
@legobeat legobeat mentioned this pull request Feb 22, 2024
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.

5 participants