ABCWallet Class Reference

Inherits from NSObject
Declared in ABCWallet.h

Overview

ABCWallet represents a single HD, multiple address, wallet within an ABCAccount. This object is the basis for Sends and Requests. Initiate sends by calling createNewSpend which returns an ABCSpend object. Use createNewReceiveAddress to generate an ABCReceiveAddress which contains a bitcoin address to receive funds.

ABCWallet properties

  uuid

Wallet random UUID used for various routines

@property (nonatomic, copy) NSString *uuid

Discussion

Wallet random UUID used for various routines

Declared In

ABCWallet.h

  name

Text name of wallet. Defaults to “My Wallet” but can be changed with renameWallet

@property (nonatomic, copy) NSString *name

Discussion

Text name of wallet. Defaults to “My Wallet” but can be changed with renameWallet

Declared In

ABCWallet.h

  currency

ABCCurrency object determines the fiat currency which this wallet uses to save exchange rate values of each transaction.

@property (nonatomic, assign) ABCCurrency *currency

Discussion

ABCCurrency object determines the fiat currency which this wallet uses to save exchange rate values of each transaction.

Declared In

ABCWallet.h

  archived

YES if this wallet is archived. App should not allow the user to get an address or spend money from an archived wallet although the SDK does not enforce such rules.

@property (nonatomic, assign) unsigned int archived

Discussion

YES if this wallet is archived. App should not allow the user to get an address or spend money from an archived wallet although the SDK does not enforce such rules.

Declared In

ABCWallet.h

  balance

The total balance of this wallet in satoshis

@property (nonatomic, assign) int64_t balance

Discussion

The total balance of this wallet in satoshis

Declared In

ABCWallet.h

  arrayTransactions

Array of ABCTransaction objects in this wallet

@property (nonatomic, strong) NSArray *arrayTransactions

Discussion

Array of ABCTransaction objects in this wallet

Declared In

ABCWallet.h

  loaded

YES if this wallet and it’s transactions have been loaded. This is NO on initial signIn while wallet info is being decrypted and loaded

@property (nonatomic, assign) BOOL loaded

Discussion

YES if this wallet and it’s transactions have been loaded. This is NO on initial signIn while wallet info is being decrypted and loaded

Declared In

ABCWallet.h

  account

The ABCAccount object which contains this wallet.

@property (nonatomic, strong) ABCAccount *account

Discussion

The ABCAccount object which contains this wallet.

Declared In

ABCWallet.h

  blockHeight

The current blockheight of the bitcoin network

@property (nonatomic, assign) int blockHeight

Discussion

The current blockheight of the bitcoin network

Declared In

ABCWallet.h

Wallet Management

– renameWallet:

NSString new name of wallet NSError error code

- (NSError *)renameWallet:(NSString *)newName

Parameters

newName

NSString new name of wallet NSError error code

Declared In

ABCWallet.h

– removeWallet:error:

Deletes wallet from user’s account. This will render wallet completely inaccessible including any future funds that may be sent to any addresses in this wallet. Give users ample warning before calling this routine.

- (void)removeWallet:(void ( ^ ) ( void ))completionHandler error:(void ( ^ ) ( NSError *error ))errorHandler

Parameters

completionHandler

Completion handler code block which is called with void. (Optional. If used, method returns immediately with void)

errorHandler

Error handler code block which is called with the following args
- param NSError* error object

Return Value

NSError* or nil if no error. Returns void if completion handlers are used.

Discussion

Deletes wallet from user’s account. This will render wallet completely inaccessible including any future funds that may be sent to any addresses in this wallet. Give users ample warning before calling this routine.

Declared In

ABCWallet.h

Transaction Management

– getTransaction:

Gets an ABCTransaction object for bitcoin transactionID txid

- (ABCTransaction *)getTransaction:(NSString *)txId

Parameters

txId

NSString Standard Bitcoin transaction ID

Return Value

