mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 12:51:51 +03:00
Merge branch 'yu/azimuth-rpc' into naive/aggregator
This commit is contained in:
commit
9e7cb91398
@ -29,7 +29,7 @@
|
|||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
::
|
::
|
||||||
=| state-0
|
=| state-0
|
||||||
=* state -
|
=* state -
|
||||||
::
|
::
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
=<
|
=<
|
||||||
@ -90,7 +90,7 @@
|
|||||||
?~ data ~
|
?~ data ~
|
||||||
:_ ~
|
:_ ~
|
||||||
^- card
|
^- card
|
||||||
[%pass / %agent [our.bowl %dice] %poke u.data]
|
[%pass / %agent [our.bowl %aggregator] %poke u.data]
|
||||||
:: TODO: validate that format is e.g. 'getPoint'
|
:: TODO: validate that format is e.g. 'getPoint'
|
||||||
:: TODO: maybe use getPoint and translate to %get-point
|
:: TODO: maybe use getPoint and translate to %get-point
|
||||||
::
|
::
|
||||||
@ -131,57 +131,57 @@
|
|||||||
%- json-response:gen
|
%- json-response:gen
|
||||||
(response-to-json:json-rpc response)
|
(response-to-json:json-rpc response)
|
||||||
=, azimuth-rpc
|
=, azimuth-rpc
|
||||||
?. ?=([%map *] params)
|
?. ?=([%map *] params)
|
||||||
[~ ~(parse error id)]
|
[~ ~(parse error id)]
|
||||||
?+ method [~ ~(method error id)]
|
?+ method [~ ~(method error id)]
|
||||||
%get-point [~ (get-point id +.params point:scry)]
|
%get-point [~ (get-point id +.params point:scry)]
|
||||||
%transfer-point (transfer-point id +.params)
|
%transfer-point (transfer-point id +.params)
|
||||||
%configure-keys (configure-keys id +.params)
|
%configure-keys (configure-keys id +.params)
|
||||||
%spawn (spawn id +.params)
|
%spawn (spawn id +.params)
|
||||||
%escape (escape id +.params)
|
%escape (escape id +.params method)
|
||||||
%cancel-escape (cancel-escape id +.params)
|
%cancel-escape (cancel-escape id +.params method)
|
||||||
%adopt (adopt id +.params)
|
%adopt (adopt id +.params method)
|
||||||
%detach (detach id +.params)
|
%detach (detach id +.params method)
|
||||||
%reject (reject id +.params)
|
%reject (reject id +.params method)
|
||||||
%set-management-proxy (management-proxy id +.params)
|
%set-management-proxy (management-proxy id +.params method)
|
||||||
%set-spawn-proxy (spawn-proxy id +.params)
|
%set-spawn-proxy (spawn-proxy id +.params method)
|
||||||
%set-transfer-proxy (transfer-proxy id +.params)
|
%set-transfer-proxy (transfer-proxy id +.params method)
|
||||||
%pending [~ (all:pending id +.params all:pending:scry)]
|
%pending [~ (all:pending id +.params all:pending:scry)]
|
||||||
%pending-by-ship [~ (ship:pending id +.params ship:pending:scry)]
|
%pending-by-ship [~ (ship:pending id +.params ship:pending:scry)]
|
||||||
%pending-by-address [~ (addr:pending id +.params addr:pending:scry)]
|
%pending-by-address [~ (addr:pending id +.params addr:pending:scry)]
|
||||||
%status [~ (status id +.params tx-status:scry)]
|
%status [~ (status id +.params tx-status:scry)]
|
||||||
:: %history [~ (history id +.params all:history:scry)]
|
:: %history [~ (history id +.params all:history:scry)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ scry
|
++ scry
|
||||||
|%
|
|%
|
||||||
++ point
|
++ point
|
||||||
|= =ship
|
|= =ship
|
||||||
.^ (unit point:naive)
|
.^ (unit point:naive)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %azimuth /nas/[(scot %p ship)]/noun)
|
(~(scry agentio bowl) %azimuth /nas/[(scot %p ship)]/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ pending
|
++ pending
|
||||||
|%
|
|%
|
||||||
++ all
|
++ all
|
||||||
.^ (list pend-tx)
|
.^ (list pend-tx)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /pending/noun)
|
(~(scry agentio bowl) %aggregator /pending/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ ship
|
++ ship
|
||||||
|= =^ship
|
|= =^ship
|
||||||
.^ (list pend-tx)
|
.^ (list pend-tx)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /pending/[(scot %p ship)]/noun)
|
(~(scry agentio bowl) %aggregator /pending/[(scot %p ship)]/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ addr
|
++ addr
|
||||||
|= =address:naive
|
|= =address:naive
|
||||||
.^ (list pend-tx)
|
.^ (list pend-tx)
|
||||||
%gx
|
%gx
|
||||||
%+ ~(scry agentio bowl) %dice
|
%+ ~(scry agentio bowl) %aggregator
|
||||||
/pending/[(scot %ux address)]/noun
|
/pending/[(scot %ux address)]/noun
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
@ -192,43 +192,43 @@
|
|||||||
:: FIXME: use proper type from aggregator/index
|
:: FIXME: use proper type from aggregator/index
|
||||||
::
|
::
|
||||||
.^ (list tx:naive)
|
.^ (list tx:naive)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /history/noun)
|
(~(scry agentio bowl) %aggregator /history/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ ship
|
++ ship
|
||||||
|= =^ship
|
|= =^ship
|
||||||
:: FIXME: use proper type from aggregator/index
|
:: FIXME: use proper type from aggregator/index
|
||||||
::
|
::
|
||||||
.^ (list tx:naive)
|
.^ (list tx:naive)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /history/[(scot %p ship)]/noun)
|
(~(scry agentio bowl) %aggregator /history/[(scot %p ship)]/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ addr
|
++ addr
|
||||||
|= =address:naive
|
|= =address:naive
|
||||||
:: FIXME: use proper type from aggregator/index
|
:: FIXME: use proper type from aggregator/index
|
||||||
::
|
::
|
||||||
.^ (list tx:naive)
|
.^ (list tx:naive)
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /history/[(scot %ux address)]/noun)
|
(~(scry agentio bowl) %aggregator /history/[(scot %ux address)]/noun)
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ tx-status
|
++ tx-status
|
||||||
|= keccak=@ux
|
|= keccak=@ux
|
||||||
.^ ^tx-status
|
.^ ^tx-status
|
||||||
%gx
|
%gx
|
||||||
(~(scry agentio bowl) %dice /tx/[(scot %ux keccak)]/status/noun)
|
(~(scry agentio bowl) %aggregator /tx/[(scot %ux keccak)]/status/noun)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ nonce
|
++ nonce
|
||||||
|= [=ship =address:naive]
|
|= [=ship =address:naive]
|
||||||
:: FIXME: use proper type from aggregator/index
|
:: FIXME: use proper type from aggregator/index
|
||||||
.^ @
|
.^ @
|
||||||
%gx
|
%gx
|
||||||
%+ ~(scry agentio bowl)
|
%+ ~(scry agentio bowl)
|
||||||
%dice
|
%aggregator
|
||||||
/nonce/[(scot %p ship)]/[(scot %ux address)]/atom
|
/nonce/[(scot %p ship)]/[(scot %ux address)]/atom
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
|
@ -6,6 +6,19 @@
|
|||||||
=> :: Utilities
|
=> :: Utilities
|
||||||
::
|
::
|
||||||
|%
|
|%
|
||||||
|
+$ spawn-action
|
||||||
|
$? %escape
|
||||||
|
%cancel-escape
|
||||||
|
%adopt
|
||||||
|
%reject
|
||||||
|
%detach
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ proxy-action
|
||||||
|
$? %set-management-proxy
|
||||||
|
%set-spawn-proxy
|
||||||
|
%set-transfer-proxy
|
||||||
|
==
|
||||||
:: FIXME: import tx-status, pend-tx from aggregator
|
:: FIXME: import tx-status, pend-tx from aggregator
|
||||||
::
|
::
|
||||||
+$ tx-status
|
+$ tx-status
|
||||||
@ -23,59 +36,79 @@
|
|||||||
?~ data=(~(get by params) 'data') ~
|
?~ data=(~(get by params) 'data') ~
|
||||||
%. u.data
|
%. u.data
|
||||||
=, dejs-soft:format
|
=, dejs-soft:format
|
||||||
%- ot
|
%- ot
|
||||||
:~ ['encrypt' so]
|
:~ ['encrypt' so]
|
||||||
['auth' so]
|
['auth' so]
|
||||||
['crypto-suite' so]
|
['crypto-suite' so]
|
||||||
['breach' bo]
|
['breach' bo]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ address-transfer
|
++ data
|
||||||
|= params=(map @t json)
|
|%
|
||||||
^- (unit [@ux ?])
|
++ address-transfer
|
||||||
?~ data=(~(get by params) 'data') ~
|
|= params=(map @t json)
|
||||||
=; ans=(unit [add=(unit @ux) r=?])
|
^- (unit [@ux ?])
|
||||||
?~ ans ~
|
?~ data=(~(get by params) 'data') ~
|
||||||
?~ add.u.ans ~
|
=; ans=(unit [add=(unit @ux) r=?])
|
||||||
(some [u.add.u.ans r.u.ans])
|
?~ ans ~
|
||||||
%. u.data
|
?~ add.u.ans ~
|
||||||
=, dejs-soft:format
|
(some [u.add.u.ans r.u.ans])
|
||||||
%- ot
|
%. u.data
|
||||||
~[['address' (cu to-hex so)] ['reset' bo]]
|
=, dejs-soft:format
|
||||||
|
%- ot
|
||||||
|
~[['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
|
||||||
|
=, dejs-soft:format
|
||||||
|
%- ot
|
||||||
|
:~ ['ship' (su ;~(pfix sig fed:ag))]
|
||||||
|
['address' (cu to-hex so)]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ address
|
||||||
|
|= params=(map @t json)
|
||||||
|
^- (unit @ux)
|
||||||
|
?~ data=(~(get by params) 'data') ~
|
||||||
|
=; ans=(unit (unit @ux))
|
||||||
|
?~(ans ~ u.ans)
|
||||||
|
=, dejs-soft:format
|
||||||
|
%. u.data
|
||||||
|
(ot ['address' (cu to-hex so)]~)
|
||||||
|
::
|
||||||
|
++ ship
|
||||||
|
|= params=(map @t json)
|
||||||
|
^- (unit @p)
|
||||||
|
?~ data=(~(get by params) 'data') ~
|
||||||
|
=, dejs-soft:format
|
||||||
|
%. u.data
|
||||||
|
(ot ['ship' (su ;~(pfix sig fed:ag))]~)
|
||||||
|
--
|
||||||
::
|
::
|
||||||
++ address-ship
|
++ ship
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
^- (unit [@ux @p])
|
^- (unit @p)
|
||||||
?~ data=(~(get by params) 'data') ~
|
?~ data=(~(get by params) 'ship') ~
|
||||||
=; ans=(unit [add=(unit @ux) ship=@p])
|
|
||||||
?~ ans ~
|
|
||||||
?~ add.u.ans ~
|
|
||||||
(some [u.add.u.ans ship.u.ans])
|
|
||||||
%. u.data
|
|
||||||
=, dejs-soft:format
|
=, dejs-soft:format
|
||||||
%- ot
|
%. u.data
|
||||||
:~ ['address' (cu to-hex so)]
|
(su ;~(pfix sig fed:ag))
|
||||||
['ship' (su ;~(pfix sig fed:ag))]
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ address
|
++ address
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
^- (unit @ux)
|
^- (unit @ux)
|
||||||
?~ data=(~(get by params) 'data') ~
|
?~ data=(~(get by params) 'address') ~
|
||||||
=; ans=(unit (unit @ux))
|
=; ans=(unit (unit @ux))
|
||||||
?~(ans ~ u.ans)
|
?~(ans ~ u.ans)
|
||||||
=, dejs-soft:format
|
=, dejs-soft:format
|
||||||
%. u.data
|
((cu to-hex so) u.data)
|
||||||
(ot ['address' (cu to-hex so)]~)
|
::
|
||||||
::
|
|
||||||
++ ship
|
|
||||||
|= params=(map @t json)
|
|
||||||
^- (unit @p)
|
|
||||||
?~ data=(~(get by params) 'data') ~
|
|
||||||
=, dejs-soft:format
|
|
||||||
%. u.data
|
|
||||||
(ot ['ship' (su ;~(pfix sig fed:ag))]~)
|
|
||||||
::
|
|
||||||
++ sig
|
++ sig
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
^- (unit @)
|
^- (unit @)
|
||||||
@ -87,11 +120,11 @@
|
|||||||
^- (unit [@p proxy:naive])
|
^- (unit [@p proxy:naive])
|
||||||
?~ from=(~(get by params) 'from') ~
|
?~ from=(~(get by params) 'from') ~
|
||||||
=, dejs-soft:format
|
=, dejs-soft:format
|
||||||
%. u.from
|
%. u.from
|
||||||
%- ot
|
%- ot
|
||||||
:~ ['ship' (su ;~(pfix sig fed:ag))]
|
:~ ['ship' (su ;~(pfix sig fed:ag))]
|
||||||
['proxy' (cu proxy:naive so)]
|
['proxy' (cu proxy:naive so)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ keccak
|
++ keccak
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
@ -101,6 +134,17 @@
|
|||||||
?~(ans ~ u.ans)
|
?~(ans ~ u.ans)
|
||||||
=, dejs-soft:format
|
=, dejs-soft:format
|
||||||
((cu to-hex so) u.keccak)
|
((cu to-hex so) u.keccak)
|
||||||
|
::
|
||||||
|
++ raw
|
||||||
|
|= params=(map @t json)
|
||||||
|
^- (unit octs)
|
||||||
|
?~ raw=(~(get by params) 'raw') ~
|
||||||
|
=; ans=(unit (unit @ux))
|
||||||
|
?~ ans ~
|
||||||
|
?~ u.ans ~
|
||||||
|
(some (as-octs:mimes:html u.u.ans))
|
||||||
|
=, dejs-soft:format
|
||||||
|
((cu to-hex so) u.raw)
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ to-json
|
++ to-json
|
||||||
@ -162,7 +206,7 @@
|
|||||||
++ en-address |=(a=@ux address+s+(crip "0x{((x-co:co 20) a)}"))
|
++ 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-spawn |=([s=@p a=@ux] ~[(en-ship s) (en-address a)])
|
||||||
++ en-transfer |=([a=@ux r=?] ~[(en-address a) reset+b+r])
|
++ en-transfer |=([a=@ux r=?] ~[(en-address a) reset+b+r])
|
||||||
++ en-keys
|
++ en-keys
|
||||||
|= [encrypt=@ auth=@ crypto-suite=@ breach=?]
|
|= [encrypt=@ auth=@ crypto-suite=@ breach=?]
|
||||||
^- (list [@t json])
|
^- (list [@t json])
|
||||||
:~ ['encrypt' (numb encrypt)]
|
:~ ['encrypt' (numb encrypt)]
|
||||||
@ -184,7 +228,7 @@
|
|||||||
%- pairs
|
%- pairs
|
||||||
:~ ['dominion' s+dominion.point]
|
:~ ['dominion' s+dominion.point]
|
||||||
::
|
::
|
||||||
:- 'ownership'
|
:- 'ownership'
|
||||||
%- pairs
|
%- pairs
|
||||||
=* own own.point
|
=* own own.point
|
||||||
^- (list [@t json])
|
^- (list [@t json])
|
||||||
@ -216,16 +260,16 @@
|
|||||||
?~ escape.net ~
|
?~ escape.net ~
|
||||||
['escape' (ship u.escape.net)]~
|
['escape' (ship u.escape.net)]~
|
||||||
== ==
|
== ==
|
||||||
::
|
::
|
||||||
++ ownership
|
++ ownership
|
||||||
|= [=address:naive =nonce:naive]
|
|= [=address:naive =nonce:naive]
|
||||||
^- json
|
^- json
|
||||||
=, enjs:format
|
=, enjs:format
|
||||||
%- pairs
|
%- pairs
|
||||||
:~ ['address' s+(crip "0x{((x-co:co 20) address)}")]
|
:~ ['address' s+(crip "0x{((x-co:co 20) address)}")]
|
||||||
['nonce' (numb nonce)]
|
['nonce' (numb nonce)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ tx-status
|
++ tx-status
|
||||||
|= =^tx-status
|
|= =^tx-status
|
||||||
^- json
|
^- json
|
||||||
@ -233,8 +277,8 @@
|
|||||||
%- pairs
|
%- pairs
|
||||||
:~ ['status' s+status.tx-status]
|
:~ ['status' s+status.tx-status]
|
||||||
::
|
::
|
||||||
:- 'tx'
|
:- 'tx'
|
||||||
?~ tx.tx-status ~
|
?~ tx.tx-status ~
|
||||||
s+(crip "0x{((x-co:co 20) u.tx.tx-status)}")
|
s+(crip "0x{((x-co:co 20) u.tx.tx-status)}")
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
@ -243,7 +287,7 @@
|
|||||||
|= =cord
|
|= =cord
|
||||||
^- (unit @ux)
|
^- (unit @ux)
|
||||||
=/ parsed=(unit (pair @ud @ux)) (de:base16:mimes:html cord)
|
=/ parsed=(unit (pair @ud @ux)) (de:base16:mimes:html cord)
|
||||||
?~ parsed
|
?~ parsed
|
||||||
::~|(%non-hex-cord !!)
|
::~|(%non-hex-cord !!)
|
||||||
~
|
~
|
||||||
(some q.u.parsed)
|
(some q.u.parsed)
|
||||||
@ -251,33 +295,52 @@
|
|||||||
++ rpc-res
|
++ rpc-res
|
||||||
|%
|
|%
|
||||||
++ sponsor
|
++ sponsor
|
||||||
|= [id=@t params=(map @t json)]
|
|= [id=@t params=(map @t json) action=spawn-action]
|
||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. =((lent ~(tap by params)) 3)
|
?. (params:validate params)
|
||||||
[~ ~(params error id)]
|
[~ ~(params error id)]
|
||||||
=/ sig=(unit @) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
||||||
=/ data=(unit [@ux @p]) (address-ship:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
?. &(?=(^ sig) ?=(^ from) ?=(^ data))
|
=/ data=(unit @p) (ship:data:from-json params)
|
||||||
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
||||||
[~ ~(parse error id)]
|
[~ ~(parse error id)]
|
||||||
:_ [%result id s+'ok']
|
:_ [%result id s+'ok']
|
||||||
%- some
|
%- some
|
||||||
noun+!>([u.sig u.from u.data])
|
:- %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]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ proxy
|
++ proxy
|
||||||
|= [id=@t params=(map @t json)]
|
|= [id=@t params=(map @t json) action=proxy-action]
|
||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. =((lent ~(tap by params)) 3)
|
?. (params:validate params)
|
||||||
[~ ~(params error id)]
|
[~ ~(params error id)]
|
||||||
=/ sig=(unit @) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
=/ from=(unit [@p proxy:naive]) (from:from-json params)
|
||||||
=/ data=(unit @ux) (address:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
?. &(?=(^ sig) ?=(^ from) ?=(^ data))
|
=/ data=(unit @ux) (address:data:from-json params)
|
||||||
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
||||||
[~ ~(parse error id)]
|
[~ ~(parse error id)]
|
||||||
:_ [%result id s+'ok']
|
:_ [%result id s+'ok']
|
||||||
%- some
|
%- some
|
||||||
noun+!>([u.sig u.from u.data])
|
:- %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]
|
||||||
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ error
|
++ error
|
||||||
@ -291,51 +354,75 @@
|
|||||||
++ internal [%error id '-32603' 'Internal error']
|
++ internal [%error id '-32603' 'Internal error']
|
||||||
++ not-found [%error id '-32000' 'Resource not found']
|
++ not-found [%error id '-32000' 'Resource not found']
|
||||||
--
|
--
|
||||||
|
::
|
||||||
|
++ validate
|
||||||
|
|%
|
||||||
|
++ params
|
||||||
|
|= params=(map @t json)
|
||||||
|
^- ?
|
||||||
|
=((lent ~(tap by params)) 4)
|
||||||
|
--
|
||||||
--
|
--
|
||||||
|%
|
|%
|
||||||
++ get-point
|
++ get-point
|
||||||
|= [id=@t params=(map @t json) scry=$-(ship (unit point:naive))]
|
|= [id=@t params=(map @t json) scry=$-(ship (unit point:naive))]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 1)
|
?. =((lent ~(tap by params)) 1)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ ship=(~(get by params) 'ship')
|
?~ ship=(~(get by params) 'ship')
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag))
|
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag))
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ point=(scry u.ship)
|
?~ point=(scry u.ship)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
[%result id (point:to-json u.point)]
|
[%result id (point:to-json u.point)]
|
||||||
::
|
::
|
||||||
++ transfer-point
|
++ transfer-point
|
||||||
|= [id=@t params=(map @t json)]
|
|= [id=@t params=(map @t json)]
|
||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. =((lent ~(tap by params)) 3)
|
?. (params:validate params)
|
||||||
[~ ~(params error id)]
|
[~ ~(params error id)]
|
||||||
=/ sig=(unit @) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [ship @t]) (from:from-json params)
|
=/ from=(unit [ship @t]) (from:from-json params)
|
||||||
=/ data=(unit [@ux ?]) (address-transfer:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
?: |(?=(~ sig) ?=(~ from) ?=(~ data))
|
=/ data=(unit [@ux ?]) (address-transfer:data:from-json params)
|
||||||
|
?: |(?=(~ sig) ?=(~ from) ?=(~ raw) ?=(~ data))
|
||||||
[~ ~(parse error id)]
|
[~ ~(parse error id)]
|
||||||
:_ [%result id s+'ok']
|
:_ [%result id s+'ok']
|
||||||
%- some
|
%- some
|
||||||
noun+!>([u.sig u.from u.data])
|
noun+!>([u.sig u.from u.data])
|
||||||
::
|
::
|
||||||
++ configure-keys
|
++ configure-keys
|
||||||
|= [id=@t params=(map @t json)]
|
|= [id=@t params=(map @t json)]
|
||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. =((lent ~(tap by params)) 3)
|
?. (params:validate params)
|
||||||
[~ ~(params error id)]
|
[~ ~(params error id)]
|
||||||
=/ sig=(unit @) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [ship @t]) (from:from-json params)
|
=/ from=(unit [ship @t]) (from:from-json params)
|
||||||
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
=/ data=(unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
||||||
(keys:from-json params)
|
(keys:data:from-json params)
|
||||||
?. &(?=(^ sig) ?=(^ from) ?=(^ data))
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
||||||
[~ ~(parse error id)]
|
[~ ~(parse error id)]
|
||||||
:_ [%result id s+'ok']
|
:_ [%result id s+'ok']
|
||||||
%- some
|
%- some
|
||||||
noun+!>([u.sig u.from u.data])
|
noun+!>([u.sig u.from u.data])
|
||||||
::
|
::
|
||||||
++ spawn sponsor:rpc-res
|
++ spawn
|
||||||
|
|= [id=@t params=(map @t json)]
|
||||||
|
^- [(unit cage) response:rpc]
|
||||||
|
?. (params:validate params)
|
||||||
|
[~ ~(params error id)]
|
||||||
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
|
=/ 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)
|
||||||
|
?. &(?=(^ sig) ?=(^ from) ?=(^ raw) ?=(^ data))
|
||||||
|
[~ ~(parse error id)]
|
||||||
|
:_ [%result id s+'ok']
|
||||||
|
%- some
|
||||||
|
aggregator-action+!>([%submit | u.sig %ful u.raw u.from %spawn u.data])
|
||||||
|
::
|
||||||
++ escape sponsor:rpc-res
|
++ escape sponsor:rpc-res
|
||||||
++ cancel-escape sponsor:rpc-res
|
++ cancel-escape sponsor:rpc-res
|
||||||
++ adopt sponsor:rpc-res
|
++ adopt sponsor:rpc-res
|
||||||
@ -349,11 +436,11 @@
|
|||||||
++ read-nonce
|
++ read-nonce
|
||||||
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
|
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 3)
|
?. =((lent ~(tap by params)) 3)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ from=(from:from-json params)
|
?~ from=(from:from-json params)
|
||||||
~(parse error id)
|
~(parse error id)
|
||||||
?~ nonce=(scry u.from)
|
?~ nonce=(scry u.from)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
[%result id (numb:enjs:format u.nonce)]
|
[%result id (numb:enjs:format u.nonce)]
|
||||||
::
|
::
|
||||||
@ -363,10 +450,10 @@
|
|||||||
|%
|
|%
|
||||||
:: - readPendingRoll() -> (list pend-tx)
|
:: - readPendingRoll() -> (list pend-tx)
|
||||||
::
|
::
|
||||||
++ all
|
++ all
|
||||||
|= [id=@t params=(map @t json) pending=(list pend-tx)]
|
|= [id=@t params=(map @t json) pending=(list pend-tx)]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 0)
|
?. =((lent ~(tap by params)) 0)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
[%result id (pending:to-json pending)]
|
[%result id (pending:to-json pending)]
|
||||||
:: - readPendingByShip(ship) -> (list pend-tx)
|
:: - readPendingByShip(ship) -> (list pend-tx)
|
||||||
@ -374,7 +461,7 @@
|
|||||||
++ ship
|
++ ship
|
||||||
|= [id=@t params=(map @t json) scry=$-(@p (list pend-tx))]
|
|= [id=@t params=(map @t json) scry=$-(@p (list pend-tx))]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 1)
|
?. =((lent ~(tap by params)) 1)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ ship=(ship:from-json params)
|
?~ ship=(ship:from-json params)
|
||||||
~(parse error id)
|
~(parse error id)
|
||||||
@ -384,7 +471,7 @@
|
|||||||
++ addr
|
++ addr
|
||||||
|= [id=@t params=(map @t json) scry=$-(@ux (list pend-tx))]
|
|= [id=@t params=(map @t json) scry=$-(@ux (list pend-tx))]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 1)
|
?. =((lent ~(tap by params)) 1)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ address=(address:from-json params)
|
?~ address=(address:from-json params)
|
||||||
~(parse error id)
|
~(parse error id)
|
||||||
@ -394,21 +481,21 @@
|
|||||||
++ status
|
++ status
|
||||||
|= [id=@t params=(map @t json) scry=$-(@ tx-status)]
|
|= [id=@t params=(map @t json) scry=$-(@ tx-status)]
|
||||||
^- response:rpc
|
^- response:rpc
|
||||||
?. =((lent ~(tap by params)) 1)
|
?. =((lent ~(tap by params)) 1)
|
||||||
~(params error id)
|
~(params error id)
|
||||||
?~ keccak=(keccak:from-json params)
|
?~ keccak=(keccak:from-json params)
|
||||||
~(parse error id)
|
~(parse error id)
|
||||||
[%result id (tx-status:to-json (scry u.keccak))]
|
[%result id (tx-status:to-json (scry u.keccak))]
|
||||||
::
|
::
|
||||||
:: ++ history
|
:: ++ history
|
||||||
:: |= $: id=@t
|
:: |= $: id=@t
|
||||||
:: params=(map @t json)
|
:: params=(map @t json)
|
||||||
:: :: FIXME: use proper type from aggregator/index
|
:: :: FIXME: use proper type from aggregator/index
|
||||||
:: ::
|
:: ::
|
||||||
:: scry=$-([@p proxy:naive] (list tx:naive))
|
:: scry=$-([@p proxy:naive] (list tx:naive))
|
||||||
:: ==
|
:: ==
|
||||||
:: ^- response:rpc
|
:: ^- response:rpc
|
||||||
:: ?. =((lent ~(tap by params)) 1)
|
:: ?. =((lent ~(tap by params)) 1)
|
||||||
:: ~(params error id)
|
:: ~(params error id)
|
||||||
:: ?~ from=(from:from-json params)
|
:: ?~ from=(from:from-json params)
|
||||||
:: ~(parse error id)
|
:: ~(parse error id)
|
||||||
|
Loading…
Reference in New Issue
Block a user