Skip to content

wait for profile comp transaction to broadcast before signing and submitting UpdateProfile transaction #524

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

Merged
merged 3 commits into from
Dec 1, 2021

Conversation

lazynina
Copy link
Member

@lazynina lazynina commented Dec 1, 2021

No description provided.

@lazynina lazynina requested a review from a team as a code owner December 1, 2021 00:04
@@ -1251,7 +1251,40 @@ export class BackendApiService {
NewStakeMultipleBasisPoints,
IsHidden,
MinFeeRateNanosPerKB,
});
}).pipe(
map((res) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this code doing? I see that it checks for the txn but then what?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we have a CompProfileCreatoinTxnHashHex, poll the get-txn endpoint until TxnFound is true. Once found, return the response from UpdateProfile

Copy link
Contributor

Choose a reason for hiding this comment

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

I could be misreading this code because it's on github and I can't read indentations but I'm not sure I understand how this accomplishes that

Copy link
Member Author

Choose a reason for hiding this comment

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

I rewrote it with observables. it works as follows:

  1. Construct the transaction using the update-profile endpoint
  2. If the response has a CompProfileCreationTxnHashHex, then start polling every half second for the transaction for a minute, take the first instance where TxnFound is true and pipe the response from the update-profile request thru.
  3. If the response does not have a CompProfileCreationTxnHashHex, pipe the response from the update-profile request thru immediately
  4. sign and submit the transaction by using the piped response from steps 2 or 3.

@lazynina lazynina requested a review from maebeam December 1, 2021 16:57
Copy link
Contributor

@maebeam maebeam left a comment

Choose a reason for hiding this comment

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

Observables make more sense to me ✅

@lazynina lazynina merged commit d98a715 into main Dec 1, 2021
@lazynina lazynina deleted the ln/wait-for-profile-comp branch December 1, 2021 18:22
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.

2 participants