@thalalabs/aptx
v0.1.2
Published
Lightweight CLI for simulating and submitting Aptos transactions
Readme
aptx
Lightweight CLI for simulating and submitting Aptos transactions.
Features
- Simple transaction submission from JSON payloads
- Fetch transaction payloads from the blockchain
- Support for stdin input (pipe JSON directly)
- Transaction simulation before submission (with --force to bypass)
- Dry-run mode to test without submitting
- Works with existing Aptos CLI profiles
- Minimal dependencies, fast execution
- Clear output with explorer links
Installation
npm install -g @thalalabs/aptxUsage
Basic Usage (with simulation)
# From file
aptx submit --payload transaction.json --profile my-profile
# From stdin (pipe)
cat transaction.json | aptx submit --profile my-profile
# From stdin (explicit)
cat transaction.json | aptx submit --payload - --profile my-profile
# From echo
echo '{"function_id":"0x1::aptos_account::transfer","type_args":[],"args":[...]}' | aptx submit --profile my-profileForce Submit (even if simulation fails)
aptx submit --payload transaction.json --profile my-profile --forceDry-run (don't submit)
cat transaction.json | aptx submit --profile my-profile --dry-runCustom Fullnode
aptx submit --payload transaction.json --profile my-profile --fullnode https://fullnode.testnet.aptoslabs.com/v1Movement Network
aptx submit --payload transaction.json --profile my-profile --source movementTransaction JSON Format
Transaction payloads should follow this format:
{
"function_id": "0x1::aptos_account::transfer",
"type_args": [],
"args": [
{
"type": "address",
"value": "0x1234..."
},
{
"type": "u64",
"value": "1000000"
}
]
}Profile Setup
aptx uses profiles from the Aptos CLI. Set them up with:
aptos init --profile my-profileProfiles are stored in .aptos/config.yaml in your current directory.
Command Reference
fetch
Fetch a transaction payload from the blockchain.
Options:
--txn <hash_or_version>- Transaction hash (0x...) or version number (required)--fullnode <url>- Fullnode URL (required)--output <path>- Output file path (optional, defaults to stdout)
Examples:
# Fetch by transaction hash
aptx fetch --txn 0x1234... --fullnode https://api.mainnet.aptoslabs.com/v1
# Fetch by version number
aptx fetch --txn 12345678 --fullnode https://api.mainnet.aptoslabs.com/v1
# Save to file
aptx fetch --txn 0x1234... --fullnode https://api.mainnet.aptoslabs.com/v1 --output transaction.json
# Fetch and re-submit workflow
aptx fetch --txn 0x1234... --fullnode https://api.mainnet.aptoslabs.com/v1 | aptx submit --profile my-profilesubmit
Submit a transaction from a JSON payload.
Options:
--payload <path>- Path to transaction JSON file or "-" for stdin (optional, defaults to stdin if omitted)--profile <name>- Profile name from .aptos/config.yaml (required)--fullnode <url>- Override fullnode URL from profile (optional)--force- Submit transaction even if simulation fails (optional)--dry-run- Only simulate the transaction without submitting (optional)--source <source>- Config source: 'aptos' or 'movement' (default: 'aptos')
Development
# Install dependencies
npm install
# Build
npm run build
# Run locally
npm startLicense
MIT
