You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,8 @@ A breaking change will get clearly marked in this log.
30
30
***Start here: [`docs/XDR_MIGRATION.md`](./docs/XDR_MIGRATION.md) covers every change below with before/after examples and a quick-reference table.**
31
31
* Unions are discriminated classes. `.switch()` becomes a `.type` string literal, arm getters like `.contractData()` become properties, and `new xdr.LedgerEntryData(disc, val)` becomes a factory call such as `xdr.LedgerEntryData.contractData(val)`.
32
32
* Enums are singletons, not factory calls: `xdr.ContractDataDurability.persistent()` becomes `xdr.ContractDataDurability.persistent`.
33
-
* Primitives are plain JS values. Integers are `number` or `bigint` instead of class wrappers, `LargeInt` subclasses are gone, byte fields are `Uint8Array`, and fields are `readonly`.
33
+
* Primitives are plain JS values. Integers are `number` or `bigint` instead of class wrappers, anonymous `opaque` fields are `Uint8Array`, `LargeInt` subclasses are gone, and fields are `readonly`.
34
+
* Named byte aliases (`Hash`, `Signature`, `AssetCode4`, `PoolId`, `ContractId`, …) are classes wrapping the bytes, not bare `Uint8Array`. They take raw bytes or a string on the way in and validate length at construction; read the bytes back with `.toBytes()`. The string form is hex, except for `AssetCode4` / `AssetCode12`, which take the asset code as ASCII text and zero-pad it (`new xdr.AssetCode4("USD")`). This includes `uint256`, whose class is named `Uint256Bytes` because `xdr.Uint256` is the bigint wrapper over `Uint256Parts` — it covers the ed25519 keys, salts, and nonces on `PublicKey` (and its alias `AccountId`), `SignerKey`, `MuxedAccount`, `MuxedAccountMed25519`, `MuxedEd25519Account`, `TransactionV0`, `SignerKeyEd25519SignedPayload`, `ContractIdPreimageFromAddress`, `ClaimOfferAtomV0`, and the `Hello`, `DontHave`, and `StellarMessage` overlay messages.
34
35
* Absent optional fields decode to `null` instead of `undefined`, so `=== undefined` checks silently stop matching. Prefer `== null`.
35
36
* Acronyms in method names collapse to single-initial-cap form, with no back-compat aliases (e.g. `validateXDR()` is now `validateXdr()`). This reaches beyond the `xdr` namespace to the wrapper classes: `Transaction.toXDR()`, `TransactionBuilder.fromXDR()`, `Operation.fromXDRObject()`, `Asset.toXDRObject()`, `contract.AssembledTransaction.toXDR()` and others all gained the `Xdr` spelling.
36
37
* Struct field names are unchanged, but a few type names moved: `UInt128Parts` / `UInt256Parts` are now `Uint128Parts` / `Uint256Parts`, `ThresholdIndices` is now `ThresholdIndexes`, and the typedef aliases `Duration`, `TimePoint`, `SequenceNumber`, `ScVec`, `ScMap`, `LedgerEntryChanges`, `ContractCostParams`, `SorobanAuthorizationEntries`, `ScString`, `ScSymbol`, `String32`, `String64`, and `SponsorshipDescriptor` are gone in favor of what they stood for.
0 commit comments