Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,36 +275,47 @@ Join our thriving community of Cardano developers:

## Roadmap

### Phase 3: Transaction Building & Providers (In Progress)
- [ ] **Transaction Builder Components**
- [ ] Transaction builder with fluent API
- [ ] UTXO selection algorithms
- [ ] Fee calculation utilities
- [ ] Balance and change computation
- [ ] Multi-asset transaction support
- [ ] Script witness attachment
- [ ] **Provider Integrations**
- [ ] `Maestro` - Maestro API provider
- [ ] `Blockfrost` - Blockfrost API provider
- [ ] `Koios` - Koios API provider
- [ ] `KupoOgmios` - Kupo/Ogmios provider
### Phase 3: Transaction Building & Providers (Mostly Complete)
- [x] **Transaction Builder Components**
- [x] Transaction builder with fluent API
- [x] UTXO selection algorithms (largest-first)
- [x] Fee calculation utilities
- [x] Balance and change computation
- [x] Multi-asset transaction support
- [x] Script witness attachment
- [x] **Provider Integrations**
- [x] `Maestro` - Maestro API provider
- [x] `Blockfrost` - Blockfrost API provider
- [x] `Koios` - Koios API provider
- [x] `KupoOgmios` - Kupo/Ogmios provider
- [ ] `UtxoRpc` - UTXO RPC provider
- [ ] Provider abstraction layer
- [x] Provider abstraction layer
- [ ] Failover and load balancing
- [ ] **Wallet Integration**
- **Wallet Integration**
- [ ] Hardware wallet support (Ledger, Trezor)
- [ ] Browser wallet integration (Nami, Eternl, Flint)
- [x] Browser wallet integration (CIP-30)
- [ ] Multi-signature wallet support
- [ ] Wallet connector abstraction layer
- [ ] CIP-30 standard implementation
- [ ] **Smart Contract Support**
- [ ] UPLC evaluation from Aiken
- [ ] UPLC evaluation from Helios
- [ ] UPLC evaluation from Plu-ts
- [ ] UPLC evaluation from Scalus
- [ ] Script validation utilities
- [ ] Datum and redeemer handling
- [ ] Script cost estimation
- [x] CIP-30 standard implementation
- [x] **Smart Contract Support**
- [x] Plutus V1/V2/V3 script evaluation
- [x] Script validation utilities
- [x] Datum and redeemer handling (inline datums, datum hashes, 3 redeemer modes)
- [x] Script cost estimation (automatic ExUnits computation)
- [x] Reference scripts support
- [x] **Governance (Conway Era)**
- [x] DRep registration, update, deregistration
- [x] Governance voting (DRep, Committee, SPO)
- [x] Governance proposals
- [x] Constitutional Committee operations
- [x] Vote delegation
- [x] **Staking**
- [x] Stake credential registration/deregistration
- [x] Pool delegation
- [x] DRep delegation (Conway)
- [x] Combined register + delegate certificates
- [x] Rewards withdrawal
- [x] Script-controlled staking
- [ ] **Effect 4.0 Migration**
- [ ] Upgrade to Effect 4.0 when released
- [ ] Leverage new Effect features and performance improvements
Expand All @@ -327,10 +338,10 @@ Join our thriving community of Cardano developers:
- [ ] CLI tool for project scaffolding
- [ ] VS Code extension
- [ ] Interactive tutorials
- [ ] Schema types from Plutus blueprint types
- [x] Schema types from Plutus blueprint types (codegen)

### Current Focus
We're currently prioritizing transaction building components and provider integrations (Maestro, Blockfrost, Koios, Kupo/Ogmios, UTXO RPC) to provide developers with the essential infrastructure needed for building production Cardano applications.
The core SDK covers transaction building, smart contracts (Plutus V1/V2/V3), providers (Blockfrost, Maestro, Koios, Kupo/Ogmios), CIP-30 wallet integration, Conway governance, and staking. Current priorities include additional coin selection algorithms, UTXO RPC provider support, hardware wallet integration, and Hydra integration.

## Contributing

Expand Down
64 changes: 62 additions & 2 deletions docs/content/docs/addresses/construction.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,68 @@
---
title: Address Construction
description: How to build Cardano addresses from keys and credentials
description: Build Cardano addresses from credentials and keys
---

# Address Construction

Content coming soon.
Cardano addresses are derived from credentials (key hashes or script hashes). Evolution SDK provides utilities for parsing, converting, and working with all address types.

## Parse from Bech32

The most common way to work with addresses:

```typescript twoslash
import { Address } from "@evolution-sdk/evolution"

const address = Address.fromBech32(
"addr_test1vrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qd9k63"
)
```

## Parse from Hex

```typescript twoslash
import { Address } from "@evolution-sdk/evolution"

// Address hex strings are typically 29 or 57 bytes
declare const addressHex: string
const address = Address.fromHex(addressHex)
```

## Convert Between Formats

```typescript twoslash
import { Address } from "@evolution-sdk/evolution"

const address = Address.fromBech32(
"addr_test1vrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qd9k63"
)

// To hex
const hex = Address.toHex(address)

// To bytes
const bytes = Address.toBytes(address)

// To bech32
const bech32 = Address.toBech32(address)
```

## Getting Your Wallet Address

```typescript twoslash
import { createClient } from "@evolution-sdk/evolution"

const client = createClient({
network: "preprod",
wallet: { type: "seed", mnemonic: process.env.WALLET_MNEMONIC!, accountIndex: 0 }
})

const myAddress = await client.address()
```

## Next Steps

