mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 20:31:40 +03:00
naive: add %noncefrom ship/proxy to rpc-api
This commit is contained in:
parent
e513768b90
commit
0573232726
@ -131,7 +131,7 @@
|
||||
:: /x/pending/[~ship] -> %noun (list pend-tx)
|
||||
:: /x/pending/[0xadd.ress] -> %noun (list pend-tx)
|
||||
:: /x/tx/[0xke.ccak]/status -> %noun tx-status
|
||||
:: /x/nonce/[~ship]/[0xadd.ress] -> %atom @
|
||||
:: /x/nonce/[~ship]/[proxy] -> %noun (unit @)
|
||||
:: /x/spawned/[~ship] -> %noun (list [ship address)
|
||||
:: /x/next-batch -> %atom time
|
||||
::
|
||||
@ -192,12 +192,13 @@
|
||||
[~ ~]
|
||||
?. ?=(proxy:naive proxy)
|
||||
[~ ~]
|
||||
:: uses cached naive state
|
||||
::
|
||||
::TODO or should we ~ when !(~(has by points.pre) who) ?
|
||||
=/ =point:naive (~(gut by points.pre) u.who *point:naive)
|
||||
=+ (proxy-from-point:naive proxy point)
|
||||
``atom+!>(nonce)
|
||||
:+ ~ ~
|
||||
:- %noun
|
||||
!> ^- (unit @)
|
||||
?~ point=(get:orm:naive points.pre u.who)
|
||||
~
|
||||
=< `nonce
|
||||
(proxy-from-point:naive proxy u.point)
|
||||
::
|
||||
++ spawned
|
||||
|= wat=@t
|
||||
|
@ -144,6 +144,7 @@
|
||||
%pending-by-address [~ (addr:pending id +.params addr:pending:scry)]
|
||||
%status [~ (status id +.params tx-status:scry)]
|
||||
%next-batch [~ (next-batch id +.params next-batch:scry)]
|
||||
%nonce [~ (nonce id +.params nonce:scry)]
|
||||
:: %history [~ (history id +.params all:history:scry)]
|
||||
==
|
||||
::
|
||||
@ -230,13 +231,12 @@
|
||||
==
|
||||
::
|
||||
++ nonce
|
||||
|= [=ship =address:naive]
|
||||
:: FIXME: use proper type from aggregator/index
|
||||
.^ @
|
||||
|= [=ship =proxy:naive]
|
||||
.^ (unit @)
|
||||
%gx
|
||||
%+ ~(scry agentio bowl)
|
||||
%aggregator
|
||||
/nonce/(scot %p ship)/[(scot %ux address)]/atom
|
||||
/nonce/(scot %p ship)/[proxy]/noun
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -114,13 +114,13 @@
|
||||
['proxy' (cu proxy:naive so)]
|
||||
==
|
||||
::
|
||||
++ keccak
|
||||
++ hash
|
||||
|= params=(map @t json)
|
||||
^- (unit @ux)
|
||||
?~ keccak=(~(get by params) 'keccak') ~
|
||||
?~ hash=(~(get by params) 'hash') ~
|
||||
=; ans=(unit (unit @ux))
|
||||
?~(ans ~ u.ans)
|
||||
((cu to-hex so) u.keccak)
|
||||
((cu to-hex so) u.hash)
|
||||
::
|
||||
++ raw
|
||||
|= params=(map @t json)
|
||||
@ -428,15 +428,15 @@
|
||||
++ transfer-proxy proxy:rpc-res
|
||||
:: - readNonce(from=[ship proxy]) -> @ :: automatically increment for pending wraps
|
||||
::
|
||||
++ read-nonce
|
||||
++ nonce
|
||||
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
|
||||
^- response:rpc
|
||||
?. =((lent ~(tap by params)) 3)
|
||||
?. =((lent ~(tap by params)) 1)
|
||||
~(params error:json-rpc id)
|
||||
?~ from=(from:from-json params)
|
||||
~(parse error:json-rpc id)
|
||||
?~ nonce=(scry u.from)
|
||||
~(params error:json-rpc id)
|
||||
~(not-found error:json-rpc id)
|
||||
[%result id (numb:enjs:format u.nonce)]
|
||||
::
|
||||
++ pending
|
||||
@ -478,9 +478,9 @@
|
||||
^- response:rpc
|
||||
?. =((lent ~(tap by params)) 1)
|
||||
~(params error:json-rpc id)
|
||||
?~ keccak=(keccak:from-json params)
|
||||
?~ hash=(hash:from-json params)
|
||||
~(parse error:json-rpc id)
|
||||
[%result id (tx-status:to-json (scry u.keccak))]
|
||||
[%result id (tx-status:to-json (scry u.hash))]
|
||||
::
|
||||
++ next-batch
|
||||
|= [id=@t params=(map @t json) when=time]
|
||||
|
Loading…
Reference in New Issue
Block a user