claz: do invite file reading in +read-invites
Ensures we read out the invite file in a consistent way
|= [as-who=ship file=path]
=/ m null-glad
=/ friends=(list [=ship @q =address])
- =+ txt=.^((list cord) %cx file)
- %+ murn txt
- |= line=cord
- ^- (unit [ship @q address])
- ?: =('' line) ~
- %- some
- ~| line
- %+ rash line
- ;~ (glue com)
- ;~(pfix sig fed:ag)
- ;~(pfix sig feq:ag)
- ;~(pfix (jest '0x') hex)
- ==
+ (read-invites file)
;< ~ bind:m
%- are-available
(turn friends head)
>missing<
==
::
+:: input file reading
+::
+++ read-invites
+ |= file=path
+ ^- (list [=ship ticket=@q =address])
+ =+ txt=.^((list cord) %cx file)
+ %+ murn txt
+ |= line=cord
+ ^- (unit [ship @q address])
+ ?: =('' line) ~
+ %- some
+ ~| line
+ %+ rash line
+ ;~ (glue com)
+ ;~(pfix sig fed:ag)
+ ;~(pfix sig feq:ag)
+ ;~(pfix (jest '0x') hex)
+ ==
+::
:: transaction generation logic
::
++ deal-with-command
|= [nonce=@ud =network as=address as-who=ship file=path]
^- (list transaction)
=/ friends=(list [=ship @q =address])
- =+ txt=.^((list cord) %cx file)
- %+ turn txt
- |= line=cord
- ~| line
- %+ rash line
- ;~ (glue com)
- ;~(pfix sig fed:ag)
- ;~(pfix sig feq:ag)
- ;~(pfix (jest '0x') hex)
- ==
+ (read-invites file)
=| txs=(list transaction)
|-
?~ friends (flop txs)
