Skip to content

Commit ef563f3

Browse files
committed
docs: add changeset
1 parent e2fdfbb commit ef563f3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.changeset/cruel-rice-sort.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
"@evolution-sdk/devnet": patch
3+
"@evolution-sdk/evolution": patch
4+
---
5+
6+
Migrate transaction builder and provider layer to use Core UTxO types throughout the SDK.
7+
8+
### New Core Types
9+
10+
- **`Core.UTxO`** — Schema-validated UTxO with branded types (`TransactionHash`, `Address`, `Assets`)
11+
- **`Core.Assets`** — Enhanced with `merge`, `subtract`, `negate`, `getAsset`, `setAsset`, `hasAsset` operations
12+
- **`Core.Time`** — New module for slot/time conversions with `SlotConfig`, `Slot`, `UnixTime`
13+
- **`Core.Address`** — Added `getAddressDetails`, `getPaymentCredential`, `getStakingCredential` utilities
14+
15+
### SDK Changes
16+
17+
- Provider methods (`getUtxos`, `getUtxoByUnit`, `getUtxosWithUnit`) now return `Core.UTxO.UTxO[]`
18+
- Client methods (`getWalletUtxos`, `newTx`) use Core UTxO internally
19+
- Transaction builder accepts `Core.UTxO.UTxO[]` for `availableUtxos`
20+
- `Genesis.calculateUtxosFromConfig` and `Genesis.queryUtxos` return Core UTxOs
21+
22+
### Rationale
23+
24+
The SDK previously used a lightweight `{ txHash, outputIndex, address, assets }` record for UTxOs, requiring constant conversions when interfacing with the Core layer (transaction building, CBOR serialization). This caused:
25+
26+
1. **Conversion overhead** — Every transaction build required converting SDK UTxOs to Core types
27+
2. **Type ambiguity**`txHash: string` vs `TransactionHash`, `address: string` vs `Address` led to runtime errors
28+
3. **Inconsistent APIs** — Some methods returned Core types, others SDK types
29+
30+
By standardizing on Core UTxO:
31+
32+
- **Zero conversion** — UTxOs flow directly from provider → wallet → builder → transaction
33+
- **Type safety** — Branded types prevent mixing up transaction hashes, addresses, policy IDs
34+
- **Unified model** — Single UTxO representation across the entire SDK
35+
36+
### Migration
37+
38+
```typescript
39+
// Before
40+
const lovelace = Assets.getAsset(utxo.assets, "lovelace")
41+
const txId = utxo.txHash
42+
const idx = utxo.outputIndex
43+
const addr = utxo.address // string
44+
45+
// After
46+
const lovelace = utxo.assets.lovelace
47+
const txId = Core.TransactionHash.toHex(utxo.transactionId)
48+
const idx = utxo.index // bigint
49+
const addr = Core.Address.toBech32(utxo.address) // or use Address directly
50+
```

0 commit comments

Comments
 (0)