# dinitheth/aegisbid architecture

> Architecture diagram of the GitHub repository dinitheth/aegisbid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dinitheth/aegisbid
- Repository: https://github.com/dinitheth/aegisbid

## Overview

AegisBid is a browser-based private tender prototype for Midnight. Issuers configure and deploy tenders; bidders prepare sealed offers and submit them through a wallet; an authorized evaluator begins evaluation and settles, exposing the outcome while keeping losing bids private. The app also discovers tenders from chain activity and local or shared listings. The README documents the V2 contract guarantees and workflow; sampled source confirms key UI, wallet, provider, and discovery connections. Unsampled implementation details are represented only where documented.

Main entry points: [`src/features/aegis/AegisUserApp.tsx`](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/AegisUserApp.tsx) (Tender UI), [`src/features/aegis/midnight/DeployPage.tsx`](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/DeployPage.tsx) (Deploy UI), [`src/features/aegis/midnight/providers.ts`](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/providers.ts) (Proof providers), [`src/features/aegis/useChainTenders.ts`](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/useChainTenders.ts) (Tender discovery hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Tender application"]
  node_app_route["App route<br/>[index.tsx]"]
  node_tender_ui["Tender UI<br/>[AegisUserApp.tsx]"]
  node_deploy_ui["Deploy UI<br/>[DeployPage.tsx]"]
  node_button["Button control<br/>[button.tsx]"]
  node_input["Input control<br/>[input.tsx]"]
  node_label["Field labels<br/>[label.tsx]"]
end

subgraph group_protocol["Tender rules"]
  node_protocol_model["Protocol model<br/>[protocol.ts]"]
  node_tender_engine["Tender engine<br/>[tenderEngine.ts]"]
  node_commitment_hash["Commitment hashing<br/>[hash.ts]"]
  node_evaluator_adapter["Evaluator adapter<br/>[evaluator.ts]"]
end

subgraph group_midnight["Midnight integration"]
  node_wallet_connector["Wallet connector<br/>[oneAmWallet.tsx]"]
  node_providers["Proof providers<br/>[providers.ts]"]
  node_contract_adapter["Contract adapter<br/>[contract.ts]"]
  node_generated_contract["V2 contract bindings<br/>[index.js]"]
  node_polyfills["Browser polyfills<br/>[polyfills.ts]"]
end

subgraph group_discovery["Tender discovery"]
  node_chain_access["Chain access<br/>[chain.ts]"]
  node_tender_hook["Tender discovery hook<br/>[useChainTenders.ts]"]
  node_registry[("Shared registry")]
end

node_bidder(("Bidder"))
node_issuer(("Issuer"))
node_evaluator(("Evaluator"))
node_wallet["1AM wallet"]
node_midnight_network[("Midnight Preprod")]

node_bidder -->|"opens app"| node_app_route
node_issuer -->|"configures tender"| node_deploy_ui
node_deploy_ui -->|"connects wallet"| node_wallet_connector
node_deploy_ui -->|"deploys through"| node_providers
node_deploy_ui -->|"registers tender"| node_registry
node_app_route -->|"renders"| node_tender_ui
node_tender_ui -->|"uses controls"| node_button
node_tender_ui -->|"uses controls"| node_input
node_tender_ui -->|"uses fields"| node_label
node_tender_ui -->|"uses protocol"| node_protocol_model
node_tender_ui -->|"maps evaluator input"| node_evaluator_adapter
node_tender_ui -->|"submits with"| node_wallet_connector
node_bidder -->|"submits sealed offer"| node_tender_ui
node_wallet_connector -->|"connects"| node_wallet
node_tender_ui -->|"requests proof transaction"| node_providers
node_providers -->|"uses contract mapping"| node_contract_adapter
node_contract_adapter -->|"integrates bindings"| node_generated_contract
node_providers -->|"delegates proving and submission"| node_wallet
node_providers -->|"submits contract calls"| node_midnight_network
node_evaluator -->|"begins and settles"| node_tender_ui
node_tender_ui -->|"builds settlement inputs"| node_evaluator_adapter
node_tender_engine -->|"hashes commitments"| node_commitment_hash
node_tender_hook -->|"loads chain activity"| node_chain_access
node_tender_hook -->|"loads shared listings"| node_registry
node_tender_ui -->|"discovers tenders"| node_tender_hook
node_chain_access -->|"queries indexer"| node_midnight_network
node_deploy_ui -->|"stores local publish"| node_chain_access
node_polyfills -.->|"supports browser runtime"| node_deploy_ui
node_midnight_network -->|"records settlement outcome"| node_tender_ui

click node_app_route "https://github.com/dinitheth/aegisbid/blob/main/src/routes/index.tsx"
click node_tender_ui "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/AegisUserApp.tsx"
click node_deploy_ui "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/DeployPage.tsx"
click node_button "https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/button.tsx"
click node_input "https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/input.tsx"
click node_label "https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/label.tsx"
click node_protocol_model "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/protocol.ts"
click node_tender_engine "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/tenderEngine.ts"
click node_commitment_hash "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/hash.ts"
click node_evaluator_adapter "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/evaluator.ts"
click node_chain_access "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/chain.ts"
click node_tender_hook "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/useChainTenders.ts"
click node_registry "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/tenderRegistry.server.ts"
click node_wallet_connector "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/oneAmWallet.tsx"
click node_providers "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/providers.ts"
click node_contract_adapter "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/contract.ts"
click node_generated_contract "https://github.com/dinitheth/aegisbid/blob/main/managed/aegis-bid-v2/contract/index.js"
click node_polyfills "https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/polyfills.ts"

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_app_route,node_tender_ui,node_deploy_ui,node_button,node_input,node_label toneBlue
class node_protocol_model,node_tender_engine,node_commitment_hash,node_evaluator_adapter,node_midnight_network toneAmber
class node_wallet_connector,node_providers,node_contract_adapter,node_generated_contract,node_polyfills toneMint
class node_chain_access,node_tender_hook,node_registry toneRose
class node_bidder,node_issuer,node_evaluator,node_wallet toneIndigo
```

## Components

### Tender application

- [App route](https://github.com/dinitheth/aegisbid/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Tender UI](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/AegisUserApp.tsx): `src/features/aegis/AegisUserApp.tsx`
- [Deploy UI](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/DeployPage.tsx): `src/features/aegis/midnight/DeployPage.tsx`
- [Button control](https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Input control](https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Field labels](https://github.com/dinitheth/aegisbid/blob/main/src/components/ui/label.tsx): `src/components/ui/label.tsx`

### Tender rules

- [Protocol model](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/protocol.ts): `src/features/aegis/protocol.ts`
- [Tender engine](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/tenderEngine.ts): `src/features/aegis/tenderEngine.ts`
- [Commitment hashing](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/hash.ts): `src/features/aegis/hash.ts`
- [Evaluator adapter](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/evaluator.ts): `src/features/aegis/evaluator.ts`

### Midnight integration

- [Wallet connector](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/oneAmWallet.tsx): `src/features/aegis/midnight/oneAmWallet.tsx`
- [Proof providers](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/providers.ts): `src/features/aegis/midnight/providers.ts`
- [Contract adapter](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/contract.ts): `src/features/aegis/midnight/contract.ts`
- [V2 contract bindings](https://github.com/dinitheth/aegisbid/blob/main/managed/aegis-bid-v2/contract/index.js): `managed/aegis-bid-v2/contract/index.js`
- [Browser polyfills](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/polyfills.ts): `src/features/aegis/midnight/polyfills.ts`

### Tender discovery

- [Chain access](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/chain.ts): `src/features/aegis/chain.ts`
- [Tender discovery hook](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/useChainTenders.ts): `src/features/aegis/useChainTenders.ts`
- [Shared registry](https://github.com/dinitheth/aegisbid/blob/main/src/features/aegis/midnight/tenderRegistry.server.ts): `src/features/aegis/midnight/tenderRegistry.server.ts`

### Other components

- **Bidder**
- **Issuer**
- **Evaluator**
- **1AM wallet**
- **Midnight Preprod**

## Connections

- Bidder → App route: opens app (evidence: `README.md`)
- Issuer → Deploy UI: configures tender (evidence: `README.md`)
- Deploy UI → Wallet connector: connects wallet (evidence: `src/features/aegis/midnight/DeployPage.tsx`)
- Deploy UI → Proof providers: deploys through (evidence: `README.md`)
- Deploy UI → Shared registry: registers tender (evidence: `src/features/aegis/midnight/DeployPage.tsx`)
- App route → Tender UI: renders (evidence: `src/routes/index.tsx`)
- Tender UI → Button control: uses controls (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender UI → Input control: uses controls (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender UI → Field labels: uses fields (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender UI → Protocol model: uses protocol (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender UI → Evaluator adapter: maps evaluator input (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender UI → Wallet connector: submits with (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Bidder → Tender UI: submits sealed offer (evidence: `README.md`)
- Wallet connector → 1AM wallet: connects (evidence: `src/features/aegis/midnight/oneAmWallet.tsx`)
- Tender UI → Proof providers: requests proof transaction (evidence: `README.md`)
- Proof providers → Contract adapter: uses contract mapping (evidence: `src/features/aegis/midnight/providers.ts`)
- Contract adapter → V2 contract bindings: integrates bindings (evidence: `src/features/aegis/midnight/contract.ts`)
- Proof providers → 1AM wallet: delegates proving and submission (evidence: `README.md`)
- Proof providers → Midnight Preprod: submits contract calls (evidence: `README.md`)
- Evaluator → Tender UI: begins and settles (evidence: `README.md`)
- Tender UI → Evaluator adapter: builds settlement inputs (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Tender engine → Commitment hashing: hashes commitments (evidence: `src/features/aegis/tenderEngine.ts`)
- Tender discovery hook → Chain access: loads chain activity (evidence: `src/features/aegis/useChainTenders.ts`)
- Tender discovery hook → Shared registry: loads shared listings (evidence: `src/features/aegis/useChainTenders.ts`)
- Tender UI → Tender discovery hook: discovers tenders (evidence: `src/features/aegis/AegisUserApp.tsx`)
- Chain access → Midnight Preprod: queries indexer (evidence: `src/features/aegis/chain.ts`)
- Deploy UI → Chain access: stores local publish (evidence: `src/features/aegis/midnight/DeployPage.tsx`)
- Browser polyfills → Deploy UI: supports browser runtime (evidence: `src/features/aegis/midnight/DeployPage.tsx`)
- Midnight Preprod → Tender UI: records settlement outcome (evidence: `README.md`)
