@@ -11,7 +11,7 @@ def __init__(self, key: str, size: int = -1, length_key = None):
11
11
self .length_key : str = length_key
12
12
13
13
14
- array_accessor_types : dict [str , ArrayAccessorType ] = {
14
+ array_accessor_types_fixed_length : dict [str , ArrayAccessorType ] = {
15
15
"LDKThirtyTwoBytes" : ArrayAccessorType (size = 32 , key = 'data' ),
16
16
"LDKPaymentPreimage" : ArrayAccessorType (size = 32 , key = 'data' ),
17
17
"LDKPublicKey" : ArrayAccessorType (size = 33 , key = 'compressed_form' ),
@@ -23,11 +23,20 @@ def __init__(self, key: str, size: int = -1, length_key = None):
23
23
"LDKTwelveBytes" : ArrayAccessorType (size = 12 , key = 'data' ),
24
24
"LDKSixteenBytes" : ArrayAccessorType (size = 16 , key = 'data' ),
25
25
"LDKTwentyBytes" : ArrayAccessorType (size = 20 , key = 'data' ),
26
- "LDKRecoverableSignature" : ArrayAccessorType (size = 68 , key = 'serialized_form' ),
26
+ "LDKRecoverableSignature" : ArrayAccessorType (size = 68 , key = 'serialized_form' )
27
+ }
28
+
29
+ array_accessor_types_variable_length : dict [str , ArrayAccessorType ] = {
30
+ "LDKu5slice" : ArrayAccessorType (length_key = 'datalen' , key = 'data' ),
27
31
"LDKu8slice" : ArrayAccessorType (length_key = 'datalen' , key = 'data' ),
28
32
"LDKCVec_u8Z" : ArrayAccessorType (length_key = 'datalen' , key = 'data' ),
29
33
"LDKCVec_u5Z" : ArrayAccessorType (length_key = 'datalen' , key = 'data' ),
30
- "LDKTransaction" : ArrayAccessorType (length_key = 'datalen' , key = 'data' ),
34
+ "LDKTransaction" : ArrayAccessorType (length_key = 'datalen' , key = 'data' )
35
+ }
36
+
37
+ array_accessor_types : dict [str , ArrayAccessorType ] = {
38
+ ** array_accessor_types_fixed_length ,
39
+ ** array_accessor_types_variable_length
31
40
}
32
41
33
42
class ConversionHelper :
@@ -348,17 +357,6 @@ def prepare_native_to_swift_callback_arguments(cls, argument_types, array_unwrap
348
357
elif received_raw_type is not None and received_raw_type .startswith ('LDK' ):
349
358
swift_local_conversion_prefix = f'Bindings.{ received_raw_type } _to_array(nativeType: '
350
359
swift_local_conversion_suffix = ')'
351
- elif received_raw_type == 'LDKTransaction' :
352
- swift_local_conversion_prefix = f'Bindings.LDKTransaction_to_array(nativeType: '
353
- swift_local_conversion_suffix = ')'
354
- published_swift_type = '[UInt8]'
355
- elif received_raw_type == 'LDKu8slice' :
356
- swift_local_conversion_prefix = f'Bindings.LDKu8slice_to_array(nativeType: '
357
- swift_local_conversion_suffix = ')'
358
- published_swift_type = '[UInt8]'
359
- elif received_raw_type == 'LDKCVec_PaymentPreimageZ' :
360
- swift_local_conversion_prefix = f'Bindings.LDKCVec_PaymentPreimageZ_to_array(nativeType: '
361
- swift_local_conversion_suffix = ')'
362
360
elif received_raw_type is not None and received_raw_type .startswith ('LDK' ):
363
361
if cls .is_instance_type (published_swift_type , received_raw_type ):
364
362
swift_local_conversion_prefix = f'{ published_swift_type } (pointer: '
0 commit comments