|
1 | 1 | # @evolution-sdk/evolution |
2 | 2 |
|
| 3 | +## 0.2.2 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#63](https://github.com/IntersectMBO/evolution-sdk/pull/63) [`7bb1da3`](https://github.com/IntersectMBO/evolution-sdk/commit/7bb1da32488c5a1a92a9c8b90e5aa4514e004232) Thanks [@solidsnakedev](https://github.com/solidsnakedev)! - Improve `Variant` type inference with `PropertyKey` constraint |
| 8 | + |
| 9 | + The `Variant` helper now accepts `PropertyKey` (string | number | symbol) as variant keys instead of just strings, enabling more flexible discriminated union patterns. |
| 10 | + |
| 11 | + **Before:** |
| 12 | + |
| 13 | + ```typescript |
| 14 | + // Only string keys were properly typed |
| 15 | + const MyVariant = TSchema.Variant({ |
| 16 | + Success: { value: TSchema.Integer }, |
| 17 | + Error: { message: TSchema.ByteArray } |
| 18 | + }) |
| 19 | + ``` |
| 20 | + |
| 21 | + **After:** |
| 22 | + |
| 23 | + ```typescript |
| 24 | + // Now supports symbols and numbers as variant keys |
| 25 | + const MyVariant = TSchema.Variant({ |
| 26 | + Success: { value: TSchema.Integer }, |
| 27 | + Error: { message: TSchema.ByteArray } |
| 28 | + }) |
| 29 | + // Type inference is improved, especially with const assertions |
| 30 | + ``` |
| 31 | + |
| 32 | + Replace `@ts-expect-error` with `as any` following Effect patterns |
| 33 | + |
| 34 | + Improved code quality by replacing forbidden `@ts-expect-error` directives with explicit `as any` type assertions, consistent with Effect Schema's approach for dynamic object construction. |
| 35 | + |
| 36 | + Add comprehensive Cardano Address type support |
| 37 | + |
| 38 | + Added full CBOR encoding support for Cardano address structures with Aiken compatibility: |
| 39 | + |
| 40 | + ```typescript |
| 41 | + const Credential = TSchema.Variant({ |
| 42 | + VerificationKey: { hash: TSchema.ByteArray }, |
| 43 | + Script: { hash: TSchema.ByteArray } |
| 44 | + }) |
| 45 | + |
| 46 | + const Address = TSchema.Struct({ |
| 47 | + payment_credential: Credential, |
| 48 | + stake_credential: TSchema.UndefinedOr( |
| 49 | + TSchema.Variant({ |
| 50 | + Inline: { credential: Credential }, |
| 51 | + Pointer: { |
| 52 | + slot_number: TSchema.Integer, |
| 53 | + transaction_index: TSchema.Integer, |
| 54 | + certificate_index: TSchema.Integer |
| 55 | + } |
| 56 | + }) |
| 57 | + ) |
| 58 | + }) |
| 59 | + |
| 60 | + // Creates proper CBOR encoding matching Aiken's output |
| 61 | + const address = Data.withSchema(Address).toData({ |
| 62 | + payment_credential: { VerificationKey: { hash } }, |
| 63 | + stake_credential: { Inline: { credential: { VerificationKey: { stakeHash } } } } |
| 64 | + }) |
| 65 | + ``` |
| 66 | + |
| 67 | +- [#63](https://github.com/IntersectMBO/evolution-sdk/pull/63) [`844dfec`](https://github.com/IntersectMBO/evolution-sdk/commit/844dfeccb48c0af0ce0cebfc67e6cdcc67e28cc8) Thanks [@solidsnakedev](https://github.com/solidsnakedev)! - Add Aiken-compatible CBOR encoding with encodeMapAsPairs option and comprehensive test suite. PlutusData maps can now encode as arrays of pairs (Aiken style) or CBOR maps (CML style). Includes 72 Aiken reference tests and 40 TypeScript compatibility tests verifying identical encoding. Also fixes branded schema pattern in Data.ts for cleaner type inference and updates TSchema error handling test. |
| 68 | + |
3 | 69 | ## 0.2.1 |
4 | 70 |
|
5 | 71 | ### Patch Changes |
|
0 commit comments