# Altius Transaction SDK (Rust)

A Rust SDK for signing and encoding Altius USD multi-token transactions. Supports the USD Multi-Token fee model (0x7a transaction type).

## Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
altius-tx-sdk = "0.1"
```

## Usage

### Basic Signing

```rust
use altius_tx_sdk::{Signer, Wallet, USDA_ADDRESS, BASE_FEE_ATTO};

use alloy_primitives::{address, U256};

// Create signer from private key
let signer = Signer::from_private_key("0x...")?
    .with_chain_id(12345);

// Get address
let address = signer.address();

// Sign a transaction
let signature = signer.sign_transaction(
    chain_id,
    nonce,
    gas_limit,
    fee_token,
    fee_payer,
    max_fee_per_gas_usd,
    sender,
)?;
```

### Generate Wallet

```rust
use altius_tx_sdk::Wallet;

// Generate new wallet
let wallet = Wallet::generate()?;

println!("Address: {}", wallet.address);
println!("Private Key: {}", wallet.private_key.unwrap());
```

### Constants

```rust
use altius_tx_sdk::{
    USDA_ADDRESS,
    FEE_TOKEN_FACTORY_ADDRESS,
    FEE_MANAGER_ADDRESS,
    BASE_FEE_ATTO,
    DEFAULT_GAS_LIMIT,
};

println!("USDA: {}", USDA_ADDRESS);
println!("Base Fee: {}", BASE_FEE_ATTO);
```

## Security Note

This SDK does NOT contain any private keys or addresses by default. All chain-specific configuration must be provided by the application layer.

**IMPORTANT**: Never transmit private keys over the network. Sign transactions locally and only send the signed raw transaction to the RPC node.

## Transaction Type

This SDK supports the USD Multi-Token fee model (0x7a transaction type):

- **fee_token**: ERC20 token address used for gas payment
- **fee_payer**: Account paying the fee (optional, defaults to sender)
- **max_fee_per_gas_usd_attodollars**: Max gas price in USD attodollars/gas

## Key Addresses

| Contract | Address |
|----------|---------|
| USDA (Fee Token) | `0xa1700000000000000000000000000000000000001` |
| Fee Token Factory | `0xa1700000000000000000000000000000000000000` |
| Fee Manager | `0xFE0000000000000000000000000000000000000001` |

## Dependencies

- `alloy-primitives` - Ethereum types
- `alloy-rlp` - RLP encoding
- `rand` - Random number generation

## License

MIT OR Apache-2.0
