Skip to content

Commit

Permalink
fix: removed live
Browse files Browse the repository at this point in the history
  • Loading branch information
isordo committed Sep 26, 2023
1 parent 5eb14b9 commit 472f13d
Show file tree
Hide file tree
Showing 38 changed files with 194 additions and 162 deletions.
4 changes: 2 additions & 2 deletions docs/advanced/custom-block-explorer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Custom Block Explorer

<!-- embedme custom-block-explorer.beacon.ts -->

```ts live
```ts
import {
BlockExplorer,
DAppClient,
Expand Down Expand Up @@ -59,7 +59,7 @@ const dAppClient = new DAppClient({
<!-- embedme custom-block-explorer.taquito.ts -->
```ts live
```ts
import { BlockExplorer, NetworkType, Network } from "@airgap/beacon-sdk";
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced/different-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Make sure the servers you use are whitelisted in the beacon network and federati

<!-- embedme different-node.beacon.ts -->

```ts live
```ts
import { DAppClient } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({
Expand All @@ -30,7 +30,7 @@ try {

<!-- embedme different-node.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";

Expand Down
12 changes: 6 additions & 6 deletions docs/advanced/sdk-info.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Client Info

<!-- embedme info-version.beacon.ts -->

```ts live
```ts
import { BEACON_VERSION, SDK_VERSION } from "@airgap/beacon-sdk";

console.log("SDK Version", SDK_VERSION);
Expand All @@ -17,7 +17,7 @@ console.log("Beacon Version", BEACON_VERSION);

<!-- embedme info-version.taquito.ts -->

```ts live
```ts
import { BEACON_VERSION, SDK_VERSION } from "@airgap/beacon-sdk";

console.log("SDK Version", SDK_VERSION);
Expand All @@ -30,7 +30,7 @@ console.log("Beacon Version", BEACON_VERSION);

<!-- embedme info-client.beacon.ts -->

```ts live
```ts
import { DAppClient } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });
Expand All @@ -41,7 +41,7 @@ console.log(`Connected Peers:`, await dAppClient.getPeers());

<!-- embedme info-client.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";

Expand All @@ -60,7 +60,7 @@ console.log(`Connected Peers:`, await wallet.client.getPeers());

<!-- embedme info-connection.beacon.ts -->

```ts live
```ts
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });
Expand Down Expand Up @@ -94,7 +94,7 @@ console.log("Own Metadata:", ownMetadata);

<!-- embedme info-connection.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";
Expand Down
12 changes: 6 additions & 6 deletions docs/advanced/ui-elements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ You can overwrite all of the default UI elements by doing the following.

<!-- embedme disable-all-ui.beacon.ts -->

```ts live
```ts
import {
BeaconEvent,
DAppClient,
Expand Down Expand Up @@ -137,7 +137,7 @@ try {

<!-- embedme disable-all-ui.taquito.ts -->

```ts live
```ts
import { BeaconEvent, defaultEventCallbacks } from "@airgap/beacon-sdk";
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
Expand Down Expand Up @@ -178,7 +178,7 @@ The same can be achieved without overwriting the default event handler by [subsc

<!-- embedme override-default-event.beacon.ts -->

```ts live
```ts
import {
BeaconEvent,
DAppClient,
Expand Down Expand Up @@ -223,7 +223,7 @@ try {

<!-- embedme override-default-event.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import {
Expand Down Expand Up @@ -283,7 +283,7 @@ If you still want to be notified of the closing of the pairing window, you can d

<!-- embedme override-alert-aborted-handler.beacon.ts -->

```ts live
```ts
import {
BeaconEvent,
DAppClient,
Expand Down Expand Up @@ -337,7 +337,7 @@ try {

<!-- embedme override-alert-aborted-handler.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import {
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/advanced-example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following example will show:

<!-- embedme example-advanced.beacon.ts -->

```ts live
```ts
import {
ColorMode,
DAppClient,
Expand Down Expand Up @@ -97,7 +97,7 @@ await dAppClient.clearActiveAccount();

<!-- embedme example-advanced.taquito.ts -->

```ts live
```ts
import { TezosToolkit } from "@taquito/taquito";
import { BeaconWallet } from "@taquito/beacon-wallet";
import {
Expand Down
100 changes: 66 additions & 34 deletions docs/getting-started/first-dapp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: First dApp
---


import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

Expand All @@ -11,7 +10,7 @@ import TabItem from "@theme/TabItem";
Let's get started with your first dApp. You have to install the necessary dependencies.

<Tabs
groupId="beaconOrTaquito"
groupId="beaconOrTaquito1"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
Expand Down Expand Up @@ -39,9 +38,15 @@ npm install --save @taquito/taquito @taquito/beacon-wallet
You can then import the `beacon-sdk` package and create a `DAppClient` instance. This instance will be used throughout your dApp to interact with the users wallet.
Once created, you can send a permission request to prompt the user to connect to his wallet.



<!-- embedme getting-started-permission-request.beacon.ts -->
<Tabs
groupId="beaconOrTaquito2"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
{ label: "Taquito", value: "taquito" },
]}
>
<TabItem value="beacon">

```ts live
import { DAppClient } from "@airgap/beacon-sdk";
Expand All @@ -57,7 +62,8 @@ try {
}
```

<!-- embedme getting-started-permission-request.taquito.ts -->
</TabItem>
<TabItem value="taquito">

```ts live
import { TezosToolkit } from "@taquito/taquito";
Expand All @@ -77,7 +83,8 @@ try {
}
```


</TabItem>
</Tabs>

After the connection is successfully established and the user has shared his account, the result will be returned.

Expand All @@ -91,9 +98,15 @@ Now let's introduce a check to see if the SDK is already connected to the dApp.
This code should be run after the page is loaded to get the users address and show it in your UI.
If the following code returns an address, there is no need to send another permission request, unless you want to pair a different account.



<!-- embedme getting-started-active-account.beacon.ts -->
<Tabs
groupId="beaconOrTaquito3"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
{ label: "Taquito", value: "taquito" },
]}
>
<TabItem value="beacon">

```ts live
import { DAppClient } from "@airgap/beacon-sdk";
Expand All @@ -113,7 +126,8 @@ if (activeAccount) {
}
```

<!-- embedme getting-started-active-account.taquito.ts -->
</TabItem>
<TabItem value="taquito">

```ts live
import { TezosToolkit } from "@taquito/taquito";
Expand All @@ -136,16 +150,22 @@ if (activeAccount) {
console.log("Not connected!");
}
```


</TabItem>
</Tabs>

The `beacon-sdk` is now fully set up and ready to receive operation requests.

> If you want to add reactivity to your DApp when an active account changes, then you have to subscribe to `BeaconEvent.ACTIVE_ACCOUNT_SET`.


<!-- embedme getting-started-active-account-events.beacon.ts -->
<Tabs
groupId="beaconOrTaquito4"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
{ label: "Taquito", value: "taquito" },
]}
>
<TabItem value="beacon">

```ts live
import { BeaconEvent, DAppClient } from "@airgap/beacon-sdk";
Expand All @@ -164,8 +184,8 @@ if (!activeAccount) {
await dAppClient.requestPermissions();
}
```

<!-- embedme getting-started-active-account-events.taquito.ts -->
</TabItem>
<TabItem value="taquito">

```ts live
import { TezosToolkit } from "@taquito/taquito";
Expand All @@ -182,14 +202,20 @@ wallet.client.subscribeToEvent(BeaconEvent.ACTIVE_ACCOUNT_SET, (account) => {
console.log(`${BeaconEvent.ACTIVE_ACCOUNT_SET} triggered: `, account);
});
```


</TabItem>
</Tabs>

## Operation Request



<!-- embedme getting-started-operation-request.beacon.ts -->
<Tabs
groupId="beaconOrTaquito5"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
{ label: "Taquito", value: "taquito" },
]}
>
<TabItem value="beacon">

```ts live
import { DAppClient, TezosOperationType } from "@airgap/beacon-sdk";
Expand Down Expand Up @@ -220,8 +246,8 @@ const response = await dAppClient.requestOperation({
],
});
```

<!-- embedme getting-started-operation-request.taquito.ts -->
</TabItem>
<TabItem value="taquito">

```ts live
import { TezosToolkit } from "@taquito/taquito";
Expand Down Expand Up @@ -255,14 +281,20 @@ const response = await wallet.sendOperations([
},
]);
```


</TabItem>
</Tabs>

> Alternatively with `BeaconEvent.ACTIVE_ACCOUNT_SET`


<!-- embedme getting-started-operation-request-events.beacon.ts -->
<Tabs
groupId="beaconOrTaquito6"
defaultValue="beacon"
values={[
{ label: "Beacon", value: "beacon" },
{ label: "Taquito", value: "taquito" },
]}
>
<TabItem value="beacon">

```ts live
import {
Expand Down Expand Up @@ -299,8 +331,8 @@ if (!activeAccount) {
await dAppClient.requestPermissions();
}
```

<!-- embedme getting-started-operation-request-events.taquito.ts -->
</TabItem>
<TabItem value="taquito">

```ts live
import { TezosToolkit } from "@taquito/taquito";
Expand Down Expand Up @@ -343,8 +375,8 @@ if (!activeAccount) {
await wallet.client.requestPermissions();
}
```


</TabItem>
</Tabs>

## User Interaction Best Practice

Expand Down
Loading

0 comments on commit 472f13d

Please sign in to comment.