|
1 | 1 | # @evolution-sdk/devnet |
2 | 2 |
|
| 3 | +## 1.1.3 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#98](https://github.com/IntersectMBO/evolution-sdk/pull/98) [`ef563f3`](https://github.com/IntersectMBO/evolution-sdk/commit/ef563f305879e6e7411d930a87733cc4e9f34314) Thanks [@solidsnakedev](https://github.com/solidsnakedev)! - Migrate transaction builder and provider layer to use Core UTxO types throughout the SDK. |
| 8 | + |
| 9 | + ### New Core Types |
| 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 | + - Provider methods (`getUtxos`, `getUtxoByUnit`, `getUtxosWithUnit`) now return `Core.UTxO.UTxO[]` |
| 17 | + - Client methods (`getWalletUtxos`, `newTx`) use Core UTxO internally |
| 18 | + - Transaction builder accepts `Core.UTxO.UTxO[]` for `availableUtxos` |
| 19 | + - `Genesis.calculateUtxosFromConfig` and `Genesis.queryUtxos` return Core UTxOs |
| 20 | + |
| 21 | + ### Rationale |
| 22 | + |
| 23 | + 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: |
| 24 | + 1. **Conversion overhead** — Every transaction build required converting SDK UTxOs to Core types |
| 25 | + 2. **Type ambiguity** — `txHash: string` vs `TransactionHash`, `address: string` vs `Address` led to runtime errors |
| 26 | + 3. **Inconsistent APIs** — Some methods returned Core types, others SDK types |
| 27 | + |
| 28 | + By standardizing on Core UTxO: |
| 29 | + - **Zero conversion** — UTxOs flow directly from provider → wallet → builder → transaction |
| 30 | + - **Type safety** — Branded types prevent mixing up transaction hashes, addresses, policy IDs |
| 31 | + - **Unified model** — Single UTxO representation across the entire SDK |
| 32 | + |
| 33 | + ### Migration |
| 34 | + |
| 35 | + ```typescript |
| 36 | + // Before |
| 37 | + const lovelace = Assets.getAsset(utxo.assets, "lovelace") |
| 38 | + const txId = utxo.txHash |
| 39 | + const idx = utxo.outputIndex |
| 40 | + const addr = utxo.address // string |
| 41 | + |
| 42 | + // After |
| 43 | + const lovelace = utxo.assets.lovelace |
| 44 | + const txId = Core.TransactionHash.toHex(utxo.transactionId) |
| 45 | + const idx = utxo.index // bigint |
| 46 | + const addr = Core.Address.toBech32(utxo.address) // or use Address directly |
| 47 | + ``` |
| 48 | + |
| 49 | +- Updated dependencies [[`ef563f3`](https://github.com/IntersectMBO/evolution-sdk/commit/ef563f305879e6e7411d930a87733cc4e9f34314)]: |
| 50 | + - @evolution-sdk/evolution@0.3.3 |
| 51 | + |
3 | 52 | ## 1.1.2 |
4 | 53 |
|
5 | 54 | ### Patch Changes |
|
0 commit comments