mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
naive: fix json param parsing in rpc-api
This commit is contained in:
parent
845a2d1c1b
commit
7e9a2bcfcd
@ -97,12 +97,9 @@
|
|||||||
::
|
::
|
||||||
++ sig
|
++ sig
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
^- (unit @ux)
|
^- (unit @)
|
||||||
?~ sig=(~(get by params) 'sig') ~
|
?~ sig=(~(get by params) 'sig') ~
|
||||||
=; ans=(unit (unit @ux))
|
(so u.sig)
|
||||||
?~(ans ~ u.ans)
|
|
||||||
%. u.sig
|
|
||||||
(cu to-hex so)
|
|
||||||
::
|
::
|
||||||
++ from
|
++ from
|
||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
@ -126,11 +123,8 @@
|
|||||||
|= params=(map @t json)
|
|= params=(map @t json)
|
||||||
^- (unit octs)
|
^- (unit octs)
|
||||||
?~ raw=(~(get by params) 'raw') ~
|
?~ raw=(~(get by params) 'raw') ~
|
||||||
=; ans=(unit (unit @ux))
|
?~ ans=(so u.raw) ~
|
||||||
?~ ans ~
|
(some (as-octs:mimes:html u.ans))
|
||||||
?~ u.ans ~
|
|
||||||
(some (as-octs:mimes:html u.u.ans))
|
|
||||||
((cu to-hex so) u.raw)
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ to-json
|
++ to-json
|
||||||
@ -293,11 +287,7 @@
|
|||||||
++ to-hex
|
++ to-hex
|
||||||
|= =cord
|
|= =cord
|
||||||
^- (unit @ux)
|
^- (unit @ux)
|
||||||
=/ parsed=(unit (pair @ud @ux)) (de:base16:mimes:html cord)
|
(rush (rsh [3 2] cord) hex)
|
||||||
?~ parsed
|
|
||||||
::~|(%non-hex-cord !!)
|
|
||||||
~
|
|
||||||
(some q.u.parsed)
|
|
||||||
::
|
::
|
||||||
++ rpc-res
|
++ rpc-res
|
||||||
|%
|
|%
|
||||||
@ -306,7 +296,7 @@
|
|||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. (params:validate params)
|
?. (params:validate params)
|
||||||
[~ ~(params error:json-rpc id)]
|
[~ ~(params error:json-rpc id)]
|
||||||
=/ sig=(unit @ux) (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)
|
||||||
=/ raw=(unit octs) (raw:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit @p) (ship:data:from-json params)
|
=/ data=(unit @p) (ship:data:from-json params)
|
||||||
@ -331,7 +321,7 @@
|
|||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. (params:validate params)
|
?. (params:validate params)
|
||||||
[~ ~(params error:json-rpc id)]
|
[~ ~(params error:json-rpc id)]
|
||||||
=/ sig=(unit @ux) (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)
|
||||||
=/ raw=(unit octs) (raw:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit @ux) (address:data:from-json params)
|
=/ data=(unit @ux) (address:data:from-json params)
|
||||||
@ -388,7 +378,7 @@
|
|||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. (params:validate params)
|
?. (params:validate params)
|
||||||
[~ ~(params error:json-rpc id)]
|
[~ ~(params error:json-rpc id)]
|
||||||
=/ sig=(unit @ux) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
||||||
=/ raw=(unit octs) (raw:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit [@ux ?]) (address-transfer:data:from-json params)
|
=/ data=(unit [@ux ?]) (address-transfer:data:from-json params)
|
||||||
@ -404,7 +394,7 @@
|
|||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. (params:validate params)
|
?. (params:validate params)
|
||||||
[~ ~(params error:json-rpc id)]
|
[~ ~(params error:json-rpc id)]
|
||||||
=/ sig=(unit @ux) (sig:from-json params)
|
=/ sig=(unit @) (sig:from-json params)
|
||||||
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
=/ from=(unit [ship proxy:naive]) (from:from-json params)
|
||||||
=/ raw=(unit octs) (raw:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
=/ data=(unit [encrypt=@ auth=@ crypto-suite=@ breach=?])
|
||||||
@ -421,7 +411,7 @@
|
|||||||
^- [(unit cage) response:rpc]
|
^- [(unit cage) response:rpc]
|
||||||
?. (params:validate params)
|
?. (params:validate params)
|
||||||
[~ ~(params error:json-rpc id)]
|
[~ ~(params error:json-rpc id)]
|
||||||
=/ sig=(unit @ux) (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)
|
||||||
=/ raw=(unit octs) (raw:from-json params)
|
=/ raw=(unit octs) (raw:from-json params)
|
||||||
=/ data=(unit [@p @ux]) (address-ship:data:from-json params)
|
=/ data=(unit [@p @ux]) (address-ship:data:from-json params)
|
||||||
|
Loading…
Reference in New Issue
Block a user