Skip to content
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

2958 eventsub #2960

Merged
merged 4 commits into from
May 14, 2024
Merged

2958 eventsub #2960

merged 4 commits into from
May 14, 2024

Conversation

dsawali
Copy link
Contributor

@dsawali dsawali commented May 13, 2024

closes #2958
Updated taquito beacon wallet to use subscribeToEvent instead of getActiveAccount

Thank you for your contribution to Taquito.

Before submitting this PR, please make sure:

  • Your code builds cleanly without any errors or warnings
  • You have run the linter against the changes
  • You have added unit tests (if relevant/appropriate)
  • You have added integration tests (if relevant/appropriate)
  • All public methods or types have TypeDoc coverage with a complete description, and ideally an @example
  • You have added or updated corresponding documentation
  • If relevant, you have written a first draft summary describing the change for inclusion in Release Notes.

In this PR, please also make sure:

  • You have linked this PR to the issue by putting closes #TICKETNUMBER in the description box (when applicable)
  • You have added a concise description on your changes

Release Note Draft Snippet

If relevant, please write a summary of your change that will be suitable for
inclusion in the Release Notes for the next Taquito release.

Copy link

github-actions bot commented May 13, 2024

A new deploy preview is available on Cloudflare Pages at https://79972cb6.taquito-test-dapp.pages.dev

Copy link

github-actions bot commented May 13, 2024

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/beacon-wallet@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/contracts-library@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/utils@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/ledger-signer@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/taquito@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip12@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/core@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/sapling@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michel-codec@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/http-utils@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/local-forging@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/timelock@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/signer@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/rpc@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/remote-signer@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michelson-encoder@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip16@19.2.1-beta.2-b6658d5-- --registry https://npm.preview.tezostaquito.io/

@dsawali dsawali changed the base branch from master to beacon-4.2.2 May 13, 2024 20:42
Copy link

cloudflare-workers-and-pages bot commented May 13, 2024

Deploying taquito with  Cloudflare Pages  Cloudflare Pages

Latest commit: 27cbfe0
Status: ✅  Deploy successful!
Preview URL: https://8400859f.taquito.pages.dev
Branch Preview URL: https://2958-eventsub.taquito.pages.dev

View logs

@dsawali dsawali marked this pull request as ready for review May 13, 2024 23:27
@dsawali dsawali requested review from hui-an-yang and ac10n May 13, 2024 23:27
@@ -59,19 +66,17 @@ export class BeaconWallet implements WalletProvider {
}

async getPKH() {
const account = await this.client.getActiveAccount();
if (!account) {
if (!this.account) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One concern:
I the dApp code calls getPkh immediately after connecting, but before the first ACTIVE_ACCOUNT_SET event is received, they will get an error. Not sure if this is actually possible, or even if it's possible if there is a better solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that will happen since the even will be subscribed to in the constructor. So getPkh will likely never be called unless the client has been constructed, and in consequence, the account member variable will always be assigned a value. And if it doesn't it will throw an error, so at least it signals the user (or developer) that the wallet has not been connected, or the wallet info is incomplete. I hope that makes sense!

Copy link
Contributor

Choose a reason for hiding this comment

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

While the event is subscribed in the constructor, it might not be triggered until a split-second later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I figured it would be a rare occurrence. But do you have any suggestions to improve it then?

Copy link
Contributor

@ac10n ac10n left a comment

Choose a reason for hiding this comment

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

It might be a good idea to investigate if it's possible to create the error mentioned in comments. If so, we might want to add something to release notes.

@dsawali dsawali changed the base branch from beacon-4.2.2 to master May 14, 2024 00:00
Copy link
Collaborator

@hui-an-yang hui-an-yang left a comment

Choose a reason for hiding this comment

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

Code change in packages/taquito-beacon-wallet/src/taquito-beacon-wallet.ts looks good!! Might be pointing to master makes this pr regressed some commit changes already in master rn. Other than that just would be good to have test-dapp to switch account to prove the change to subscribeToEvent will capture switching account successfully in beaconWallet class.

@dsawali dsawali changed the base branch from master to beacon-4.2.2 May 14, 2024 15:19
@dsawali dsawali merged commit 72a4d60 into beacon-4.2.2 May 14, 2024
10 checks passed
@dsawali dsawali deleted the 2958-eventsub branch May 14, 2024 17:03
dsawali added a commit that referenced this pull request May 15, 2024
* feat: updated beacon to 4.2.2-beta.0

* feat: feat: updated beacon to 4.2.2-beta.1

* feat: feat: updated beacon to 4.2.2-beta.2

* chore(releng) bump version to 19.2.1-beta.0

* feat: updated beacon to 4.2.2-beta.3

* feat: updating to private prc nodes

* reverted config to use public testnets instead

* fix: updating back to public node

* chore(releng) bump version to 19.2.1-beta.1

* feat: updated beacon to 4.2.2-beta.4

* Revert "Merge branch 'master' of https://github.com/ecadlabs/taquito into beacon-4.2.2"

This reverts commit caf851a, reversing
changes made to ecd6f5a.

* chore(releng) bump version to 19.2.1-beta.2

* 2958 eventsub (#2960)

* updated taquito-beacon-wallet to use eventsub

* removed comments

* removed console log

* trigger ci build

* updated beacon version to v4.2.2

* chore(releng) bump version to 19.2.1

---------

Co-authored-by: Davis Sawali <davis.sawali@ecadlabs.com>
ac10n pushed a commit that referenced this pull request May 21, 2024
* updated taquito-beacon-wallet to use eventsub

* removed comments

* removed console log

* trigger ci build
ac10n added a commit that referenced this pull request May 21, 2024
* feat: updated beacon to 4.2.2-beta.0

* feat: feat: updated beacon to 4.2.2-beta.1

* feat: feat: updated beacon to 4.2.2-beta.2

* chore(releng) bump version to 19.2.1-beta.0

* feat: updated beacon to 4.2.2-beta.3

* feat: updating to private prc nodes

* reverted config to use public testnets instead

* fix: updating back to public node

* chore(releng) bump version to 19.2.1-beta.1

* feat: updated beacon to 4.2.2-beta.4

* chore(releng) bump version to 19.2.1-beta.2

* 2958 eventsub (#2960)

* updated taquito-beacon-wallet to use eventsub

* removed comments

* removed console log

* trigger ci build

* updated beacon version to v4.2.2

* chore(releng) bump version to 19.2.1

---------

Co-authored-by: huianyang <hui-an.yang@ecadlabs.com>
Co-authored-by: Davis Sawali <davis.sawali@ecadlabs.com>
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.

Update remaining Taquito references of getActiveAccount()
3 participants