naive: add aggregator sur

This commit is contained in:
yosoyubik 2021-05-21 15:07:08 +02:00
parent 9caa686173
commit 937cc2ce44
5 changed files with 45 additions and 54 deletions

View File

@ -26,6 +26,7 @@
::TODO questions:
:: - it's a bit weird how we just assume the raw and tx in raw-tx to match...
::
/- *aggregator
/+ naive, default-agent, ethereum, dbug, verb
/= ttttt /tests/lib/naive ::TODO use new lib
::
@ -53,27 +54,6 @@
endpoint=@t
==
::
+$ keccak @ux
::
+$ tx-status
$: status=?(%unknown %pending %sending %confirmed %failed)
pointer=(unit l1-tx-pointer)
==
::
+$ l1-tx-pointer
$: =address:ethereum
nonce=@ud
==
::
::TODO cache sender address?
+$ pend-tx [force=? =raw-tx:naive]
::
+$ part-tx
$% [%raw raw=octs]
[%don =tx:naive]
[%ful raw=octs =tx:naive] ::TODO redundant?
==
::
+$ action
$% [%submit force=? sig=@ tx=part-tx]
[%cancel sig=@ keccak=@]
@ -430,7 +410,7 @@
%+ start-thread:spider
/send/(scot %ud nonce)
:- %aggregator-send
!>
!> ^- rpc-send-roll
:* endpoint
contract
chain-id

View File

@ -1,6 +1,6 @@
:: Azimuth JSON-RPC API
::
/- rpc=json-rpc
/- rpc=json-rpc, *aggregator
/+ naive,
azimuth-rpc,
json-rpc,
@ -11,14 +11,6 @@
version,
agentio
|%
:: FIXME: import tx-status, pend-tx from aggregator
::
+$ tx-status
$: status=?(%unknown %pending %sent %confirmed %failed)
tx=(unit @ux)
==
::
+$ pend-tx [force=? =raw-tx:naive]
::
+$ card card:agent:gall
::

View File

@ -1,6 +1,6 @@
:: azimuth-rpc: command parsing and utilities
::
/- rpc=json-rpc
/- rpc=json-rpc, *aggregator
/+ naive, json-rpc
::
=> :: Utilities
@ -19,14 +19,6 @@
%set-spawn-proxy
%set-transfer-proxy
==
:: FIXME: import tx-status, pend-tx from aggregator
::
+$ tx-status
$: status=?(%unknown %pending %sent %confirmed %failed)
tx=(unit @ux)
==
::
+$ pend-tx [force=? =raw-tx:naive]
::
++ from-json
=, dejs-soft:format
@ -266,9 +258,10 @@
%- pairs
:~ ['status' s+status.tx-status]
::
:- 'tx'
?~ tx.tx-status ~
s+(crip "0x{((x-co:co 20) u.tx.tx-status)}")
:- 'pointer'
?~ pointer.tx-status ~
=* pointer u.pointer.tx-status
(ownership address.pointer nonce.pointer)
==
--
::

View File

@ -0,0 +1,35 @@
/+ naive, ethereum
::
|%
+$ keccak @ux
::
+$ tx-status
$: status=?(%unknown %pending %sending %confirmed %failed)
pointer=(unit l1-tx-pointer)
==
::
+$ l1-tx-pointer
$: =address:ethereum
nonce=@ud
==
::
::TODO cache sender address?
+$ pend-tx [force=? =raw-tx:naive]
::
+$ part-tx
$% [%raw raw=octs]
[%don =tx:naive]
[%ful raw=octs =tx:naive] ::TODO redundant?
==
::
+$ rpc-send-roll
$: endpoint=@t
contract=address:ethereum
chain-id=@
pk=@
::
nonce=@ud
next-gas-price=@ud
txs=(list raw-tx:naive)
==
--

View File

@ -1,6 +1,6 @@
:: aggregator/send: send rollup tx
::
/- rpc=json-rpc
/- rpc=json-rpc, *aggregator
/+ naive, ethereum, ethio, strandio
::
=/ gas-limit=@ud 30.000 ::TODO verify, maybe scale with roll size
@ -10,16 +10,7 @@
(keccak-256:keccak:crypto (as-octs:mimes:html 'batch(bytes)'))
::
|= args=vase
=+ !< $: endpoint=@t
contract=address:ethereum
chain-id=@
pk=@
::
nonce=@ud
next-gas-price=@ud
txs=(list raw-tx:naive)
==
args
=+ !<(rpc-send-roll args)
=/ m (strand:strandio ,vase)
|^
^- form:m