ZcashLightClientKit/Example/ZcashLightClientSample
Francisco Gindre f5e7c027af
[#1001] Remove PendingDb in favor of `v_transactions` and `v_tx_output` Views (#1001)
Removes `PendingTransactionEntity` and all of its related components.
Pending items are still tracked and visualized by the existing APIs
but they are retrieved from the `TransactionRepository` instead by
returning `ZcashTransaction.Overview` instead.

`pendingDbURL` is removed from every place it was required. Its
deletion is responsibility of wallet developers.

`ClearedTransactions` are now just `transactions`.

`MigrationManager` is deleted. Now all migrations are in charge of
the rust welding layer.

`PendingTransactionDao.swift` is removed.

Implementation of `AccountEntity` called `Account` is now `DbAccount`

`ZcashTransaction.Overview` can be checked for "pending-ness" by calling
`.isPending(latestHeight:)` latest height must be provided so that minedHeight
can be compared with the lastest and the `defaultStaleTolerance` constant.

`TransactionRecipient` is now a public type.

protocol `PendingTransactionRepository` is removed.

`TransactionManagerError` and `PersistentTransactionManager` are deleted.

`OutboundTransactionManager` is deleted and replaced by `TransactionEncoder`
which now incorporates `submit(encoded:)` functionality

`WalletTransactionEncoder` now uses a `LightWalletService` to submit the
encoded transactions.

Add changelog changes

Delete references to PendingDb from tests and documentation.

Fixes some typos. Adds the ability to trace transaction repository
SQL queries from test

Fix rebase conflicts and generate code

[#837] Memo tests regarding transparent address

Closes #837

Add model for transaction output

Point to FFI branch

Fix issue where sync wouldn't resume after wipe. Becasue GRPC
channel would be closed

Fix Tests

Fix testPendingTransactionMinedHeightUpdated

Fix testLastStates

[#921] Fix  broken SynchronizerDarksideTests

Add ZcashTransaction.Output API to Synchronizer

Changelog + comment fix

Add Assertions for transaction outputs and recipients

Point to FFI 0.3.1

Fix Demo App Compiler errors

Fix Demo App Compiler errors

fix cacheDb warnings

Fix Tests and compiler errors of rebase

build demo app

Remove `ZcashTransaction.Sent` and `.Received`. Add `.State` and tests

Fix SPM warning

PR Suggestions

Removes errors that are not used anymore

fix warnings
2023-05-05 14:30:47 -03:00
..
ZcashLightClientSample [#1001] Remove PendingDb in favor of `v_transactions` and `v_tx_output` Views (#1001) 2023-05-05 14:30:47 -03:00
ZcashLightClientSample.xcodeproj [#442] Introduce parallel downloading and scanning 2023-05-05 09:35:43 +02:00
ZcashLightClientSampleTests [#711] Add Swiftlint plug in to SDK (#722) 2023-01-18 17:09:04 +01:00
assets Move read.me up a directory. (#90) 2020-03-09 19:39:10 -03:00
README.md Remove dependecy on rust sources 2022-02-28 17:03:20 +00:00
ZcashLightClientSample-Mainnet-Info.plist Feature/single pod mainnet (#60) 2020-01-14 19:25:14 -03:00

README.md

iOS demo app

This is a demo app that exercises code in https://github.com/zcash/ZcashLightClientKit, which has all the iOS-related functionalities necessary to build a mobile Zcash shielded wallet.

It relies on Lightwalletd, a backend service that provides a bandwidth-efficient interface to the Zcash blockchain. There is an equivalent Android demo app.

Contents

Requirements

Demo app requires a target device running iOS 12+.

Back to contents

Exploring the demo app

After building the app, the emulator should launch with a basic app that exercises the SDK (see picture below). To explore the app, click on each menu item, in order, and also look at the associated code.

The android demo app, running in Android Studio

The demo app is not trying to show what's possible, but to present how to accomplish the building blocks of wallet functionality in a simple way in code. It is comprised of the following self-contained demos. All data is reset between demos in order to keep the behavior repeatable and independent of state.

Demos

Menu Item Related Code Description
Get address GetAddressViewController.swift Given a seed, display its z-addr
Latest block height LatestHeightViewController.swift Given a lightwalletd server, retrieve the latest block height
Sync blocks SyncBlocksViewController.swift Download compact blocks from the lightwalletd server.
Get balance GetBalanceViewController.swift Calculates the balance of the current wallet address.
Send funds SendViewController.swift Send a transaction, the most complex demo.
Transaction details TransactionDetailViewController.swift See status of a transaction: pending or confirmed, sent or received.
All transactions TransactionsTableViewController.swift, TransactionsDataSource.swift Displays as much available transaction information on the wallet.
Paginated transactions PaginatedTransactionsViewController.swift Demonstrates how to paginate transactions.

Back to contents

Getting started

Were assuming you already have a brilliant app idea, a vision for the apps UI, and know the ins and outs of the Android lifecycle. Well just stick to the Zcash app part of “getting started.”

Similarly, the best way to build a functioning Zcash shielded app is to implement the functionalities that are listed in the demo app, in roughly that order:

  1. Generate and safely store your private key.
  2. Get the associated address, and display it to the user on a receive screen. You may also want to generate a QR code from this address.
  3. Make sure your app can talk to the lightwalletd server and check by asking for the latest height, and verify that its current with the Zcash network.
  4. Try interacting with lightwalletd by fetching a block and processing it. Then try fetching a range of blocks, which is much more efficient.
  5. Now that you have the blocks process them and list transactions that send to or are from that wallet, to calculate your balance.
  6. With a current balance (and funds, of course), send a transaction and monitor its transaction status and update the UI with the results.

Back to contents

Resources

You dont need to do it all on your own.

Back to contents