forked from zcash/librustzcash
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
173 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
zcash_client_memory/src/types/serialization/transparent.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// use sapling::{value::NoteValue, PaymentAddress, Rseed}; | ||
// use serde_with::{DeserializeAs, SerializeAs}; | ||
|
||
// use zcash_address::ZcashAddress; | ||
// use zcash_client_backend::wallet::Note; | ||
// use zip32::Scope; | ||
|
||
// use std::io; | ||
|
||
// use serde::{Deserialize, Deserializer, Serialize, Serializer}; | ||
|
||
// use serde_with::serde_as; | ||
|
||
// use zcash_client_backend::wallet::{NoteId, Recipient}; | ||
|
||
// use crate::{ByteArray, TransparentAddressDef, TryByteArray, ZcashAddressDef}; | ||
|
||
// use zcash_primitives::{ | ||
// legacy::TransparentAddress, | ||
// transaction::{components::OutPoint, TxId}, | ||
// }; | ||
|
||
// use zcash_protocol::{PoolType, ShieldedProtocol}; | ||
|
||
// use super::{ToArray, TryFromArray}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use serde_with::serde_as; | ||
use serde_with::FromInto; | ||
use zcash_client_backend::wallet::WalletTransparentOutput; | ||
use zcash_primitives::{ | ||
legacy::TransparentAddress, | ||
transaction::{ | ||
components::{OutPoint, TxOut}, | ||
TxId, | ||
}, | ||
}; | ||
use zcash_protocol::consensus::BlockHeight; | ||
|
||
use super::AccountId; | ||
use crate::{ByteArray, OutPointDef, TransparentAddressDef, TxOutDef}; | ||
|
||
pub struct TransparentOutputTable(BTreeMap<OutPoint, ReceivedTransparentUtxo>); | ||
|
||
impl TransparentOutputTable { | ||
pub fn new() -> Self { | ||
Self(BTreeMap::new()) | ||
} | ||
} | ||
|
||
#[serde_as] | ||
#[derive(Serialize, Deserialize)] | ||
pub struct ReceivedTransparentUtxoSpends( | ||
#[serde_as(as = "BTreeMap<OutPointDef, ByteArray<32>>")] BTreeMap<OutPoint, TxId>, | ||
); | ||
|
||
#[serde_as] | ||
#[derive(Serialize, Deserialize)] | ||
// transparent_received_outputs | ||
pub struct ReceivedTransparentUtxo { | ||
// transaction_id, output_index | ||
#[serde_as(as = "OutPointDef")] | ||
outpoint: OutPoint, | ||
// Spend authority of this utxo | ||
account_id: AccountId, | ||
// value_zat, script_pubkey | ||
#[serde_as(as = "TxOutDef")] | ||
txout: TxOut, | ||
#[serde_as(as = "TransparentAddressDef")] | ||
recipient_address: TransparentAddress, | ||
#[serde_as(as = "Option<FromInto<u32>>")] | ||
max_observed_unspent_height: Option<BlockHeight>, | ||
// ??? do we need? | ||
#[serde_as(as = "Option<FromInto<u32>>")] | ||
mined_height: Option<BlockHeight>, | ||
} | ||
|
||
#[serde_as] | ||
#[derive(Serialize, Deserialize)] | ||
pub struct SentTransparentUtxoTable( | ||
#[serde_as(as = "BTreeMap<OutPointDef,_>")] BTreeMap<OutPoint, SentUtxo>, | ||
); | ||
#[derive(Serialize, Deserialize)] | ||
struct SentUtxo {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters