Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
omarespejel committed Aug 24, 2023
2 parents def25bd + 565b832 commit 58e9195
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.2.108](https://github.com/starknet-edu/starknetbook/compare/v1.2.107...v1.2.108) (2023-08-24)

### [1.2.107](https://github.com/starknet-edu/starknetbook/compare/v1.2.106...v1.2.107) (2023-08-11)

### [1.2.106](https://github.com/starknet-edu/starknetbook/compare/v1.2.105...v1.2.106) (2023-08-11)

### [1.2.105](https://github.com/starknet-edu/starknetbook/compare/v1.2.104...v1.2.105) (2023-08-11)
Expand Down
52 changes: 22 additions & 30 deletions chapters/book/modules/chapter_1/pages/first_contract.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ starkli account fetch --help
Fetch account config from an already deployed account contract
----

Currently, the "fetch" command does not support Braavos or Argent X smart wallets. However, there's an open PR to add this functionality. For now, we have to create the account descriptor file manually.

Currently, the "fetch" command does support Braavos or Argent X smart wallets. Make sure your wallet address is already deployed and input following command to create and save the account descriptor file.

[source,shell]
----
touch ~/.starkli-wallets/deployer/account.json
starkli account fetch <SMART_WALLET_ADDRESS> ~/.starkli-wallets/deployer/account.json
----

You can see the details of the account descriptor with the following command.

[source,shell]
----
cat ~/.starkli-wallets/deployer/account.json
----

The account descriptor should have the following structure:
Expand All @@ -70,9 +78,11 @@ The account descriptor should have the following structure:
{
"version": 1,
"variant": {
"type": "open_zeppelin",
"type": "argent",
"version": 1,
"public_key": "<SMART_WALLET_PUBLIC_KEY>"
"implementation": "<ARGENT_CLASS_HASH>",
"signer": "<SMART_WALLET_PUBLIC_KEY>",
"guardian": "0x0"
},
"deployment": {
"status": "deployed",
Expand All @@ -82,25 +92,7 @@ The account descriptor should have the following structure:
}
----

Edit the file with the right fields for the public key, class hash, and address. Here is how to find them:

The public key was returned by the "starkli signer keystore from-key ~/.starkli-wallets/deployer/keystore.json" command. However, you can also find it using the following command and writing the password you used to create the keystore file:

[source,shell]
----
starkli signer keystore inspect ~/.starkli-wallets/deployer/keystore.json
----

The address is the address of your smart wallet. You can find it in the Braavos or Argent X browser extensions. Then use this address to fetch the class hash of your smart wallet with the following Starkli command:

[source,shell]
----
starkli class-hash-at <SMART_WALLET_ADDRESS>
----

You might be wondering why the type is defined as "open_zeppelin" even though we're working with a Braavos wallet. This is because the CLI uses Open Zeppelin's default algorithm to sign transactions, which happens to be the same one used by Braavos and Argent X by default.

However, note that a Braavos smart wallet with a hardware signer enabled will not work in this context, as a hardware signer uses a different elliptic curve to sign transactions.
If you are working with Braavos wallet, the type is defined as "braavos" and the account descriptor strcuture might be slightly different.

== Setting up Environment Variables

Expand Down Expand Up @@ -148,10 +140,10 @@ Here's the structure for the declaration command using the Starknet Sequencer's

[source,bash]
----
starkli declare target/dev/contracts_Ownable.sierra.json --network=goerli-1 --compiler-version=2.0.1
starkli declare target/dev/contracts_Ownable.sierra.json --network=goerli-1 --compiler-version=2.1.0
----

The network flag is used to specify the network you want to use, it could also be "mainnet" for example. The compiler-version flag is used to specify the version of the compiler you want to use. Starkli is currently running on version 2.0.1 of the compiler. You can know the compiler version supported by Starkli by running:
The network flag is used to specify the network you want to use, it could also be "mainnet" for example. The compiler-version flag is used to specify the version of the compiler you want to use. Starkli is currently running on version 2.1.0 and 2.0.1 of the compiler. You can know the compiler version supported by Starkli by running:

[source,bash]
----
Expand All @@ -163,21 +155,21 @@ In the --compiler-version flag you will see possible versions of the compiler:
[source,bash]
----
--compiler-version <COMPILER_VERSION>
Statically-linked Sierra compiler version [possible values: 2.0.1]
Statically-linked Sierra compiler version [possible values: 2.0.1, 2.1.0]
----

However, it could be that the Scarb compiler version is 2.0.2, you can know this by running:
However, it could be that the Scarb compiler version is 2.2.0, you can know this by running:

[source,bash]
----
scarb --version
----

This is because Starkli and Scarb are not always in sync. In this case you would need to use the compiler version that Starkli is using by installing a previous version of Scarb (check out the releases in the https://github.com/software-mansion/scarb/releases[Scarb github repo]). For example, you can do this by running the following command for installing Scarb version 0.5.1:
This is because Starkli and Scarb are not always in sync. In this case you would need to use the compiler version that Starkli is using by installing a previous version of Scarb (check out the releases in the https://github.com/software-mansion/scarb/releases[Scarb github repo]). For example, you can do this by running the following command for installing Scarb version 0.6.1:

[source,bash]
----
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 0.5.1
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 0.6.1
----

If you get an error "Error: Invalid contract class", it means that you are using a version of Scarb that is not supported by Starkli. In this case, you need to install a previous version of Scarb as explained above.
Expand All @@ -188,7 +180,7 @@ If you were using a provider like Infura or Alchemy, the declaration command wou
----
starkli declare target/dev/contracts_Ownable.sierra.json \
--rpc=https://starknet-goerli.infura.io/v3/<API_KEY> \
--compiler-version=2.0.1
--compiler-version=2.1.0
----

The result of the declaration command is a contract class hash (Class hash declared:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"simple-git": "^3.15.0",
"standard-version": "^9.3.2"
},
"version": "1.2.106"
"version": "1.2.108"
}

0 comments on commit 58e9195

Please sign in to comment.