Commit Graph

79 Commits

Author SHA1 Message Date
Michal Fousek 00946f6a70 Fix Sample SDK app compilation 2022-11-03 17:24:52 +01:00
Francisco Gindre c0f1aa959a Fix SendViewController `viewDidLoad` 2022-10-31 20:45:58 -03:00
Francisco Gindre dbd4b8934c Merge branch 'master' into merge-master 2022-10-31 09:34:38 -03:00
Lukas Korba cfe71d5da2
[#523] Make a CompactBlockProcessor an Actor (#565)
- Sample app refactored for the processor being an actor
- tests refactored as well
- dark side tests fixed
- utilities separated to new file
- synchronizer's start and stop are no longer in async context
- updating the UI for the scan fixed
2022-10-27 12:51:38 +02:00
Michal Fousek d4dc571f27 Fix compilation 2022-10-04 17:32:32 +02:00
Francisco Gindre 7806b5114f
Use UnifiedSpendingKey for shielding and Spending (#535)
[#534] Use UnifiedSpendingKey for shielding and Spending

This commit implements the use of Unified Spending Keys for shielding
and spending as well as rolling Unified Addresses.

Users should obtain addresses by rolling them from the SDK.
USKs replace Sapling Extended Spending keys and TransparentAccountPrivKeys
when shielding or spending

Closes #534

Co-authored-by: Kris Nuttycombe <kris@nutty.land>

* Fix rebase issues

* PR Suggestion. Make `lastError` an Optional

* Fix test `testReOrgRemovesOutboundTxAndIsNeverMined`

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-10-02 23:11:17 -03:00
Francisco Gindre ca5221ac75 Merge branch 'master' into merge-master-to-zip-316 2022-09-30 09:53:34 -03:00
Francisco Gindre 28985a4e38
Merge pull request #536 from LukasKorba/486_sendToAddress_async_await
[#486] sendToAddress async/await
2022-09-23 12:08:31 -07:00
Lukas Korba 2c93802828 [#487] shieldFunds to async/await
- API refactored to async

[#487] shieldFunds to async/await

- unit tests refactored
2022-09-21 16:36:41 +02:00
Lukas Korba 61683a85f3 [486] sendToAddress async/await
- sendToAddress and SaplingParameterDownloader refactored to async
- unit tests WIP

[486] sendToAddress async/await

- testing code cleanup

[#486] sendToAddress async/await

- reducing number of Tasks in Sample app

[#486] sendToAddress async/await

- I finally figure out how to make the dark side tests async, using new sendToAddress APIs and pass, POC done, 18 more tests to refactor

[#486] sendToAddress async/await

- async sendToAddress unit test refactored except NetworkUpgradeTests

[#486] sendToAddress async/await

- NetworkUpgradeTests refactored to async API

[#486] sendToAddress async/await

- cleanup

[#486] sendToAddress async/await (#536)

- PR comments resolved
2022-09-21 13:47:17 +02:00
Francisco Gindre e82a6d26ee
Merge pull request #518 from zcash/merge_master_to_zip_316
Merge master to zip 316
2022-09-15 08:03:29 -07:00
Francisco Gindre bee1c9db80 Merge branch 'master' into merge_master_to_zip_316 2022-09-15 11:04:49 -03:00
Lukas Korba 2b65bd46e4 [476] CompactBlockProcessor to async/await
- getting rid of the Operation Queue
- the cleanup is needed
- the update of tests is needed
- tested and it successfully finishes the sync process

[476] CompactBlockProcessor to async/await

- old processNewBlocks() removed

[476] CompactBlockProcessor to async/await

- unused operations removed

[476] CompactBlockProcessor to async/await

- unit tests update

[476] CompactBlockProcessor to async/await

- unit tests refactored

[476] CompactBlockProcessor to async/await

- cleanup of deprecated method

[476] CompactBlockProcessor to async/await

- fail(error) was called even for canceled tasks but that must be excluded

[476] CompactBlockProcessor to async/await

- removal of all ZcashOperations from the code (unit test will follow)

[476] CompactBlockProcessor to async/await

- network tests in building and success order again

[476] CompactBlockProcessor to async/await

- offline tests in building and success order

[476] CompactBlockProcessor to async/await (519)

- cleanup of suspending the task

[476] CompactBlockProcessor to async/await (519)

- most comments resolved

[476] CompactBlockProcessor to async/await (519)

- thread safe state for both sync and async context

[476] CompactBlockProcessor to async/await (519)

- fixed build for a sample project

[476] CompactBlockProcessor to async/await (519)

- func testStartNotifiesSuscriptors() reverted

[476] CompactBlockProcessor to async/await (519)

- TODO added to track why we used NSLock instead of an Actor
- Task priority enhanced

[476] CompactBlockProcessor to async/await (519)

- cleanup in Tasks and priorities
2022-09-15 08:10:12 +02:00
Francisco Gindre 72c1f14aa6 Issue #375 - User can't go twice in a row to SendFundsViewController 2022-09-12 16:58:29 -06:00
Francisco Gindre 458d3d7106 Merge branch 'feature/zip-316-and-latest-upstream' into merge_master_to_zip_316 2022-09-07 20:58:46 -03:00
Francisco Gindre ed87a2781c [#461] Adopt a Type-Safe Keys and Addresses API
This PR creates data types for Addresses and Keys so that they are
not represented by Strings anymore. This avoids mistakenly use
the wrong keys because they are all alike for the type system.

New Protocols:
=============

StringEncoded -> Protocol that makes a type can be expressed in an
string-encoded fashion either for UI or Interchange purposes.

Undescribable -> A protocol that implements methods that override default
decriptions used by debuggers, loggers and event trackers to avoid types
conforming to it to be leaked to logs.

Deleted Protocols:
==================

UnifiedFullViewingKey --> turned into a struct.
UnifiedAddress --> turned into a struct

new Error Type:
================

````
enum KeyEncodingError: Error {
    case invalidEncoding
}
````

This error is thrown when an Address or Key type (addresses are public
keys in the end) can be decoded from their String representation,
typically upon initialization from a User input.

New Types:
=========

SaplingExtendedSpendingKey -> Type for Sapling Extended Full Viewing Keys
this type will be replaced with Unified Spending Keys soon.

SaplingExtendedFullViewingKey -> Extended Full Viewing Key for Sapling.
Maintains existing funcionality. Will be probably deprecated in favor of
UFVK.

TransparentAccountPrivKey -> Private key for transparent account. Used
only for shielding operations. Note: this will probably be deprecated soon.

UnifiedFullViewingKey -> Replaces the protocol that had the same name.

TransparentAddress -> Replaces a type alias with a struct

SaplingAddress --> Represents a Sapling receiver address. Comonly called zAddress. This address corresponds to the Zcash Sapling shielded pool.
Although this it is fully functional, we encourage developers to
choose `UnifiedAddress` before Sapling or Transparent ones.

UnifiedAddress -> Represents a UA. String-encodable and Equatable. Use of
UAs must be favored instead of individual receivers for different pools.
This type can't be decomposed into their Receiver types yet.

Recipient -> This represents all valid receiver types to be used as
inputs for outgoing transactions.

````
public enum Recipient: Equatable, StringEncoded {
    case transparent(TransparentAddress)
    case sapling(SaplingAddress)
    case unified(UnifiedAddress)
````

The wrapped concrete receiver is a valid receiver type.

Deleted Type Aliases:
=====================

The following aliases were deleted and turned into types
````
public typealias TransparentAddress = String
public typealias SaplingShieldedAddress = String

````

Changes to Derivation Tool
==========================

DerivationTool has been changed to accomodate this new types and
remove Strings whenever possible.

Changes to Synchronizer and CompactBlockProcessor
=================================================
Accordingly these to components have been modified to accept the
new types intead of strings when possible.

Changes to Demo App
===================
The demo App has been patch to compile and work with the new types.
Developers must consider that the use (and abuse) of forced_try and
forced unwrapping is a "license" that maintainers are using for the
sake of brevity. We consider that clients of this SDK do know how to
handle Errors and Optional and it is not the objective of the demo
code to show good practices on those matters.

Closes #461
2022-09-05 15:09:07 -03:00
Francisco Gindre d737ddefa9 Merge branch 'master' into merge_master_to_zip_316 2022-09-01 17:51:46 -03:00
Lukas Korba f1a570bbc2
[#463] Migrate LightwalletService to Async/Await (#493)
- migration of the protocol's methods done
- split the code so there's blocking and non-blocking API separately

[463] Migrate LightwalletService to Async/Await

- draft

[463] Migrate LightwalletService to Async/Await

- failing tests under investigation

[463] Migrate LightwalletService to Async/Await

- code cleanup
- tests cleanup
- async throws unit tests added

[463] Migrate LightwalletService to Async/Await

- sample app updated to the latest API

[463] Migrate LightwalletService to Async/Await

- cleanup

[463] Migrate LightwalletService to Async/Await

- cleanup

[463] Migrate LightwalletService to Async/Await

- fixed non-building tests

[463] Migrate LightwalletService to Async/Await

- reverting back to lastHeight()

[463] Migrate LightwalletService to Async/Await

updated code to AsyncStream

[463] Migrate LightwalletService to Async/Await (493)

- tests fixed
- blockRange reimplemented to use AsyncStream
- grpc proto files regenerated to exclude Server
2022-08-25 10:39:59 -03:00
Kris Nuttycombe 905ee401d1 Use zcash_client_sqlite to manage migrations for the wallet db.
This change removes responsibility for maintaining the state of
the wallet database from `ZcashLightClientKit` in favor of using
the migration system now provided by librustzcash. This will help
to ensure that the structure of the database is kept consistent with
the functions that query and update the database state.

Co-authored-by: Francisco Gindre <francisco.gindre@gmail.com>
2022-08-24 09:38:42 -06:00
Jack Grigg b0343d4c38 Rename `UnifiedViewingKey` to `UnifiedFullViewingKey`
The type does not yet match ZIP 316, but performing this rename first
makes the subsequent commit simpler.
2022-08-24 09:33:42 -06:00
Francisco Gindre b9ae012e09
[#381] Move Zatoshi and Amount Types to the SDK (#396)
Closes #381

This commit brings a Zatoshi type developed on the Secant project,
helper classes like Clamped and tests.

Zatoshi has been incorporated as a Codable type for SQLite Swift
to allow serialization into the pending database.

FIXES on Demo App

fix comments
2022-06-22 16:45:37 -03:00
Daniel Haight 86d1257ab5 Remove dependecy on rust sources 2022-02-28 17:03:20 +00:00
Adam Stener ae5b3cfc21 SwiftLint Fixes 2021-09-21 06:27:49 -05:00
Francisco Gindre b1a0b01673 Clear SwiftLint on ZcashLightClientKit 2021-09-15 09:21:29 -03:00
Francisco Gindre 09ac2c5877 remove WalletBirthday as generated file and add it as constants in the sdk 2021-07-28 15:46:45 -03:00
Francisco Gindre f26ad811c6 fix lint warnings 2021-06-20 11:59:00 -03:00
Francisco Gindre 392b4ee0d4 Fix Demo App 2021-06-14 19:56:32 -03:00
Francisco Gindre 3a963d79c4 CompactBlock batch download and stream download operation
tests pass.
2021-06-02 18:32:05 -03:00
Francisco Gindre f663df1711 fix demo app not compiling 2021-05-19 18:49:08 -03:00
Francisco Gindre 90c7a4d755 Fix Tests. deleted two obsolete ones 2021-05-07 15:50:50 -03:00
Francisco Gindre 37f2232d2d Update to gRPC-Swift 1.0.0 2021-04-20 11:49:10 -03:00
Francisco Gindre 65aa7d8474 [wip] autoshield poc with uvks 2021-04-02 19:18:16 -03:00
Francisco Gindre 477f7cc69f Merge branch 'master' into shield-funds-poc 2021-03-29 14:53:01 -03:00
Francisco Gindre 14a5a02966 Logger fixes 2021-03-15 10:52:53 -03:00
Francisco Gindre 246d10edaa [WIP] catch up to latest librustzcash changes 2021-03-08 15:47:36 -03:00
Francisco Gindre 1affc50726 [WIP] data access api compliance 2021-03-03 18:19:10 -03:00
Francisco Gindre 81f4edfd55 Issue #244 Add Synchronizer support for shielding funds 2021-03-03 18:19:10 -03:00
Francisco Gindre d1a099b26f shield funds demo 2021-03-03 18:19:10 -03:00
Francisco Gindre 4abf914f9f Issue #166 Download UTXO set 2021-03-03 18:09:13 -03:00
Francisco Gindre 7cb4750f29 Get UTXOs screen 2021-03-03 18:09:13 -03:00
Francisco Gindre bedeb89316 fix alert without button 2021-03-03 18:09:13 -03:00
Francisco Gindre 60dc7ae6c5 Horrible looking derivation screen 2021-03-03 18:09:13 -03:00
Francisco Gindre 1926ea6824 Canopy Tests Successfully pass 2020-11-05 19:02:01 -03:00
Francisco Gindre 972fb08926 Issue 208 - Improve API method to request transaction history 2020-10-19 21:01:46 -03:00
Francisco Gindre 0df4b9e4f2 fix compilation error on DemoApp. Add troubleshooting step on README 2020-10-16 19:11:05 -03:00
Francisco Gindre 18b8d622c2 remove SeedProvider protoco 2020-10-14 20:18:10 -03:00
Francisco Gindre 4a01865a7d Add IVK capabilities to Initializer 2020-10-14 19:50:26 -03:00
Francisco Gindre 37a15bb93f add DownloadIFNeeded 2020-10-08 17:29:38 -03:00
Francisco Gindre af8ee1ef12 Add SaplingParameterDownloader 2020-10-08 17:29:38 -03:00
Francisco Gindre d4dfb23657 fix issue 201 Throw exception when seed can't be provided 2020-10-08 17:29:38 -03:00