mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 20:31:40 +03:00
naive: add get-spawned to rpc-api
This commit is contained in:
parent
7e665b4fe8
commit
bac79bf55d
@ -132,11 +132,19 @@
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
|^
|
||||
?+ path ~
|
||||
[%x %pending ~] ``noun+!>(pending)
|
||||
[%x %pending ~] pending
|
||||
[%x %pending @ ~] (pending-by i.t.t.path)
|
||||
[%x %tx @ %status ~] (status i.t.t.path)
|
||||
[%x %nonce @ @ ~] (nonce i.t.t.path i.t.t.t.path)
|
||||
[%x %spawned @ ~] (spawned i.t.t.path)
|
||||
==
|
||||
::
|
||||
[%x %pending @ ~]
|
||||
=* wat i.t.t.path
|
||||
++ pending ``noun+!>(^pending)
|
||||
::
|
||||
++ pending-by
|
||||
|= wat=@t
|
||||
?~ who=(slaw %p wat)
|
||||
:: by-address
|
||||
::
|
||||
@ -144,7 +152,7 @@
|
||||
[~ ~]
|
||||
=; pending=(list pend-tx)
|
||||
``noun+!>(pending)
|
||||
%+ skim pending
|
||||
%+ skim ^pending
|
||||
|= pend-tx
|
||||
::TODO deduce address from sig.raw-tx ?
|
||||
!!
|
||||
@ -152,12 +160,13 @@
|
||||
::
|
||||
=; pending=(list pend-tx)
|
||||
``noun+!>(pending)
|
||||
%+ skim pending
|
||||
%+ skim ^pending
|
||||
|= pend-tx
|
||||
=(u.who ship.from.tx.raw-tx)
|
||||
::
|
||||
[%x %tx @ %status ~]
|
||||
?~ keccak=(slaw %ux i.t.t.path)
|
||||
++ status
|
||||
|= wat=@t
|
||||
?~ keccak=(slaw %ux wat)
|
||||
[~ ~]
|
||||
:+ ~ ~
|
||||
:- %noun
|
||||
@ -168,14 +177,14 @@
|
||||
::TODO potentially slow!
|
||||
=; known=?
|
||||
[?:(known %pending %unknown) ~]
|
||||
%+ lien pending
|
||||
%+ lien ^pending
|
||||
|= [* raw-tx:naive]
|
||||
=(u.keccak (hash-tx raw))
|
||||
::
|
||||
[%x %nonce @ @ ~]
|
||||
?~ who=(slaw %p i.t.t.path)
|
||||
++ nonce
|
||||
|= [who=@t proxy=@t]
|
||||
?~ who=(slaw %p who)
|
||||
[~ ~]
|
||||
=+ proxy=i.t.t.t.path
|
||||
?. ?=(proxy:naive proxy)
|
||||
[~ ~]
|
||||
:: uses cached naive state
|
||||
@ -184,7 +193,21 @@
|
||||
=/ =point:naive (~(gut by points.nas) u.who *point:naive)
|
||||
=+ (proxy-from-point:naive proxy point)
|
||||
``atom+!>(nonce)
|
||||
==
|
||||
::
|
||||
++ spawned
|
||||
|= wat=@t
|
||||
:+ ~ ~
|
||||
:- %noun
|
||||
!> ^- (list [=^ship =address:ethereum])
|
||||
?~ star=(slaw %p wat) ~
|
||||
%+ murn ~(tap by points.nas)
|
||||
|= [=ship =point:naive]
|
||||
^- (unit [=^ship =address:ethereum])
|
||||
?. =(star (^sein:title ship)) ~
|
||||
%- some
|
||||
:- ship
|
||||
address:(proxy-from-point:naive %own point)
|
||||
--
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
|
@ -127,6 +127,7 @@
|
||||
[~ ~(parse error:json-rpc id)]
|
||||
?+ method [~ ~(method error:json-rpc id)]
|
||||
%get-point [~ (get-point id +.params point:scry)]
|
||||
%get-spawned [~ (get-spawned id +.params spawned:scry)]
|
||||
%transfer-point (transfer-point id +.params)
|
||||
%configure-keys (configure-keys id +.params)
|
||||
%spawn (spawn id +.params)
|
||||
@ -154,6 +155,13 @@
|
||||
(~(scry agentio bowl) %azimuth /nas/(scot %p ship)/noun)
|
||||
==
|
||||
::
|
||||
++ spawned
|
||||
|= =ship
|
||||
.^ (list [@p @ux])
|
||||
%gx
|
||||
(~(scry agentio bowl) %aggregator /spawned/(scot %p ship)/noun)
|
||||
==
|
||||
::
|
||||
++ pending
|
||||
|%
|
||||
++ all
|
||||
|
@ -1,7 +1,7 @@
|
||||
:: azimuth-rpc: command parsing and utilities
|
||||
::
|
||||
/- rpc=json-rpc, *aggregator
|
||||
/+ naive, json-rpc
|
||||
/+ naive, json-rpc, lib=naive-transactions
|
||||
::
|
||||
=> :: Utilities
|
||||
::
|
||||
@ -252,6 +252,17 @@
|
||||
['nonce' (numb nonce)]
|
||||
==
|
||||
::
|
||||
++ spawned
|
||||
|= children=(list [@p @ux])
|
||||
^- json
|
||||
:- %a
|
||||
%+ turn children
|
||||
|= [child=@p addr=@ux]
|
||||
%- pairs
|
||||
:~ ['ship' (ship child)]
|
||||
['address' s+(crip "0x{((x-co:co 20) addr)}")]
|
||||
==
|
||||
::
|
||||
++ tx-status
|
||||
|= =^tx-status
|
||||
^- json
|
||||
@ -347,6 +358,17 @@
|
||||
~(params error:json-rpc id)
|
||||
[%result id (point:to-json u.point)]
|
||||
::
|
||||
++ get-spawned
|
||||
|= [id=@t params=(map @t json) scry=$-(ship (list [ship @ux]))]
|
||||
^- response:rpc
|
||||
?. =((lent ~(tap by params)) 1)
|
||||
~(params error:json-rpc id)
|
||||
?~ ship=(~(get by params) 'ship')
|
||||
~(params error:json-rpc id)
|
||||
?~ ship=(rush (so:dejs:format u.ship) ;~(pfix sig fed:ag))
|
||||
~(params error:json-rpc id)
|
||||
[%result id (spawned:to-json (scry u.ship))]
|
||||
::
|
||||
++ transfer-point
|
||||
|= [id=@t params=(map @t json)]
|
||||
^- [(unit cage) response:rpc]
|
||||
|
Loading…
Reference in New Issue
Block a user