roller-rpc: add rpc %spawns-remaining

This commit is contained in:
yosoyubik 2021-11-09 16:08:30 +01:00
parent 360f5fdd35
commit 502fd5822b
2 changed files with 10 additions and 0 deletions

View File

@ -156,6 +156,7 @@
%cancel-transaction (cancel-tx id +.params)
%get-spawned `(get-spawned id +.params spawned:scry)
%get-unspawned `(get-spawned id +.params unspawned:scry)
%spawns-remaining `(spawns-remaining id +.params unspawned:scry)
%get-owned-points `(get-ships id +.params owned:scry)
%get-transferring-for `(get-ships id +.params transfers:scry)
%get-manager-for `(get-ships id +.params manager:scry)

View File

@ -491,6 +491,15 @@
~(params error:json-rpc id)
[%result id (ships:to-json (scry u.ship))]
::
++ spawns-remaining
|= [id=@t params=(map @t json) scry=$-(@p (list @p))]
^- response:rpc
?. =((lent ~(tap by params)) 1)
~(params error:json-rpc id)
?~ ship=(ship:from-json params)
~(params error:json-rpc id)
[%result id (numb:enjs:format (lent (scry u.ship)))]
::
++ process-rpc
|= [id=@t params=(map @t json) action=l2-tx over-quota=$-(@p ?)]
^- [(unit cage) response:rpc]