Repository navigation
Expand file tree
/
Copy pathBRCryptoUnit.h
More file actions
88 lines (69 loc) · 2.25 KB
/
Copy pathBRCryptoUnit.h
File metadata and controls
88 lines (69 loc) · 2.25 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
//
// BRCryptoUnit.h
// BRCore
//
// Created by Ed Gamble on 3/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 BRCryptoUnit_h
#define BRCryptoUnit_h
#include "BRCryptoBase.h"
#include "BRCryptoCurrency.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct BRCryptoUnitRecord *BRCryptoUnit;
private_extern BRCryptoUnit
cryptoUnitCreateAsBase (BRCryptoCurrency currency,
const char *uids,
const char *name,
const char *symbol);
private_extern BRCryptoUnit
cryptoUnitCreate (BRCryptoCurrency currency,
const char *uids,
const char *name,
const char *symbol,
BRCryptoUnit baseUnit,
uint8_t powerOffset);
extern const char *
cryptoUnitGetUids(BRCryptoUnit unit);
extern const char *
cryptoUnitGetName (BRCryptoUnit unit);
extern const char *
cryptoUnitGetSymbol (BRCryptoUnit unit);
/**
* Returns the unit's currency
*
* @param unit the Unit
*
* @return The currency w/ an incremented reference count (aka 'taken')
*/
extern BRCryptoCurrency
cryptoUnitGetCurrency (BRCryptoUnit unit);
extern BRCryptoBoolean
cryptoUnitHasCurrency (BRCryptoUnit unit,
BRCryptoCurrency currency);
/**
* Returns the unit's base unit. If unit is itself the base unit then unit is returned
*
* @param unit The unit
*
* @return the base unit w/ an incremented reference count (aka 'taken')
*/
extern BRCryptoUnit
cryptoUnitGetBaseUnit (BRCryptoUnit unit);
extern uint8_t
cryptoUnitGetBaseDecimalOffset (BRCryptoUnit unit);
extern BRCryptoBoolean
cryptoUnitIsCompatible (BRCryptoUnit u1,
BRCryptoUnit u2);
extern BRCryptoBoolean
cryptoUnitIsIdentical (BRCryptoUnit u1,
BRCryptoUnit u2);
DECLARE_CRYPTO_GIVE_TAKE (BRCryptoUnit, cryptoUnit);
#ifdef __cplusplus
}
#endif
#endif /* BRCryptoUnit_h */