refactor(swift-sdk): data transformers#3045
refactor(swift-sdk): data transformers#3045alfie-dash wants to merge 2 commits intofeat/iOSSupportfrom
Conversation
- Add new validator methods to AddressValidator: - validateBech32mAddress() for bech32m Platform addresses - validateAddress() with auto-detection (hex or bech32m) - validateHash() for 32-byte hashes - validateIdentityIdHex() and isHexIdentityId() for identity IDs - Create comprehensive unit tests for all validators (40+ tests) covering AddressValidator, TransferInputValidator, WithdrawInputValidator, TopUpAddressFromAssetLockValidator, and Identity validators - Update views to use centralized validators: - AddressQueriesView: use validateHash() - DocumentWithPriceView: use isHexIdentityId() - TransitionDetailView: use isHexIdentityId()
Add DataTransformers.swift with utilities for address, number, and response transformations: - AddressTransformer: hex/Data conversion, bech32m parsing, identity ID normalization - NumberTransformer: UInt64/UInt32 parsing, amount formatting, credits/duffs to Dash - ResponseParser: PlatformAddressInfo parsing and formatting - TransferInputBuilder: create transfer inputs/outputs from form strings Update ViewModels to use new transformers: - AddressTransferViewModel: use TransferInputBuilder - WithdrawAddressFundsViewModel: use TransferInputBuilder and NumberTransformer - TopUpAddressFromAssetLockViewModel: use AddressTransformer and NumberTransformer Add comprehensive unit tests for all transformer functionality (39 tests).
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Failure to add the new IP will result in interrupted reviews. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ DashSDKFFI.xcframework built for this PR.
SwiftPM (host the zip at a stable URL, then use): .binaryTarget(
name: "DashSDKFFI",
url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
checksum: "d917a28a90ad66ee8bdd5d68b93b2249bb71140c867b9a33cad70c59fffa83a0"
)Xcode manual integration:
|
Issue being fixed or feature implemented
Phase 2 of Swift SDK refactoring: Extract data transformation logic into centralized utilities for better code reuse and maintainability.
What was done?
Added
DataTransformers.swiftwith centralized utilities for data conversion:Updated ViewModels to use new transformers:
AddressTransferViewModelWithdrawAddressFundsViewModelTopUpAddressFromAssetLockViewModelHow Has This Been Tested?
DataTransformersTests.swiftBreaking Changes
None
Checklist: