You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 20, 2024. It is now read-only.
* Add starkli, scarb compiler version
* Update first_contract.adoc
Update this section according to starkli official website suggestion
* Update first_contract.adoc
We have to make sure that our Starkli compiler version match Scarb compiler version
19
+
20
+
To find the compiler versions supported by Starkli, execute:
21
+
22
+
[source,bash]
23
+
----
24
+
starkli declare --help
25
+
----
26
+
27
+
You'll see a list of possible compiler versions under the `--compiler-version` flag.
28
+
29
+
[source,bash]
30
+
----
31
+
--compiler-version <COMPILER_VERSION>
32
+
Statically-linked Sierra compiler version [possible values: [COMPILER VERSIONS]]]
33
+
----
34
+
35
+
Note that the Scarb compiler version might not align with Starkli's supported versions. To check Scarb's version:
36
+
37
+
[source,bash]
38
+
----
39
+
scarb --version
40
+
----
41
+
42
+
You'll see a list that contains scarb, cairo and sierra version.
43
+
44
+
[source,bash]
45
+
----
46
+
scarb <SCARB VERSION>
47
+
cairo: <COMPILER VERSION>
48
+
sierra: <SIERRA VERSION>
49
+
----
50
+
51
+
If there's a mismatch, it is suggested that you install the version of Scarb that uses the compiler version that Starkli supports. You can find previous releases on https://github.com/software-mansion/scarb/releases[Scarb]'s GitHub repo.
52
+
53
+
To install a specific version, such as 0.6.1, run:
A smart wallet comprises a Signer and an Account Descriptor. The Signer is a smart contract with a private key for signing transactions, while the Account Descriptor is a JSON file detailing the wallet's address and public key.
@@ -211,66 +256,32 @@ With the smart contract compiled, we're ready to declare it using Starkli. Befor
211
256
212
257
There are three main options for RPC providers, sorted by ease of use:
213
258
214
-
. *Starknet Sequencer's Gateway*: The quickest option and the one we'll use in this tutorial. It's the default for Starkli. As you dig deeper into Starknet, consider other options. The Sequencer's Gateway can get overloaded, causing transaction delays and it will be deprecated in the near future.
259
+
. *Starknet Sequencer's Gateway*: The quickest option and it's the default for Starkli for now. The sequencer gateway is deprecated and will be disabled by StarkWare soon. You're strongly recommended to use a third-party JSON-RPC API provider like Infura, Alchemy, or Chainstack.
215
260
. *Infura or Alchemy*: A step up in complexity. You'll need to set up an API key and choose an endpoint. For Infura, it would look like `https://starknet-goerli.infura.io/v3/<API_KEY>`. Learn more in the https://docs.infura.io/networks/starknet/how-to/choose-a-network[Infura documentation].
216
261
. *Your Own Node*: For those who want full control. It's the most complex but offers the most freedom. Check out https://book.starknet.io/chapter_4/node.html[Chapter 4 of the Starknet Book] or https://www.kasar.io/[Kasar] for setup guides.
217
262
218
-
=== Declaring Your Contract
219
-
220
-
Run this command to declare your contract using the default Starknet Sequencer's Gateway:
263
+
In this tutorial, we will use Alchemy. We can set the STARKNET_RPC environment variable to make command invocations easier:
If there's a mismatch, it is suggested that you install the version of Scarb that uses the compiler version that Starkli supports. You can find previous releases on https://github.com/software-mansion/scarb/releases[Scarb]'s GitHub repo.
255
-
256
-
To install a specific version, such as 0.6.1, run:
279
+
According to the STARKNET_RPC url, starkli can recognize the target blockchain network, in this case "goerli", so it is not necessary explicitly specify it.
Unless you're working with custom networks where it's infeasible for Starkli to detect the right compiler version, you shouldn't need to manually choose a version with `--network` and `--compiler-version`.
262
282
263
283
If you encounter an "Error: Invalid contract class," it likely means your Scarb's compiler version is incompatible with Starkli. Follow the steps above to align the versions. Starkli usually supports compiler versions accepted by mainnet, even if Scarb's latest version is not yet compatible.
264
284
265
-
If you're using third-party providers like Infura or Alchemy for your Remote Procedure Call (RPC), the declaration command would be modified to include the `--rpc` flag.
After running the command, you'll receive a contract class hash. This unique hash serves as the identifier for your contract class within Starknet. For example:
275
286
276
287
[source,bash]
@@ -304,8 +315,7 @@ The command would look like this:
304
315
----
305
316
starkli deploy \
306
317
<CLASS_HASH> \
307
-
<CONSTRUCTOR_INPUTS> \
308
-
--network=goerli-1
318
+
<CONSTRUCTOR_INPUTS>
309
319
----
310
320
311
321
Here's a specific example with an actual class hash and constructor inputs (as the owner address use the address of your smart wallet so you can invoke the transfer_ownership function later):
@@ -314,8 +324,7 @@ Here's a specific example with an actual class hash and constructor inputs (as t
After executing the command and entering your password, you should see output like the following:
@@ -344,8 +353,7 @@ The `call` command enables you to query a smart contract function without sendin
344
353
----
345
354
starkli call \
346
355
<CONTRACT_ADDRESS> \
347
-
get_owner \
348
-
--network=goerli-1
356
+
get_owner
349
357
----
350
358
351
359
Replace `<CONTRACT_ADDRESS>` with the address of your contract. The command will return the owner's address, which was initially set during the contract's deployment:
@@ -366,8 +374,7 @@ You can modify the contract's state using the `invoke` command. For example, let
366
374
starkli invoke \
367
375
<CONTRACT_ADDRESS> \
368
376
transfer_ownership \
369
-
<NEW_OWNER_ADDRESS> \
370
-
--network=goerli-1
377
+
<NEW_OWNER_ADDRESS>
371
378
----
372
379
373
380
Replace `<CONTRACT_ADDRESS>` with the address of the contract and `<NEW_OWNER_ADDRESS>` with the address you want to transfer ownership to. If the smart wallet you're using isn't the contract's owner, an error will appear. Note that the initial owner was set when deploying the contract:
@@ -394,8 +401,7 @@ To verify that the ownership has successfully transferred, you can call the `get
394
401
----
395
402
starkli call \
396
403
<CONTRACT_ADDRESS> \
397
-
get_owner \
398
-
--network=goerli-1
404
+
get_owner
399
405
----
400
406
401
407
If the function returns the new owner's address, the transfer was successful.
0 commit comments