Skip to content

Commit adc3dfa

Browse files
committed
chore: small edits to webauthn tutorial
1 parent 1e52258 commit adc3dfa

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

content/contracts/5.x/learn/webauthn-smart-accounts.mdx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ In a real world application you might use a bundler instead of a server like we
10311031

10321032
Make sure you are in the root directory and run the following command
10331033

1034-
```npm
1034+
```
10351035
pnpm create vite@latest client
10361036
```
10371037

@@ -1067,7 +1067,7 @@ This will be a helper function to help process `BigInt` types that can't be seri
10671067

10681068
Move back out into the main root directory of the tutorial and then run the following command to create a [Hono]() app:
10691069

1070-
```npm
1070+
```
10711071
pnpm create hono@latest server
10721072
```
10731073

@@ -1643,24 +1643,20 @@ app.post("/account/create", async (c) => {
16431643
args: [qx, qy],
16441644
});
16451645

1646-
// Generate random salt
1647-
const accountSalt =
1648-
`0x${Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("hex")}` as Hex;
1649-
16501646
// Predict account address
16511647
const [predictedAddress] = await publicClient.readContract({
16521648
address: FACTORY_ADDRESS,
16531649
abi: accountFactoryAbi,
16541650
functionName: "predictAddress",
1655-
args: [accountSalt, initCallData],
1651+
args: [initCallData],
16561652
});
16571653

16581654
// Deploy the account
16591655
const hash = await walletClient.writeContract({
16601656
address: FACTORY_ADDRESS,
16611657
abi: accountFactoryAbi,
16621658
functionName: "cloneAndInitialize",
1663-
args: [accountSalt, initCallData],
1659+
args: [initCallData],
16641660
});
16651661

16661662
// Wait for transaction
@@ -1688,9 +1684,9 @@ app.post("/account/create", async (c) => {
16881684
});
16891685
```
16901686
1691-
In this endpoint the server parses the JSON body to grab the serialized coordinates of the public key, then we put together what we need to do in order to predict our address. We don't necessarily need this in our flow, but it's good to know how it works. The predicted address is calculated by creating `initCallData` from `initializeWebAuthn` function and the coordiantes we got from the client. We combine that with a random salt that's generated and then we can read the `predictAddress` from the factory.
1687+
In this endpoint the server parses the JSON body to grab the serialized coordinates of the public key, then we put together what we need to do in order to predict our address. We don't necessarily need this in our flow, but it's good to know how it works. The predicted address is calculated by creating `initCallData` from `initializeWebAuthn` function and the coordiantes we got from the client.
16921688
1693-
To actually deploy our smart account we'll take the same `initCallData` and `randomSalt` as arguments, then call `cloneAndInitialize` from the factory. This will return the smart account address, which we can then fund with our server wallet. Finally we can return the result of our process to the client.
1689+
To actually deploy our smart account we'll take the same `initCallData` as the argument, then call `cloneAndInitialize` from the factory. This will return the smart account address, which we can then fund with our server wallet. Finally we can return the result of our process to the client.
16941690
16951691
</Step>
16961692

0 commit comments

Comments
 (0)