roller-rpc: fix serializing tx for personal_sign

This commit is contained in:
yosoyubik 2021-11-09 19:18:10 +01:00
parent 502fd5822b
commit 084c70497d
2 changed files with 11 additions and 12 deletions

View File

@ -175,9 +175,9 @@
%get-unsigned-tx `(hash-transaction id +.params chain:scry & |)
%get-predicted-state `(get-naive id +.params predicted:scry)
%hash-raw-transaction `(hash-raw-transaction id +.params)
:: TODO: deprecated, remove
:: TODO: deprecated, remove (used together with personal_sign)
::
%hash-transaction `(hash-transaction id +.params chain:scry & |)
%hash-transaction `(hash-transaction id +.params chain:scry | &)
==
--
::

View File

@ -620,17 +620,16 @@
~(parse error:json-rpc id)
=/ tx=(unit tx:naive) (build-l2-tx u.l2-tx u.from params)
?~ tx ~(parse error:json-rpc id)
=/ =octs (gen-tx-octs:lib u.tx)
:+ %result id
=; =keccak
%+ hex:to-json 32
?. reverse keccak
(reverse-hash:lib keccak)
%- hash-tx:lib
%. [chain-id u.nonce octs]
=/ =octs
%. [chain-id u.nonce (gen-tx-octs:lib u.tx)]
?: header
unsigned-tx:lib
prepare-for-sig:lib
:+ %result id
%- hex:to-json
?: reverse
p.octs^(rev 3 octs)
32^(hash-tx:lib octs)
::
++ hash-raw-transaction
|= [id=@t params=(map @t json)]