naive: support camel case rpc method name

This commit is contained in:
yosoyubik 2021-07-01 14:34:24 +02:00
parent c4f8d6c672
commit 8ada986f78
2 changed files with 51 additions and 41 deletions

View File

@ -125,31 +125,32 @@
=, azimuth-rpc
?. ?=([%map *] params)
[~ ~(parse error:json-rpc id)]
=/ method=@tas (enkebab method)
?+ method [~ ~(method error:json-rpc id)]
%get-point [~ (get-point id +.params point:scry)]
%get-points [~ (get-points id +.params points:scry)]
%get-dns [~ (get-dns id +.params dns:scry)]
%transfer-point (transfer-point id +.params)
%cancel-tx (cancel-tx id +.params)
%get-spawned [~ (get-spawned id +.params spawned:scry)]
%configure-keys (configure-keys id +.params)
%spawn (spawn id +.params)
%escape (escape id +.params method)
%cancel-escape (cancel-escape id +.params method)
%adopt (adopt id +.params method)
%detach (detach id +.params method)
%reject (reject id +.params method)
%set-management-proxy (management-proxy id +.params method)
%set-spawn-proxy (spawn-proxy id +.params method)
%set-transfer-proxy (transfer-proxy id +.params method)
%pending [~ (all:pending id +.params all:pending:scry)]
%pending-by-ship [~ (ship:pending id +.params ship:pending:scry)]
%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 addr:history:scry)]
%get-config [~ (get-config id +.params config:scry)]
%get-point `(get-point id +.params point:scry)
%get-points `(get-points id +.params points:scry)
%get-dns `(get-dns id +.params dns:scry)
%transfer-point (transfer-point id +.params)
%cancel-transaction (cancel-tx id +.params)
%get-spawned `(get-spawned id +.params spawned:scry)
%configure-keys (configure-keys id +.params)
%spawn (spawn id +.params)
%escape (escape id +.params method)
%cancel-escape (cancel-escape id +.params method)
%adopt (adopt id +.params method)
%detach (detach id +.params method)
%reject (reject id +.params method)
%set-management-proxy (management-proxy id +.params method)
%set-spawn-proxy (spawn-proxy id +.params method)
%set-transfer-proxy (transfer-proxy id +.params method)
%get-all-pending `(all:pending id +.params all:pending:scry)
%get-pending-by-ship `(ship:pending id +.params ship:pending:scry)
%get-pending-by-address `(addr:pending id +.params addr:pending:scry)
%get-transaction-status `(status id +.params tx-status:scry)
%when-next-batch `(next-batch id +.params next-batch:scry)
%get-nonce `(nonce id +.params nonce:scry)
%get-history `(history id +.params addr:history:scry)
%get-roller-config `(get-config id +.params config:scry)
==
::
++ scry

View File

@ -40,6 +40,24 @@
`(rash p.jon dem)
?. ?=([%s *] jon) ~
`(rash p.jon ;~(pfix sig fed:ag))
:: TODO: from /lib/group-store (move to zuse?)
++ enkebab
|= str=cord
^- @tas
~| str
=- (fall - str)
%+ rush str
=/ name
%+ cook
|= part=tape
^- tape
?~ part part
:- (add i.part 32)
t.part
;~(plug hig (star low))
%+ cook
|=(a=(list tape) (crip (zing (join "-" a))))
;~(plug (star low) (star name))
::
++ from-json
=, dejs-soft:format
@ -52,7 +70,7 @@
%- ot
:~ ['encrypt' so]
['auth' so]
['crypto-suite' so]
['cryptoSuite' so]
['breach' bo]
==
::
@ -166,8 +184,9 @@
^- json
%- pairs
:~ ['force' b+force]
['address' s+(crip "0x{((x-co:co 20) address)}")]
::
:- 'raw-tx'
:- 'rawTx'
%- pairs
:~ ['tx' (tx:to-json tx.raw-tx)]
::
@ -219,7 +238,7 @@
^- (list [@t json])
:~ ['encrypt' (numb encrypt)]
['auth' (numb auth)]
['crypto-suite' (numb crypto-suite)]
['cryptoSuite' (numb crypto-suite)]
['breach' b+breach]
==
--
@ -312,27 +331,17 @@
['address' s+(crip "0x{((x-co:co 20) addr)}")]
==
::
++ tx-status
|= =^tx-status
^- json
%- pairs
:~ ['status' s+status.tx-status]
::
:- 'pointer'
?~ pointer.tx-status ~
=* pointer u.pointer.tx-status
(ownership address.pointer nonce.pointer)
==
++ tx-status |=(=^tx-status ^-(json s+status.tx-status))
::
++ config
|= roller-config
^- json
%- pairs
:~ ['next-batch' (time next-batch)]
:~ ['nextBatch' (time next-batch)]
['frequency' (numb (div frequency ~s1))]
['refresh-time' (numb (div refresh-time ~s1))]
['refreshTime' (numb (div refresh-time ~s1))]
['contract' s+(crip "0x{((x-co:co 20) contract)}")]
['chain-id' (numb chain-id)]
['chainId' (numb chain-id)]
==
--
::