Skip to content

Commit

Permalink
Merge branch 'main' into device-signer
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Mar 18, 2024
2 parents 3bbd836 + 961655d commit 3c7bf37
Show file tree
Hide file tree
Showing 19 changed files with 22,329 additions and 34 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ version = "0.1.0"
anyhow = "1"
async-trait = "0.1"
base64 = "0.21"
cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.1.8", features = [
"abigen-rs",
cainome = { git = "https://github.com/piniom/cainome", tag="v0.2.4-expand", features = [
"abigen-rs", "expand-expr"
] }
cairo-lang-starknet = "2.4"
cairo-lang-starknet = "2.4.0"
coset = { version = "0.3.4", features = ["std"] }
futures = "0.3"
lazy_static = "1"
Expand All @@ -24,7 +24,7 @@ serde = "1"
serde_json = "1"
sha2 = "0.10"
starknet = "0.8"
starknet-crypto = "0.6"
starknet-crypto = "0.6.1"
thiserror = "1"
toml = "0.8"
u256-literal = "1"
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ config := --account katana-0 \
# Build files helpers.
build := ./target/dev/cartridge_account_
sierra := .contract_class.json
artifacts := ./target/abi/
compiled := .compiled_contract_class.json
store := ./crates/account_sdk/compiled/

# Contract params for deploy.
test_pubkey = 0x1234
katana_0 = 0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973

generate_artifacts:
scarb --manifest-path ./crates/cartridge_account/Scarb.toml build
mkdir -p ${artifacts}
mkdir -p ${store}

jq .abi ${build}Account${sierra} > ${artifacts}account.abi.json
jq .abi ${build}ERC20${sierra} > ${artifacts}erc20.abi.json
jq . ${build}Account${sierra} > ${store}account${sierra}
jq . ${build}ERC20${sierra} > ${store}erc20${sierra}

cp ${build}Account${compiled} ${store}account${compiled}

deploy-katana:
@set -x; \
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,33 @@ The project has a global rust workspace.

This is a rust project, that will eventually be compiled to wasm. It's purpose is to export and test functions for interacting with the custom account contract. The testing framework implemented within uses [dojo/katana](https://github.com/dojoengine/dojo) underneath. Each test starts its own katana network, deploys a contract and performs operations on it. Naturally, you must have `katana` installed to run the tests. You can specify the path to the `katana` executable in the `account_sdk/KatanaConfig.toml` file. Note that if you have `dojo` installed and in `PATH` the path can remain simply as `katana`.

### Running the tests

To run the tests you first have to compile (to sierra and casm) the contract in the `cartidge_account` folder:
### Compiling the cairo code

To build rust you first have to compile cairo. Run

```bash
make
```

in the root directory.

### Commiting changes

The compiled account is stored in the git repository in the `crates/account_sdk/compiled/` folder. To make sure that the tests are run against the most reacent version of the code run `make` in the root repository. The `make` command should also be run before commiting any changes to ensure a valid state of the compiled code.

### Building for web assembly

After you've compiled the cairo code you can compile rust to wasm using

```bash
cargo build -p account-sdk --target wasm32-unknown-unknown --release
```

## Running the tests

Note, that to run the tests you first have to [compile](#compiling-the-cairo-code) (to sierra and casm) the contract in the `cartidge_account` folder.

StarkNet Foundry tests:

```bash
Expand Down
2 changes: 1 addition & 1 deletion crates/account_sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
wasm-webauthn.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 3c7bf37

Please sign in to comment.