New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lifi/abi-parser

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lifi/abi-parser

## Requirements

0.0.4
latest
Source
npm
Version published
Weekly downloads
137
-46.06%
Maintainers
0
Weekly downloads
 
Created
Source

abi-parser

Requirements

Part of our daily business as developers is analysing the call data of transactions (e.g. to find out why they failed).

We would like to have a tool that accepts a call data string and tries to parse it against a set of known ABIs. Ultimately we would like to host the tool on a simple website, but initially a script or CLI is fine as long as it can be easily migrated later on.

Calls to our own Smart Contract often contain wrapped call data inside the actual call data. It would be great to be able to parse this information as well against the same set of ABIs. These calls can be:

  • Calls to Dexes on the source chain to perform a swap before calling the bridge (Dex ABIs will have to be added along the way, we don’t need them in this initial implementation)
  • Calls to our Fee Collector contract on the source chain to collect fees before calling the bridge
  • Calls to our own contract on the destination chain to perform a swap after the bridging process

Usage

Install dependencies

pnpm install

Parse call data

The tool is available as script in the package.json. The call data string to parse is passed as argument:

pnpm run parse-call-data xa4baa10c...

The tool allows passing multiple call data strings as arguments:

pnpm run parse-call-data xa4baa10c... 0x2a7a7042...

An example invocation looks like this:

