naive: also accept ship in rpc argument as number

This commit is contained in:
yosoyubik 2021-06-28 12:36:48 +02:00
parent 845cd2090e
commit ed36304749

View File

@ -20,6 +20,14 @@
%set-transfer-proxy %set-transfer-proxy
== ==
:: ::
++ parse-ship
|= jon=json
^- (unit @p)
?: ?=([%n *] jon)
`(rash p.jon dem)
?. ?=([%s *] jon) ~
`(rash p.jon ;~(pfix sig fed:ag))
::
++ from-json ++ from-json
=, dejs-soft:format =, dejs-soft:format
|% |%
@ -59,7 +67,7 @@
(some [ship.u.ans u.add.u.ans]) (some [ship.u.ans u.add.u.ans])
%. u.data %. u.data
%- ot %- ot
:~ ['ship' (su ;~(pfix ^sig fed:ag))] :~ ['ship' parse-ship]
['address' (cu to-hex so)] ['address' (cu to-hex so)]
== ==
:: ::
@ -77,15 +85,14 @@
^- (unit @p) ^- (unit @p)
?~ data=(~(get by params) 'data') ~ ?~ data=(~(get by params) 'data') ~
%. u.data %. u.data
(ot ['ship' (su ;~(pfix ^sig fed:ag))]~) (ot ['ship' parse-ship]~)
-- --
:: ::
++ ship ++ ship
|= params=(map @t json) |= params=(map @t json)
^- (unit @p) ^- (unit @p)
?~ data=(~(get by params) 'ship') ~ ?~ data=(~(get by params) 'ship') ~
%. u.data (parse-ship u.data)
(su ;~(pfix ^sig fed:ag))
:: ::
++ address ++ address
|= params=(map @t json) |= params=(map @t json)
@ -107,7 +114,7 @@
?~ from=(~(get by params) 'from') ~ ?~ from=(~(get by params) 'from') ~
%. u.from %. u.from
%- ot %- ot
:~ ['ship' (su ;~(pfix ^sig fed:ag))] :~ ['ship' parse-ship]
['proxy' (cu proxy:naive so)] ['proxy' (cu proxy:naive so)]
== ==
:: ::
@ -374,7 +381,7 @@
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ ship=(~(get by params) 'ship') ?~ ship=(~(get by params) 'ship')
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag)) ?~ ship=(parse-ship u.ship)
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ point=(scry u.ship) ?~ point=(scry u.ship)
~(not-found error:json-rpc id) ~(not-found error:json-rpc id)
@ -425,7 +432,7 @@
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ ship=(~(get by params) 'ship') ?~ ship=(~(get by params) 'ship')
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag)) ?~ ship=(parse-ship u.ship)
~(params error:json-rpc id) ~(params error:json-rpc id)
[%result id (spawned:to-json (scry u.ship))] [%result id (spawned:to-json (scry u.ship))]
:: ::