From f36074c903727b1e940eeefa1e4d942d0a5f1b59 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Tue, 9 Apr 2024 15:25:40 -0700 Subject: [PATCH 1/5] updated taquito/beacon-wallet readme to match current beacon implementation --- packages/taquito-beacon-wallet/README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/taquito-beacon-wallet/README.md b/packages/taquito-beacon-wallet/README.md index c8c0c170e0..b24e4ab6e1 100644 --- a/packages/taquito-beacon-wallet/README.md +++ b/packages/taquito-beacon-wallet/README.md @@ -26,7 +26,7 @@ import { BeaconWallet } from '@taquito/beacon-wallet'; const options = { name: 'MyAwesomeDapp', iconUrl: 'https://taquito.io/img/favicon.svg', - preferredNetwork: 'chosen_network', + network: { type: 'ghostnet' }, eventHandlers: { PERMISSION_REQUEST_SUCCESS: { handler: async (data) => { @@ -34,15 +34,19 @@ const options = { }, }, }, + enableMetrics: true, }; const wallet = new BeaconWallet(options); -// The Beacon wallet requires an extra step to set up the network to connect to and the permissions: -await wallet.requestPermissions({ - network: { - type: 'chosen_network', +await wallet.requestPermissions(); + +wallet.client.subscribeToEvent( + BeaconEvent.ACTIVE_ACCOUNT_SET, + async (account) => { + // An active account has been set, update the dApp UI + console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); }, -}); +); const Tezos = new TezosToolkit('https://YOUR_PREFERRED_RPC_URL'); Tezos.setWalletProvider(wallet); From 410e832fb1fdddf3bf987240a67022bc62ec51ea Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Wed, 10 Apr 2024 14:54:08 -0700 Subject: [PATCH 2/5] addressed PR comments --- packages/taquito-beacon-wallet/README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/taquito-beacon-wallet/README.md b/packages/taquito-beacon-wallet/README.md index b24e4ab6e1..3863baa2d3 100644 --- a/packages/taquito-beacon-wallet/README.md +++ b/packages/taquito-beacon-wallet/README.md @@ -27,20 +27,13 @@ const options = { name: 'MyAwesomeDapp', iconUrl: 'https://taquito.io/img/favicon.svg', network: { type: 'ghostnet' }, - eventHandlers: { - PERMISSION_REQUEST_SUCCESS: { - handler: async (data) => { - console.log('permission data:', data); - }, - }, - }, enableMetrics: true, }; const wallet = new BeaconWallet(options); await wallet.requestPermissions(); -wallet.client.subscribeToEvent( +await wallet.client.subscribeToEvent( BeaconEvent.ACTIVE_ACCOUNT_SET, async (account) => { // An active account has been set, update the dApp UI From eb3723e3aedf7dffd3408e71662ce1de5ad14e0d Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Wed, 10 Apr 2024 15:01:32 -0700 Subject: [PATCH 3/5] updated originate.md --- docs/originate.md | 16 ++++++++++++---- .../versioned_docs/version-19.2.0/originate.md | 14 +++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/originate.md b/docs/originate.md index dcf279f65e..fe402c2b18 100644 --- a/docs/originate.md +++ b/docs/originate.md @@ -46,10 +46,18 @@ importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); -const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true} -const wallet = new BeaconWallet(option) -await wallet.requestPermissions() -Tezos.setWalletProvider(wallet) +const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true}; +const wallet = new BeaconWallet(option); +await wallet.requestPermissions(); +Tezos.setWalletProvider(wallet); + +await wallet.client.subscribeToEvent( + BeaconEvent.ACTIVE_ACCOUNT_SET, + async (account) => { + // An active account has been set, update the dApp UI + console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); + }, + ``` diff --git a/website/versioned_docs/version-19.2.0/originate.md b/website/versioned_docs/version-19.2.0/originate.md index dcf279f65e..ae0758f2be 100644 --- a/website/versioned_docs/version-19.2.0/originate.md +++ b/website/versioned_docs/version-19.2.0/originate.md @@ -46,9 +46,17 @@ importKey(Tezos, "p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1") import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); -const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true} -const wallet = new BeaconWallet(option) -await wallet.requestPermissions() +const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true}; +const wallet = new BeaconWallet(option); +await wallet.requestPermissions(); + +await wallet.client.subscribeToEvent( + BeaconEvent.ACTIVE_ACCOUNT_SET, + async (account) => { + // An active account has been set, update the dApp UI + console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); + }, + Tezos.setWalletProvider(wallet) ``` From 78c5fdeb451d28d72aab65c58957d7aafc86fa5a Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 11 Apr 2024 10:49:02 -0700 Subject: [PATCH 4/5] remove eventHandlers property --- docs/wallet_API.md | 7 ------- website/versioned_docs/version-19.2.0/wallet_API.md | 7 ------- 2 files changed, 14 deletions(-) diff --git a/docs/wallet_API.md b/docs/wallet_API.md index f1ca4e50fc..f73f5d32e9 100644 --- a/docs/wallet_API.md +++ b/docs/wallet_API.md @@ -64,13 +64,6 @@ const options = { name: 'MyAwesomeDapp', iconUrl: 'https://taquito.io/img/favicon.svg', network: { type: 'ghostnet' }, - eventHandlers: { - PERMISSION_REQUEST_SUCCESS: { - handler: async (data) => { - console.log('permission data:', data); - }, - }, - }, enableMetrics: true, }; const wallet = new BeaconWallet(options); diff --git a/website/versioned_docs/version-19.2.0/wallet_API.md b/website/versioned_docs/version-19.2.0/wallet_API.md index f1ca4e50fc..f73f5d32e9 100644 --- a/website/versioned_docs/version-19.2.0/wallet_API.md +++ b/website/versioned_docs/version-19.2.0/wallet_API.md @@ -64,13 +64,6 @@ const options = { name: 'MyAwesomeDapp', iconUrl: 'https://taquito.io/img/favicon.svg', network: { type: 'ghostnet' }, - eventHandlers: { - PERMISSION_REQUEST_SUCCESS: { - handler: async (data) => { - console.log('permission data:', data); - }, - }, - }, enableMetrics: true, }; const wallet = new BeaconWallet(options); From 7e890893ac3e70b70438b6eb8e758a0328317ac8 Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Thu, 11 Apr 2024 13:35:22 -0700 Subject: [PATCH 5/5] updated wrong order on wallet initialization docs --- docs/originate.md | 4 ++-- packages/taquito-beacon-wallet/README.md | 3 +-- website/versioned_docs/version-19.2.0/originate.md | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/originate.md b/docs/originate.md index fe402c2b18..5ee4d99235 100644 --- a/docs/originate.md +++ b/docs/originate.md @@ -48,8 +48,6 @@ import { TezosToolkit } from '@taquito/taquito'; const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true}; const wallet = new BeaconWallet(option); -await wallet.requestPermissions(); -Tezos.setWalletProvider(wallet); await wallet.client.subscribeToEvent( BeaconEvent.ACTIVE_ACCOUNT_SET, @@ -58,6 +56,8 @@ await wallet.client.subscribeToEvent( console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); }, +await wallet.requestPermissions(); +Tezos.setWalletProvider(wallet); ``` diff --git a/packages/taquito-beacon-wallet/README.md b/packages/taquito-beacon-wallet/README.md index 3863baa2d3..278fdd2231 100644 --- a/packages/taquito-beacon-wallet/README.md +++ b/packages/taquito-beacon-wallet/README.md @@ -31,8 +31,6 @@ const options = { }; const wallet = new BeaconWallet(options); -await wallet.requestPermissions(); - await wallet.client.subscribeToEvent( BeaconEvent.ACTIVE_ACCOUNT_SET, async (account) => { @@ -40,6 +38,7 @@ await wallet.client.subscribeToEvent( console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); }, ); +await wallet.requestPermissions(); const Tezos = new TezosToolkit('https://YOUR_PREFERRED_RPC_URL'); Tezos.setWalletProvider(wallet); diff --git a/website/versioned_docs/version-19.2.0/originate.md b/website/versioned_docs/version-19.2.0/originate.md index ae0758f2be..9fd1899732 100644 --- a/website/versioned_docs/version-19.2.0/originate.md +++ b/website/versioned_docs/version-19.2.0/originate.md @@ -48,7 +48,6 @@ import { TezosToolkit } from '@taquito/taquito'; const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com'); const option = { name: "nameOfWallet", network: { type: 'ghostnet' }, enableMetrics: true}; const wallet = new BeaconWallet(option); -await wallet.requestPermissions(); await wallet.client.subscribeToEvent( BeaconEvent.ACTIVE_ACCOUNT_SET, @@ -56,7 +55,8 @@ await wallet.client.subscribeToEvent( // An active account has been set, update the dApp UI console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account); }, - + +await wallet.requestPermissions(); Tezos.setWalletProvider(wallet) ```