pnpm run parse-call-data 0xa4baa10c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000018062eecd3ecc0370ea9b728b53df85adb02c25091289833e5ed3ed7f23b61fd30600000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da100000000000000000000000009215ebd1aef08d368dd97a956ac66e756ce0e25000000000000000000000000000000000000000000000000000000000000a4b10000000000000000000000000000000000000000000000000000000003523cc0000000000000000000000000000000000000000000000000000000000000000e7472616e73666572746f2e78797a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e640000000000000000000000006352a56caadc4f1e25cd6c75970fa768a3304e64000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000000000000000000000000000000000000003523cc000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000078490411a320000000000000000000000004e6b18217ac75a779262c20b3cc07050cbe7282b000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000004e6b18217ac75a779262c20b3cc07050cbe7282b000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f0000000000000000000000000000000000000000000000000000000003523cc00000000000000000000000000000000000000000000000030176a683ca0a9fa000000000000000000000000000000000000000000000000305548354da7e74b00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000933a06c631ed8b5e4f3848c91a1cfc45e5c7eab300000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104aeba9ec1000000000000000000000000d98fca6160c5265c1da4ba709d686b85f490a21d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003523cc00000000000000000000000004e6b18217ac75a779262c20b3cc07050cbe7282b00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002bff970a61a04b1ca14834a43f5de4533ebddb5cc800000ada10009cbd5d07dd0cecc66161fc93d7c9000da100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000648a6a1e85000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1000000000000000000000000353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a027100000000000000000000000000000000000000000000305548354da7e74b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a49f865422000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da100000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0x2a7a7042000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000092019f87461fa42edb4b0b435d60a2d73512d88a101b6872be20d28f5267ea32a630000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b000000000000000000000000000000000000000000000000000000000000a86a0000000000000000000000000000000000000000000000000429d069189e000000000000000000000000000000000000000000000000000000000000000000126f6276696f75732e746563686e6f6c6f677900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000bd6c7b0d2f68c2b7805d88388319cfb6ecb50ea9000000000000000000000000bd6c7b0d2f68c2b7805d88388319cfb6ecb50ea9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000429d069189e000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000064e0cbc5f20000000000000000000000000000000000000000000000000000e7ebd06af000000000000000000000000000000000000000000000000000000028ed6103d000000000000000000000000000d5e230cea6da2f0c62bdeed2cf85326f1063e27d00000000000000000000000000000000000000000000000000000000000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000000000000000000000000000000428bf8fe72f400000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004c454e3f31b0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000000000000000000000000000000428bf8fe72f40000000000000000000000000000000000000000000000000000000000000055d7800000000000000000000000000000000000000000000000000000000000587f200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f0000000000000000000000008c208b7b5625d78deb49240ef28126cbe273809801000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000006366597276f4ade9ada04be183751aec6ba373390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000128d0e30db0c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000000000000000000000000000000000000636613220000000000000000000000000000000000000000000000000428bf8fe72f40000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000012800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000428bf8fe72f4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031efc4aeaa7c39e54a33fdc3c46ee2bd70ae0a09000000000000000000000000997f29174a766a1da04cf77d135d59dd12fb54d10000000000000000000000006db8506a7454c5a83b9e68dfc89fd7413ce97a5d000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f000000000000000000000000c7198437980c041c805a1edcba50c1ce5db9511800000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b00000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f0000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000a86a981a622a259fe01db196baf3a050e73df5c09cf2b8a53c9d051c722fc380c842bbb456165881bca87671b96f532c2976c84ce5a3c4433b5341c0e4301696ec100000000000000000000000000000000000000000000000000000000000055f17000000000000000000000000000000000000000000000000000000006369f99c00000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000bc000000000000000000000000000000000000000000000000000000000000017a000000000000000000000000000000000000000000000000000000000000018200000000000000000000000000000000000000000000000000000000000000924cf76d313000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b19f87461fa42edb4b0b435d60a2d73512d88a101b6872be20d28f5267ea32a630000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b000000000000000000000000000000000000000000000000000000000000a86a0000000000000000000000000000000000000000000000000429d069189e000000000000000000000000000000000000000000000000000000000000000000126f6276696f75732e746563686e6f6c6f6779000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c70000000000000000000000000000000000000000000000000000000000009c3a00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000628415565b0000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c70000000000000000000000000000000000000000000000000000000000009c3a000000000000000000000000000000000000000000000000000000000000970300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000009c3a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000250616e676f6c696e00000000000000000000000000000000000000000000000000000000000000000000000000009c3a0000000000000000000000000000000000000000000000000000000000009703000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e54ca86531e17ef3616d22ca28b0d458b6c8910600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c7000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c7198437980c041c805a1edcba50c1ce5db95118000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd0000000000000000000000001000000000000000000000000000000000000011000000000000000000000000000000000000000000000086b66df1ce63660513000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000997f29174a766a1da04cf77d135d59dd12fb54d10000000000000000000000006db8506a7454c5a83b9e68dfc89fd7413ce97a5d000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f0000000000000000000000000000000000000000000000000000000000000089000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000000000000000000000000000000000000000055f17000000000000000000000000000000000000000000000000000000000000a86a000000000000000000000000c7198437980c041c805a1edcba50c1ce5db95118000000000000000000000000000000000000000000000000000000000003851000000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5bbbb456165881bca87671b96f532c2976c84ce5a3c4433b5341c0e4301696ec10000000000000000000000000000000000000000000000000000000006369f993981a622a259fe01db196baf3a050e73df5c09cf2b8a53c9d051c722fc380c842000000000000000000000000362fa9d0bca5d19f743db50738345ce2b40ec99f00000000000000000000000000000000000000000000000000000000000002400000000000000000000000006090de2ec76eb1dc3b5d632734415c93c44fd11300000000000000000000000031efc4aeaa7c39e54a33fdc3c46ee2bd70ae0a0900000000000000000000000000000000000000000000000000000000636606410000000000000000000000000000000000000000000000000000000000000924cf76d313000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b19f87461fa42edb4b0b435d60a2d73512d88a101b6872be20d28f5267ea32a630000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000001a9b3852a5352a3897d7b20bc3783f1f68d1b5b000000000000000000000000000000000000000000000000000000000000a86a0000000000000000000000000000000000000000000000000429d069189e000000000000000000000000000000000000000000000000000000000000000000126f6276696f75732e746563686e6f6c6f6779000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c70000000000000000000000000000000000000000000000000000000000009c3a00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000628415565b0000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c70000000000000000000000000000000000000000000000000000000000009c3a000000000000000000000000000000000000000000000000000000000000970300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c700000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000009c3a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000250616e676f6c696e00000000000000000000000000000000000000000000000000000000000000000000000000009c3a0000000000000000000000000000000000000000000000000000000000009703000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e54ca86531e17ef3616d22ca28b0d458b6c8910600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c7198437980c041c805a1edcba50c1ce5db951180000000000000000000000009702230a8ea53601f5cd2dc00fdbc13d4df4a8c7000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c7198437980c041c805a1edcba50c1ce5db95118000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd0000000000000000000000001000000000000000000000000000000000000011000000000000000000000000000000000000000000000086b66df1ce63660513000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041621a238ba573590cbe2f925a21587261687bdb3b78845883a24655a8abb7606960a4d7ef33eafa664e82fbc135b8106965cb3d3596677a5e5d91780c2907ea2d1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Add new ABI

ABIs are read from the abis/ directory when the tool is initialized. New ABIs are added by creating a JSON file that contains the ABI data in this directory.

Development

Lint code

The following command lints the code using eslint, formats the code according to prettier and checks the types in the code using tsc:

pnpm run lint

Execute test cases

Services are tested using jest. The tests can be executed using the following command:

pnpm run test

FAQs

Package last updated on 01 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts