forked from breadwallet/breadwallet-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBRCryptoWalletManagerClient.h
More file actions
330 lines (273 loc) · 15.6 KB
/
Copy pathBRCryptoWalletManagerClient.h
File metadata and controls
330 lines (273 loc) · 15.6 KB
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
//
// BRCryptoWalletManagerClient.h
// BRCrypto
//
// Created by Michael Carrara on 6/19/19.
// Copyright © 2019 breadwallet. All rights reserved.
//
// See the LICENSE file at the project root for license information.
// See the CONTRIBUTORS file at the project root for a list of contributors.
#ifndef BRCryptoWalletManagerClient_h
#define BRCryptoWalletManagerClient_h
#include "BRCryptoBase.h"
#include "BRCryptoNetwork.h"
#include "BRCryptoAccount.h"
#include "BRCryptoStatus.h"
#include "BRCryptoTransfer.h"
#include "BRCryptoWallet.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void *BRCryptoClientContext;
typedef struct BRCryptoClientCallbackStateRecord *BRCryptoClientCallbackState;
// MARK: - Get Balance
typedef void
(*BRCryptoClientGetBalanceCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char **addresses,
size_t addressesCount,
OwnershipKept const char *issuer); // NULLABLE
extern void
cwmAnnounceGetBalanceSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
const char *balance);
extern void
cwmAnnounceGetBalanceFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
// MARK: - Get Block Number
typedef void
(*BRCryptoClientGetBlockNumberCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState);
extern void
cwmAnnounceGetBlockNumberSuccessAsInteger (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
uint64_t blockNumber);
extern void
cwmAnnounceGetBlockNumberSuccessAsString (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *blockNumber);
extern void
cwmAnnounceGetBlockNumberFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
// MARK: - Get Transactions
typedef void
(*BRCryptoClientGetTransactionsCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char **addresses,
size_t addressCount,
OwnershipKept const char *currency,
uint64_t begBlockNumber,
uint64_t endBlockNumber);
extern void
cwmAnnounceGetTransactionsItem (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoTransferStateType status,
OwnershipKept uint8_t *transaction,
size_t transactionLength,
uint64_t timestamp,
uint64_t blockHeight);
extern void
cwmAnnounceGetTransactionsComplete (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoBoolean success);
// MARK: - Get Transfers
typedef void
(*BRCryptoClientGetTransfersCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char **addresses,
size_t addressCount,
OwnershipKept const char *currency,
uint64_t begBlockNumber,
uint64_t endBlockNumber);
extern void
cwmAnnounceGetTransferItemGEN (BRCryptoWalletManager cwm,
BRCryptoClientCallbackState callbackState,
BRCryptoTransferStateType status,
OwnershipKept const char *hash,
OwnershipKept const char *uids,
OwnershipKept const char *from,
OwnershipKept const char *to,
OwnershipKept const char *amount,
OwnershipKept const char *currency,
OwnershipKept const char *fee,
uint64_t timestamp,
uint64_t blockHeight,
size_t attributesCount,
OwnershipKept const char **attributeKeys,
OwnershipKept const char **attributeVals);
extern void
cwmAnnounceGetTransactionsItemETH (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *hash,
OwnershipKept const char *from,
OwnershipKept const char *to,
OwnershipKept const char *contract,
OwnershipKept const char *amount, // value
OwnershipKept const char *gasLimit,
OwnershipKept const char *gasPrice,
OwnershipKept const char *data,
OwnershipKept const char *nonce,
OwnershipKept const char *gasUsed,
OwnershipKept const char *blockNumber,
OwnershipKept const char *blockHash,
OwnershipKept const char *blockConfirmations,
OwnershipKept const char *blockTransactionIndex,
OwnershipKept const char *blockTimestamp,
// cumulative gas used,
// confirmations
// txreceipt_status
OwnershipKept const char *isError);
extern void
cwmAnnounceGetLogsItemETH (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *strHash,
OwnershipKept const char *strContract,
int topicCount,
OwnershipKept const char **arrayTopics,
OwnershipKept const char *strData,
OwnershipKept const char *strGasPrice,
OwnershipKept const char *strGasUsed,
OwnershipKept const char *strLogIndex,
OwnershipKept const char *strBlockNumber,
OwnershipKept const char *strBlockTransactionIndex,
OwnershipKept const char *strBlockTimestamp);
extern void
cwmAnnounceGetTransfersComplete (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoBoolean success);
extern void
cwmAnnounceSubmitTransferSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
extern void
cwmAnnounceGetLogsComplete(OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoBoolean success);
// MARK: - Submit Transaction
typedef void
(*BRCryptoClientSubmitTransactionCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const uint8_t *transaction,
size_t transactionLength,
OwnershipKept const char *hashAsHex);
extern void
cwmAnnounceSubmitTransferSuccessForHash (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
const char *hash);
extern void
cwmAnnounceSubmitTransferFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
// MARK: - (ETH) Get Gas Price
typedef void
(*BRCryptoClientETHGetGasPriceCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *network);
extern void
cwmAnnounceGetGasPriceSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
const char *gasPrice);
extern void
cwmAnnounceGetGasPriceFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
// MARK: - (ETH) Get Gas Estimate
typedef void
(*BRCryptoClientETHEstimateGasCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *network,
OwnershipKept const char *from,
OwnershipKept const char *to,
OwnershipKept const char *amount,
OwnershipKept const char *price,
OwnershipKept const char *data);
extern void
cwmAnnounceGetGasEstimateSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
const char *gasEstimate,
const char *gasPrice);
extern void
cwmAnnounceGetGasEstimateFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoStatus status);
// MARK: - (ETH) Get Blocks
typedef void
(*BRCryptoClientETHGetBlocksCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *network,
OwnershipKept const char *address, // disappears immediately
unsigned int interests,
uint64_t blockNumberStart,
uint64_t blockNumberStop);
extern void
cwmAnnounceGetBlocksSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
int blockNumbersCount,
uint64_t *blockNumbers);
extern void
cwmAnnounceGetBlocksFailure (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
// MARK: - (ETH) Get Tokens
typedef void
(*BRCryptoClientETHGetTokensCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState);
extern void
cwmAnnounceGetTokensItem (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *address,
OwnershipKept const char *symbol,
OwnershipKept const char *name,
OwnershipKept const char *description,
unsigned int decimals,
OwnershipKept const char *strDefaultGasLimit,
OwnershipKept const char *strDefaultGasPrice);
extern void
cwmAnnounceGetTokensComplete (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
BRCryptoBoolean success);
// MARK: - (ETH) Get Block Number
typedef void
(*BRCryptoClientETHGetBlockNumberCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *network);
// MARK: (ETH) Get Nonce
typedef void
(*BRCryptoClientETHGetNonceCallback) (BRCryptoClientContext context,
OwnershipGiven BRCryptoWalletManager manager,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *network,
OwnershipKept const char *address);
extern void
cwmAnnounceGetNonceSuccess (OwnershipKept BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState,
OwnershipKept const char *address,
OwnershipKept const char *nonce);
extern void
cwmAnnounceGetNonceFailure (BRCryptoWalletManager cwm,
OwnershipGiven BRCryptoClientCallbackState callbackState);
typedef struct {
} BRCryptoCWMClientETH;
typedef struct {
BRCryptoClientContext context;
BRCryptoClientGetBalanceCallback funcGetBalance;
BRCryptoClientGetBlockNumberCallback funcGetBlockNumber;
BRCryptoClientGetTransactionsCallback funcGetTransactions;
BRCryptoClientGetTransfersCallback funcGetTransfers;
BRCryptoClientSubmitTransactionCallback funcSubmitTransaction;
BRCryptoClientETHGetGasPriceCallback funcGetGasPriceETH;
BRCryptoClientETHEstimateGasCallback funcEstimateGasETH;
BRCryptoClientETHGetBlocksCallback funcGetBlocksETH;
BRCryptoClientETHGetTokensCallback funcGetTokensETH; // announce one-by-one
BRCryptoClientETHGetNonceCallback funcGetNonceETH;
} BRCryptoClient;
#ifdef __cplusplus
}
#endif
#endif /* BRCryptoWalletManagerClient_h */