Skip to content

Commit 570ef93

Browse files
Maurice Webergitbook-bot
Maurice Weber
authored andcommitted
GITBOOK-64: fix: version bump-related fixes
1 parent 86e498e commit 570ef93

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

build/your-first-anoma-application/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ import PackageDescription.V2 open;
4343
4444
package : Package :=
4545
defaultPackage@{
46-
name := "hello-world";
46+
name := "simple-hello-world";
4747
dependencies :=
4848
[
49-
github "anoma" "juvix-stdlib" "v0.10.0";
50-
github "anoma" "anoma-applib" "v0.7.1";
51-
github "anoma" "juvix-mtl" "v0.1.1";
49+
github "anoma" "juvix-stdlib" "v0.10.1";
50+
github "anoma" "anoma-applib" "v0.7.2";
51+
github "anoma" "juvix-mtl" "v0.2.1";
5252
];
5353
};
5454
```

build/your-first-anoma-application/run-your-app.md

+42-19
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ Please mind that the `makefile` is temporary and an **artifact of the current st
6363
```makefile
6464
ANOMA_PATH ?= $(error set the ANOMA_PATH variable to a path to an anoma clone)
6565
base-path = .
66-
base = HelloWorld
66+
base = SimpleHelloWorld
6767
get-message = GetMessage
6868

6969
anoma-build-dir = anoma-build
7070
anoma-build = $(anoma-build-dir)/.exists
7171

7272
config = $(anoma-build-dir)/config.yaml
7373

74+
temp-file := $(anoma-build-dir)/temp_line
75+
7476
juvix = $(base-path)/$(base).juvix
7577
nockma = $(anoma-build-dir)/$(base).nockma
7678
proved = $(anoma-build-dir)/$(base).proved.nockma
@@ -79,7 +81,8 @@ get-message-juvix = $(base-path)/$(get-message).juvix
7981
get-message-nockma = $(anoma-build-dir)/$(get-message).nockma
8082
get-message-proved = $(anoma-build-dir)/$(get-message).proved.nockma
8183

82-
last-unspent-resource = $(anoma-build-dir)/last-unspent-resources
84+
unspent-resources = $(anoma-build-dir)/unspent-resources
85+
last-message-txt = $(anoma-build-dir)/last-message.txt
8386

8487
port = $(anoma-build-dir)/port
8588
host = $(anoma-build-dir)/host
@@ -93,13 +96,28 @@ clean:
9396
@juvix clean
9497
@rm -rf $(anoma-build-dir)
9598

96-
.PHONY: start-anoma
97-
start-anoma:
98-
@juvix dev anoma start --anoma-dir $(ANOMA_PATH)
99-
100-
.PHONY: stop-anoma
101-
stop-anoma:
102-
@juvix dev anoma stop
99+
.PHONY: anoma-start
100+
anoma-start:
101+
rm -f $(config)
102+
ifdef ANOMA_DEBUG
103+
cd $(ANOMA_PATH) && \
104+
mix run --no-halt $(root)/../../start-config.exs
105+
else
106+
juvix dev anoma start --force --anoma-dir $(ANOMA_PATH)
107+
endif
108+
109+
.PHONY: anoma-stop
110+
anoma-stop:
111+
ifdef ANOMA_DEBUG
112+
@echo "ANOMA_DEBUG is incompatible with anoma-stop" && false
113+
else
114+
juvix dev anoma stop
115+
endif
116+
117+
.PHONY: $(message-file)
118+
$(message-file): $(anoma-build)
119+
@echo $(message) \
120+
> $(message-file)
103121

104122
$(config): $(anoma-build)
105123
@juvix dev anoma print-config > $(config)
@@ -108,10 +126,15 @@ $(config): $(anoma-build)
108126
add-transaction: $(proved) $(config)
109127
@juvix dev anoma -c $(config) add-transaction $(proved)
110128

111-
.PHONY: get-message
112-
get-message: $(get-message-nockma) $(config) $(last-unspent-resource)
113-
@juvix dev anoma -c $(config) prove $(get-message-nockma) -o $(get-message-proved) --arg 'base64:$(last-unspent-resource)'
114-
@juvix dev nockma encode --cue --from bytes --to bytes < anoma-build/GetMessage.proved.nockma
129+
.PHONY: get-last-message
130+
get-last-message: $(last-message-txt)
131+
@cat $(last-message-txt)
132+
133+
.PHONY: $(last-message-txt)
134+
$(last-message-txt): $(get-message-nockma) $(config) $(unspent-resources)
135+
@tail -n 1 $(unspent-resources) > $(temp-file)
136+
@juvix dev anoma -c $(config) prove $(get-message-nockma) -o $(get-message-proved) --arg 'base64:$(temp-file)'
137+
@juvix dev nockma encode --cue --from bytes --to bytes < anoma-build/GetMessage.proved.nockma > $(last-message-txt)
115138

116139
$(nockma): $(juvix) $(anoma-build)
117140
@juvix compile anoma $(juvix) -o $(nockma)
@@ -122,9 +145,9 @@ $(proved): $(nockma) $(config)
122145
$(get-message-nockma): $(anoma-build) $(get-message-juvix)
123146
@juvix compile anoma $(get-message-juvix) -o $(get-message-nockma)
124147

125-
.PHONY: $(last-unspent-resource)
126-
$(last-unspent-resource): $(anoma-build) $(host) $(port)
127-
@grpcurl -plaintext $$(cat $(host)):$$(cat $(port)) Anoma.Protobuf.IndexerService.ListUnspentResources | jq -r '.unspentResources[-1] // error("no messages exist")' > $(last-unspent-resource)
148+
.PHONY: $(unspent-resources)
149+
$(unspent-resources): $(anoma-build) $(host) $(port)
150+
@grpcurl -plaintext $$(cat $(host)):$$(cat $(port)) Anoma.Protobuf.IndexerService.ListUnspentResources | jq -r '.unspentResources[-1] // error("no messages exist")' > $(unspent-resources)
128151

129152
$(host): $(config)
130153
@yq -r '.url' $(config) | tr -d '\n' > $(host)
@@ -146,7 +169,7 @@ Open a new terminal in your project root:
146169
147170
{% code title="HelloWorld" %}
148171
```bash
149-
make start-anoma # start the Anoma node
172+
make anoma-start # start the Anoma node
150173
```
151174
{% endcode %}
152175

@@ -157,9 +180,9 @@ Now, once the Anoma Client and Node have started in your first terminal which yo
157180
{% code title="HelloWorld" %}
158181
```bash
159182
make add-transaction # Submit the HelloWorld transaction to anoma
160-
make get-message # Get the message from the latest HelloWorld Resource
183+
make get-last-message # Get the message from the latest HelloWorld Resource
161184
# ...
162-
make stop-anoma # stop the Anoma node when you've finished
185+
make anoma-stop # stop the Anoma node when you've finished
163186
make clean # clean up after yourself
164187
```
165188
{% endcode %}

build/your-first-anoma-application/write-projection-function.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import Stdlib.Prelude open;
2222
import Applib open;
2323
2424
--- Extract the message from a HelloWorld ;Resource;
25-
main (encodedResource : Nat) : String :=
26-
encodedResource |> builtinAnomaDecode |> Resource.label |> builtinAnomaDecode;
25+
main (resource : Resource) : String :=
26+
resource |> Resource.label |> builtinAnomaDecode;
2727
```
2828
{% endcode %}
2929

0 commit comments

Comments
 (0)