ABCTransaction Transaction object or nil if fails to find transaction in wallet.

Discussion

Gets an ABCTransaction object for bitcoin transactionID txid

Declared In

ABCWallet.h

– searchTransactionsIn:addTo:

Searches transactions in wallet for any transactions with metadata matching term and returns the matching transactions in arrayTransactions

- (NSError *)searchTransactionsIn:(NSString *)term addTo:(NSMutableArray *)arrayTransactions

Parameters

term

NSString Search term

arrayTransactions

Allocated NSMutableArray for the resulting matching transactions

Return Value

NSError Error object

Discussion

Searches transactions in wallet for any transactions with metadata matching term and returns the matching transactions in arrayTransactions

Declared In

ABCWallet.h

Bitcoin Address Creation

– createNewReceiveAddress:error:

Create a receive request from the current wallet using completion handlers Caller may then optionally set the values in the following properties:
ABCReceiveAddress.metadata
ABCReceiveAddress.amountSatoshi
ABCReceiveAddress.uriMessage
ABCReceiveAddress.uriLabel
ABCReceiveAddress.uriCategory

Caller can then read the following properties
ABCReceiveAddress.address
ABCReceiveAddress.qrCode
ABCReceiveAddress.uri

Properties in the metadata object are permanently associated with the ABCReceiveAddress such that any future payments to this address will have that metadata automatically tagged in the transaction. User must read either the address, qrCode, or uri properties to ensure that modified fields in ABCReceiveAddress.metadata are saved. The qrCode and uri values will include the amountSatoshi, uriMessage, uriLabel, and uriCategory properties

- (void)createNewReceiveAddress:(void ( ^ ) ( ABCReceiveAddress *))completionHandler error:(void ( ^ ) ( NSError *error ))errorHandler

Parameters

completionHandler

Completion handler code block which is called with void. (Optional. If used, method returns immediately with void)
- param ABCReceiveAddress* Receive address object

errorHandler

Error handler code block which is called with the following args
- param NSError* error object

Return Value

void

Discussion

Create a receive request from the current wallet using completion handlers Caller may then optionally set the values in the following properties:
ABCReceiveAddress.metadata
ABCReceiveAddress.amountSatoshi
ABCReceiveAddress.uriMessage
ABCReceiveAddress.uriLabel
ABCReceiveAddress.uriCategory

Caller can then read the following properties
ABCReceiveAddress.address
ABCReceiveAddress.qrCode
ABCReceiveAddress.uri

Properties in the metadata object are permanently associated with the ABCReceiveAddress such that any future payments to this address will have that metadata automatically tagged in the transaction. User must read either the address, qrCode, or uri properties to ensure that modified fields in ABCReceiveAddress.metadata are saved. The qrCode and uri values will include the amountSatoshi, uriMessage, uriLabel, and uriCategory properties

Declared In

ABCWallet.h

– createNewReceiveAddress:

Create a receive request from the current wallet. Caller may then optionally set the values in the following properties:
ABCReceiveAddress.metadata
ABCReceiveAddress.amountSatoshi
ABCReceiveAddress.uriMessage
ABCReceiveAddress.uriLabel
ABCReceiveAddress.uriCategory

Caller can then read the following properties
ABCReceiveAddress.address
ABCReceiveAddress.qrCode
ABCReceiveAddress.uri

Properties in the metadata object are permanently associated with the ABCReceiveAddress such that any future payments to this address will have that metadata automatically tagged in the transaction. User must read either the address, qrCode, or uri properties to ensure that modified fields in ABCReceiveAddress.metadata are saved. The qrCode and uri values will include the amountSatoshi, uriMessage, uriLabel, and uriCategory properties

- (ABCReceiveAddress *)createNewReceiveAddress:(NSError **)error

Parameters

error

NSError** (optional)

Return Value

ABCReceiveAddress* or nil if failure

Discussion

