11use std:: str:: FromStr ;
22
3+ use super :: {
4+ File , PostalAddress ,
5+ contact:: {
6+ BillIdentParticipant , LightBillIdentParticipant , LightBillIdentParticipantWithAddress ,
7+ } ,
8+ notification:: Notification ,
9+ } ;
310use crate :: {
411 ID_PREFIX , NETWORK_MAINNET , NETWORK_REGTEST , NETWORK_TESTNET , NETWORK_TESTNET4 , NodeId ,
512 ValidationError ,
@@ -8,14 +15,7 @@ use crate::{
815 network_char,
916 util:: { self , BcrKeys } ,
1017} ;
11-
12- use super :: {
13- File , PostalAddress ,
14- contact:: {
15- BillIdentParticipant , LightBillIdentParticipant , LightBillIdentParticipantWithAddress ,
16- } ,
17- notification:: Notification ,
18- } ;
18+ use borsh:: { BorshDeserialize , BorshSerialize } ;
1919use secp256k1:: { PublicKey , SecretKey } ;
2020use serde:: { Deserialize , Serialize } ;
2121
@@ -110,7 +110,7 @@ impl<'de> serde::Deserialize<'de> for BillId {
110110 where
111111 D : serde:: Deserializer < ' de > ,
112112 {
113- let s = String :: deserialize ( d) ?;
113+ let s = <std :: string :: String as serde :: Deserialize > :: deserialize ( d) ?;
114114 BillId :: from_str ( & s) . map_err ( serde:: de:: Error :: custom)
115115 }
116116}
@@ -611,14 +611,26 @@ pub struct PastPaymentDataRecourse {
611611 pub status : PastPaymentStatus ,
612612}
613613
614- #[ derive( Serialize , Deserialize , Debug , Clone ) ]
614+ #[ derive( BorshSerialize , BorshDeserialize , Serialize , Deserialize , Debug , Clone ) ]
615615pub struct BillToShareWithExternalParty {
616616 /// The bill id
617617 pub bill_id : BillId ,
618618 /// The base58 encoded, encrypted BillBlockPlaintextWrapper of the bill
619619 pub data : String ,
620+ #[ borsh(
621+ serialize_with = "crate::util::borsh::serialize_vec_url" ,
622+ deserialize_with = "crate::util::borsh::deserialize_vec_url"
623+ ) ]
624+ /// The file urls of bill files, encrypted with the receiver's key, uploaded to Nostr
625+ pub file_urls : Vec < url:: Url > ,
620626 /// The hash over the unencrypted data
621627 pub hash : String ,
622628 /// The signature over the hash by the sharer of the bill
623629 pub signature : String ,
630+ #[ borsh(
631+ serialize_with = "crate::util::borsh::serialize_pubkey" ,
632+ deserialize_with = "crate::util::borsh::deserialize_pubkey"
633+ ) ]
634+ /// The receiver's pub key
635+ pub receiver : PublicKey ,
624636}
0 commit comments