ABCDenomination Class Reference
Inherits from | NSObject |
---|---|
Declared in | ABCDenomination.h |
Overview
ABCDenomination represents a specific bitcoin denomination such as BTC, mBTC, or bits (uBTC). The class also includes several utility methods to convert to/from 64 bit satoshi amounts and user viewable strings in the current denomination.
index
Index of this denomination in the list of denominations.
0 = BTC, 1 = mBTC, 2 = bits
@property (nonatomic) int index
Discussion
Index of this denomination in the list of denominations.
0 = BTC, 1 = mBTC, 2 = bits
Declared In
ABCDenomination.h
multiplier
Number of satoshis to equal one unit of this denomination
ie. 1 BTC -> multiplier = 100,000,000
1 mBTC -> multipliers = 100,000
@property (nonatomic) int multiplier
Discussion
Number of satoshis to equal one unit of this denomination
ie. 1 BTC -> multiplier = 100,000,000
1 mBTC -> multipliers = 100,000
Declared In
ABCDenomination.h
symbol
Denomination symbol such as “Ƀ”
@property (nonatomic) NSString *symbol
Discussion
Denomination symbol such as “Ƀ”
Declared In
ABCDenomination.h
label
Denomination label such as “BTC” or “bits”
@property (nonatomic) NSString *label
Discussion
Denomination label such as “BTC” or “bits”
Declared In
ABCDenomination.h
– maxBitcoinDecimalPlaces
Returns the maximum number of decimal places represented by this denomination
- (int)maxBitcoinDecimalPlaces
Return Value
int Maximum decimal places. BTC=8, mBTC=5, bits=2
Discussion
Returns the maximum number of decimal places represented by this denomination
Declared In
ABCDenomination.h
– prettyBitcoinDecimalPlaces
Returns the ‘pretty’ number of decimal places represented by this denomination. Due to the large number of subunits of bitcoin, several decimal places represent units of value considered to be uninteresting to users. This returns the number of decimal places to represent no less than .001 USD.
- (int)prettyBitcoinDecimalPlaces
Return Value
int Maximum decimal places
Discussion
Returns the ‘pretty’ number of decimal places represented by this denomination. Due to the large number of subunits of bitcoin, several decimal places represent units of value considered to be uninteresting to users. This returns the number of decimal places to represent no less than .001 USD.
Declared In
ABCDenomination.h
– satoshiToBTCString:withSymbol:cropDecimals:
Convert a 64 bit satoshi value to a string using the current denomination. Routine will automatically apply the correct conversion to BTC/mBTC/bits based on this objects denomination
- (NSString *)satoshiToBTCString:(int64_t)satoshi withSymbol:(bool)symbol cropDecimals:(bool)cropDecimals
Parameters
satoshi |
int64_t Signed satoshi amount to convert |
---|---|
symbol |
(optional) bool YES if routine should add a denomination symbol such as “Ƀ” before the amount |
cropDecimals |
(optional) bool YES if routine should only show the number of decimal places specified by prettyBitcoinDecimalPlaces |
Return Value
NSString String representation of bitcoin amount
Discussion
Convert a 64 bit satoshi value to a string using the current denomination. Routine will automatically apply the correct conversion to BTC/mBTC/bits based on this objects denomination
Declared In
ABCDenomination.h
– btcStringToSatoshi:
Parse an NSString to satoshi amount. Factors in the current denomination in the conversion.
- (int64_t)btcStringToSatoshi:(NSString *)amount
Parameters
amount |
NSString String value to parse |
---|
Return Value
int64_t Signed 64 bit satoshi amount
Discussion
Parse an NSString to satoshi amount. Factors in the current denomination in the conversion.
Declared In
ABCDenomination.h
+ getDenominationForMultiplier:
Returns an ABCDenomination object for the given multipier enum
+ (ABCDenomination *)getDenominationForMultiplier:(ABCDenominationMultiplier)multiplier
Parameters
multiplier |
---|
Return Value
ABCDenomination Corresponding ABCDenomination for the multiplier
Discussion
Returns an ABCDenomination object for the given multipier enum
Declared In
ABCDenomination.h
+ getDenominationForIndex:
Returns an ABCDenomination object for the given index into the enum list.
+ (ABCDenomination *)getDenominationForIndex:(int)index
Parameters
index |
int |
---|
Return Value
ABCDenomination Corresponding ABCDenomination for the index
0 -> ABCDenominationMultiplierBTC
1 -> ABCDenominationMultiplierMBTC
2 -> ABCDenominationMultiplierUBTC
Discussion
Returns an ABCDenomination object for the given index into the enum list.
Declared In
ABCDenomination.h