2021-05-14 10:46:36 +03:00
|
|
|
:: azimuth-rpc: command parsing and utilities
|
|
|
|
::
|
|
|
|
/- rpc=json-rpc
|
2021-05-21 14:39:06 +03:00
|
|
|
/+ naive, json-rpc
|
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
|
|
|
:: 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
|
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]
|
|
|
|
['crypto-suite' so]
|
|
|
|
['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-05-21 13:57:47 +03:00
|
|
|
:~ ['ship' (su ;~(pfix ^sig fed:ag))]
|
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-05-21 13:57:47 +03:00
|
|
|
(ot ['ship' (su ;~(pfix ^sig fed:ag))]~)
|
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-05-03 14:35:21 +03:00
|
|
|
%. u.data
|
2021-05-21 13:57:47 +03:00
|
|
|
(su ;~(pfix ^sig fed:ag))
|
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-05-14 10:46:36 +03:00
|
|
|
=; ans=(unit (unit @ux))
|
|
|
|
?~(ans ~ u.ans)
|
2021-05-17 18:49:41 +03:00
|
|
|
((cu to-hex so) u.data)
|
|
|
|
::
|
2021-05-14 10:46:36 +03:00
|
|
|
++ sig
|
|
|
|
|= params=(map @t json)
|
2021-05-21 13:17:59 +03:00
|
|
|
^- (unit @ux)
|
|
|
|
?~ sig=(~(get by params) 'sig') ~
|
|
|
|
=; ans=(unit (unit @ux))
|
|
|
|
?~(ans ~ u.ans)
|
|
|
|
%. u.sig
|
|
|
|
(cu to-hex so)
|
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-05-21 13:57:47 +03:00
|
|
|
:~ ['ship' (su ;~(pfix ^sig fed:ag))]
|
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
|
|
|
::
|
|
|
|
++ keccak
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit @ux)
|
|
|
|
?~ keccak=(~(get by params) 'keccak') ~
|
|
|
|
=; ans=(unit (unit @ux))
|
|
|
|
?~(ans ~ u.ans)
|
|
|
|
((cu to-hex so) u.keccak)
|
2021-05-17 18:49:41 +03:00
|
|
|
::
|
|
|
|
++ raw
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- (unit octs)
|
|
|
|
?~ raw=(~(get by params) 'raw') ~
|
|
|
|
=; ans=(unit (unit @ux))
|
2021-05-17 18:50:45 +03:00
|
|
|
?~ ans ~
|
|
|
|
?~ u.ans ~
|
2021-05-17 18:49:41 +03:00
|
|
|
(some (as-octs:mimes:html u.u.ans))
|
|
|
|
((cu to-hex so) u.raw)
|
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]
|
|
|
|
::
|
|
|
|
:- 'raw-tx'
|
|
|
|
%- pairs
|
|
|
|
:~ ['sig' (numb sig.raw-tx)]
|
|
|
|
['tx' (tx:to-json tx.raw-tx)]
|
|
|
|
== ==
|
|
|
|
::
|
|
|
|
++ 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)]
|
|
|
|
['crypto-suite' (numb crypto-suite)]
|
|
|
|
['breach' b+breach]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ txs
|
|
|
|
|= txs=(list tx:naive)
|
|
|
|
^- json
|
|
|
|
a+(turn txs |=(=tx:naive (tx:to-json tx)))
|
|
|
|
::
|
|
|
|
++ 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-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-05-14 10:46:36 +03:00
|
|
|
++ tx-status
|
|
|
|
|= =^tx-status
|
|
|
|
^- json
|
|
|
|
%- pairs
|
|
|
|
:~ ['status' s+status.tx-status]
|
|
|
|
::
|
2021-05-17 18:50:45 +03:00
|
|
|
:- 'tx'
|
|
|
|
?~ tx.tx-status ~
|
2021-05-14 10:46:36 +03:00
|
|
|
s+(crip "0x{((x-co:co 20) u.tx.tx-status)}")
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ to-hex
|
|
|
|
|= =cord
|
|
|
|
^- (unit @ux)
|
|
|
|
=/ parsed=(unit (pair @ud @ux)) (de:base16:mimes:html cord)
|
2021-05-17 18:50:45 +03:00
|
|
|
?~ parsed
|
2021-05-14 10:46:36 +03:00
|
|
|
::~|(%non-hex-cord !!)
|
|
|
|
~
|
|
|
|
(some q.u.parsed)
|
|
|
|
::
|
|
|
|
++ 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-05-21 13:17:59 +03:00
|
|
|
=/ sig=(unit @ux) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ raw=(unit octs) (raw:from-json params)
|
|
|
|
=/ data=(unit @p) (ship:data:from-json params)
|
2021-05-17 18:50:45 +03:00
|
|
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-05-14 10:46:36 +03:00
|
|
|
:_ [%result id s+'ok']
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-05-17 18:49:41 +03:00
|
|
|
:- %aggregator-action
|
|
|
|
!>
|
|
|
|
=; =skim-tx:naive
|
|
|
|
[%submit | u.sig %ful u.raw u.from skim-tx]
|
|
|
|
?- action
|
|
|
|
%escape [%escape u.data]
|
|
|
|
%cancel-escape [%cancel-escape u.data]
|
|
|
|
%adopt [%adopt u.data]
|
|
|
|
%reject [%reject u.data]
|
|
|
|
%detach [%detach u.data]
|
|
|
|
==
|
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-05-21 13:17:59 +03:00
|
|
|
=/ sig=(unit @ux) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ raw=(unit octs) (raw:from-json params)
|
|
|
|
=/ data=(unit @ux) (address:data:from-json params)
|
2021-05-17 18:50:45 +03:00
|
|
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-05-14 10:46:36 +03:00
|
|
|
:_ [%result id s+'ok']
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-05-17 18:49:41 +03:00
|
|
|
:- %aggregator-action
|
|
|
|
!>
|
|
|
|
=; =skim-tx:naive
|
|
|
|
[%submit | u.sig %ful u.raw u.from skim-tx]
|
|
|
|
?- action
|
|
|
|
%set-management-proxy [%set-management-proxy u.data]
|
|
|
|
%set-spawn-proxy [%set-spawn-proxy u.data]
|
|
|
|
%set-transfer-proxy [%set-transfer-proxy u.data]
|
|
|
|
==
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
::
|
2021-05-17 18:49:41 +03:00
|
|
|
++ validate
|
|
|
|
|%
|
|
|
|
++ params
|
|
|
|
|= params=(map @t json)
|
|
|
|
^- ?
|
2021-05-17 18:50:45 +03:00
|
|
|
=((lent ~(tap by params)) 4)
|
2021-05-17 18:49:41 +03:00
|
|
|
--
|
2021-05-14 10:46:36 +03:00
|
|
|
--
|
|
|
|
|%
|
|
|
|
++ get-point
|
|
|
|
|= [id=@t params=(map @t json) scry=$-(ship (unit point:naive))]
|
|
|
|
^- 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-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-05-14 10:46:36 +03:00
|
|
|
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag))
|
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-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (point:to-json u.point)]
|
|
|
|
::
|
|
|
|
++ transfer-point
|
|
|
|
|= [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-05-21 13:17:59 +03:00
|
|
|
=/ sig=(unit @ux) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [ship @t]) (from:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ raw=(unit octs) (raw:from-json params)
|
|
|
|
=/ data=(unit [@ux ?]) (address-transfer:data:from-json params)
|
2021-05-17 18:50:45 +03:00
|
|
|
?: |(?=(~ sig) ?=(~ from) ?=(~ raw) ?=(~ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-05-14 10:46:36 +03:00
|
|
|
:_ [%result id s+'ok']
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-05-14 10:46:36 +03:00
|
|
|
noun+!>([u.sig u.from u.data])
|
|
|
|
::
|
|
|
|
++ 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-05-21 13:17:59 +03:00
|
|
|
=/ sig=(unit @ux) (sig:from-json params)
|
2021-05-14 10:46:36 +03:00
|
|
|
=/ from=(unit [ship @t]) (from:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ raw=(unit octs) (raw: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-05-17 18:50:45 +03:00
|
|
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-05-14 10:46:36 +03:00
|
|
|
:_ [%result id s+'ok']
|
2021-05-17 18:50:45 +03:00
|
|
|
%- some
|
2021-05-14 10:46:36 +03:00
|
|
|
noun+!>([u.sig u.from u.data])
|
|
|
|
::
|
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-05-21 13:17:59 +03:00
|
|
|
=/ sig=(unit @ux) (sig:from-json params)
|
2021-05-17 18:49:41 +03:00
|
|
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
|
|
|
=/ raw=(unit octs) (raw:from-json params)
|
|
|
|
=/ data=(unit [@p @ux]) (address-ship:data:from-json params)
|
2021-05-17 18:50:45 +03:00
|
|
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
2021-05-21 14:39:06 +03:00
|
|
|
[~ ~(parse error:json-rpc id)]
|
2021-05-17 18:49:41 +03:00
|
|
|
:_ [%result id s+'ok']
|
|
|
|
%- some
|
|
|
|
aggregator-action+!>([%submit | u.sig %ful u.raw u.from %spawn u.data])
|
|
|
|
::
|
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
|
|
|
|
:: - readNonce(from=[ship proxy]) -> @ :: automatically increment for pending wraps
|
|
|
|
::
|
|
|
|
++ read-nonce
|
|
|
|
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
|
|
|
|
^- response:rpc
|
2021-05-17 18:50:45 +03:00
|
|
|
?. =((lent ~(tap by params)) 3)
|
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-05-21 14:39:06 +03:00
|
|
|
~(params error:json-rpc id)
|
2021-05-14 10:46:36 +03:00
|
|
|
[%result id (numb:enjs:format u.nonce)]
|
|
|
|
::
|
|
|
|
++ pending
|
|
|
|
:: FIXME: send raw-tx (i.e. tx with signature) instead?
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
:: - readPendingRoll() -> (list pend-tx)
|
|
|
|
::
|
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)]
|
|
|
|
:: - readPendingByShip(ship) -> (list pend-tx)
|
|
|
|
::
|
|
|
|
++ 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))]
|
|
|
|
:: - readPendingByAddress(address) -> (list pend-tx)
|
|
|
|
::
|
|
|
|
++ 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-05-14 10:46:36 +03:00
|
|
|
?~ keccak=(keccak: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 (tx-status:to-json (scry u.keccak))]
|
|
|
|
::
|
|
|
|
:: ++ history
|
2021-05-17 18:50:45 +03:00
|
|
|
:: |= $: id=@t
|
|
|
|
:: params=(map @t json)
|
2021-05-14 10:46:36 +03:00
|
|
|
:: :: FIXME: use proper type from aggregator/index
|
|
|
|
:: ::
|
|
|
|
:: scry=$-([@p proxy:naive] (list tx:naive))
|
|
|
|
:: ==
|
|
|
|
:: ^- 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
|
|
|
:: ?~ from=(from: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 (txs:to-json (scry u.from))]
|
|
|
|
--
|