2018-09-07 19:29:41 +03:00
|
|
|
::
|
|
|
|
/+ ceremony
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
++ state
|
|
|
|
$: txs=(list @ux)
|
2018-09-12 19:15:46 +03:00
|
|
|
see=(set @ux)
|
|
|
|
wen=@da
|
2018-09-07 19:29:41 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ move (pair bone card)
|
|
|
|
++ card
|
|
|
|
$% [%hiss wire [~ ~] mark %hiss hiss:eyre]
|
|
|
|
[%wait wire @da]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
|_ [bol=bowl:gall state]
|
|
|
|
::
|
2018-09-12 19:15:46 +03:00
|
|
|
++ this .
|
|
|
|
::
|
|
|
|
++ prep
|
|
|
|
|= old=(unit *)
|
|
|
|
[~ ..prep]
|
|
|
|
::
|
2018-09-07 19:29:41 +03:00
|
|
|
++ poke-noun
|
|
|
|
|= a=@t
|
2018-09-12 19:15:46 +03:00
|
|
|
^- [(list move) _this]
|
|
|
|
?. =('start' a) [~ this]
|
|
|
|
~& 'loading txs...'
|
2018-09-07 19:29:41 +03:00
|
|
|
=/ tox=(list cord)
|
|
|
|
.^ (list cord) %cx
|
|
|
|
/(scot %p our.bol)/home/(scot %da now.bol)/txs/txt
|
|
|
|
==
|
|
|
|
=. txs
|
|
|
|
%+ turn tox
|
|
|
|
(cork trip tape-to-ux:ceremony)
|
2018-09-12 19:15:46 +03:00
|
|
|
~& [(lent txs) 'loaded txs']
|
|
|
|
send-next-batch
|
|
|
|
::
|
|
|
|
++ batch-requests
|
|
|
|
|= [wir=wire req=(list [(unit @t) request:ethe])]
|
2018-09-07 19:29:41 +03:00
|
|
|
^- move
|
|
|
|
:- ost.bol
|
2018-09-12 19:15:46 +03:00
|
|
|
:^ %hiss wir [~ ~]
|
2018-09-07 19:29:41 +03:00
|
|
|
:+ %json-rpc-response %hiss
|
|
|
|
%+ json-request:ethereum
|
|
|
|
=+ (need (de-purl:html 'http://localhost:8545'))
|
|
|
|
-(p.p |)
|
2018-09-18 00:04:25 +03:00
|
|
|
a+(turn req request-to-json:ethereum)
|
2018-09-12 19:15:46 +03:00
|
|
|
::
|
|
|
|
++ send-next-batch
|
|
|
|
^- [(list move) _this]
|
|
|
|
?: =(0 (lent txs))
|
|
|
|
~& 'all sent!'
|
|
|
|
[~ this]
|
|
|
|
:_ .(txs (slag 50 txs))
|
2018-09-18 00:04:25 +03:00
|
|
|
~& ['remaining txs: ' (lent txs)]
|
2018-09-12 19:15:46 +03:00
|
|
|
~& 'sending 50 txs...'
|
|
|
|
:_ ~
|
|
|
|
%+ batch-requests /send
|
|
|
|
%+ turn (scag 50 txs)
|
2018-09-07 19:29:41 +03:00
|
|
|
|= tx=@ux
|
2018-09-12 19:15:46 +03:00
|
|
|
:- `'id'
|
2018-09-07 19:29:41 +03:00
|
|
|
[%eth-send-raw-transaction tx]
|
2018-09-12 19:15:46 +03:00
|
|
|
::
|
|
|
|
++ sigh-json-rpc-response-send
|
2018-09-18 00:04:25 +03:00
|
|
|
|= [wir=wire res=response:rpc:jstd]
|
2018-09-12 19:15:46 +03:00
|
|
|
^- [(list move) _this]
|
|
|
|
?> ?=(%batch -.res)
|
|
|
|
=. see
|
|
|
|
%- ~(gas in see)
|
|
|
|
%+ turn bas.res
|
2018-09-18 00:04:25 +03:00
|
|
|
|= r=response:rpc:jstd
|
2018-09-12 19:15:46 +03:00
|
|
|
^- @ux
|
|
|
|
?: ?=(%error -.r)
|
|
|
|
~| :- 'transaction send failed, game over'
|
|
|
|
[code.r message.r]
|
|
|
|
!!
|
|
|
|
?> ?=(%result -.r)
|
|
|
|
%- tape-to-ux:ceremony
|
|
|
|
(sa:dejs:format res.r)
|
|
|
|
(wake-see ~ ~)
|
|
|
|
::
|
|
|
|
++ kick-timer
|
|
|
|
^- [(list move) _this]
|
|
|
|
~& :_ ~(wyt in see)
|
|
|
|
'waiting for transaction confirms... '
|
|
|
|
?: (gth wen now.bol) [~ this]
|
|
|
|
=. wen (add now.bol ~s5) ::TODO more sane/polite value
|
|
|
|
[[ost.bol %wait /see wen]~ this]
|
|
|
|
::
|
|
|
|
++ wake-see
|
|
|
|
|= [wir=wire ~]
|
|
|
|
^- [(list move) _this]
|
|
|
|
:_ this(see ~)
|
|
|
|
:_ ~
|
|
|
|
^- move
|
|
|
|
%+ batch-requests /see
|
|
|
|
%+ turn ~(tap in see)
|
|
|
|
|= txh=@ux
|
|
|
|
:- `(crip '0' 'x' ((x-co:co 64) txh))
|
|
|
|
[%eth-get-transaction-receipt txh]
|
|
|
|
::
|
|
|
|
++ sigh-json-rpc-response-see
|
2018-09-18 00:04:25 +03:00
|
|
|
|= [wir=wire res=response:rpc:jstd]
|
2018-09-12 19:15:46 +03:00
|
|
|
^- [(list move) _this]
|
|
|
|
?> ?=(%batch -.res)
|
|
|
|
=. see
|
|
|
|
%- ~(gas in see)
|
|
|
|
%+ murn bas.res
|
2018-09-18 00:04:25 +03:00
|
|
|
|= r=response:rpc:jstd
|
2018-09-12 19:15:46 +03:00
|
|
|
^- (unit @ux)
|
|
|
|
?< ?=(%batch -.r)
|
|
|
|
=+ txh=(tape-to-ux:ceremony (trip id.r))
|
2018-09-18 00:04:25 +03:00
|
|
|
=* done ~
|
|
|
|
=* wait `txh
|
2018-09-12 19:15:46 +03:00
|
|
|
?: ?=(%error -.r)
|
|
|
|
~& :- 'receipt fetch error'
|
|
|
|
[code.r message.r]
|
2018-09-18 00:04:25 +03:00
|
|
|
wait
|
|
|
|
?~ res.r wait
|
2018-09-12 19:15:46 +03:00
|
|
|
?> ?=(%o -.res.r)
|
|
|
|
?: .= 1
|
|
|
|
%- tape-to-ux:ceremony
|
2018-09-18 00:04:25 +03:00
|
|
|
%- sa:dejs:format
|
|
|
|
(~(got by p.res.r) 'status')
|
|
|
|
done
|
|
|
|
wait
|
2018-09-12 19:15:46 +03:00
|
|
|
?~ see
|
|
|
|
~& 'batch confirmed, next!'
|
|
|
|
send-next-batch
|
|
|
|
kick-timer
|
|
|
|
::
|
|
|
|
++ sigh-tang
|
|
|
|
|= [wir=wire err=tang]
|
|
|
|
~& %sigh-tang
|
|
|
|
~& (slog err)
|
|
|
|
[~ this]
|
2018-09-07 19:29:41 +03:00
|
|
|
--
|