@@ -63,14 +63,16 @@ Please mind that the `makefile` is temporary and an **artifact of the current st
63
63
``` makefile
64
64
ANOMA_PATH ?= $(error set the ANOMA_PATH variable to a path to an anoma clone)
65
65
base-path = .
66
- base = HelloWorld
66
+ base = SimpleHelloWorld
67
67
get-message = GetMessage
68
68
69
69
anoma-build-dir = anoma-build
70
70
anoma-build = $(anoma-build-dir ) /.exists
71
71
72
72
config = $(anoma-build-dir ) /config.yaml
73
73
74
+ temp-file := $(anoma-build-dir ) /temp_line
75
+
74
76
juvix = $(base-path ) /$(base ) .juvix
75
77
nockma = $(anoma-build-dir ) /$(base ) .nockma
76
78
proved = $(anoma-build-dir ) /$(base ) .proved.nockma
@@ -79,7 +81,8 @@ get-message-juvix = $(base-path)/$(get-message).juvix
79
81
get-message-nockma = $(anoma-build-dir ) /$(get-message ) .nockma
80
82
get-message-proved = $(anoma-build-dir ) /$(get-message ) .proved.nockma
81
83
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
83
86
84
87
port = $(anoma-build-dir ) /port
85
88
host = $(anoma-build-dir ) /host
@@ -93,13 +96,28 @@ clean:
93
96
@juvix clean
94
97
@rm -rf $(anoma-build-dir )
95
98
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 )
103
121
104
122
$(config ) : $(anoma-build )
105
123
@juvix dev anoma print-config > $(config )
@@ -108,10 +126,15 @@ $(config): $(anoma-build)
108
126
add-transaction : $(proved ) $(config )
109
127
@juvix dev anoma -c $(config ) add-transaction $(proved )
110
128
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 )
115
138
116
139
$(nockma ) : $(juvix ) $(anoma-build )
117
140
@juvix compile anoma $(juvix ) -o $(nockma )
@@ -122,9 +145,9 @@ $(proved): $(nockma) $(config)
122
145
$(get-message-nockma ) : $(anoma-build ) $(get-message-juvix )
123
146
@juvix compile anoma $(get-message-juvix ) -o $(get-message-nockma )
124
147
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 )
128
151
129
152
$(host ) : $(config )
130
153
@yq -r ' .url' $(config ) | tr -d ' \n' > $(host )
@@ -146,7 +169,7 @@ Open a new terminal in your project root:
146
169
147
170
{% code title=" HelloWorld" %}
148
171
` `` bash
149
- make start- anoma # start the Anoma node
172
+ make anoma-start # start the Anoma node
150
173
```
151
174
{% endcode %}
152
175
@@ -157,9 +180,9 @@ Now, once the Anoma Client and Node have started in your first terminal which yo
157
180
{% code title="HelloWorld" %}
158
181
``` bash
159
182
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
161
184
# ...
162
- make stop- anoma # stop the Anoma node when you've finished
185
+ make anoma-stop # stop the Anoma node when you've finished
163
186
make clean # clean up after yourself
164
187
```
165
188
{% endcode %}
0 commit comments