1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
use super::*;

use {CString, Error, CommandHandle, WalletHandle};

extern {
    #[no_mangle]
    pub fn indy_register_payment_method(command_handle: CommandHandle,
                                        payment_method: CString,
                                        create_payment_address: Option<CreatePaymentAddressCB>,
                                        add_request_fees: Option<AddRequestFeesCB>,
                                        parse_response_with_fees: Option<ParseResponseWithFeesCB>,
                                        build_get_payment_sources_request: Option<BuildGetPaymentSourcesRequestCB>,
                                        parse_get_payment_sources_response: Option<ParseGetPaymentSourcesResponseCB>,
                                        build_payment_req: Option<BuildPaymentReqCB>,
                                        parse_payment_response: Option<ParsePaymentResponseCB>,
                                        build_mint_req: Option<BuildMintReqCB>,
                                        build_set_txn_fees_req: Option<BuildSetTxnFeesReqCB>,
                                        build_get_txn_fees_req: Option<BuildGetTxnFeesReqCB>,
                                        parse_get_txn_fees_response: Option<ParseGetTxnFeesResponseCB>,
                                        build_verify_payment_req: Option<BuildVerifyPaymentReqCB>,
                                        parse_verify_payment_response: Option<ParseVerifyPaymentResponseCB>,
                                        sign_with_address: Option<SignWithAddressCB>,
                                        verify_with_address: Option<VerifyWithAddressCB>,
                                        cb: Option<ResponseEmptyCB>) -> Error;

    #[no_mangle]
    pub fn indy_create_payment_address(command_handle: CommandHandle,
                                       wallet_handle: WalletHandle,
                                       payment_method: CString,
                                       config: CString,
                                       cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_list_payment_addresses(command_handle: CommandHandle,
                                       wallet_handle: WalletHandle,
                                       cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_add_request_fees(command_handle: CommandHandle,
                                 wallet_handle: WalletHandle,
                                 submitter_did: CString,
                                 req_json: CString,
                                 inputs_json: CString,
                                 outputs_json: CString,
                                 extra: CString,
                                 cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_response_with_fees(command_handle: CommandHandle,
                                         payment_method: CString,
                                         resp_json: CString,
                                         cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_get_payment_sources_with_from_request(command_handle: CommandHandle,
                                                            wallet_handle: WalletHandle,
                                                            submitter_did: CString,
                                                            payment_address: CString,
                                                            from: i64,
                                                            cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_get_payment_sources_with_from_response(command_handle: CommandHandle,
                                                   payment_method: CString,
                                                   resp_json: CString,
                                                   cb: Option<ResponseStringI64CB>) -> Error;

    #[no_mangle]
    pub fn indy_build_get_payment_sources_request(command_handle: CommandHandle,
                                                  wallet_handle: WalletHandle,
                                                  submitter_did: CString,
                                                  payment_address: CString,
                                                  cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_get_payment_sources_response(command_handle: CommandHandle,
                                                   payment_method: CString,
                                                   resp_json: CString,
                                                   cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_payment_req(command_handle: CommandHandle,
                                  wallet_handle: WalletHandle,
                                  submitter_did: CString,
                                  inputs_json: CString,
                                  outputs_json: CString,
                                  extra: CString,
                                  cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_payment_response(command_handle: CommandHandle,
                                       payment_method: CString,
                                       resp_json: CString,
                                       cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_prepare_payment_extra_with_acceptance_data(command_handle: CommandHandle,
                                                           extra_json: CString,
                                                           text: CString,
                                                           version: CString,
                                                           hash: CString,
                                                           acc_mech_type: CString,
                                                           time_of_acceptance: u64,
                                                           cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_mint_req(command_handle: CommandHandle,
                               wallet_handle: WalletHandle,
                               submitter_did: CString,
                               outputs_json: CString,
                               extra: CString,
                               cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_set_txn_fees_req(command_handle: CommandHandle,
                                       wallet_handle: WalletHandle,
                                       submitter_did: CString,
                                       payment_method: CString,
                                       fees_json: CString,
                                       cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_get_txn_fees_req(command_handle: CommandHandle,
                                       wallet_handle: WalletHandle,
                                       submitter_did: CString,
                                       payment_method: CString,
                                       cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_get_txn_fees_response(command_handle: CommandHandle,
                                            payment_method: CString,
                                            resp_json: CString,
                                            cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_build_verify_payment_req(command_handle: CommandHandle,
                                         wallet_handle: WalletHandle,
                                         submitter_did: CString,
                                         receipt: CString,
                                         cb: Option<ResponseStringStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_parse_verify_payment_response(command_handle: CommandHandle,
                                              payment_method: CString,
                                              resp_json: CString,
                                              cb: Option<ResponseStringCB>) -> Error;

    #[no_mangle]
    pub fn indy_get_request_info(command_handle: CommandHandle,
                                 get_auth_rule_resp_json: CString,
                                 requester_info_json: CString,
                                 fees_json: CString,
                                 cb: Option<ResponseStringCB>) -> Error;
    pub fn indy_sign_with_address(command_handle: CommandHandle,
                                  wallet_handle: WalletHandle,
                                  address: CString,
                                  message_raw: BString,
                                  message_len: u32,
                                  cb: Option<ResponseSliceCB>) -> Error;
    #[no_mangle]
    pub fn indy_verify_with_address(command_handle: CommandHandle,
                                    address: CString,
                                    message_raw: BString,
                                    message_len: u32,
                                    signature_raw: BString,
                                    signature_len: u32,
                                    cb: Option<ResponseBoolCB>) -> Error;
    
}

pub type CreatePaymentAddressCB = extern fn(command_handle: CommandHandle,
                                            wallet_handle: WalletHandle,
                                            config: CString,
                                            cb: Option<extern fn(command_handle_: CommandHandle,
                                                                 err: Error,
                                                                 payment_address: CString) -> Error>) -> Error;
pub type AddRequestFeesCB = extern fn(command_handle: CommandHandle,
                                      wallet_handle: WalletHandle,
                                      submitter_did: CString,
                                      req_json: CString,
                                      inputs_json: CString,
                                      outputs_json: CString,
                                      extra: CString,
                                      cb: Option<extern fn(command_handle_: CommandHandle,
                                                           err: Error,
                                                           req_with_fees_json: CString) -> Error>) -> Error;
pub type ParseResponseWithFeesCB = extern fn(command_handle: CommandHandle,
                                             resp_json: CString,
                                             cb: Option<extern fn(command_handle_: CommandHandle,
                                                                  err: Error,
                                                                  receipts_json: CString) -> Error>) -> Error;
pub type BuildGetPaymentSourcesRequestCB = extern fn(command_handle: CommandHandle,
                                                     wallet_handle: WalletHandle,
                                                     submitter_did: CString,
                                                     payment_address: CString,
                                                     from: i64,
                                                     cb: Option<extern fn(command_handle_: CommandHandle,
                                                                          err: Error,
                                                                          get_sources_txn_json: CString) -> Error>) -> Error;
pub type ParseGetPaymentSourcesResponseCB = extern fn(command_handle: CommandHandle,
                                                      resp_json: CString,
                                                      cb: Option<extern fn(command_handle_: CommandHandle,
                                                                           err: Error,
                                                                           sources_json: CString,
                                                                           next: i64) -> Error>) -> Error;
pub type BuildPaymentReqCB = extern fn(command_handle: CommandHandle,
                                       wallet_handle: WalletHandle,
                                       submitter_did: CString,
                                       inputs_json: CString,
                                       outputs_json: CString,
                                       extra: CString,
                                       cb: Option<extern fn(command_handle_: CommandHandle,
                                                            err: Error,
                                                            payment_req_json: CString) -> Error>) -> Error;
pub type ParsePaymentResponseCB = extern fn(command_handle: CommandHandle,
                                            resp_json: CString,
                                            cb: Option<extern fn(command_handle_: CommandHandle,
                                                                 err: Error,
                                                                 receipts_json: CString) -> Error>) -> Error;
pub type BuildMintReqCB = extern fn(command_handle: CommandHandle,
                                    wallet_handle: WalletHandle,
                                    submitter_did: CString,
                                    outputs_json: CString,
                                    extra: CString,
                                    cb: Option<extern fn(command_handle_: CommandHandle,
                                                         err: Error,
                                                         mint_req_json: CString) -> Error>) -> Error;
pub type BuildSetTxnFeesReqCB = extern fn(command_handle: CommandHandle,
                                          wallet_handle: WalletHandle,
                                          submitter_did: CString,
                                          fees_json: CString,
                                          cb: Option<extern fn(command_handle_: CommandHandle,
                                                               err: Error,
                                                               set_txn_fees_json: CString) -> Error>) -> Error;
pub type BuildGetTxnFeesReqCB = extern fn(command_handle: CommandHandle,
                                          wallet_handle: WalletHandle,
                                          submitter_did: CString,
                                          cb: Option<extern fn(command_handle_: CommandHandle,
                                                               err: Error,
                                                               get_txn_fees_json: CString) -> Error>) -> Error;
pub type ParseGetTxnFeesResponseCB = extern fn(command_handle: CommandHandle,
                                               resp_json: CString,
                                               cb: Option<extern fn(command_handle_: CommandHandle,
                                                                    err: Error,
                                                                    fees_json: CString) -> Error>) -> Error;
pub type BuildVerifyPaymentReqCB = extern fn(command_handle: CommandHandle,
                                             wallet_handle: WalletHandle,
                                             submitter_did: CString,
                                             receipt: CString,
                                             cb: Option<extern fn(command_handle_: CommandHandle,
                                                                  err: Error,
                                                                  verify_txn_json: CString) -> Error>) -> Error;
pub type ParseVerifyPaymentResponseCB = extern fn(command_handle: CommandHandle,
                                                  resp_json: CString,
                                                  cb: Option<extern fn(command_handle_: CommandHandle,
                                                                       err: Error,
                                                                       txn_json: CString) -> Error>) -> Error;

pub type SignWithAddressCB = extern fn (command_handle: CommandHandle, wallet_handle: WalletHandle,
                                        address: CString,
                                        message_raw: BString, message_len: u32,
                                        cb: Option<extern fn(command_handle: i32, err: Error, raw: BString, len: u32)>) -> Error;

pub type VerifyWithAddressCB = extern fn (command_handle: i32, address: CString,
                                          message_raw: BString, message_len: u32,
                                          signature_raw: BString, signature_len: u32,
                                          cb: Option<extern fn(command_handle: i32, err: Error, result: bool)>) -> Error;