@@ -2,9 +2,9 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
22use sqlx:: { Database , Decode , Encode , Type , encode:: IsNull } ;
33
44use super :: {
5- AccountPublicKey , AccountSecretKey , AccountStateCommitment , AccountStateNullifier ,
6- EncryptionPublicKey , EncryptionSecretKey , FeeAccountStateCommitment , FeeAccountStateNullifier ,
7- LegEncrypted , SettlementRef ,
5+ AccountPublicKey , AccountPublicKeys , AccountSecretKey , AccountStateCommitment ,
6+ AccountStateNullifier , EncryptionPublicKey , EncryptionSecretKey , FeeAccountStateCommitment ,
7+ FeeAccountStateNullifier , LegEncrypted , SettlementRef ,
88} ;
99
1010// SettlementRef is stored as a BLOB in the database
@@ -124,6 +124,45 @@ where
124124 }
125125}
126126
127+ // AccountPublicKeys is stored as a BLOB in the database
128+
129+ impl < DB : Database > Type < DB > for AccountPublicKeys
130+ where
131+ // Make sure BLOBs are supported by the database
132+ Vec < u8 > : Type < DB > ,
133+ {
134+ fn type_info ( ) -> DB :: TypeInfo {
135+ <Vec < u8 > as Type < DB > >:: type_info ( )
136+ }
137+ }
138+
139+ impl < ' r , DB : Database > Decode < ' r , DB > for AccountPublicKeys
140+ where
141+ // Make sure BLOBs are supported by the database
142+ Vec < u8 > : Decode < ' r , DB > ,
143+ {
144+ fn decode (
145+ value : DB :: ValueRef < ' r > ,
146+ ) -> Result < AccountPublicKeys , Box < dyn core:: error:: Error + ' static + Send + Sync > > {
147+ let value = <Vec < u8 > as Decode < DB > >:: decode ( value) ?;
148+ Ok ( codec:: Decode :: decode ( & mut & value[ ..] ) ?)
149+ }
150+ }
151+
152+ impl < ' r , DB : Database > Encode < ' r , DB > for AccountPublicKeys
153+ where
154+ // Make sure BLOBs are supported by the database
155+ Vec < u8 > : Encode < ' r , DB > ,
156+ {
157+ fn encode_by_ref (
158+ & self ,
159+ buf : & mut DB :: ArgumentBuffer < ' r > ,
160+ ) -> Result < IsNull , Box < dyn core:: error:: Error + ' static + Send + Sync > > {
161+ let value = codec:: Encode :: encode ( self ) ;
162+ Encode :: < ' r , DB > :: encode ( value, buf)
163+ }
164+ }
165+
127166// AccountSecretKey is stored as a BLOB in the database
128167
129168impl < DB : Database > Type < DB > for AccountSecretKey
0 commit comments