Skip to content

Commit 4b7370a

Browse files
authored
Merge pull request #133 from HerodotusDev/scarb_update
7 - scarb update - examples improved
2 parents b5b0b94 + 5642dad commit 4b7370a

File tree

18 files changed

+4086
-647
lines changed

18 files changed

+4086
-647
lines changed

.tool-versions

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
scarb 2.6.3
2-
starknet-foundry 0.24.0
1+
scarb 2.9.2

Scarb.lock

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Code generated by scarb DO NOT EDIT.
22
version = 1
33

4+
[[package]]
5+
name = "examples"
6+
version = "0.1.0"
7+
dependencies = [
8+
"hdp_cairo",
9+
]
10+
411
[[package]]
512
name = "hdp_cairo"
613
version = "0.1.0"
@@ -10,10 +17,4 @@ name = "modules"
1017
version = "0.1.0"
1118
dependencies = [
1219
"hdp_cairo",
13-
"snforge_std",
1420
]
15-
16-
[[package]]
17-
name = "snforge_std"
18-
version = "0.24.0"
19-
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.24.0#95e9fb09cb91b3c05295915179ee1b55bf923653"

Scarb.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ version = "0.1.0"
44
edition = "2023_11"
55

66
members = [
7+
"examples",
78
"hdp_cairo",
89
"tests",
910
]
1011

1112
[workspace.dependencies]
13+
starknet = "2.9.2"
1214
hdp_cairo = { path = "hdp_cairo" }

examples/Scarb.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "examples"
3+
version = "0.1.0"
4+
edition = "2023_11"
5+
6+
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html
7+
8+
[dependencies]
9+
starknet = { workspace = true }
10+
hdp_cairo = { workspace = true }
11+
12+
[[target.starknet-contract]]
13+
sierra = true
14+
casm = true
15+
casm-add-pythonic-hints = true
16+
17+
[scripts]
18+
test = "snforge test"

examples/compose_hdp_input.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Resolve the absolute path of the compiled class file
4+
compiled_class_path=$(realpath ../target/dev/examples_example.compiled_contract_class.json)
5+
6+
# Check if the file exists
7+
if [ ! -f "$compiled_class_path" ]; then
8+
echo "Error: Compiled class file not found at $compiled_class_path"
9+
exit 1
10+
fi
11+
12+
# Read the contents of the file
13+
compiled_class_content=$(<"$compiled_class_path")
14+
15+
# Define the JSON structure using jq
16+
json_output=$(jq -n \
17+
--argjson compiled_class "$compiled_class_content" \
18+
'{
19+
"params": [],
20+
"compiled_class": $compiled_class
21+
}')
22+
23+
# Specify the output file name
24+
output_file="hdp_input.json"
25+
26+
# Write the JSON to the file
27+
echo "$json_output" > "$output_file"
28+
29+
echo "JSON file created: $output_file"

0 commit comments

Comments
 (0)