@@ -68,27 +68,84 @@ typedef enum {
68
68
STELLAR_OPERATION_PAYMENT = 1
69
69
} stellar_operation_type_t ;
70
70
71
+ // Custom generic structure for Stellar operation data
72
+ // So far we only support create account and payment operations with native
73
+ // asset only
74
+ typedef struct {
75
+ stellar_operation_type_t type ;
76
+ uint8_t destination [STELLAR_PUBKEY_RAW_SIZE ];
77
+ uint64_t amount ;
78
+ } stellar_operation_data_t ;
79
+
80
+ // Stellar preconditions types
81
+ // See
82
+ // https://developers.stellar.org/docs/learn/fundamentals/transactions/operations-and-transactions#preconditions
83
+ // See
84
+ // https://github.com/stellar/js-stellar-base/blob/master/xdr/curr/Stellar-transaction.x#L804
85
+ typedef enum {
86
+ STELLAR_PRECOND_NONE = 0 ,
87
+ STELLAR_PRECOND_TIME = 1 ,
88
+ STELLAR_PRECOND_V2 = 2
89
+ } stellar_preconditions_type_t ;
90
+
91
+ // Stellar time bounds structure
92
+ // See
93
+ // https://developers.stellar.org/docs/learn/fundamentals/transactions/operations-and-transactions#time-bounds
94
+ // See
95
+ // https://github.com/stellar/js-stellar-base/blob/master/xdr/curr/Stellar-transaction.x#L759
96
+ typedef struct {
97
+ uint64_t min_time ;
98
+ uint64_t max_time ;
99
+ } stellar_time_bounds_t ;
100
+
101
+ // Stellar preconditions structure
102
+ // See
103
+ // https://developers.stellar.org/docs/learn/fundamentals/transactions/operations
104
+ typedef struct {
105
+ stellar_preconditions_type_t type ;
106
+ union {
107
+ stellar_time_bounds_t
108
+ time_bounds ; // For PRECOND_TIME, only PRECOND_TIME is supported
109
+ // For PRECOND_V2, we can add more fields in future if needed
110
+ } preconditions ;
111
+ } stellar_preconditions_t ;
112
+
113
+ // Stellar transaction extension types
114
+ // See
115
+ // https://github.com/stellar/js-stellar-base/blob/master/xdr/curr/Stellar-transaction.x#L929
116
+ typedef enum {
117
+ STELLAR_EXT_TYPE_EMPTY = 0 , // Empty extension, only supported type
118
+ // Other extension types can be added in future if needed
119
+ } stellar_ext_type_t ;
120
+
121
+ // Stellar transaction extension structure
122
+ // See
123
+ // https://github.com/stellar/js-stellar-base/blob/master/xdr/curr/Stellar-transaction.x#L929
124
+ typedef struct {
125
+ stellar_ext_type_t
126
+ type ; // Currently only STELLAR_EXT_TYPE_EMPTY is supported
127
+ // Other fields can be added in future if needed
128
+ } stellar_transaction_extension_t ;
129
+
71
130
// Stellar transaction structures
72
- // See https://developers.stellar.org/docs/learn/encyclopedia/data-format/xdr
131
+ // See
132
+ // https://github.com/stellar/stellar-xdr/blob/curr/Stellar-transaction.x#L911
73
133
typedef struct {
74
- uint8_t source_account [32 ];
134
+ uint8_t source_account [STELLAR_PUBKEY_RAW_SIZE ];
75
135
uint64_t sequence_number ;
76
136
uint32_t fee ;
77
- uint32_t operation_count ;
78
- stellar_operation_type_t operation_type ;
79
137
stellar_memo_type_t memo_type ;
80
138
union {
81
139
char text [29 ]; // STELLAR_MEMO_TEXT (max 28 bytes + 1 byte delimiter)
82
140
uint64_t id ; // STELLAR_MEMO_ID
83
141
uint8_t hash [32 ]; // STELLAR_MEMO_HASH or STELLAR_MEMO_RETURN(32 bytes)
84
142
} memo ;
143
+ uint32_t operation_count ;
144
+ stellar_operation_data_t operations [1 ]; // Only one operation supported
145
+ stellar_preconditions_t preconditions ;
146
+ stellar_transaction_extension_t ext ;
85
147
} stellar_transaction_t ;
86
148
87
- typedef struct {
88
- uint8_t destination [32 ];
89
- uint64_t amount ;
90
- } stellar_payment_t ;
91
-
92
149
typedef enum {
93
150
STELLAR_NETWORK_MAINNET = 0 ,
94
151
STELLAR_NETWORK_TESTNET = 1
0 commit comments