@@ -178,10 +178,10 @@ def __init__(self, from_fbs=None):
178
178
# uint8[] (uint256)
179
179
self ._amount = None
180
180
181
- # uint8[] (bytes20 )
181
+ # uint8[] (uuid )
182
182
self ._payment_channel = None
183
183
184
- # uint8[] (bytes20 )
184
+ # uint8[] (uuid )
185
185
self ._paying_channel = None
186
186
187
187
# uint8
@@ -228,16 +228,18 @@ def marshal(self):
228
228
'created_paying_channel_seq' : self ._created_paying_channel_seq ,
229
229
'offer' : str (self .offer ) if self .offer else None ,
230
230
'amount' : pack_uint256 (self .amount ) if self .amount else 0 ,
231
- 'payment_channel' : self .payment_channel ,
232
- 'paying_channel' : self .paying_channel ,
231
+ 'payment_channel' : self .payment_channel . bytes if self . payment_channel else None ,
232
+ 'paying_channel' : self .paying_channel . bytes if self . paying_channel else None ,
233
233
'state' : self .state ,
234
234
'completed' : self .completed ,
235
235
'completed_payment_channel_seq' : self ._completed_payment_channel_seq ,
236
236
'completed_paying_channel_seq' : self ._completed_paying_channel_seq ,
237
- 'key' : self .key ,
237
+ 'key' : self .key . bytes if self . key else None ,
238
238
'buyer_pubkey' : self .buyer_pubkey ,
239
- 'payment_channel_after' : self .payment_channel_after ,
240
- 'paying_channel_after' : self .paying_channel_after ,
239
+ 'payment_channel_after' :
240
+ pack_uint256 (self .payment_channel_after ) if self .payment_channel_after else None ,
241
+ 'paying_channel_after' :
242
+ pack_uint256 (self .paying_channel_after ) if self .paying_channel_after else None ,
241
243
'payment_mm_sig' : self .payment_mm_sig ,
242
244
'payment_del_sig' : self .payment_del_sig ,
243
245
'paying_mm_sig' : self .paying_mm_sig ,
@@ -341,33 +343,33 @@ def amount(self, value: int):
341
343
self ._amount = value
342
344
343
345
@property
344
- def payment_channel (self ) -> bytes :
346
+ def payment_channel (self ) -> uuid . UUID :
345
347
"""
346
348
Address of the payment channel (of the buyer) this transaction is transacting on.
347
349
"""
348
350
if self ._payment_channel is None and self ._from_fbs :
349
351
if self ._from_fbs .PaymentChannelLength ():
350
- self ._payment_channel = self ._from_fbs .PaymentChannelAsBytes ()
352
+ self ._payment_channel = uuid . UUID ( bytes = bytes ( self ._from_fbs .PaymentChannelAsBytes ()) )
351
353
return self ._payment_channel
352
354
353
355
@payment_channel .setter
354
- def payment_channel (self , value : bytes ):
355
- assert value is None or ( type ( value ) == bytes and len ( value ) == 20 )
356
+ def payment_channel (self , value : uuid . UUID ):
357
+ assert value is None or isinstance ( value , uuid . UUID )
356
358
self ._payment_channel = value
357
359
358
360
@property
359
- def paying_channel (self ) -> bytes :
361
+ def paying_channel (self ) -> uuid . UUID :
360
362
"""
361
363
Address of the paying channel (of the seller) this transaction is transacting on.
362
364
"""
363
365
if self ._payment_channel is None and self ._from_fbs :
364
366
if self ._from_fbs .PayingChannelLength ():
365
- self ._payment_channel = self ._from_fbs .PayingChannelAsBytes ()
367
+ self ._payment_channel = uuid . UUID ( bytes = bytes ( self ._from_fbs .PayingChannelAsBytes ()) )
366
368
return self ._payment_channel
367
369
368
370
@paying_channel .setter
369
- def paying_channel (self , value : bytes ):
370
- assert value is None or ( type ( value ) == bytes and len ( value ) == 20 )
371
+ def paying_channel (self , value : uuid . UUID ):
372
+ assert value is None or isinstance ( value , uuid . UUID )
371
373
self ._payment_channel = value
372
374
373
375
@property
@@ -571,11 +573,11 @@ def build(self, builder):
571
573
if amount :
572
574
amount = builder .CreateString (pack_uint256 (amount ))
573
575
574
- payment_channel = self .payment_channel
576
+ payment_channel = self .payment_channel . bytes if self . payment_channel else None
575
577
if payment_channel :
576
578
payment_channel = builder .CreateString (payment_channel )
577
579
578
- paying_channel = self .paying_channel
580
+ paying_channel = self .paying_channel . bytes if self . paying_channel else None
579
581
if paying_channel :
580
582
paying_channel = builder .CreateString (paying_channel )
581
583
0 commit comments