You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a RawTransaction is being signed on the ledger nano device, we want to display relevant transaction fields on the display so that the user can confirm them before signing.
The byte array is after we apply bcs::to_bytes() on the RawTransaction object, so using the above example(transactions_test.rs#L1701), the array is following. Thank you for confirming!
When a RawTransaction is being signed on the ledger nano device, we want to display relevant transaction fields on the display so that the user can confirm them before signing.
Source of RawTransaction struct : https://github.com/diem/diem/blob/0bf8a9702c847bb9741b3b4747ed4e0ca5f1a827/types/src/transaction/mod.rs#L67
Fields that we want to extract:
Example serialized (hex-encoded) RawTransaction in bcs is:
The code for constructing this RawTransaction object and serializing it is here : https://github.com/ankushagarwal/libra/blob/test-txn-serialize/api/src/tests/transactions_test.rs#L1701
We need to take this serialized RawTransaction in our app and write a function which can extract the fields mentioned above
Step 1
Write a function in
rust-app/src/utils.rs
which takes as an input the raw_txn as a byte array (&[u8]
) and parses returns the u64 sequence number.Sample fn signature :
fn seq_num(raw_txn: &[u8]) -> Result<u64, u8>
The text was updated successfully, but these errors were encountered: