A command-line utility for Mayan Finance operations that provides easy access to auction state data from order IDs or auction state addresses.
- Get Auction State Address: Retrieve the auction state address from a Mayan order ID
- Get Auction State: Fetch and parse complete auction state data from order ID or auction state address
- Colored Output: Enhanced readability with green-colored field names
- Flexible Input: Works with both order IDs and direct auction state addresses
| Command | Alias | Description |
|---|---|---|
get-auction-state-address |
gasa |
Get auction state address from order ID |
get-auction-state |
gas |
Get and parse auction state data from order ID or auction state address |
We provide an automated install script that detects your system and builds the appropriate binary:
# Clone the repository
git clone <your-repo-url>
cd mayan-cli
# Run the install script
./install.shSupported Systems:
- macOS: Intel (x86_64) and Apple Silicon (M1/M2/M3)
- Linux: x86_64, ARM64, and ARM v7 architectures
- Auto-detection: Automatically detects your system and builds the correct target
The script will:
- ✅ Check for Rust installation
- 🔍 Detect your system architecture
- 🏗️ Build the optimized binary for your platform
- 📦 Install to
/usr/local/bin(may require sudo) - ✅ Verify the installation
- Rust (install from rustup.rs)
git clone <your-repo-url>
cd mayan-cli
cargo build --releaseThe compiled binary will be available at target/release/mayan-cli.
# Copy to system bin directory (requires sudo on most systems)
sudo cp target/release/mayan-cli /usr/local/bin/
# Or copy to user bin directory
mkdir -p ~/.local/bin
cp target/release/mayan-cli ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH" # Add to your shell profileRetrieve the auction state address for a given order ID:
# Using full command name
cargo run -- get-auction-state-address <ORDER_ID>
# Using short alias
cargo run -- gasa <ORDER_ID>
# Using the compiled binary
./target/release/mayan-cli gasa <ORDER_ID>cargo run -- gasa "SWIFT_0xcd96bb4c31aa86d29a39117206055d2b17b65156c66886050c10abd48ee6691a"Output:
Auction State Address: 6p7fUeppNLatf5TkmMA4ybpSJBejMnGSRknhPfEBNSF3
Fetch and parse the complete auction state data. This command accepts either:
- Order ID: Automatically fetches auction state address from Mayan API
- Auction State Address: Directly queries Solana blockchain
# Using full command name with order ID
cargo run -- get-auction-state <ORDER_ID>
# Using short alias with order ID
cargo run -- gas <ORDER_ID>
# Using auction state address directly
cargo run -- gas <AUCTION_STATE_ADDRESS>
# Using a custom RPC endpoint
cargo run -- gas <ORDER_ID_OR_ADDRESS> --rpc-url <RPC_URL>
# Using the compiled binary
./target/release/mayan-cli gas <ORDER_ID_OR_ADDRESS>cargo run -- gas "SWIFT_0xcd96bb4c31aa86d29a39117206055d2b17b65156c66886050c10abd48ee6691a"cargo run -- gas "6p7fUeppNLatf5TkmMA4ybpSJBejMnGSRknhPfEBNSF3"Output:
Auction State Details:
Bump: 255
Hash: cd96bb4c31aa86d29a39117206055d2b17b65156c66886050c10abd48ee6691a
Initializer: B88xH3Jmhq4WEaiRno2mYmsxV35MmgSY45ZmQnbL8yft
Close Epoch: 797
Amount Out Min: 641865924
Winner: FzZ77TM8Ekcb6gyWPmcT9upWkAZKZc5xrYfuFu7pifPn
Amount Promised: 644921303
Valid From: 1748670506
Sequence Message: 0
To see all available commands:
cargo run -- --helpTo get help for a specific command:
cargo run -- get-auction-state-address --help
cargo run -- get-auction-state --helpThe parsed auction state contains the following fields:
- Bump: Program derived address bump seed
- Hash: 32-byte hash identifier
- Initializer: Public key of the auction initializer
- Close Epoch: Epoch when the auction closes
- Amount Out Min: Minimum amount out (in token units)
- Winner: Public key of the auction winner
- Amount Promised: Amount promised by the winner
- Valid From: Unix timestamp when the auction becomes valid
- Sequence Message: Sequence number for the message
This tool uses the following APIs:
- Mayan Explorer API:
https://explorer-api.mayan.finance/v3/swap/order-id/<order-id>- Method: GET
- Response: JSON object containing order details including
auctionStateAddr
- Solana RPC API: Configurable RPC endpoint (defaults to mainnet)
- Used to fetch account data from the blockchain
- Data is deserialized using Borsh format
reqwest: HTTP client for API requestsserde: JSON serialization/deserializationclap: Command-line argument parsing with aliasestokio: Async runtimeanyhow: Error handlingsolana-client: Solana RPC clientsolana-sdk: Solana SDK for public key handlingborsh: Binary serialization format for Solana account datahex: Hexadecimal encoding for hash displaycolored: Terminal color output for better readability
cargo testRUST_LOG=debug cargo run -- <command> <args>