- [Address Types](/docs/addresses/address-types) — Base, enterprise, pointer, reward
- [Address Validation](/docs/addresses/validation) — Validate address format
- [Address Conversion](/docs/addresses/conversion) — Convert between formats
73 changes: 71 additions & 2 deletions docs/content/docs/advanced/architecture.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,77 @@
---
title: Architecture
description: SDK architecture overview
description: How the transaction builder works internally
---

# Architecture

Content coming soon.
Evolution SDK's transaction builder uses a **deferred execution pattern**. Operations like `payToAddress`, `collectFrom`, and `mintAssets` don't execute immediately — they accumulate as a list of programs that run together when you call `.build()`.

## Build Phases

When `.build()` is called, the transaction goes through a state machine of phases. The exact order depends on whether scripts are involved:

**Simple transactions (no scripts):**
Selection → Change Creation → Fee Calculation → Balance → Complete

**Script transactions:**
Selection → Collateral → Change Creation → Fee Calculation → Balance → Evaluation → (re-balance if needed) → Complete

| Phase | Purpose |
|-------|---------|
| **Selection** | Choose UTxOs from the wallet to cover outputs + fees |
| **Collateral** | Select collateral UTxOs (script transactions only) |
| **Change Creation** | Compute change outputs for leftover value |
| **Fee Calculation** | Calculate transaction fees based on size and script costs |
| **Balance** | Verify inputs equal outputs + fees |
| **Evaluation** | Execute Plutus scripts and compute execution units |
| **Fallback** | Handle edge cases (insufficient change, etc.) |
| **Complete** | Assemble the final transaction |

## Deferred Execution

```typescript
// These don't execute immediately — they record operations
const builder = client.newTx()
.payToAddress({ ... }) // Records a "pay" program
.collectFrom({ ... }) // Records a "collect" program
.mintAssets({ ... }) // Records a "mint" program

// This executes all programs and runs the build phases
const tx = await builder.build()
```

This design enables:
- **Composition** — Combine builders with `.compose()`
- **Redeemer indexing** — Compute correct indices after coin selection
- **Optimization** — The builder sees all operations before making decisions

## Three Build Methods

| Method | Returns | Use Case |
|--------|---------|----------|
| `.build()` | `Promise<SignBuilder>` | Standard async/await |
| `.buildEffect()` | `Effect<SignBuilder, Error>` | Effect-based composition |
| `.buildEither()` | `Promise<Either<Error, SignBuilder>>` | Explicit error handling |

## Build Options

Customize the build process:

```typescript
.build({
coinSelection: "largest-first", // or custom function
changeAddress: customAddress, // Override change address
availableUtxos: utxos, // Override available UTxOs
evaluator: customEvaluator, // Custom script evaluator
debug: true, // Enable debug logging
setCollateral: 5_000_000n, // Collateral amount
slotConfig: { ... }, // Custom time configuration
})
```

## Next Steps

- [Error Handling](/docs/advanced/error-handling) — Effect-based error patterns
- [Performance](/docs/advanced/performance) — Coin selection and optimization
- [Custom Providers](/docs/advanced/custom-providers) — Implement a provider
63 changes: 61 additions & 2 deletions docs/content/docs/advanced/custom-providers.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,67 @@
---
title: Custom Providers
description: Build custom blockchain providers
description: Implement your own blockchain provider
---

# Custom Providers

Content coming soon.
If the built-in providers (Blockfrost, Maestro, Koios, Kupo/Ogmios) don't meet your needs, you can implement the `ProviderEffect` interface to create a custom provider.

## Provider Interface

A provider must implement these methods:

```typescript
interface ProviderEffect {
getProtocolParameters(): Effect<ProtocolParameters, ProviderError>
getUtxos(addressOrCredential): Effect<UTxO[], ProviderError>
getUtxosWithUnit(addressOrCredential, unit): Effect<UTxO[], ProviderError>
getUtxoByUnit(unit): Effect<UTxO, ProviderError>
getUtxosByOutRef(refs): Effect<UTxO[], ProviderError>
getDelegation(rewardAddress): Effect<Delegation, ProviderError>
getDatum(datumHash): Effect<Data, ProviderError>
submitTx(tx): Effect<TransactionHash, ProviderError>
awaitTx(txHash, checkInterval?, timeout?): Effect<boolean, ProviderError>
evaluateTx(tx, additionalUTxOs?): Effect<EvalRedeemer[], ProviderError>
}
```

## Built-in Providers

| Provider | Connection | Best For |
|----------|-----------|----------|
| **Blockfrost** | REST API | Production apps, simple setup |
| **Maestro** | REST API | Advanced queries, data analytics |
| **Koios** | REST API | Open source, community maintained |
| **Kupo/Ogmios** | WebSocket + REST | Self-hosted, devnet, full control |

## Using a Provider

```typescript twoslash
import { createClient } from "@evolution-sdk/evolution"

// Blockfrost
const blockfrostClient = createClient({
network: "preprod",
provider: {
type: "blockfrost",
baseUrl: "https://cardano-preprod.blockfrost.io/api/v0",
projectId: process.env.BLOCKFROST_API_KEY!
}
})

// Kupo/Ogmios
const kupmiosClient = createClient({
network: "preprod",
provider: {
type: "kupmios",
kupoUrl: "http://localhost:1442",
ogmiosUrl: "http://localhost:1337"
}
})
```

## Next Steps

- [Architecture](/docs/advanced/architecture) — How providers fit into the build pipeline
- [Providers](/docs/providers) — Provider comparison and configuration
Loading
Loading