mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 07:52:59 +03:00
roller-rpc: add %hash-raw-transaction rpc
the returned hash can be used to cancel pending txs by signing the message 'cancel: 0xke.ccak'
This commit is contained in:
parent
df9827a2cb
commit
9e2e6a7aee
@ -173,7 +173,8 @@
|
||||
%prepare-for-signing `(hash-transaction id +.params chain:scry | &)
|
||||
%get-unsigned-tx `(hash-transaction id +.params chain:scry & |)
|
||||
%get-predicted-state `(get-naive id +.params predicted:scry)
|
||||
:: TODO: deprecated, remove]
|
||||
%hash-raw-transaction `(hash-raw-transaction id +.params)
|
||||
:: TODO: deprecated, remove
|
||||
::
|
||||
%hash-transaction `(hash-transaction id +.params chain:scry & |)
|
||||
==
|
||||
|
@ -908,7 +908,7 @@
|
||||
::
|
||||
=; hash=@t
|
||||
(met 3 hash)^hash
|
||||
(crip "0x{((x-co:co 20) keccak)}")
|
||||
(crip "0x{((x-co:co 65) keccak)}")
|
||||
::
|
||||
~
|
||||
==
|
||||
|
@ -623,6 +623,25 @@
|
||||
unsigned-tx:lib
|
||||
prepare-for-sig:lib
|
||||
::
|
||||
++ hash-raw-transaction
|
||||
|= [id=@t params=(map @t json)]
|
||||
^- response:rpc
|
||||
?. =((lent ~(tap by params)) 4)
|
||||
~(params error:json-rpc id)
|
||||
=+ ^- $: sig=(unit @)
|
||||
l2-tx=(unit l2-tx)
|
||||
from=(unit [=ship proxy:naive])
|
||||
==
|
||||
=, from-json
|
||||
[(sig params) (tx params) (from params)]
|
||||
?: |(?=(~ sig) ?=(~ from) ?=(~ l2-tx))
|
||||
~(parse error:json-rpc id)
|
||||
=/ tx=(unit tx:naive) (build-l2-tx u.l2-tx u.from params)
|
||||
?~ tx ~(parse error:json-rpc id)
|
||||
:+ %result id
|
||||
%+ hex:to-json 32
|
||||
(hash-raw-tx:lib u.sig (gen-tx-octs:lib u.tx) u.tx)
|
||||
::
|
||||
++ get-naive
|
||||
|= [id=@t params=(map @t json) =^state:naive]
|
||||
^- response:rpc
|
||||
|
Loading…
Reference in New Issue
Block a user