# al-the-bot-father/pump_fun_py architecture

> Architecture diagram of the GitHub repository al-the-bot-father/pump_fun_py, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/al-the-bot-father/pump_fun_py
- Repository: https://github.com/al-the-bot-father/pump_fun_py

## Overview

pump_fun_py is a Python client library for buying and selling pump.fun tokens through Solana RPC. Users configure an RPC client and keypair, then invoke the buy or sell example; the library reads bonding-curve state, calculates trade amounts, builds and submits a transaction, and checks its confirmation. The README also documents slippage and compute-unit fee settings. The excerpts show the curve parsing and transaction-building responsibilities; SOURCE INDEX references establish imports for some unsampled calls, so those edges are cited there.

Main entry points: [`pump_fun_py/pump_fun.py`](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/pump_fun.py) (Buy and sell), [`pump_fun_py/bonding_curve.py`](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/bonding_curve.py) (Curve state and pricing), [`pump_fun_py/example_buy.py`](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_buy.py) (Buy example), [`pump_fun_py/example_sell.py`](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_sell.py) (Sell example)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entrypoints["Trade entrypoints"]
  node_buy_example["Buy example<br/>[example_buy.py]"]
  node_sell_example["Sell example<br/>[example_sell.py]"]
end

subgraph group_trade["Trade execution"]
  node_trade_api["Buy and sell<br/>[pump_fun.py]"]
end

subgraph group_support["Curve and support"]
  node_curve_data["Curve state and pricing<br/>[bonding_curve.py]"]
  node_trade_utils["Balance and confirmation<br/>[utils.py]"]
  node_program_constants["Program accounts<br/>[constants.py]"]
end

node_user(("Library user"))
node_solana_rpc["Solana RPC"]

node_user -->|"runs buy"| node_buy_example
node_user -->|"runs sell"| node_sell_example
node_buy_example -->|"calls buy"| node_trade_api
node_sell_example -->|"calls sell"| node_trade_api
node_trade_api -->|"reads curve"| node_curve_data
node_trade_api -->|"uses helpers"| node_trade_utils
node_trade_api -->|"uses addresses"| node_program_constants
node_curve_data -->|"uses program ID"| node_program_constants
node_curve_data -->|"reads account"| node_solana_rpc
node_trade_api -->|"submits transaction"| node_solana_rpc
node_trade_utils -->|"checks balance and status"| node_solana_rpc

click node_buy_example "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_buy.py"
click node_sell_example "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_sell.py"
click node_trade_api "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/pump_fun.py"
click node_curve_data "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/bonding_curve.py"
click node_trade_utils "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/utils.py"
click node_program_constants "https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/constants.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_buy_example,node_sell_example,node_user toneBlue
class node_trade_api toneAmber
class node_curve_data,node_trade_utils,node_program_constants toneMint
class node_solana_rpc toneIndigo
```

## Components

### Trade entrypoints

- [Buy example](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_buy.py): `pump_fun_py/example_buy.py`
- [Sell example](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/example_sell.py): `pump_fun_py/example_sell.py`

### Trade execution

- [Buy and sell](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/pump_fun.py): `pump_fun_py/pump_fun.py`

### Curve and support

- [Curve state and pricing](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/bonding_curve.py): `pump_fun_py/bonding_curve.py`
- [Balance and confirmation](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/utils.py): `pump_fun_py/utils.py`
- [Program accounts](https://github.com/al-the-bot-father/pump_fun_py/blob/main/pump_fun_py/constants.py): `pump_fun_py/constants.py`

### Other components

- **Library user**
- **Solana RPC**

## Connections

- Library user → Buy example: runs buy (evidence: `README.md`)
- Library user → Sell example: runs sell (evidence: `README.md`)
- Buy example → Buy and sell: calls buy (evidence: `pump_fun_py/example_buy.py`)
- Sell example → Buy and sell: calls sell (evidence: `pump_fun_py/example_sell.py`)
- Buy and sell → Curve state and pricing: reads curve (evidence: `pump_fun_py/pump_fun.py`)
- Buy and sell → Balance and confirmation: uses helpers (evidence: `pump_fun_py/pump_fun.py`)
- Buy and sell → Program accounts: uses addresses (evidence: `pump_fun_py/pump_fun.py`)
- Curve state and pricing → Program accounts: uses program ID (evidence: `pump_fun_py/bonding_curve.py`)
- Curve state and pricing → Solana RPC: reads account (evidence: `pump_fun_py/bonding_curve.py`)
- Buy and sell → Solana RPC: submits transaction (evidence: `pump_fun_py/pump_fun.py`)
- Balance and confirmation → Solana RPC: checks balance and status (evidence: `pump_fun_py/utils.py`)
