Skip to content

Commit

Permalink
fix: wallet.client missing in taquito's examples
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaccoSordo committed Aug 7, 2024
1 parent 4bd665a commit c2dd231
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/docs/getting-started/subscribe-to-active-account.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Sometimes `requestPermissions` may not be enough, and you want to ensure the use
dAppClient.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account) {
Expand Down Expand Up @@ -108,23 +108,23 @@ wallet.client.subscribeToEvent(
async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account) {
return;
}

try {
await dAppClient.requestSignPayload({
await wallet.client.requestSignPayload({
payload:
"05010000004254657a6f73205369676e6564204d6573736167653a207465737455726c20323032332d30322d30385431303a33363a31382e3435345a2048656c6c6f20576f726c64",
});
} catch (err: any) {
// The request was rejected
// handle disconnection
}
},
}
);
```

Expand Down Expand Up @@ -229,7 +229,7 @@ Now, inside the handler, check whether the current tab has the leadership. If no
dAppClient.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account || !elector.isLeader) {
Expand Down Expand Up @@ -257,23 +257,23 @@ wallet.client.subscribeToEvent(
async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account || !elector.isLeader) {
return;
}

try {
await dAppClient.requestSignPayload({
await wallet.client.requestSignPayload({
payload:
"05010000004254657a6f73205369676e6564204d6573736167653a207465737455726c20323032332d30322d30385431303a33363a31382e3435345a2048656c6c6f20576f726c64",
});
} catch (err: any) {
// The request was rejected
// handle disconnection
}
},
}
);
```

Expand Down Expand Up @@ -333,7 +333,7 @@ const dAppClient = new DAppClient({
dAppClient.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account || !elector.isLeader) {
Expand All @@ -360,6 +360,7 @@ dAppClient.requestPermissions();
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import { BeaconEvent } from "@airgap/beacon-dapp";}
import { BroadcastChannel, createLeaderElection } from "broadcast-channel";

const channel = new BroadcastChannel("beacon-test");
Expand Down Expand Up @@ -396,23 +397,23 @@ wallet.client.subscribeToEvent(
async (account) => {
console.log(
`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `,
account?.address,
account?.address
);

if (!account || !elector.isLeader) {
return;
}

try {
await dAppClient.requestSignPayload({
await wallet.client.requestSignPayload({
payload:
"05010000004254657a6f73205369676e6564204d6573736167653a207465737455726c20323032332d30322d30385431303a33363a31382e3435345a2048656c6f20576f726c64",
});
} catch (err: any) {
// The request was rejected
// handle disconnection
}
},
}
);

wallet.client.requestPermissions();
Expand Down

0 comments on commit c2dd231

Please sign in to comment.