# oil-mint-api

API for interacting with the OIL mint program on Solana. This crate provides instruction builders and state types for minting OIL tokens.

[![crates.io](https://img.shields.io/crates/v/oil-mint-api.svg)](https://crates.io/crates/oil-mint-api)
[![docs.rs](https://docs.rs/oil-mint-api/badge.svg)](https://docs.rs/oil-mint-api)

## Features

- **Instruction builders** for OIL minting operations
- **State types** and account deserialization
- **PDA derivation utilities** for the authority account
- **Type-safe** instruction handling using `steel` and `bytemuck`

## Usage

Add to your `Cargo.toml`:

```toml
[dependencies]
oil-mint-api = "0.0.1"
```

## Example

```rust
use oil_mint_api::prelude::*;
use solana_program::pubkey::Pubkey;

// Derive the authority PDA
let (authority_pda, _bump) = authority_pda();

// Build an Init instruction
let init_ix = init(&signer.pubkey());

// Build a MintOIL instruction
let mint_ix = mint_oil(amount); // amount in OIL (grams)
```

## Modules

- **`consts`** - Program constants including mint address, treasury address, and token configuration
- **`error`** - Custom program error types
- **`instruction`** - Instruction types and builders
- **`sdk`** - High-level SDK functions for minting operations
- **`state`** - Account state types and PDA derivation functions

## Instructions

- `init` - Initialize the authority account
- `mint_oil` - Mint OIL tokens to the treasury

## Constants

- **`MINT_ADDRESS`** - The OIL token mint address
- **`TREASURY_ADDRESS`** - The treasury address authorized to request mints
- **`TOKEN_DECIMALS`** - Token decimal precision (11)
- **`ONE_OIL`** - One OIL token in indivisible units (grams)
- **`MAX_MINT_AMOUNT`** - Maximum amount that can be minted per request
- **`MAX_SUPPLY`** - Maximum token supply (21 million OIL)

## Program ID

The OIL mint program ID is: `minti1ANBuCm6bzkWqXprLRP1xiFurquUmtkA9qFNMa`

## Documentation

Full API documentation is available at:
- **docs.rs**: https://docs.rs/oil-mint-api
- **Repository**: https://github.com/oil-protocol/oil

## License

Licensed under Apache-2.0

## Related

- [OIL API](https://github.com/oil-protocol/oil) - Main OIL protocol API
- [OIL Protocol](https://oil.supply) - Protocol website
