ABCSpend Class Reference

Inherits from NSObject
Declared in ABCSpend.h

Overview

ABCSpend is used to build a Spend from the ABCWallet that generated this ABCSpend object. Caller can add multiple spend targets by calling either of addAddress, addTransfer, or addPaymentRequest repeated times. Use signBroadcastAndSave to send the transaction to the blockchain. This spend may also be signed without broadcast by calling signTx.

– addAddress:amount:

Adds an address and amount to this spend request

- (NSError *)addAddress:(NSString *)address amount:(uint64_t)amount

Parameters

address

NSString Bitcoin public address to send funds to

amount

uint64_t Amount of bitcoin to send in satoshis

Return Value

NSError

Discussion

Adds an address and amount to this spend request

Declared In

ABCSpend.h

– addTransfer:amount:destMeta:

Adds a transfer of funds between ABCWallets in an account. The source wallet is the wallet that created this ABCSpend and once the transaction is sent, the source wallet is tagged with the metaData from this ABCSpend object. The destWallet is tagged with metadata supplied in detaMeta

- (NSError *)addTransfer:(ABCWallet *)destWallet amount:(uint64_t)amountSatoshi destMeta:(ABCMetaData *)destMeta

Parameters

destWallet

ABCWallet Destination wallet for transfer

amountSatoshi

uint64_t Amount of transfer

destMeta

ABCMetaData Metadata to tag the destination transaction with

Return Value

NSError Error object. Nil if success

Discussion

Adds a transfer of funds between ABCWallets in an account. The source wallet is the wallet that created this ABCSpend and once the transaction is sent, the source wallet is tagged with the metaData from this ABCSpend object. The destWallet is tagged with metadata supplied in detaMeta

Declared In

ABCSpend.h

– addPaymentRequest:

Adds a BIP70 payment request to this ABCSpend transaction. No amount parameter is provided as the payment request always has the amount included. Generate an ABCPaymentRequest object by calling parseURI then getPaymentRequest

- (NSError *)addPaymentRequest:(ABCPaymentRequest *)paymentRequest

Parameters

paymentRequest

ABCPaymentRequest object to add

Return Value

NSError Error object. Nil if success

Discussion

Adds a BIP70 payment request to this ABCSpend transaction. No amount parameter is provided as the payment request always has the amount included. Generate an ABCPaymentRequest object by calling parseURI then getPaymentRequest

Declared In

ABCSpend.h

– signBroadcastAndSave:

Signs this send request and broadcasts it to the blockchain

- (ABCTransaction *)signBroadcastAndSave:(NSError **)error

Parameters

error

NSError object

Return Value

ABCTransaction Transaction object

Discussion

Signs this send request and broadcasts it to the blockchain

Declared In

ABCSpend.h

– signBroadcastAndSave:error:

Signs this send request and broadcasts it to the blockchain. Uses completion handlers

- (void)signBroadcastAndSave:(void ( ^ ) ( ABCTransaction *))completionHandler error:(void ( ^ ) ( NSError *error ))errorHandler

Parameters

completionHandler

Completion handler code block
- param ABCTransaction Transaction object

errorHandler

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

Return Value

void

Discussion

Signs this send request and broadcasts it to the blockchain. Uses completion handlers

Declared In

ABCSpend.h

– getFees:

Calculate the amount of fees needed to send this transaction

- (uint64_t)getFees:(NSError **)error

Parameters

error

NSError (optional)

Return Value

uint64_t Total fees required for this transaction

Discussion

Calculate the amount of fees needed to send this transaction

Declared In

ABCSpend.h

– getFees:error:

Calculate the amount of fees needed to send this transaction

- (void)getFees:(void ( ^ ) ( uint64_t fees ))completionHandler error:(void ( ^ ) ( NSError *error ))errorHandler

Parameters

completionHandler

Completion handler code block which is called with uint64_t totalFees
- param uint64_t Amount of fees in satoshis

errorHandler

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

Discussion

Calculate the amount of fees needed to send this transaction

Declared In

ABCSpend.h

– getMaxSpendable:

Get the maximum amount spendable from this wallet using the currenct ABCSpend object

- (uint64_t)getMaxSpendable:(NSError **)error

Parameters

error

NSError (optional)

Return Value

uint64_t Maximum spendable from this wallet in satoshis

Discussion

Get the maximum amount spendable from this wallet using the currenct ABCSpend object

Declared In

ABCSpend.h

– getMaxSpendable:error:

Get the maximum amount spendable from this wallet using completion handlers

- (void)getMaxSpendable:(void ( ^ ) ( uint64_t amountSpendable ))completionHandler error:(void ( ^ ) ( NSError *error ))errorHandler

Parameters

completionHandler

Completion handler code block which is called with uint64_t totalFees
- param uint64_t amountSpendable Total amount spendablein satoshis

errorHandler

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

Discussion

Get the maximum amount spendable from this wallet using completion handlers

Declared In

ABCSpend.h