@extra-wallet/transaction-history
v1.0.3
Published
**Transaction History CLI** allows you to easily get transaction history of any address on any supported network!
Readme
Transaction History CLI
About
Transaction History CLI allows you to easily get transaction history of any address on any supported network!
License
Licensed under the PolyForm Noncommercial License 1.0.0. Commercial use requires a separate written commercial license agreement from the licensor — contact [email protected].
Key features
- Supported Networks: Ethereum, Optimism, Bsc, Polygon, Sonic, Base, Arbitrum, Avalanche, Tron, Ethereum-Classic, Ton, Bitcoin, Litecoin, Solana, Sui, Aptos, Dogecoin, Ripple, Cardano, Bch, Polkadot
- Pro Mode: You can use EXTRA WALLET API key if you do not want to search for all the other APIs. We will handle everything for you
How to run
Option 1: Run via npm (recommended)
This is the recommended way for most users.
Requirements
- Node.js (v22)
Run
npx @extra-wallet/transaction-historyThis will:
- download the CLI on demand,
- start the interactive terminal UI
Option 2: Run locally from the repository (development)
Use this if you want to:
- inspect the code,
- modify the CLI,
- contribute or debug.
Requirements
- Node.js (v22)
- pnpm
1. Install dependencies
From the repository root:
pnpm install2. Build shared code
cd shared/sdk
pnpm build3. Return to the root of the repository
cd ../..4. Build the CLI
cd packages/transaction-history-cli
pnpm build5. Run locally
npx transaction-historyHow to use
The CLI can be run in two modes: interactive and non-interactive
To run the program in interactive mode you just have to follow the instructions of the previous step. In this mode you will be asked for needed inputs step by step.
To run the program in non-interactive mode you have to also specify arguments using flags like this:
npx transaction-history --network="arbitrum" --extrawallet-key="..." --address="0x..."To get information about every argument, you can use help command:
npx transaction-history helpArguments
| Flag | Required | Description | Aliases |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| address | true | Address transaction history of which you want to get |
| network | true | One of the supported networks you want to get history from |
| extrawallet-key | false | Your EXTRA WALLET API key | e |
| api-key | false | API key for the service that will be used to fetch data in case you did not specify extrawallet-key. The service depends on the network you want to check. |
| output | false | The file to which the result will be written. If no file is specified, the result will be printed to stdout. | o |
| formatted | false | Whether output should be formatted or raw | f |
Info: About API key for Bitcoin Cash and Sui
API key is not needed at all on Bitcoin Cash(BCH).
For Sui it is optional even if you do not specify
extrawallet-key
Network and service it uses
| Network | Service used in free mode |
| ------------------ | --------------------------- |
| ethereum | Ankr |
| optimism | Ankr |
| bsc | Ankr |
| polygon | Ankr |
| sonic | Etherscan |
| base | Ankr |
| arbitrum | Ankr |
| avalanche | Ankr |
| tron | Tronscan |
| ethereum-classic | Blockscout Ethereum Classic |
| ton | Tonapi |
| bitcoin | Tatum |
| litecoin | Tatum |
| solana | Ankr |
| sui | Ankr |
| aptos | Ankr |
| dogecoin | Tatum |
| ripple | Tatum |
| cardano | Cardanoscan |
| bch | Fullstack Bitcoin Cash |
| polkadot | Subscan |
Output
if output is specified, the result will be written to file. If not, the result will be printed to stdout.
In both cases, formatting or its absence depends on formatted flag.
Result format
The result will be a JSON array of transaction entries. Every entry will have the following fields:
| Field | Type | Explanation |
| --------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| from | SenderOrReceiver[] | Array of structs which tell which addresses sent the cryptocurrencies, which cryptocurrencies and how many of them |
| to | SenderOrReceiver[] / null | Array of structs which tell which addresses received the cryptocurrencies, which cryptocurrencies and how many of them. Can be null in case transaction does not have any receivers(e.g. contract Deploy on EVM) |
| fee | string / null | Fee for the transaction in base units of the chain(satoshi for Bitcoin, Wei for Ethereum etc. |
| type | TxType / string | Type of the transaction. Either one that can easily be classified or something provided by the network itself |
| hash | string | Hash of the transaction |
| explorer | string | Url that leads to transaction on network's explorer |
| timestamp | number | UNIX time of the transaction |
| status | TxStatus | Status of the transaction |
SenderOrReceiver has three fields:
address: string, address of the person that sends or receives the cryptocurrencyamount: number, raw not formatted amount of cryptocurrency that is sent or receivedcurrency: optional string or object, if absent, the native currency was sent or received. If it is a string, it's eitherUnknownor currency address.
But if you use EXTRA WALLET API key, currency can be absent if currency is native, string if only the address of the currency is known or a struct with the following fields:
| Field | Type | Explanation
| -------- | ---------|--------------------------------------------------------------------------------------------------------------------------------------
| decimals | number | Decimals of the cryptocurrency
| coinId | string | Coin id that corresponds to this cryptocurrency on CoinGecko
| address | string | Address of the currency
| price | number | Price of the cryptocurrency in dollars
| symbol | string | Symbol of the cryptocurrency
| img | string | Url of the logo of the cryptocurrency
TxType can be one of the following values:
Contract CallContract DeployBlock RewardSendReceiveCancel
TxStatus can be one of the following values: Failed, Success, Pending, Unknown.
