Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update overview docs #735

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
49baf23
feat: update format and add api
ericnordelo Aug 23, 2023
6ba12a9
fix: typo
ericnordelo Aug 23, 2023
38a7363
feat: add counterfactual deployment doc
ericnordelo Aug 24, 2023
06d3384
feat: add API entries
ericnordelo Aug 24, 2023
48e77cf
feat: add events
ericnordelo Aug 24, 2023
2cce06a
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 25, 2023
71cc37d
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 25, 2023
a34020e
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 25, 2023
60305e7
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 25, 2023
2223482
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 25, 2023
1ae6d18
feat: update from reviews
ericnordelo Aug 25, 2023
849739d
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Aug 25, 2023
7a9f38e
feat: apply review updates
ericnordelo Aug 25, 2023
2c3b734
feat: update docs
ericnordelo Aug 30, 2023
fbc18fb
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
b235619
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
13248e4
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
cdf7bd2
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
bea7e8d
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
437b196
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
d3ffdf4
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
0d8bdce
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
964e58b
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
99fa76f
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
e5afaeb
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
56715e7
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
a596957
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Aug 31, 2023
c5d1466
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 31, 2023
022d8bd
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 31, 2023
4ede5cc
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 31, 2023
f007a1f
Update docs/modules/ROOT/pages/guides/deployment.adoc
ericnordelo Aug 31, 2023
76ce366
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
207662c
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
699a27a
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
29b23f4
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
19b8372
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
d909516
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
8c23b4c
feat: apply review updates
ericnordelo Aug 31, 2023
8741eea
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Aug 31, 2023
501b241
fix: account casing
ericnordelo Aug 31, 2023
5b33694
feat: add headers
ericnordelo Aug 31, 2023
e781bfd
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Aug 31, 2023
7fdf47b
feat: add link
ericnordelo Aug 31, 2023
448a015
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Aug 31, 2023
77da367
feat: move API
ericnordelo Sep 1, 2023
76fd058
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Sep 11, 2023
0342dfc
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Sep 11, 2023
7e5a3ec
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Sep 11, 2023
f3cccac
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Sep 11, 2023
0f4583d
refactor: update wording
ericnordelo Sep 11, 2023
7a2db69
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Sep 11, 2023
55287f4
Merge branch 'cairo-2' of github.com:OpenZeppelin/cairo-contracts int…
ericnordelo Sep 11, 2023
039fb1f
Update docs/antora.yml
ericnordelo Sep 11, 2023
2f51db7
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Sep 11, 2023
bf2543c
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Sep 11, 2023
eba2992
feat: apply update reviews
ericnordelo Sep 11, 2023
0fe2d86
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Sep 11, 2023
694b3a2
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Sep 11, 2023
5de23f2
refactor: UI
ericnordelo Sep 11, 2023
717f548
fix: UI
ericnordelo Sep 11, 2023
a5d6f94
feat: focus on SRC6
ericnordelo Sep 11, 2023
184b536
Update docs/modules/ROOT/pages/accounts.adoc
ericnordelo Sep 14, 2023
3755397
Merge branch 'feat/update-account-docs-#560' into feat/update-overvie…
ericnordelo Sep 14, 2023
648f8f0
feat: update overview
ericnordelo Sep 14, 2023
000672a
feat: apply review updates
ericnordelo Sep 15, 2023
caea081
Merge branch 'feat/update-account-docs-#560' of github.com:ericnordel…
ericnordelo Sep 15, 2023
6831345
Merge branch 'feat/update-account-docs-#560' into feat/update-overvie…
ericnordelo Sep 15, 2023
32fe871
Update docs/modules/ROOT/pages/index.adoc
ericnordelo Sep 15, 2023
4260bb6
feat: apply review updates
ericnordelo Sep 15, 2023
a6abfb8
Merge branch 'feat/update-overview-docs-#727' of github.com:ericnorde…
ericnordelo Sep 15, 2023
511c6fd
Update docs/modules/ROOT/pages/index.adoc
ericnordelo Sep 18, 2023
3f36ccd
feat: apply review updates
ericnordelo Sep 18, 2023
9907ecc
Merge branch 'feat/update-overview-docs-#727' of github.com:ericnorde…
ericnordelo Sep 18, 2023
0008cd9
Merge branch 'cairo-2' of github.com:OpenZeppelin/cairo-contracts int…
ericnordelo Sep 18, 2023
92abbc2
Update docs/modules/ROOT/pages/index.adoc
ericnordelo Sep 19, 2023
922ebda
Merge branch 'cairo-2' of github.com:OpenZeppelin/cairo-contracts int…
ericnordelo Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/modules/ROOT/pages/accounts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ In this section we will describe the methods that the protocol uses for abstract
are required for enabling accounts to be used for executing transactions. The rest are optional:

1. `\\__validate__` verifies the validity of the transaction to be executed. This is usually used to validate signatures,
but following the account abstraction design, the entrypoint implementation can be customized to feature any
validation mechanism.
but the entrypoint implementation can be customized to feature any validation mechanism https://docs.starknet.io/documentation/architecture_and_concepts/Accounts/validate_and_execute/#validate_limitations[with some limitations].

2. `\\__execute__` executes the transaction if the validation is successful.

Expand All @@ -88,8 +87,7 @@ meant to declare other contracts.

4. `\\__validate_deploy__` optional entrypoint similar to `\\__validate__` but meant for {counterfactual}.

NOTE: Even though these entrypoints _can_ be called directly at the contract level, they are not designed for that,
but to be called by the Starknet OS in the transaction execution flow.
NOTE: Although these entrypoints are available to the protocol for its regular transaction flow, they can also be called like any other method.

== Deploying an account

Expand Down
2 changes: 0 additions & 2 deletions docs/modules/ROOT/pages/api/account.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Reference of interfaces, presets, and utilities related to account contracts.
[[ISRC6]]
=== `++ISRC6++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/cairo-2/src/account/interface.cairo#L12[{github-icon},role=heading-link]

[.hljs-theme-light.nopadding]
```javascript
use openzeppelin::account::interface::ISRC6;
```
Expand Down Expand Up @@ -62,7 +61,6 @@ Returns the short string `'VALID'` if valid, otherwise it reverts.
:OwnerAdded: xref:Account-OwnerAdded[OwnerAdded]
:OwnerRemoved: xref:Account-OwnerRemoved[OwnerRemoved]

[.hljs-theme-light.nopadding]
```javascript
use openzeppelin::account::Account;
```
Expand Down
44 changes: 29 additions & 15 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

WARNING: This repo contains highly experimental code. Expect rapid iteration. *Use at your own risk.*

== Overview

=== Installation
== Installation

The library is available as a {scarb} package. Follow {installation} for installing Cairo and Scarb on your machine
before proceeding, and run the following command to check that the installation was successful:
Expand All @@ -24,17 +22,23 @@ cairo: 2.2.0 (https://crates.io/crates/cairo-lang-compiler/2.2.0)
sierra: 1.3.0
----

==== Set up your project
=== Set up your project

Create an empty directory, and `cd` into it:

[,bash]
----
mkdir my_project/ && cd my_project/
----

Create an empty directory, then `cd` into it, and initialize a new scarb project by running:
Initialize a new Scarb project:

[,bash]
----
mkdir my_project && cd my_project
scarb init
----

The contents of `my_project` should now look like this:
The contents of `my_project/` should now look like this:

[,bash]
----
Expand All @@ -43,21 +47,22 @@ $ ls
Scarb.toml src
----

==== Install the library
=== Install the library

Add the library to your project be adding the openzeppelin dependency to the `Scarb.toml` file:
Install the library by declaring it as a dependency in the project's `Scarb.toml` file:

[,text]
----
[dependencies]
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.7.0" }
----

WARNING: Make sure the correct tag matching the release is selected.
WARNING: Make sure the tag matches the target release.

=== Basic usage
== Basic usage

Copy the following account contract code into `src/lib.cairo`, and run `scarb build` to compile it:
This is how it looks to build an account contract using the xref:accounts.adoc[account module].
Copy the code into `src/lib.cairo`.

[,javascript]
----
Expand All @@ -67,16 +72,18 @@ mod MyAccount {
use openzeppelin::account::account::PublicKeyTrait;
use openzeppelin::account::interface;
use openzeppelin::introspection::interface::ISRC5;
use openzeppelin::introspection::src5::SRC5;
use starknet::account::Call;

// Storage members used by this contract are defined in each imported
// module whose `unsafe_state` is used. This design will be improved
// with the addition of components in the future.
#[storage]
struct Storage {}
ericnordelo marked this conversation as resolved.
Show resolved Hide resolved

#[constructor]
fn constructor(ref self: ContractState, _public_key: felt252) {
fn constructor(ref self: ContractState, public_key: felt252) {
let mut unsafe_state = _unsafe_state();
Account::InternalImpl::initializer(ref unsafe_state, _public_key);
Account::InternalImpl::initializer(ref unsafe_state, public_key);
}

#[external(v0)]
Expand Down Expand Up @@ -133,3 +140,10 @@ mod MyAccount {
}
}
----

You can now compile it:

[,bash]
----
scarb build
----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's maintain the consistency and use backticks for codeblock. I used --- in my suggestion just to illustrate because it conflicts with github's markdown

Copy link
Member Author

@ericnordelo ericnordelo Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean, we've been using ---- for multiple-lines code blocks even for the previous doc version, and also in solidity docs. We use backticks for single-line code blocks. Am I missing something?