Synchronizer

public protocol Synchronizer

Primary interface for interacting with the SDK. Defines the contract that specific implementations like SdkSynchronizer fulfill.

  • Starts this synchronizer within the given scope.

    Implementations should leverage structured concurrency and cancel all jobs when this scope completes.

    Declaration

    Swift

    func start(retry: Bool) throws
  • Stop this synchronizer. Implementations should ensure that calling this method cancels all jobs that were created by this instance.

    Declaration

    Swift

    func stop() throws
  • Value representing the Status of this Synchronizer. As the status changes, a new value will be emitted by KVO

    Declaration

    Swift

    var status: Status { get }
  • A flow of progress values, typically corresponding to this Synchronizer downloading blocks. Typically, any non-zero value below 1.0 indicates that progress indicators can be shown and a value of 1.0 signals that progress is complete and any progress indicators can be hidden. KVO Compliant

    Declaration

    Swift

    var progress: Float { get }
  • Gets the address for the given account.

    Declaration

    Swift

    func getAddress(accountIndex: Int) -> String

    Parameters

    accountIndex

    the optional accountId whose address is of interest. By default, the first account is used.

  • Sends zatoshi.

    Declaration

    Swift

    func sendToAddress(spendingKey: String, zatoshi: Int64, toAddress: String, memo: String?, from accountIndex: Int, resultBlock: @escaping (_ result: Result<PendingTransactionEntity, Error>) -> Void)

    Parameters

    spendingKey

    the key that allows spends to occur.

    zatoshi

    the amount of zatoshi to send.

    toAddress

    the recipient’s address.

    memo

    the optional memo to include as part of the transaction.

    accountIndex

    the optional account id to use. By default, the first account is used.

  • Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only an option if the transaction has not yet been submitted to the server.

    Declaration

    Swift

    func cancelSpend(transaction: PendingTransactionEntity) -> Bool

    Parameters

    transaction

    the transaction to cancel.

    Return Value

    true when the cancellation request was successful. False when it is too late.

  • all outbound pending transactions that have been sent but are awaiting confirmations

    Declaration

    Swift

    var pendingTransactions: [PendingTransactionEntity] { get }
  • al the transactions that are on the blockchain

    Declaration

    Swift

    var clearedTransactions: [ConfirmedTransactionEntity] { get }
  • All transactions that are related to sending funds

    Declaration

    Swift

    var sentTransactions: [ConfirmedTransactionEntity] { get }
  • all transactions related to receiving funds

    Declaration

    Swift

    var receivedTransactions: [ConfirmedTransactionEntity] { get }
  • a repository serving transactions in a paginated manner

    Declaration

    Swift

    func paginatedTransactions(of kind: TransactionKind) -> PaginatedTransactionRepository

    Parameters

    kind

    Transaction Kind expected from this PaginatedTransactionRepository