2021-05-14 10:46:36 +03:00
|
|
|
:: azimuth-rpc: command parsing and utilities
|
|
|
|
::
|
2021-07-22 07:34:42 +03:00
|
|
|
/- rpc=json-rpc, *dice
|
2021-06-04 12:41:59 +03:00
|
|
|
/+ naive, json-rpc, lib=naive-transactions
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
=> :: Utilities
|
|
|
|
::
|
|
|
|
|%
|
2021-05-17 18:49:41 +03:00
|
|
|
+$ spawn-action
|
|
|
|
$? %escape
|
|
|
|
%cancel-escape
|
|
|
|
%adopt
|
|
|
|
%reject
|
|
|
|
%detach
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ proxy-action
|
|
|
|
$? %set-management-proxy
|
|
|
|
%set-spawn-proxy
|
|
|
|
%set-transfer-proxy
|
|
|
|
==
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-06-28 13:36:48 +03:00
|
|
|
++ parse-ship
|
|
|
|
|= jon=json
|
|
|
|
^- (unit @p)
|
|
|
|
?: ?=([%n *] jon)
|
2021-07-20 12:22:16 +03:00
|
|
|
(rush p.jon dem)
|
2021-06-28 13:36:48 +03:00
|
|
|
?. ?=([%s *] jon) ~
|
2021-07-20 12:22:16 +03:00
|
|
|
(rush p.jon ;~(pfix sig fed:ag))
|
2021-07-01 15:34:24 +03:00
|
|
|
:: TODO: from /lib/group-store (move to zuse?)
|
|
|
|
++ enkebab
|
|
|
|
|= str=cord
|
|
|
|
^- @tas
|
|
|
|
~| str
|
|
|
|
=- (fall - str)
|
|
|
|
%+ rush str
|
|
|
|
=/ name
|
|
|
|
%+ cook
|
|
|
|
|= part=tape
|
|
|
|
^- tape
|
|
|
|
?~ part part
|
|
|
|
:- (add i.part 32)
|
|
|
|
t.part
|
|
|
|
;~(plug hig (star low))
|
|
|
|
%+ cook
|
|
|
|
|=(a=(list tape) (crip (zing (join "-" a))))
|
|
|
|
;~(plug (star low) (star name))
|
2021-06-28 13:36:48 +03:00
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ from-json
|
2021-05-21 13:57:47 +03:00
|
|
|
=, dejs-soft:format
|
2021-05-14 10:46:36 +03:00
|
|
|
|%
|
|
|
|
++ keys
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
%. u.data
|
2021-05-17 18:50:45 +03:00
|
|
|
%- ot
|
2021-05-14 10:46:36 +03:00
|
|
|
:~ ['encrypt' so]
|
|
|
|
['auth' so]
|
2021-07-01 15:34:24 +03:00
|
|
|
['cryptoSuite' so]
|
2021-05-14 10:46:36 +03:00
|
|
|
['breach' bo]
|
|
|
|
==
|
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ data
|
|
|
|
|%
|
|
|
|
++ address-transfer
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit [@ux ?])
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
=; ans=(unit [add=(unit @ux) r=?])
|
|
|
|
?~ ans ~
|
|
|
|
?~ add.u.ans ~
|
|
|
|
(some [u.add.u.ans r.u.ans])
|
|
|
|
%. u.data
|
2021-05-17 18:50:45 +03:00
|
|
|
%- ot
|
2021-05-17 18:49:41 +03:00
|
|
|
~[['address' (cu to-hex so)] ['reset' bo]]
|
|
|
|
::
|
|
|
|
++ address-ship
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit [@p @ux])
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
=; ans=(unit [ship=@p add=(unit @ux)])
|
|
|
|
?~ ans ~
|
|
|
|
?~ add.u.ans ~
|
|
|
|
(some [ship.u.ans u.add.u.ans])
|
|
|
|
%. u.data
|
2021-05-17 18:50:45 +03:00
|
|
|
%- ot
|
2021-06-28 13:36:48 +03:00
|
|
|
:~ ['ship' parse-ship]
|
2021-05-17 18:49:41 +03:00
|
|
|
['address' (cu to-hex so)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ address
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit @ux)
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
=; ans=(unit (unit @ux))
|
|
|
|
?~(ans ~ u.ans)
|
|
|
|
%. u.data
|
|
|
|
(ot ['address' (cu to-hex so)]~)
|
2021-05-17 18:50:45 +03:00
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ ship
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit @p)
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
%. u.data
|
2021-06-28 13:36:48 +03:00
|
|
|
(ot ['ship' parse-ship]~)
|
2021-07-20 12:22:16 +03:00
|
|
|
::
|
|
|
|
++ cancel
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit [l2-tx @p])
|
|
|
|
?~ data=(~(get by params) 'data') ~
|
|
|
|
%. u.data
|
|
|
|
%- ot
|
|
|
|
:~ ['type' (cu l2-tx so)]
|
|
|
|
['ship' parse-ship]
|
|
|
|
==
|
2021-05-17 18:49:41 +03:00
|
|
|
--
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ ship
|
2021-05-14 10:46:36 +03:00
|
|
|
|= params=(map @t json)
|
2021-05-17 18:49:41 +03:00
|
|
|
^- (unit @p)
|
|
|
|
?~ data=(~(get by params) 'ship') ~
|
2021-06-28 13:36:48 +03:00
|
|
|
(parse-ship u.data)
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
++ address
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit @ux)
|
2021-05-17 18:49:41 +03:00
|
|
|
?~ data=(~(get by params) 'address') ~
|
2021-06-28 13:38:10 +03:00
|
|
|
?~ ans=((cu to-hex so) u.data) ~
|
|
|
|
u.ans
|
2021-05-17 18:49:41 +03:00
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ sig
|
|
|
|
|= params=(map @t json)
|
2021-06-17 16:12:10 +03:00
|
|
|
^- (unit @)
|
2021-05-21 13:17:59 +03:00
|
|
|
?~ sig=(~(get by params) 'sig') ~
|
2021-06-28 13:38:10 +03:00
|
|
|
?~ ans=((cu to-hex so) u.sig) ~
|
|
|
|
u.ans
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
++ from
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit [@p proxy:naive])
|
|
|
|
?~ from=(~(get by params) 'from') ~
|
2021-05-17 18:50:45 +03:00
|
|
|
%. u.from
|
2021-05-14 10:46:36 +03:00
|
|
|
%- ot
|
2021-06-28 13:36:48 +03:00
|
|
|
:~ ['ship' parse-ship]
|
2021-05-14 10:46:36 +03:00
|
|
|
['proxy' (cu proxy:naive so)]
|
2021-05-17 18:50:45 +03:00
|
|
|
==
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-06-14 15:18:57 +03:00
|
|
|
++ hash
|
2021-05-14 10:46:36 +03:00
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit @ux)
|
2021-06-14 15:18:57 +03:00
|
|
|
?~ hash=(~(get by params) 'hash') ~
|
2021-06-28 13:38:10 +03:00
|
|
|
?~ ans=((cu to-hex so) u.hash) ~
|
|
|
|
u.ans
|
2021-05-17 18:49:41 +03:00
|
|
|
::
|
|
|
|
++ raw
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit octs)
|
|
|
|
?~ raw=(~(get by params) 'raw') ~
|
2021-06-28 13:38:10 +03:00
|
|
|
?~ ans=((cu to-hex so) u.raw) ~
|
|
|
|
?~ u.ans ~
|
|
|
|
(some (as-octs:mimes:html u.u.ans))
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ to-json
|
2021-05-21 13:57:47 +03:00
|
|
|
=, enjs:format
|
2021-05-14 10:46:36 +03:00
|
|
|
|%
|
|
|
|
++ pending
|
|
|
|
|= pending=(list pend-tx)
|
|
|
|
^- json
|
|
|
|
:- %a
|
|
|
|
%+ turn pending
|
|
|
|
|= pend-tx
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['force' b+force]
|
2021-07-01 15:34:24 +03:00
|
|
|
['address' s+(crip "0x{((x-co:co 20) address)}")]
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-07-01 15:34:24 +03:00
|
|
|
:- 'rawTx'
|
2021-05-14 10:46:36 +03:00
|
|
|
%- pairs
|
2021-06-29 08:46:29 +03:00
|
|
|
:~ ['tx' (tx:to-json tx.raw-tx)]
|
|
|
|
::
|
|
|
|
:+ 'sig' %s
|
|
|
|
%- crip
|
|
|
|
"0x{((x-co:co (met 3 sig.raw-tx)) sig.raw-tx)}"
|
2021-05-14 10:46:36 +03:00
|
|
|
== ==
|
|
|
|
::
|
|
|
|
++ tx
|
|
|
|
|= =tx:naive
|
|
|
|
^- json
|
|
|
|
|^
|
|
|
|
%- pairs
|
|
|
|
:~ ['tx' (parse-tx +.tx)]
|
|
|
|
::
|
|
|
|
:- 'from'
|
|
|
|
%- pairs
|
|
|
|
~[['ship' (ship ship.from.tx)] ['proxy' s+proxy.from.tx]]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ parse-tx
|
|
|
|
|= tx=skim-tx:naive
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['type' s+-.tx]
|
|
|
|
::
|
|
|
|
:- 'data'
|
|
|
|
%- pairs
|
|
|
|
?- -.tx
|
|
|
|
%transfer-point (en-transfer +.tx)
|
|
|
|
%spawn (en-spawn +.tx)
|
|
|
|
%configure-keys (en-keys +.tx)
|
|
|
|
%escape ~[(en-ship parent.tx)]
|
|
|
|
%cancel-escape ~[(en-ship parent.tx)]
|
|
|
|
%adopt ~[(en-ship ship.tx)]
|
|
|
|
%reject ~[(en-ship ship.tx)]
|
|
|
|
%detach ~[(en-ship ship.tx)]
|
|
|
|
%set-management-proxy ~[(en-address address.tx)]
|
|
|
|
%set-spawn-proxy ~[(en-address address.tx)]
|
|
|
|
%set-transfer-proxy ~[(en-address address.tx)]
|
|
|
|
== ==
|
|
|
|
::
|
|
|
|
++ en-ship |=(s=@p ship+(ship s))
|
|
|
|
++ en-address |=(a=@ux address+s+(crip "0x{((x-co:co 20) a)}"))
|
|
|
|
++ en-spawn |=([s=@p a=@ux] ~[(en-ship s) (en-address a)])
|
|
|
|
++ en-transfer |=([a=@ux r=?] ~[(en-address a) reset+b+r])
|
2021-05-17 18:50:45 +03:00
|
|
|
++ en-keys
|
2021-05-14 10:46:36 +03:00
|
|
|
|= [encrypt=@ auth=@ crypto-suite=@ breach=?]
|
|
|
|
^- (list [@t json])
|
|
|
|
:~ ['encrypt' (numb encrypt)]
|
|
|
|
['auth' (numb auth)]
|
2021-07-01 15:34:24 +03:00
|
|
|
['cryptoSuite' (numb crypto-suite)]
|
2021-05-14 10:46:36 +03:00
|
|
|
['breach' b+breach]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ txs
|
|
|
|
|= txs=(list tx:naive)
|
|
|
|
^- json
|
|
|
|
a+(turn txs |=(=tx:naive (tx:to-json tx)))
|
|
|
|
::
|
2021-06-16 18:03:21 +03:00
|
|
|
++ roller-txs
|
|
|
|
|= txs=(list roller-tx)
|
|
|
|
^- json
|
|
|
|
:- %a
|
|
|
|
%+ turn txs
|
|
|
|
|= roller-tx
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['status' s+status.status]
|
|
|
|
['hash' s+(crip "0x{((x-co:co 20) hash)}")]
|
|
|
|
['type' s+type]
|
|
|
|
==
|
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ point
|
|
|
|
|= =point:naive
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['dominion' s+dominion.point]
|
|
|
|
::
|
2021-05-17 18:50:45 +03:00
|
|
|
:- 'ownership'
|
2021-05-14 10:46:36 +03:00
|
|
|
%- pairs
|
|
|
|
=* own own.point
|
|
|
|
^- (list [@t json])
|
|
|
|
:~ ['owner' (ownership owner.own)]
|
|
|
|
['spawnProxy' (ownership spawn-proxy.own)]
|
|
|
|
['managementProxy' (ownership management-proxy.own)]
|
|
|
|
['votingProxy' (ownership voting-proxy.own)]
|
|
|
|
['transferProxy' (ownership transfer-proxy.own)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:- 'network'
|
|
|
|
%- pairs
|
|
|
|
=* net net.point
|
|
|
|
:* ['rift' (numb rift.net)]
|
|
|
|
::
|
|
|
|
:- 'keys'
|
|
|
|
%- pairs
|
|
|
|
:~ ['life' (numb life.keys.net)]
|
|
|
|
['suite' (numb suite.keys.net)]
|
|
|
|
['auth' (numb auth.keys.net)]
|
|
|
|
['crypt' (numb crypt.keys.net)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
['rift' (numb rift.net)]
|
|
|
|
:- 'sponsor'
|
|
|
|
%- pairs
|
|
|
|
~[['has' b+has.sponsor.net] ['who' (ship who.sponsor.net)]]
|
|
|
|
::
|
|
|
|
?~ escape.net ~
|
|
|
|
['escape' (ship u.escape.net)]~
|
|
|
|
== ==
|
2021-05-17 18:50:45 +03:00
|
|
|
::
|
2021-06-24 17:54:23 +03:00
|
|
|
++ points
|
|
|
|
|= points=(list [@p point:naive])
|
|
|
|
^- json
|
|
|
|
:- %a
|
|
|
|
%+ turn points
|
|
|
|
|= [ship=@p =point:naive]
|
|
|
|
%- pairs
|
|
|
|
:~ ['ship' (^ship ship)]
|
|
|
|
['point' (^point point)]
|
|
|
|
==
|
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ ownership
|
|
|
|
|= [=address:naive =nonce:naive]
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['address' s+(crip "0x{((x-co:co 20) address)}")]
|
|
|
|
['nonce' (numb nonce)]
|
|
|
|
==
|
2021-05-17 18:50:45 +03:00
|
|
|
::
|
2021-06-04 12:41:59 +03:00
|
|
|
++ spawned
|
|
|
|
|= children=(list [@p @ux])
|
|
|
|
^- json
|
|
|
|
:- %a
|
|
|
|
%+ turn children
|
|
|
|
|= [child=@p addr=@ux]
|
|
|
|
%- pairs
|
|
|
|
:~ ['ship' (ship child)]
|
|
|
|
['address' s+(crip "0x{((x-co:co 20) addr)}")]
|
|
|
|
==
|
|
|
|
::
|
2021-07-01 15:34:24 +03:00
|
|
|
++ tx-status |=(=^tx-status ^-(json s+status.tx-status))
|
2021-06-29 08:45:44 +03:00
|
|
|
::
|
|
|
|
++ config
|
|
|
|
|= roller-config
|
|
|
|
^- json
|
|
|
|
%- pairs
|
2021-07-01 15:34:24 +03:00
|
|
|
:~ ['nextBatch' (time next-batch)]
|
2021-06-29 08:45:44 +03:00
|
|
|
['frequency' (numb (div frequency ~s1))]
|
2021-07-01 15:34:24 +03:00
|
|
|
['refreshTime' (numb (div refresh-time ~s1))]
|
2021-06-29 08:45:44 +03:00
|
|
|
['contract' s+(crip "0x{((x-co:co 20) contract)}")]
|
2021-07-01 15:34:24 +03:00
|
|
|
['chainId' (numb chain-id)]
|
2021-06-29 08:45:44 +03:00
|
|
|
==
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ to-hex
|
|
|
|
|= =cord
|
|
|
|
^- (unit @ux)
|
2021-06-17 16:12:10 +03:00
|
|
|
(rush (rsh [3 2] cord) hex)
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
++ rpc-res
|
|
|
|
|%
|
|
|
|
++ sponsor
|
2021-05-17 18:49:41 +03:00
|
|
|
|= [id=@t params=(map @t json) action=spawn-action]
|
2021-05-14 10:46:36 +03:00
|
|
|
^- [(unit cage) response:rpc]
|
2021-05-17 18:49:41 +03:00
|
|
|
?. (params:validate params)
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(params error:json-rpc id)]
|
2021-06-17 16:12:10 +03:00
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ addr=(unit @ux) (address:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ data=(unit @p) (ship:data:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ addr) ?=(~ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-07-15 15:23:08 +03:00
|
|
|
=/ =tx:naive
|
|
|
|
?- action
|
|
|
|
%escape [u.from %escape u.data]
|
|
|
|
%cancel-escape [u.from %cancel-escape u.data]
|
|
|
|
%adopt [u.from %adopt u.data]
|
|
|
|
%reject [u.from %reject u.data]
|
|
|
|
%detach [u.from %detach u.data]
|
|
|
|
==
|
|
|
|
=/ =keccak (hash-tx:lib (gen-tx-octs:lib tx))
|
|
|
|
:_ [%result id (l2-hash:to-json keccak)]
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%submit | u.addr u.sig %don tx])
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
++ proxy
|
2021-05-17 18:49:41 +03:00
|
|
|
|= [id=@t params=(map @t json) action=proxy-action]
|
2021-05-14 10:46:36 +03:00
|
|
|
^- [(unit cage) response:rpc]
|
2021-05-17 18:50:45 +03:00
|
|
|
?. (params:validate params)
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(params error:json-rpc id)]
|
2021-06-17 16:12:10 +03:00
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ addr=(unit @ux) (address:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ data=(unit @ux) (address:data:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ addr) ?=(~ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-07-15 15:23:08 +03:00
|
|
|
=/ =tx:naive
|
|
|
|
?- action
|
|
|
|
%set-management-proxy [u.from %set-management-proxy u.data]
|
|
|
|
%set-spawn-proxy [u.from %set-spawn-proxy u.data]
|
|
|
|
%set-transfer-proxy [u.from %set-transfer-proxy u.data]
|
|
|
|
==
|
|
|
|
=/ =keccak (hash-tx:lib (gen-tx-octs:lib tx))
|
|
|
|
:_ [%result id (l2-hash:to-json keccak)]
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%submit | u.addr u.sig %don tx])
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ validate
|
|
|
|
|%
|
|
|
|
++ params
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- ?
|
2021-07-20 12:22:16 +03:00
|
|
|
=((lent ~(tap by params)) 4)
|
2021-05-17 18:49:41 +03:00
|
|
|
--
|
2021-07-15 15:23:08 +03:00
|
|
|
++ l2-hash
|
|
|
|
|= =keccak
|
|
|
|
^- json
|
|
|
|
s+(crip "0x{((x-co:co 20) keccak)}")
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
|%
|
|
|
|
++ get-point
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(ship (unit point:naive))]
|
|
|
|
^- response:rpc
|
2021-06-16 18:03:21 +03:00
|
|
|
?. =(~(wyt by params) 1)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-17 18:50:45 +03:00
|
|
|
?~ ship=(~(get by params) 'ship')
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-06-28 13:36:48 +03:00
|
|
|
?~ ship=(parse-ship u.ship)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-17 18:50:45 +03:00
|
|
|
?~ point=(scry u.ship)
|
2021-06-16 18:03:21 +03:00
|
|
|
~(not-found error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (point:to-json u.point)]
|
|
|
|
::
|
2021-06-24 17:54:23 +03:00
|
|
|
++ get-points
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(@ux (list [@p point:naive]))]
|
|
|
|
^- response:rpc
|
|
|
|
?. =(~(wyt by params) 1)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
?~ address=(address:from-json params)
|
|
|
|
~(parse error:json-rpc id)
|
|
|
|
[%result id (points:to-json (scry u.address))]
|
|
|
|
::
|
2021-06-28 14:01:04 +03:00
|
|
|
++ get-dns
|
|
|
|
|= [id=@t params=(map @t json) dns=(list @t)]
|
|
|
|
^- response:rpc
|
|
|
|
?. =((lent ~(tap by params)) 0)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
[%result id a+(turn dns (cork same (lead %s)))]
|
|
|
|
::
|
2021-06-21 12:27:36 +03:00
|
|
|
++ cancel-tx
|
|
|
|
|= [id=@t params=(map @t json)]
|
|
|
|
^- [(unit cage) response:rpc]
|
|
|
|
?. =(~(wyt by params) 3)
|
|
|
|
[~ ~(params error:json-rpc id)]
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
|
|
|
=/ keccak=(unit @ux) (hash:from-json params)
|
|
|
|
=/ data=(unit [l2-tx ship]) (cancel:data:from-json params)
|
|
|
|
?. &(?=(^ sig) ?=(^ keccak) ?=(^ data))
|
2021-06-21 12:27:36 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
|
|
|
:_ [%result id s+'ok']
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%cancel u.sig u.keccak u.data])
|
2021-06-21 12:27:36 +03:00
|
|
|
::
|
2021-07-15 15:23:08 +03:00
|
|
|
++ transfer-point
|
|
|
|
|= [id=@t params=(map @t json)]
|
|
|
|
^- [(unit cage) response:rpc]
|
|
|
|
?. (params:validate params)
|
|
|
|
[~ ~(params error:json-rpc id)]
|
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
|
|
|
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ addr=(unit @ux) (address:from-json params)
|
2021-07-15 15:23:08 +03:00
|
|
|
=/ data=(unit [@ux ?]) (address-transfer:data:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ addr) ?=(~ data))
|
2021-07-15 15:23:08 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
|
|
|
=/ =tx:naive [u.from %transfer-point u.data]
|
|
|
|
=/ =keccak (hash-tx:lib (gen-tx-octs:lib tx))
|
|
|
|
:_ [%result id (l2-hash:to-json keccak)]
|
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%submit | u.addr u.sig %don tx])
|
2021-07-22 07:34:42 +03:00
|
|
|
::
|
2021-06-21 12:27:36 +03:00
|
|
|
++ get-spawned
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(ship (list [ship @ux]))]
|
|
|
|
^- response:rpc
|
|
|
|
?. =((lent ~(tap by params)) 1)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
?~ ship=(~(get by params) 'ship')
|
|
|
|
~(params error:json-rpc id)
|
2021-06-28 13:36:48 +03:00
|
|
|
?~ ship=(parse-ship u.ship)
|
2021-06-21 12:27:36 +03:00
|
|
|
~(params error:json-rpc id)
|
|
|
|
[%result id (spawned:to-json (scry u.ship))]
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
|
|
|
++ configure-keys
|
|
|
|
|= [id=@t params=(map @t json)]
|
|
|
|
^- [(unit cage) response:rpc]
|
2021-05-17 18:50:45 +03:00
|
|
|
?. (params:validate params)
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(params error:json-rpc id)]
|
2021-06-17 16:12:10 +03:00
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
2021-06-16 18:03:21 +03:00
|
|
|
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ addr=(unit @ux) (address:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ data=(unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
2021-05-17 18:49:41 +03:00
|
|
|
(keys:data:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ addr) ?=(~ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-07-15 15:23:08 +03:00
|
|
|
=/ =tx:naive [u.from %configure-keys u.data]
|
|
|
|
=/ =keccak (hash-tx:lib (gen-tx-octs:lib tx))
|
|
|
|
:_ [%result id (l2-hash:to-json keccak)]
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%submit | u.addr u.sig %don tx])
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ spawn
|
|
|
|
|= [id=@t params=(map @t json)]
|
|
|
|
^- [(unit cage) response:rpc]
|
2021-05-17 18:50:45 +03:00
|
|
|
?. (params:validate params)
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(params error:json-rpc id)]
|
2021-06-17 16:12:10 +03:00
|
|
|
=/ sig=(unit @) (sig:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
=/ addr=(unit @ux) (address:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ data=(unit [@p @ux]) (address-ship:data:from-json params)
|
2021-07-20 12:22:16 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ addr) ?=(~ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-07-15 15:23:08 +03:00
|
|
|
=/ =tx:naive [u.from %spawn u.data]
|
|
|
|
=/ =keccak (hash-tx:lib (gen-tx-octs:lib tx))
|
|
|
|
:_ [%result id (l2-hash:to-json keccak)]
|
2021-05-17 18:49:41 +03:00
|
|
|
%- some
|
2021-07-20 12:22:16 +03:00
|
|
|
aggregator-action+!>([%submit | u.addr u.sig %don tx])
|
2021-05-17 18:49:41 +03:00
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ escape sponsor:rpc-res
|
|
|
|
++ cancel-escape sponsor:rpc-res
|
|
|
|
++ adopt sponsor:rpc-res
|
|
|
|
++ detach sponsor:rpc-res
|
|
|
|
++ reject sponsor:rpc-res
|
|
|
|
++ management-proxy proxy:rpc-res
|
|
|
|
++ spawn-proxy proxy:rpc-res
|
|
|
|
++ transfer-proxy proxy:rpc-res
|
|
|
|
::
|
2021-06-14 15:18:57 +03:00
|
|
|
++ nonce
|
2021-05-14 10:46:36 +03:00
|
|
|
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
|
|
|
|
^- response:rpc
|
2021-06-14 15:18:57 +03:00
|
|
|
?. =((lent ~(tap by params)) 1)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
?~ from=(from:from-json params)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(parse error:json-rpc id)
|
2021-05-17 18:50:45 +03:00
|
|
|
?~ nonce=(scry u.from)
|
2021-06-14 15:18:57 +03:00
|
|
|
~(not-found error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (numb:enjs:format u.nonce)]
|
|
|
|
::
|
|
|
|
++ pending
|
|
|
|
|%
|
|
|
|
::
|
2021-05-17 18:50:45 +03:00
|
|
|
++ all
|
2021-05-14 10:46:36 +03:00
|
|
|
|= [id=@t params=(map @t json) pending=(list pend-tx)]
|
|
|
|
^- response:rpc
|
2021-05-17 18:50:45 +03:00
|
|
|
?. =((lent ~(tap by params)) 0)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (pending:to-json pending)]
|
|
|
|
::
|
|
|
|
++ ship
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(@p (list pend-tx))]
|
|
|
|
^- response:rpc
|
2021-05-17 18:50:45 +03:00
|
|
|
?. =((lent ~(tap by params)) 1)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
?~ ship=(ship:from-json params)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(parse error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (pending:to-json (scry u.ship))]
|
|
|
|
::
|
|
|
|
++ addr
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(@ux (list pend-tx))]
|
|
|
|
^- response:rpc
|
2021-05-17 18:50:45 +03:00
|
|
|
?. =((lent ~(tap by params)) 1)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
?~ address=(address:from-json params)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(parse error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (pending:to-json (scry u.address))]
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ status
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(@ tx-status)]
|
|
|
|
^- response:rpc
|
2021-05-17 18:50:45 +03:00
|
|
|
?. =((lent ~(tap by params)) 1)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-06-14 15:18:57 +03:00
|
|
|
?~ hash=(hash:from-json params)
|
2021-05-21 14:39:06 +03:00
|
|
|
~(parse error:json-rpc id)
|
2021-06-14 15:18:57 +03:00
|
|
|
[%result id (tx-status:to-json (scry u.hash))]
|
2021-05-14 10:46:36 +03:00
|
|
|
::
|
2021-06-09 16:59:04 +03:00
|
|
|
++ next-batch
|
|
|
|
|= [id=@t params=(map @t json) when=time]
|
|
|
|
^- response:rpc
|
|
|
|
?. =((lent ~(tap by params)) 0)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
[%result id (time:enjs:format when)]
|
|
|
|
::
|
2021-06-16 18:03:21 +03:00
|
|
|
++ history
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(address:naive (list roller-tx))]
|
|
|
|
^- response:rpc
|
|
|
|
?. =((lent ~(tap by params)) 1)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
?~ address=(address:from-json params)
|
|
|
|
~(parse error:json-rpc id)
|
|
|
|
[%result id (roller-txs:to-json (scry u.address))]
|
2021-06-29 08:45:44 +03:00
|
|
|
::
|
|
|
|
++ get-config
|
|
|
|
|= [id=@t params=(map @t json) =roller-config]
|
|
|
|
^- response:rpc
|
|
|
|
?. =((lent ~(tap by params)) 0)
|
|
|
|
~(params error:json-rpc id)
|
|
|
|
[%result id (config:to-json roller-config)]
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|