Create a receive request from the current wallet. Caller may then optionally set the values in the following properties:
ABCReceiveAddress.metadata
ABCReceiveAddress.amountSatoshi
ABCReceiveAddress.uriMessage
ABCReceiveAddress.uriLabel
ABCReceiveAddress.uriCategory

Caller can then read the following properties
ABCReceiveAddress.address
ABCReceiveAddress.qrCode
ABCReceiveAddress.uri

Properties in the metadata object are permanently associated with the ABCReceiveAddress such that any future payments to this address will have that metadata automatically tagged in the transaction. User must read either the address, qrCode, or uri properties to ensure that modified fields in ABCReceiveAddress.metadata are saved. The qrCode and uri values will include the amountSatoshi, uriMessage, uriLabel, and uriCategory properties

Declared In

ABCWallet.h

– getReceiveAddress:error:

Retrieves an ABCReceiveAddress object for the given public address At this time, metadata or amountSatoshi values previously associated with this receive address are not re-populated into this ABCReceiveAddress object even if they are still saved in the internal ABC database.

- (ABCReceiveAddress *)getReceiveAddress:(NSString *)address error:(NSError **)error

Parameters

address

NSString* Bitcoin public address from a previous ABCReceiveAddress

error

NSError** Pointer to error object (optional)

Return Value

ABCReceiveAddress* ABCReceiveAddress object

Discussion

Retrieves an ABCReceiveAddress object for the given public address At this time, metadata or amountSatoshi values previously associated with this receive address are not re-populated into this ABCReceiveAddress object even if they are still saved in the internal ABC database.

Declared In

ABCWallet.h

Spend Bitcoin Routines

– createNewSpend:

Create a new ABCSpend object. Can be explicitly deallocated using ABCSpend free.

- (ABCSpend *)createNewSpend:(NSError **)error

Parameters

error

Return pointer to NSError object

Return Value

ABCSpend object

Discussion

Create a new ABCSpend object. Can be explicitly deallocated using ABCSpend free.

Declared In

ABCWallet.h

Import and Export Routines

– importPrivateKey:importing:complete:error:

Import (sweep) private key funds into this wallet. Private key is discarded after sweep.

- (void)importPrivateKey:(NSString *)privateKey importing:(void ( ^ ) ( NSString *address ))importingHandler complete:(void ( ^ ) ( ABCImportDataModel dataModel , NSString *address , ABCTransaction *transaction , uint64_t amount ))completionHandler error:(void ( ^ ) ( NSError *))errorHandler

Parameters

privateKey

NSString* WIF or HBITS format private key string

importingHandler

Called when private key is determined to be valid and ABC is sweeping funds. May take up to 30 seconds to sweep. - param address NSString* public address of private key

completionHandler

Called on success.
- param dataModel ABCImportDataModel of private key
- param address NSString public address of private key
-
param transaction ABCTransaction that swept funds
-
param* amount uint64_t amount of satoshis swept into wallet

errorHandler

Error code block called on error with parameters
- param NSError* error

Return Value

void

Discussion

Import (sweep) private key funds into this wallet. Private key is discarded after sweep.

Declared In

ABCWallet.h

– exportTransactionsToCSV:

Export a wallet’s transactions to CSV format

- (NSError *)exportTransactionsToCSV:(NSMutableString *)csv

Parameters

csv

NSMutableString* allocated and initialized mutable string to receive CSV contents. Must not be nil.

Return Value

NSError* error object. nil if success

Discussion

Export a wallet’s transactions to CSV format

Declared In

ABCWallet.h

– exportTransactionsToQBO:

Export a wallet’s transactions to Quickbooks QBO format

- (NSError *)exportTransactionsToQBO:(NSMutableString *)qbo

Parameters

qbo

NSMutableString* allocated and initialized mutable string to receive CSV contents. Must not be nil.

Return Value

NSError* error object. nil if success

Discussion

Export a wallet’s transactions to Quickbooks QBO format

Declared In

ABCWallet.h