@@ -35,24 +35,24 @@ class BlockchainBalance:
3535
3636 def to_json (self ) -> Mapping [str , Any ]:
3737 return {
38- "blockchain_balance_total_balance" : self . total_balance . to_json ()
39- if self .total_balance
40- else None ,
41- "blockchain_balance_confirmed_balance" : self . confirmed_balance . to_json ()
42- if self .confirmed_balance
43- else None ,
44- "blockchain_balance_unconfirmed_balance" : self . unconfirmed_balance . to_json ()
45- if self .unconfirmed_balance
46- else None ,
47- "blockchain_balance_locked_balance" : self . locked_balance . to_json ()
48- if self .locked_balance
49- else None ,
50- "blockchain_balance_required_reserve" : self . required_reserve . to_json ()
51- if self .required_reserve
52- else None ,
53- "blockchain_balance_available_balance" : self . available_balance . to_json ()
54- if self .available_balance
55- else None ,
38+ "blockchain_balance_total_balance" : (
39+ self . total_balance . to_json () if self .total_balance else None
40+ ) ,
41+ "blockchain_balance_confirmed_balance" : (
42+ self . confirmed_balance . to_json () if self .confirmed_balance else None
43+ ) ,
44+ "blockchain_balance_unconfirmed_balance" : (
45+ self . unconfirmed_balance . to_json () if self .unconfirmed_balance else None
46+ ) ,
47+ "blockchain_balance_locked_balance" : (
48+ self . locked_balance . to_json () if self .locked_balance else None
49+ ) ,
50+ "blockchain_balance_required_reserve" : (
51+ self . required_reserve . to_json () if self .required_reserve else None
52+ ) ,
53+ "blockchain_balance_available_balance" : (
54+ self . available_balance . to_json () if self .available_balance else None
55+ ) ,
5656 }
5757
5858
@@ -114,34 +114,44 @@ def to_json(self) -> Mapping[str, Any]:
114114def from_json (requester : Requester , obj : Mapping [str , Any ]) -> BlockchainBalance :
115115 return BlockchainBalance (
116116 requester = requester ,
117- total_balance = CurrencyAmount_from_json (
118- requester , obj ["blockchain_balance_total_balance" ]
119- )
120- if obj ["blockchain_balance_total_balance" ]
121- else None ,
122- confirmed_balance = CurrencyAmount_from_json (
123- requester , obj ["blockchain_balance_confirmed_balance" ]
124- )
125- if obj ["blockchain_balance_confirmed_balance" ]
126- else None ,
127- unconfirmed_balance = CurrencyAmount_from_json (
128- requester , obj ["blockchain_balance_unconfirmed_balance" ]
129- )
130- if obj ["blockchain_balance_unconfirmed_balance" ]
131- else None ,
132- locked_balance = CurrencyAmount_from_json (
133- requester , obj ["blockchain_balance_locked_balance" ]
134- )
135- if obj ["blockchain_balance_locked_balance" ]
136- else None ,
137- required_reserve = CurrencyAmount_from_json (
138- requester , obj ["blockchain_balance_required_reserve" ]
139- )
140- if obj ["blockchain_balance_required_reserve" ]
141- else None ,
142- available_balance = CurrencyAmount_from_json (
143- requester , obj ["blockchain_balance_available_balance" ]
144- )
145- if obj ["blockchain_balance_available_balance" ]
146- else None ,
117+ total_balance = (
118+ CurrencyAmount_from_json (requester , obj ["blockchain_balance_total_balance" ])
119+ if obj ["blockchain_balance_total_balance" ]
120+ else None
121+ ),
122+ confirmed_balance = (
123+ CurrencyAmount_from_json (
124+ requester , obj ["blockchain_balance_confirmed_balance" ]
125+ )
126+ if obj ["blockchain_balance_confirmed_balance" ]
127+ else None
128+ ),
129+ unconfirmed_balance = (
130+ CurrencyAmount_from_json (
131+ requester , obj ["blockchain_balance_unconfirmed_balance" ]
132+ )
133+ if obj ["blockchain_balance_unconfirmed_balance" ]
134+ else None
135+ ),
136+ locked_balance = (
137+ CurrencyAmount_from_json (
138+ requester , obj ["blockchain_balance_locked_balance" ]
139+ )
140+ if obj ["blockchain_balance_locked_balance" ]
141+ else None
142+ ),
143+ required_reserve = (
144+ CurrencyAmount_from_json (
145+ requester , obj ["blockchain_balance_required_reserve" ]
146+ )
147+ if obj ["blockchain_balance_required_reserve" ]
148+ else None
149+ ),
150+ available_balance = (
151+ CurrencyAmount_from_json (
152+ requester , obj ["blockchain_balance_available_balance" ]
153+ )
154+ if obj ["blockchain_balance_available_balance" ]
155+ else None
156+ ),
147157 )
0 commit comments