Skip to content
2 changes: 1 addition & 1 deletion docs/build/apps/guestbook/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ sidebar_position: 57

import DocCardList from "@theme/DocCardList";

This section walks you through designing and building a decentralized application (dapp) that interacts with a smart contract guestbook, allowing users to read and write public messages. This tutorial also implements a passkey-powered smart wallet for user authentication.
This section walks you through designing and building a decentralized application (dapp) that interacts with a smart contract guestbook, allowing users to read and write public messages. The tutorial also implements a passkey-powered smart wallet for user authentication, using [Smart Account Kit](https://github.com/stellar/smart-account-kit), the [OpenZeppelin Smart Account](https://docs.openzeppelin.com/stellar-contracts/accounts/smart-account), and the [OpenZeppelin Relayer (Stellar Channels plugin)](https://docs.openzeppelin.com/relayer/1.4.x/guides/stellar-channels-guide).

<DocCardList />
25 changes: 13 additions & 12 deletions docs/build/apps/guestbook/bindings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,28 @@ We're straying just a _bit_ into the Svelte-ish side of things here. The main go

Now, we'll define the contract client in a way we can easily access it through the rest of our app.

```js title="src/lib/contracts/ye_olde_guestbook.ts"
import * as Client from "ye_olde_guestbook"; // import the package we just added as a dependency
import { PUBLIC_STELLAR_RPC_URL } from "$env/static/public"; // import the RPC url from the .env file

// instantiate and export the Client class from the bindings package
export default new Client.Client({
...Client.networks.testnet, // this includes the contract address and network passphrase
rpcUrl: PUBLIC_STELLAR_RPC_URL, // this is required to invoke the contract through RPC calls
```ts title="src/lib/contracts/ye_olde_guestbook.ts"
import { Client, networks } from "ye_olde_guestbook";
import { PUBLIC_STELLAR_RPC_URL } from "$env/static/public";

// `networks.testnet` contains the contract address and network passphrase
// baked in at bindings-generation time.
export default new Client({
...networks.testnet,
rpcUrl: PUBLIC_STELLAR_RPC_URL,
});
```

### The automated way

That was a lot of steps and a lot of work wasn't it!? The good news is that our starter template (remember that?) comes with an `initialize.js` script that will perform all of those actions for you! This script will go through all the following steps for you:
That was a lot of steps and a lot of work wasn't it!? The good news is that the guestbook repo ships with an `initialize.js` script that performs all of those actions for you. This script will:

- Create and fund a keypair in the CLI
- Install and deploy **all contracts** in the `/contracts` directory
- Generate bindings from the deployed contracts
- Create a `$lib/contracts/<contract_alias>.ts` file for easy import into your frontend code

You can always customize this script to suit your needs. Check out the [source code here](https://github.com/ElliotFriend/soroban-template-sveltekit-passkeys/blob/main/initialize.js) (which has been documented with comments). Or, you can see the [officially maintained script](https://github.com/stellar/soroban-template-astro/blob/main/initialize.js) in the [`soroban-template-astro` repository](https://github.com/stellar/soroban-template-astro), as well.
You can always customize this script to suit your needs. See the [source code in the guestbook repo](https://github.com/AshFrancis/ye-olde-guestbook/blob/main/initialize.js) (which is documented with comments), or the [officially maintained version](https://github.com/stellar/soroban-template-astro/blob/main/initialize.js) in the [`soroban-template-astro` repository](https://github.com/stellar/soroban-template-astro).

Run the initialization script like so:

Expand All @@ -124,6 +125,6 @@ We've also added a command to the `package.json` scripts, so you can run this in
pnpm run setup
```

Right, so we've now created a starter project, written a guestbook smart contract, and generated an NPM package that will help us interact with that contract on the network. Amazing!
Right, so we've now cloned the starter project, written a guestbook smart contract, and generated an NPM package that will help us interact with that contract on the network. Amazing!

Next up, let's take a look at how our users will connect with and interact with our dapp. It's time for passkeys! (insert air horn noises)📢
Next up, let's set up the prerequisites for our passkey-powered smart wallets — the OpenZeppelin Relayer API key and a funder account.
Loading
Loading