naive: add %noncefrom ship/proxy to rpc-api

This commit is contained in:
yosoyubik 2021-06-14 14:18:57 +02:00
parent e513768b90
commit 0573232726
3 changed files with 20 additions and 19 deletions

View File

@ -131,7 +131,7 @@
:: /x/pending/[~ship] -> %noun (list pend-tx) :: /x/pending/[~ship] -> %noun (list pend-tx)
:: /x/pending/[0xadd.ress] -> %noun (list pend-tx) :: /x/pending/[0xadd.ress] -> %noun (list pend-tx)
:: /x/tx/[0xke.ccak]/status -> %noun tx-status :: /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/spawned/[~ship] -> %noun (list [ship address)
:: /x/next-batch -> %atom time :: /x/next-batch -> %atom time
:: ::
@ -192,12 +192,13 @@
[~ ~] [~ ~]
?. ?=(proxy:naive proxy) ?. ?=(proxy:naive proxy)
[~ ~] [~ ~]
:: uses cached naive state :+ ~ ~
:: :- %noun
::TODO or should we ~ when !(~(has by points.pre) who) ? !> ^- (unit @)
=/ =point:naive (~(gut by points.pre) u.who *point:naive) ?~ point=(get:orm:naive points.pre u.who)
=+ (proxy-from-point:naive proxy point) ~
``atom+!>(nonce) =< `nonce
(proxy-from-point:naive proxy u.point)
:: ::
++ spawned ++ spawned
|= wat=@t |= wat=@t

View File

@ -144,6 +144,7 @@
%pending-by-address [~ (addr:pending id +.params addr:pending:scry)] %pending-by-address [~ (addr:pending id +.params addr:pending:scry)]
%status [~ (status id +.params tx-status:scry)] %status [~ (status id +.params tx-status:scry)]
%next-batch [~ (next-batch id +.params next-batch:scry)] %next-batch [~ (next-batch id +.params next-batch:scry)]
%nonce [~ (nonce id +.params nonce:scry)]
:: %history [~ (history id +.params all:history:scry)] :: %history [~ (history id +.params all:history:scry)]
== ==
:: ::
@ -230,13 +231,12 @@
== ==
:: ::
++ nonce ++ nonce
|= [=ship =address:naive] |= [=ship =proxy:naive]
:: FIXME: use proper type from aggregator/index .^ (unit @)
.^ @
%gx %gx
%+ ~(scry agentio bowl) %+ ~(scry agentio bowl)
%aggregator %aggregator
/nonce/(scot %p ship)/[(scot %ux address)]/atom /nonce/(scot %p ship)/[proxy]/noun
== ==
-- --
-- --

View File

@ -114,13 +114,13 @@
['proxy' (cu proxy:naive so)] ['proxy' (cu proxy:naive so)]
== ==
:: ::
++ keccak ++ hash
|= params=(map @t json) |= params=(map @t json)
^- (unit @ux) ^- (unit @ux)
?~ keccak=(~(get by params) 'keccak') ~ ?~ hash=(~(get by params) 'hash') ~
=; ans=(unit (unit @ux)) =; ans=(unit (unit @ux))
?~(ans ~ u.ans) ?~(ans ~ u.ans)
((cu to-hex so) u.keccak) ((cu to-hex so) u.hash)
:: ::
++ raw ++ raw
|= params=(map @t json) |= params=(map @t json)
@ -428,15 +428,15 @@
++ transfer-proxy proxy:rpc-res ++ transfer-proxy proxy:rpc-res
:: - readNonce(from=[ship proxy]) -> @ :: automatically increment for pending wraps :: - readNonce(from=[ship proxy]) -> @ :: automatically increment for pending wraps
:: ::
++ read-nonce ++ nonce
|= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))] |= [id=@t params=(map @t json) scry=$-([ship proxy:naive] (unit @))]
^- response:rpc ^- response:rpc
?. =((lent ~(tap by params)) 3) ?. =((lent ~(tap by params)) 1)
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ from=(from:from-json params) ?~ from=(from:from-json params)
~(parse error:json-rpc id) ~(parse error:json-rpc id)
?~ nonce=(scry u.from) ?~ nonce=(scry u.from)
~(params error:json-rpc id) ~(not-found error:json-rpc id)
[%result id (numb:enjs:format u.nonce)] [%result id (numb:enjs:format u.nonce)]
:: ::
++ pending ++ pending
@ -478,9 +478,9 @@
^- response:rpc ^- response:rpc
?. =((lent ~(tap by params)) 1) ?. =((lent ~(tap by params)) 1)
~(params error:json-rpc id) ~(params error:json-rpc id)
?~ keccak=(keccak:from-json params) ?~ hash=(hash:from-json params)
~(parse error:json-rpc id) ~(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 ++ next-batch
|= [id=@t params=(map @t json) when=time] |= [id=@t params=(map @t json) when=time]