22// SPDX-License-Identifier: Apache-2.0, MIT
33
44use super :: * ;
5+ use crate :: lotus_json:: signature:: SignatureLotusJson ;
56use crate :: shim:: address:: Address ;
67use crate :: shim:: clock:: ChainEpoch ;
78use crate :: shim:: econ:: TokenAmount ;
@@ -252,17 +253,13 @@ macro_rules! impl_lotus_json_for_deal_proposal {
252253 } ;
253254}
254255
255- impl_lotus_json_for_deal_proposal ! ( 15 , 16 ) ;
256+ impl_lotus_json_for_deal_proposal ! ( 13 , 14 , 15 , 16 ) ;
256257
257258#[ derive( Serialize , Deserialize , JsonSchema , Debug , Clone , PartialEq ) ]
258259#[ serde( rename_all = "PascalCase" ) ]
259260pub struct ClientDealProposalLotusJson {
260- #[ schemars( with = "LotusJson<DealProposal>" ) ]
261- #[ serde( with = "crate::lotus_json" ) ]
262- pub proposal : DealProposal ,
263- // #[schemars(with = "LotusJson<Signature>")]
264- // #[serde(with = "crate::lotus_json")]
265- // pub client_signature: Signature,
261+ pub proposal : DealProposalLotusJson ,
262+ // pub client_signature: SignatureLotusJson,
266263}
267264
268265macro_rules! impl_lotus_json_for_client_deal_proposal {
@@ -280,15 +277,17 @@ macro_rules! impl_lotus_json_for_client_deal_proposal {
280277
281278 fn into_lotus_json( self ) -> Self :: LotusJson {
282279 Self :: LotusJson {
283- proposal: todo!( ) , //self.proposal.into(),
284- // TODO
285- // client_signature: self.client_signature.into(),
280+ proposal: self . proposal. into_lotus_json( ) ,
281+ // client_signature: {
282+ // // TODO: shim signature
283+ // self.client_signature.into().into_lotus_json()
284+ // }
286285 }
287286 }
288287
289288 fn from_lotus_json( json: Self :: LotusJson ) -> Self {
290289 Self {
291- proposal: todo! ( ) , // json.proposal.into( ),
290+ proposal: fil_actor_market_state :: [ <v $version> ] :: DealProposal :: from_lotus_json ( json. proposal) ,
292291 // TODO
293292 client_signature: Signature :: new_bls( vec![ ] ) ,
294293 }
@@ -299,14 +298,12 @@ macro_rules! impl_lotus_json_for_client_deal_proposal {
299298 } ;
300299}
301300
302- impl_lotus_json_for_client_deal_proposal ! ( 15 , 16 ) ;
301+ impl_lotus_json_for_client_deal_proposal ! ( 13 , 14 , 15 , 16 ) ;
303302
304303#[ derive( Serialize , Deserialize , JsonSchema , Debug , Clone , PartialEq ) ]
305304#[ serde( rename_all = "PascalCase" ) ]
306305pub struct PublishStorageDealsParamsLotusJson {
307- #[ schemars( with = "LotusJson<ClientDealProposal>" ) ]
308- #[ serde( with = "crate::lotus_json" ) ]
309- pub deals : Vec < ClientDealProposal > ,
306+ pub deals : Vec < ClientDealProposalLotusJson > ,
310307}
311308
312309macro_rules! impl_lotus_json_for_publish_storage_deals_params {
@@ -324,13 +321,15 @@ macro_rules! impl_lotus_json_for_publish_storage_deals_params {
324321
325322 fn into_lotus_json( self ) -> Self :: LotusJson {
326323 Self :: LotusJson {
327- deals: self . deals. into_iter( ) . map( |deal| deal . into ( ) ) . collect( ) ,
324+ deals: self . deals. into_iter( ) . map( |d| d . into_lotus_json ( ) ) . collect( ) ,
328325 }
329326 }
330327
331328 fn from_lotus_json( json: Self :: LotusJson ) -> Self {
332329 Self {
333- deals: json. deals. into_iter( ) . map( |deal| deal. into( ) ) . collect( ) ,
330+ deals: json. deals. into_iter( )
331+ . map( |d| fil_actor_market_state:: [ <v $version>] :: ClientDealProposal :: from_lotus_json( d) ) // delegate
332+ . collect( ) ,
334333 }
335334 }
336335 }
@@ -340,4 +339,4 @@ macro_rules! impl_lotus_json_for_publish_storage_deals_params {
340339}
341340
342341//impl_lotus_json_for_publish_storage_deals_params!(9, 10, 11, 12, 13, 14, 15, 16);
343- impl_lotus_json_for_publish_storage_deals_params ! ( 15 , 16 ) ;
342+ impl_lotus_json_for_publish_storage_deals_params ! ( 13 , 14 , 15 , 16 ) ;
0 commit comments