hw_wallet_calldata_formatter
v1.0.1
Published
Format calldata into a format that reflects what users see on their hw wallet screen.
Readme
hw_wallet_calldata_formatter
Format a hex string for visual inspection on Ledger or Trezor hardware wallets.
Feel free to open PRs with other formats :)
Disclaimer
This is experimental software. It has not been audited. It doesn't even contain tests. This software might contain critical bugs. You could lose all your funds if you use this software. Do not rely on this software.
🛠 Installation
npm install -g hw_wallet_calldata_formatterwhich hw_wallet_calldata_formatterContributing
Clonse the repo:
git clone https://github.com/iAmMichaelConnor/hw_wallet_calldata_formatter.gitcd hw_wallet_calldata_formatterInstall dependencies
npm iThen add it to your bin, so that you can use it as a command line tool:
npm i -gTo verify installation:
which hw_wallet_calldata_formatter🚀 Usage
hw_wallet_calldata_formatter <calldata hex string> [options]Options
-l, --ledgerFormat output for Ledger Flex-t, --trezorFormat output for Trezor Safe 5
You can use one or both flags.
Examples
hw_wallet_calldata_formatter 0x6a761202000000000000000000000000A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000003253ea053090adca994cbd4291e6834206ab40f90000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --ledgerOutputs:
Ledger Flex Format:
6a761202
00:A0b86991:c6218b36c1d19D4a:2e9Eb0cE3606eB48
00:00:00:00
00:00:00:120
00:00:00:00
00:00:00:00
00:00:00:00
00:00:00:00
00:00:00:00
00:00:00:00
00:00:00:1a0
00:00:00:44
a9059cbb00000000:00:3253ea053090adca:994cbd4291e68342
6ab40f900000000:00:00:00
271000000000:00:00:00
00:00:00:00hw_wallet_calldata_formatter 0x6a761202000000000000000000000000A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000003253ea053090adca994cbd4291e6834206ab40f90000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --trezorTrezor Format:
Size: 484 bytes
Page 1:
6a7612020000000000
00000000000000A0b8
6991c6218b36c1d19D
4a2e9Eb0cE3606eB48
000000000000000000
00000000000000
Page 2:
00000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
00000001200000
Page 3:
00000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
00000000000000
Page 4:
00000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
00000000000000
Page 5:
00000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
00000000000000
Page 6:
00000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
00000000000000
Page 7:
00000000000000
000000000000000000
0000000001a0000000
000000000000000000
000000000000000000
00000000000000
Page 8:
00000044a9059c
bb0000000000000000
000000003253ea0530
90adca994cbd4291e6
834206ab40f9000000
00000000000000
Page 9:
00000000000000
000000000000000000
000000002710000000
000000000000000000
000000000000000000
00000000000000
Page 10:
00000000000000
000000000000000000
000000000000000000
00000000000000🧾 Notes
- The hex string may start with or without
0x - Output is printed to
stdout - Invalid or odd-length hex strings will throw an error
