-
Notifications
You must be signed in to change notification settings - Fork 136
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
Conversation
…mitting UpdateProfile transaction
src/app/backend-api.service.ts
Outdated
@@ -1251,7 +1251,40 @@ export class BackendApiService { | |||
NewStakeMultipleBasisPoints, | |||
IsHidden, | |||
MinFeeRateNanosPerKB, | |||
}); | |||
}).pipe( | |||
map((res) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
- Construct the transaction using the update-profile endpoint
- If the response has a
CompProfileCreationTxnHashHex
, then start polling every half second for the transaction for a minute, take the first instance whereTxnFound
istrue
and pipe the response from the update-profile request thru. - If the response does not have a
CompProfileCreationTxnHashHex
, pipe the response from the update-profile request thru immediately - sign and submit the transaction by using the piped response from steps 2 or 3.
There was a problem hiding this 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 ✅
No description provided.