diff --git a/Cargo.lock b/Cargo.lock index 8262a058813..d8afc3f4f04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1132,7 +1132,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1550,7 +1550,7 @@ dependencies = [ [[package]] name = "dash-network" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "bincode", "bincode_derive", @@ -1561,7 +1561,7 @@ dependencies = [ [[package]] name = "dash-network-seeds" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "dash-network", ] @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "dash-spv" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "async-trait", "chrono", @@ -1666,7 +1666,7 @@ dependencies = [ [[package]] name = "dash-spv-ffi" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "cbindgen 0.29.2", "clap", @@ -1685,7 +1685,7 @@ dependencies = [ [[package]] name = "dashcore" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "anyhow", "base64-compat", @@ -1711,12 +1711,12 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" [[package]] name = "dashcore-rpc" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "dashcore-rpc-json", "hex", @@ -1729,7 +1729,7 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "bincode", "dashcore", @@ -1744,7 +1744,7 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "bincode", "dashcore-private", @@ -2279,7 +2279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3562,7 +3562,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3793,7 +3793,7 @@ dependencies = [ [[package]] name = "key-wallet" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "aes", "async-trait", @@ -3821,7 +3821,7 @@ dependencies = [ [[package]] name = "key-wallet-ffi" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "cbindgen 0.29.2", "dash-network", @@ -3837,13 +3837,14 @@ dependencies = [ [[package]] name = "key-wallet-manager" version = "0.42.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=53130869e5b9343ae59016323e5e5269e717a8fd#53130869e5b9343ae59016323e5e5269e717a8fd" +source = "git+https://github.com/dashpay/rust-dashcore?branch=feat%2Fkey-wallet-serde-derives#56a84402c8cb006d65b12e400785a62d67441930" dependencies = [ "async-trait", "bincode", "dashcore", "key-wallet", "rayon", + "serde", "tokio", "tracing", "zeroize", @@ -4313,7 +4314,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4848,6 +4849,7 @@ dependencies = [ "key-wallet-manager", "platform-encryption", "rand 0.8.6", + "serde", "serde_json", "sha2", "static_assertions", @@ -5319,7 +5321,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6042,7 +6044,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6055,7 +6057,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6114,7 +6116,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6954,7 +6956,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix 1.1.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -8356,7 +8358,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 078306a8b88..4efc3d93d47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,15 +49,20 @@ members = [ ] [workspace.dependencies] -dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -dash-spv-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "53130869e5b9343ae59016323e5e5269e717a8fd" } +# Temporary: branch-pinned to dashpay/rust-dashcore#761 (`feat/key-wallet-serde-derives`) +# for serde derives on AssetLockFundingType + DerivedAddress. The branch has been +# rebased onto 53130869 so it carries ONLY the serde additions (no v0.42-dev drift). +# Drop the branch= override and restore rev= once #761 merges to v0.42-dev and a +# subsequent dashcore rev bump flows the new rev in. +dashcore = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +dash-spv = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +dash-spv-ffi = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +key-wallet = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +dash-network = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", branch = "feat/key-wallet-serde-derives" } # Optimize heavy crypto crates even in dev/test builds so that # Halo 2 proof generation and verification run at near-release speed. diff --git a/packages/rs-platform-wallet/Cargo.toml b/packages/rs-platform-wallet/Cargo.toml index c766d7759ef..402a476840b 100644 --- a/packages/rs-platform-wallet/Cargo.toml +++ b/packages/rs-platform-wallet/Cargo.toml @@ -38,6 +38,7 @@ tracing = "0.1" # Encoding hex = "0.4" bs58 = "0.5" +serde = { version = "1", default-features = false, features = ["derive"], optional = true } serde_json = "1.0" # Image processing (DIP-15 avatar hash + fingerprint) @@ -65,6 +66,15 @@ default = ["bls", "eddsa"] bls = ["key-wallet/bls", "key-wallet-manager/bls"] eddsa = ["key-wallet/eddsa", "key-wallet-manager/eddsa"] shielded = ["dep:grovedb-commitment-tree", "dep:zip32", "dash-sdk/shielded", "dpp/shielded-client"] +# Opt-in serde derives on the changeset types. Activates `key-wallet/serde`, +# `key-wallet-manager/serde` (both via dashpay/rust-dashcore#761, branch-pinned in +# workspace Cargo.toml), and `dash-sdk/serde`. `dpp` derives serde unconditionally. +serde = [ + "dep:serde", + "key-wallet/serde", + "key-wallet-manager/serde", + "dash-sdk/serde", +] # Forward to the upstream `key-wallet` / `key-wallet-manager` # `keep-finalized-transactions` feature. With it OFF (the default), # chainlocked transactions are evicted from the in-memory diff --git a/packages/rs-platform-wallet/src/changeset/changeset.rs b/packages/rs-platform-wallet/src/changeset/changeset.rs index 40af538a08f..88ce9ec0ceb 100644 --- a/packages/rs-platform-wallet/src/changeset/changeset.rs +++ b/packages/rs-platform-wallet/src/changeset/changeset.rs @@ -78,6 +78,7 @@ use crate::wallet::identity::{ContactRequest, DashPayProfile, EstablishedContact /// upstream type. Tests that need to inspect a changeset's contents /// reach into individual fields directly. #[derive(Debug, Clone, Default)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct CoreChangeSet { /// Transaction records produced by this batch. /// @@ -228,6 +229,7 @@ impl Merge for CoreChangeSet { /// call [`IdentityEntry::from_managed`] to produce a fresh scalar /// snapshot so the merge can resolve the latest state by last-write-wins. #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IdentityEntry { /// Identity identifier. pub id: Identifier, @@ -302,6 +304,7 @@ impl IdentityEntry { /// path — platform-wallet itself never carries or persists the key /// bytes. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IdentityKeyDerivationIndices { /// DIP-9 identity index (hardened). pub identity_index: u32, @@ -322,6 +325,7 @@ pub struct IdentityKeyDerivationIndices { /// persist it. When either is `None` the key is watch-only from /// this wallet's point of view. #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IdentityKeyEntry { /// Owning identity. pub identity_id: Identifier, @@ -350,6 +354,7 @@ pub struct IdentityKeyEntry { /// `{upsert, remove}` per key per mutation — the merge does not resolve /// insert-vs-tombstone for the same key. #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IdentityKeysChangeSet { /// Inserted or updated identity keys keyed by (identity_id, key_id). pub upserts: BTreeMap<(Identifier, KeyID), IdentityKeyEntry>, @@ -386,6 +391,7 @@ impl Merge for IdentityKeysChangeSet { /// [`ContactChangeSet`]; same mitigation: every current emitter /// produces only one of {insert, tombstone} per key per mutation. #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct IdentityChangeSet { /// Inserted or updated identities keyed by identifier. pub identities: BTreeMap, @@ -471,6 +477,7 @@ impl Merge for IdentityChangeSet { /// /// Modelled after [`crate::wallet::identity::ContactRequest`]. #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ContactRequestEntry { /// The contact request. pub request: ContactRequest, @@ -479,6 +486,7 @@ pub struct ContactRequestEntry { /// Key for sent contact requests: the **owner** sent a request TO the /// **recipient**. Used for `sent_requests` and `removed_sent`. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct SentContactRequestKey { /// The identity owned by this wallet (the sender). pub owner_id: Identifier, @@ -490,6 +498,7 @@ pub struct SentContactRequestKey { /// FROM the **sender**. Used for `incoming_requests` and /// `removed_incoming`. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ReceivedContactRequestKey { /// The identity owned by this wallet (the recipient). pub owner_id: Identifier, @@ -538,6 +547,7 @@ pub struct ReceivedContactRequestKey { /// semantics, the merge impl should resolve `sent_requests ∩ /// removed_sent` by last-seen rather than carrying both. #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ContactChangeSet { /// Sent contact requests keyed by (owner → recipient). pub sent_requests: BTreeMap, @@ -600,6 +610,7 @@ impl Merge for ContactChangeSet { /// persisters can apply the entry without guessing which account or /// HD slot it belongs to. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct PlatformAddressBalanceEntry { pub wallet_id: WalletId, pub account_index: u32, @@ -609,6 +620,7 @@ pub struct PlatformAddressBalanceEntry { } #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct PlatformAddressChangeSet { /// Updated platform addresses produced by the last sync pass. /// A `Vec` rather than a map because the diff already deduplicates @@ -665,6 +677,7 @@ impl Merge for PlatformAddressChangeSet { /// Changes to the asset lock store. #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AssetLockChangeSet { /// Asset lock entries keyed by outpoint (txid + output index). /// @@ -681,6 +694,7 @@ pub struct AssetLockChangeSet { /// Contains all fields needed to fully reconstruct a /// [`TrackedAssetLock`](crate::wallet::asset_lock::tracked::TrackedAssetLock). #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AssetLockEntry { /// The outpoint identifying this credit output (txid + vout). pub out_point: OutPoint, @@ -723,6 +737,7 @@ impl Merge for AssetLockChangeSet { /// purely in the manager's in-memory cache. Persistence carries only /// the post-sync balance updates and tombstones. #[derive(Debug, Clone, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TokenBalanceChangeSet { /// Updated token balances keyed by `(identity_id, token_id)`. /// Last write wins on merge. @@ -763,6 +778,7 @@ impl Merge for TokenBalanceChangeSet { /// time; the parent `Option<...>` field stays `None` for every other /// flush. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct WalletMetadataEntry { /// Network the wallet is bound to. pub network: Network, @@ -787,6 +803,7 @@ pub struct WalletMetadataEntry { /// is simple `extend` and dedup is the apply-side caller's /// responsibility if it ever matters. #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AccountRegistrationEntry { /// The account variant being registered. pub account_type: AccountType, @@ -820,6 +837,7 @@ pub struct AccountRegistrationEntry { /// the upstream type. Tests that need to inspect snapshot contents /// reach into the `addresses` vec by index instead. #[derive(Debug, Clone)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AccountAddressPoolEntry { /// Which account this pool belongs to. pub account_type: AccountType, @@ -847,6 +865,7 @@ pub struct AccountAddressPoolEntry { /// Not `PartialEq` because [`CoreChangeSet`] isn't (its `records` carry /// `TransactionRecord`, which is `Debug + Clone` only upstream). #[derive(Debug, Clone, Default)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct PlatformWalletChangeSet { /// Core-wallet deltas projected from upstream `WalletEvent`s: /// transaction records, UTXO add/remove, height checkpoints, IS-lock diff --git a/packages/rs-platform-wallet/src/wallet/asset_lock/tracked.rs b/packages/rs-platform-wallet/src/wallet/asset_lock/tracked.rs index 7939e67d03c..6a06632d119 100644 --- a/packages/rs-platform-wallet/src/wallet/asset_lock/tracked.rs +++ b/packages/rs-platform-wallet/src/wallet/asset_lock/tracked.rs @@ -14,6 +14,7 @@ use crate::changeset::AssetLockEntry; /// Asset lock status on Core chain. Tracked until consumed, then removed. #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum AssetLockStatus { Built, Broadcast, diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/block_time.rs b/packages/rs-platform-wallet/src/wallet/identity/types/block_time.rs index 7c6e28d039b..b4291e5b57a 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/block_time.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/block_time.rs @@ -7,6 +7,7 @@ use dpp::prelude::{BlockHeight, CoreBlockHeight, TimestampMillis}; /// Block time information containing height, core height, and timestamp #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct BlockTime { /// Platform block height pub height: BlockHeight, diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/contact_request.rs b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/contact_request.rs index 73a2c45337f..d0b1540a3ce 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/contact_request.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/contact_request.rs @@ -8,6 +8,7 @@ use dpp::prelude::{CoreBlockHeight, Identifier}; /// A contact request represents a one-way relationship between two identities #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct ContactRequest { /// The unique id of the sender (owner of the contact request) pub sender_id: Identifier, diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/established_contact.rs b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/established_contact.rs index b1be89ef227..49cfe288d5b 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/established_contact.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/established_contact.rs @@ -10,6 +10,7 @@ use dpp::prelude::Identifier; /// /// This is formed when both identities have sent contact requests to each other. #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct EstablishedContact { /// The contact's identity unique identifier pub contact_identity_id: Identifier, diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/payment.rs b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/payment.rs index fd1044c0c20..976b64acad3 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/payment.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/payment.rs @@ -19,6 +19,7 @@ use dpp::prelude::Identifier; /// Direction of a DashPay payment, from the owner's point of view. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum PaymentDirection { /// The owner sent this payment to the counterparty. Sent, @@ -28,6 +29,7 @@ pub enum PaymentDirection { /// Status of a DashPay payment on Core chain. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum PaymentStatus { /// Broadcast but not yet confirmed. #[default] @@ -63,6 +65,7 @@ pub struct DashpayAddressMatch { /// Keyed by transaction id (hex string, matching evo-tool's /// `dashpay_payments.tx_id` column which is `TEXT UNIQUE NOT NULL`). #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct PaymentEntry { /// The other identity in this payment. Whether they're the /// sender or receiver is encoded in `direction`. diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/profile.rs b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/profile.rs index 4082f42035f..06d6d415529 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/profile.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/dashpay/profile.rs @@ -21,6 +21,7 @@ use sha2::{Digest, Sha256}; /// User-facing DashPay profile data published via the DashPay data /// contract. This is the **output/stored** model — no raw image bytes. #[derive(Debug, Clone, Default, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DashPayProfile { /// Display name (publicly visible, max 25 chars per DIP-15). pub display_name: Option, diff --git a/packages/rs-platform-wallet/src/wallet/identity/types/key_storage.rs b/packages/rs-platform-wallet/src/wallet/identity/types/key_storage.rs index 4813dca6de5..8dee1a702b9 100644 --- a/packages/rs-platform-wallet/src/wallet/identity/types/key_storage.rs +++ b/packages/rs-platform-wallet/src/wallet/identity/types/key_storage.rs @@ -27,6 +27,7 @@ pub enum PrivateKeyData { /// Identity lifecycle status on Platform. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum IdentityStatus { #[default] Unknown, @@ -38,6 +39,7 @@ pub enum IdentityStatus { /// DPNS username associated with an identity. #[derive(Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DpnsNameInfo { pub label: String, pub acquired_at: Option, diff --git a/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs b/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs index f7d83a2fff3..aec6d5b4f9d 100644 --- a/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs +++ b/packages/rs-platform-wallet/src/wallet/platform_addresses/wallet.rs @@ -117,11 +117,7 @@ impl PlatformAddressWallet { .platform_payment_managed_account_at_index_mut(*account_index) { for (p2pkh, funds) in account_state.found() { - account.set_address_credit_balance( - *p2pkh, - funds.balance, - None, - ); + account.set_address_credit_balance(*p2pkh, funds.balance, None); } } } diff --git a/packages/rs-sdk/src/platform/address_sync/types.rs b/packages/rs-sdk/src/platform/address_sync/types.rs index 15ce6d82eb7..74daea4609a 100644 --- a/packages/rs-sdk/src/platform/address_sync/types.rs +++ b/packages/rs-sdk/src/platform/address_sync/types.rs @@ -49,6 +49,7 @@ pub type LeafBoundaryKey = Vec; /// Funds stored for a platform address. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AddressFunds { /// Address nonce used for anti-replay. pub nonce: AddressNonce,